Adding some of the database changes that is part of v6 - just renaming a few columns so far.
Refactoring the installer, which is not working 100% yet.
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Web;
|
||||
using System.Web.Configuration;
|
||||
using System.Xml.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
@@ -43,7 +44,7 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This should not be used for CRUD operations or queries against the
|
||||
/// standard Umbraco tables!
|
||||
/// standard Umbraco tables! Use the Public services for that.
|
||||
/// </remarks>
|
||||
public Database Database
|
||||
{
|
||||
@@ -122,7 +123,7 @@ namespace Umbraco.Core
|
||||
SaveConnectionString(connectionString, appSettingsConnection, providerName);
|
||||
|
||||
string appData = VirtualPathUtility.ToAbsolute(GlobalSettings.StorageDirectory);
|
||||
var path = Path.Combine(appData, "Umbraco.sdf");
|
||||
var path = Path.Combine(GlobalSettings.FullpathToRoot, "App_Data", "Umbraco.sdf");
|
||||
if (File.Exists(path) == false)
|
||||
{
|
||||
var engine = new SqlCeEngine(connectionString);
|
||||
@@ -231,6 +232,8 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
xml.Save(fileName);
|
||||
|
||||
LogHelper.Info<DatabaseContext>("Configured new ConnectionString: " + connectionString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -43,6 +43,11 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
[Constraint(Default = "0")]
|
||||
public bool AllowAtRoot { get; set; }
|
||||
|
||||
[Column("masterContentType")]
|
||||
[Constraint(Default = "0")]
|
||||
[NullSetting(NullSetting = NullSettings.Null)]
|
||||
public int MasterContentType { get; set; }//TODO Delete once "masterContentType" has been removed from the Core
|
||||
|
||||
[ResultColumn]
|
||||
public NodeDto NodeDto { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.Migrations.Initial;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions;
|
||||
@@ -84,7 +85,7 @@ namespace Umbraco.Core.Persistence
|
||||
}
|
||||
|
||||
//Specific to Sql Ce - look for changes to Identity Seed
|
||||
if(DatabaseContext.Current.DatabaseProvider == DatabaseProviders.SqlServerCE)
|
||||
if (DatabaseContext.Current.ProviderName.Contains("SqlServerCe"))
|
||||
{
|
||||
var seedSql = SyntaxConfig.SqlSyntaxProvider.ToAlterIdentitySeedStatements(tableDefinition);
|
||||
foreach (var sql in seedSql)
|
||||
@@ -93,6 +94,8 @@ namespace Umbraco.Core.Persistence
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogHelper.Info<Database>(string.Format("New table '{0}' was created", tableName));
|
||||
}
|
||||
|
||||
public static void DropTable<T>(this Database db)
|
||||
@@ -125,6 +128,8 @@ namespace Umbraco.Core.Persistence
|
||||
{
|
||||
NewTable += PetaPocoExtensions_NewTable;
|
||||
|
||||
LogHelper.Info<Database>("Initializing database schema creation");
|
||||
|
||||
var creation = new DatabaseCreation(db);
|
||||
creation.InitializeDatabaseSchema();
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Threading;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.DataLayer.Utility.Installer;
|
||||
@@ -174,27 +176,21 @@ namespace umbraco.presentation.install.steps
|
||||
DatabaseType.SelectedValue);
|
||||
}
|
||||
|
||||
if(DatabaseContext.Current.IsDatabaseConfigured == false)
|
||||
throw new Exception("ConnectionString could not be found");
|
||||
|
||||
Helper.setProgress(20, "Connection opened", "");
|
||||
|
||||
var database = new Database(DatabaseContext.Current.ConnectionString,
|
||||
DatabaseContext.Current.ProviderName);
|
||||
DatabaseContext.Current.ProviderName);
|
||||
|
||||
database.Initialize();
|
||||
|
||||
Helper.setProgress(90, "Refreshing content cache", "");
|
||||
|
||||
library.RefreshContent();
|
||||
|
||||
Helper.setProgress(100, "Database is up-to-date", "");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<detect>("Exception was thrown during the setup of the database in 'saveDBConfig'.", ex);
|
||||
|
||||
Exception error = new Exception("Could not save the web.config file. Please modify the connection string manually.", ex);
|
||||
Helper.setProgress(-1, "Could not save the web.config file. Please modify the connection string manually.", error.InnerException.Message);
|
||||
}
|
||||
|
||||
Thread.Sleep(5000);
|
||||
|
||||
settings.Visible = false;
|
||||
installing.Visible = true;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence;
|
||||
using umbraco.DataLayer.Utility.Installer;
|
||||
using umbraco.DataLayer;
|
||||
|
||||
@@ -13,6 +17,7 @@ namespace umbraco.presentation.install.utills
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
LogHelper.Info<p>(string.Format("Hitting Page_Load on p.aspx for the requested '{0}' feed", Request.QueryString["feed"]));
|
||||
|
||||
// Stop Caching in IE
|
||||
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
|
||||
@@ -57,16 +62,31 @@ namespace umbraco.presentation.install.utills
|
||||
[System.Web.Script.Services.ScriptMethod]
|
||||
public static string installOrUpgrade()
|
||||
{
|
||||
Helper.setProgress(5, "Opening database connection...", "");
|
||||
LogHelper.Info<p>("Running 'installOrUpgrade' service");
|
||||
|
||||
IInstallerUtility installer;
|
||||
//Helper.setProgress(5, "Opening database connection...", "");
|
||||
//IInstallerUtility installer;
|
||||
|
||||
// Build the new connection string
|
||||
//DbConnectionStringBuilder connectionStringBuilder = CreateConnectionString();
|
||||
Helper.setProgress(5, "Connecting...", "");
|
||||
if (DatabaseContext.Current.IsDatabaseConfigured == false)
|
||||
return "ConnectionString could not be found";
|
||||
|
||||
// Try to connect to the database
|
||||
try
|
||||
//Helper.setProgress(20, "Connection opened", "");
|
||||
|
||||
//var database = new Database(DatabaseContext.Current.ConnectionString, DatabaseContext.Current.ProviderName);
|
||||
|
||||
//Helper.setProgress(35, "Installing tables...", "");
|
||||
|
||||
//database.Initialize();
|
||||
|
||||
//Helper.setProgress(90, "Refreshing content cache", "");
|
||||
|
||||
//library.RefreshContent();
|
||||
|
||||
Helper.setProgress(100, "Installation completed!", "");
|
||||
|
||||
return "installed";
|
||||
|
||||
/*try
|
||||
{
|
||||
var sqlHelper = DataLayerHelper.CreateSqlHelper(GlobalSettings.DbDSN);
|
||||
installer = sqlHelper.Utility.CreateInstaller();
|
||||
@@ -83,17 +103,17 @@ namespace umbraco.presentation.install.utills
|
||||
string.Format("{0}<br />Connection string: {1}", error.InnerException.Message, GlobalSettings.DbDSN));
|
||||
|
||||
return error.Message;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
if (installer.CanConnect)
|
||||
/*if (installer.CanConnect)
|
||||
{
|
||||
if (installer.IsLatestVersion)
|
||||
{
|
||||
|
||||
Helper.setProgress(90, "Refreshing content cache", "");
|
||||
|
||||
//library.RefreshContent();
|
||||
library.RefreshContent();
|
||||
|
||||
Helper.setProgress(100, "Database is up-to-date", "");
|
||||
|
||||
@@ -103,10 +123,9 @@ namespace umbraco.presentation.install.utills
|
||||
if (installer.IsEmpty)
|
||||
{
|
||||
Helper.setProgress(35, "Installing tables...", "");
|
||||
//do install
|
||||
try
|
||||
{
|
||||
//installer.Install();
|
||||
installer.Install();
|
||||
Helper.setProgress(100, "Installation completed!", "");
|
||||
installer = null;
|
||||
|
||||
@@ -119,17 +138,11 @@ namespace umbraco.presentation.install.utills
|
||||
return "error";
|
||||
}
|
||||
|
||||
} //else if (m_Installer.CurrentVersion == DatabaseVersion.None || m_Installer.CanUpgrade) {
|
||||
//Helper.setProgress(35, "Updating database tables...", "");
|
||||
//m_Installer.Install();
|
||||
|
||||
// library.RefreshContent();
|
||||
// return "installed";
|
||||
// }
|
||||
}
|
||||
else if (installer.CurrentVersion == DatabaseVersion.None || installer.CanUpgrade)
|
||||
{
|
||||
Helper.setProgress(35, "Updating database tables...", "");
|
||||
//installer.Install();
|
||||
installer.Install();
|
||||
|
||||
Helper.setProgress(100, "Upgrade completed!", "");
|
||||
|
||||
@@ -139,10 +152,7 @@ namespace umbraco.presentation.install.utills
|
||||
return "upgraded";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
return "no connection;";
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
|
||||
{
|
||||
((DropDownList)e.Item.FindControl("dllTab")).SelectedValue =
|
||||
((DataRowView)e.Item.DataItem).Row["tabid"].ToString();
|
||||
((DataRowView)e.Item.DataItem).Row["propertyTypeGroupId"].ToString();
|
||||
((DropDownList)e.Item.FindControl("ddlType")).SelectedValue =
|
||||
((DataRowView)e.Item.DataItem).Row["type"].ToString();
|
||||
}
|
||||
@@ -540,13 +540,13 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
ds.Tables.Add(dtT);
|
||||
|
||||
dtP.Columns.Add("id");
|
||||
dtP.Columns.Add("tabid");
|
||||
dtP.Columns.Add("propertyTypeGroupId");
|
||||
dtP.Columns.Add("alias");
|
||||
dtP.Columns.Add("name");
|
||||
dtP.Columns.Add("type");
|
||||
dtP.Columns.Add("tab");
|
||||
|
||||
dtT.Columns.Add("tabid");
|
||||
dtT.Columns.Add("propertyTypeGroupId");
|
||||
dtT.Columns.Add("TabName");
|
||||
dtT.Columns.Add("genericProperties");
|
||||
|
||||
@@ -555,7 +555,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
{
|
||||
DataRow dr = dtT.NewRow();
|
||||
dr["TabName"] = tb.GetRawCaption();
|
||||
dr["tabid"] = tb.Id;
|
||||
dr["propertyTypeGroupId"] = tb.Id;
|
||||
dtT.Rows.Add(dr);
|
||||
|
||||
// zb-00036 #29889 : fix property types getter
|
||||
@@ -563,7 +563,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
{
|
||||
DataRow dr1 = dtP.NewRow();
|
||||
dr1["alias"] = pt.Alias;
|
||||
dr1["tabid"] = tb.Id;
|
||||
dr1["propertyTypeGroupId"] = tb.Id;
|
||||
dr1["name"] = pt.GetRawName();
|
||||
dr1["type"] = pt.DataTypeDefinition.Id;
|
||||
dr1["tab"] = tb.GetRawCaption();
|
||||
@@ -575,7 +575,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
|
||||
DataRow dr2 = dtT.NewRow();
|
||||
dr2["TabName"] = "General properties";
|
||||
dr2["tabid"] = 0;
|
||||
dr2["propertyTypeGroupId"] = 0;
|
||||
dtT.Rows.Add(dr2);
|
||||
|
||||
foreach (cms.businesslogic.propertytype.PropertyType pt in cType.PropertyTypes)
|
||||
@@ -584,7 +584,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
{
|
||||
DataRow dr1 = dtP.NewRow();
|
||||
dr1["alias"] = pt.Alias;
|
||||
dr1["tabid"] = 0;
|
||||
dr1["propertyTypeGroupId"] = 0;
|
||||
dr1["name"] = pt.GetRawName();
|
||||
dr1["type"] = pt.DataTypeDefinition.Id;
|
||||
dr1["tab"] = "General properties";
|
||||
@@ -594,7 +594,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
}
|
||||
|
||||
|
||||
ds.Relations.Add(new DataRelation("tabidrelation", dtT.Columns["tabid"], dtP.Columns["tabid"], false));
|
||||
ds.Relations.Add(new DataRelation("tabidrelation", dtT.Columns["propertyTypeGroupId"], dtP.Columns["propertyTypeGroupId"], false));
|
||||
}
|
||||
|
||||
|
||||
@@ -733,7 +733,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
|
||||
protected void dlTab_itemdatabound(object sender, DataListItemEventArgs e)
|
||||
{
|
||||
if (int.Parse(((DataRowView)e.Item.DataItem).Row["tabid"].ToString()) == 0)
|
||||
if (int.Parse(((DataRowView)e.Item.DataItem).Row["propertyTypeGroupId"].ToString()) == 0)
|
||||
{
|
||||
((Button)e.Item.FindControl("btnTabDelete")).Visible = false;
|
||||
((Button)e.Item.FindControl("btnTabUp")).Visible = false;
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace umbraco.cms.businesslogic
|
||||
/// <returns>The Id of the Tab on which the PropertyType is placed</returns>
|
||||
public static int getTabIdFromPropertyType(PropertyType pt)
|
||||
{
|
||||
object tmp = SqlHelper.ExecuteScalar<object>("Select tabId from cmsPropertyType where id = " + pt.Id.ToString());
|
||||
object tmp = SqlHelper.ExecuteScalar<object>("Select propertyTypeGroupId from cmsPropertyType where id = " + pt.Id.ToString());
|
||||
if (tmp == DBNull.Value)
|
||||
return 0;
|
||||
else return int.Parse(tmp.ToString());
|
||||
@@ -760,11 +760,11 @@ namespace umbraco.cms.businesslogic
|
||||
{
|
||||
|
||||
// Get tab count
|
||||
int tabCount = SqlHelper.ExecuteScalar<int>("SELECT COUNT(*) FROM cmsTab WHERE contenttypeNodeId = @nodeId",
|
||||
int tabCount = SqlHelper.ExecuteScalar<int>("SELECT COUNT(*) FROM cmsPropertyTypeGroup WHERE contenttypeNodeId = @nodeId",
|
||||
SqlHelper.CreateParameter("@nodeId", Id));
|
||||
|
||||
// The method is synchronized
|
||||
SqlHelper.ExecuteNonQuery("INSERT INTO cmsTab (contenttypeNodeId,text,sortorder) VALUES (@nodeId,@text,@sortorder)",
|
||||
SqlHelper.ExecuteNonQuery("INSERT INTO cmsPropertyTypeGroup (contenttypeNodeId,text,sortorder) VALUES (@nodeId,@text,@sortorder)",
|
||||
SqlHelper.CreateParameter("@nodeId", Id),
|
||||
SqlHelper.CreateParameter("@text", Caption),
|
||||
SqlHelper.CreateParameter("@sortorder", tabCount + 1));
|
||||
@@ -772,7 +772,7 @@ namespace umbraco.cms.businesslogic
|
||||
// Remove from cache
|
||||
FlushFromCache(Id);
|
||||
|
||||
return SqlHelper.ExecuteScalar<int>("SELECT MAX(id) FROM cmsTab");
|
||||
return SqlHelper.ExecuteScalar<int>("SELECT MAX(id) FROM cmsPropertyTypeGroup");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -792,7 +792,7 @@ namespace umbraco.cms.businesslogic
|
||||
x.TabId = 0;
|
||||
});
|
||||
|
||||
SqlHelper.ExecuteNonQuery("delete from cmsTab where id =" + id);
|
||||
SqlHelper.ExecuteNonQuery("delete from cmsPropertyTypeGroup where id =" + id);
|
||||
|
||||
InitializeVirtualTabs();
|
||||
// Remove from cache
|
||||
@@ -806,7 +806,7 @@ namespace umbraco.cms.businesslogic
|
||||
/// <param name="Caption">The new Caption</param>
|
||||
public void SetTabName(int tabId, string Caption)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery("Update cmsTab set text = @text where id = @id",
|
||||
SqlHelper.ExecuteNonQuery("Update cmsPropertyTypeGroup set text = @text where id = @id",
|
||||
SqlHelper.CreateParameter("@text", Caption),
|
||||
SqlHelper.CreateParameter("@id", tabId));
|
||||
|
||||
@@ -822,7 +822,7 @@ namespace umbraco.cms.businesslogic
|
||||
public void SetTabSortOrder(int tabId, int sortOrder)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
"Update cmsTab set sortOrder = " + sortOrder + " where id = " + tabId);
|
||||
"Update cmsPropertyTypeGroup set sortOrder = " + sortOrder + " where id = " + tabId);
|
||||
|
||||
// Remove from cache
|
||||
FlushFromCache(Id);
|
||||
@@ -1028,7 +1028,7 @@ namespace umbraco.cms.businesslogic
|
||||
var temporaryList = new List<TabI>();
|
||||
using (IRecordsReader dr = SqlHelper.ExecuteReader(
|
||||
string.Format(
|
||||
"Select Id,text,sortOrder from cmsTab where contenttypeNodeId = {0} order by sortOrder",
|
||||
"Select Id,text,sortOrder from cmsPropertyTypeGroup where contenttypeNodeId = {0} order by sortOrder",
|
||||
Id)))
|
||||
{
|
||||
while (dr.Read())
|
||||
@@ -1174,7 +1174,7 @@ namespace umbraco.cms.businesslogic
|
||||
Tab tab = null;
|
||||
using (IRecordsReader dr = SqlHelper.ExecuteReader(
|
||||
string.Format(
|
||||
"Select Id, text, contenttypeNodeId, sortOrder from cmsTab where Id = {0} order by sortOrder",
|
||||
"Select Id, text, contenttypeNodeId, sortOrder from cmsPropertyTypeGroup where Id = {0} order by sortOrder",
|
||||
id)))
|
||||
{
|
||||
if (dr.Read())
|
||||
@@ -1233,7 +1233,7 @@ namespace umbraco.cms.businesslogic
|
||||
var tmp1 = new List<PropertyType>();
|
||||
|
||||
using (IRecordsReader dr = SqlHelper.ExecuteReader(string.Format(
|
||||
@"select id from cmsPropertyType where tabId = {0} and contentTypeId = {1}
|
||||
@"select id from cmsPropertyType where propertyTypeGroupId = {0} and contentTypeId = {1}
|
||||
order by sortOrder", _id, ctype)))
|
||||
{
|
||||
while (dr.Read())
|
||||
@@ -1254,7 +1254,7 @@ namespace umbraco.cms.businesslogic
|
||||
var tmp = new List<PropertyType>();
|
||||
|
||||
using (IRecordsReader dr = SqlHelper.ExecuteReader(string.Format(
|
||||
@"select id from cmsPropertyType where tabId = {0}", _id)))
|
||||
@"select id from cmsPropertyType where propertyTypeGroupId = {0}", _id)))
|
||||
{
|
||||
while (dr.Read())
|
||||
tmp.Add(PropertyType.GetPropertyType(dr.GetInt("id")));
|
||||
@@ -1294,9 +1294,9 @@ namespace umbraco.cms.businesslogic
|
||||
/// </summary>
|
||||
public void Delete()
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery("update cmsPropertyType set tabId = NULL where tabid = @id",
|
||||
SqlHelper.ExecuteNonQuery("update cmsPropertyType set propertyTypeGroupId = NULL where propertyTypeGroupId = @id",
|
||||
SqlHelper.CreateParameter("@id", Id));
|
||||
SqlHelper.ExecuteNonQuery("delete from cmsTab where id = @id",
|
||||
SqlHelper.ExecuteNonQuery("delete from cmsPropertyTypeGroup where id = @id",
|
||||
SqlHelper.CreateParameter("@id", Id));
|
||||
}
|
||||
|
||||
@@ -1309,7 +1309,7 @@ namespace umbraco.cms.businesslogic
|
||||
{
|
||||
try
|
||||
{
|
||||
string tempCaption = SqlHelper.ExecuteScalar<string>("Select text from cmsTab where id = " + id.ToString());
|
||||
string tempCaption = SqlHelper.ExecuteScalar<string>("Select text from cmsPropertyTypeGroup where id = " + id.ToString());
|
||||
if (!tempCaption.StartsWith("#"))
|
||||
return tempCaption;
|
||||
else
|
||||
@@ -1344,13 +1344,13 @@ namespace umbraco.cms.businesslogic
|
||||
{
|
||||
if (!_sortOrder.HasValue)
|
||||
{
|
||||
_sortOrder = SqlHelper.ExecuteScalar<int>("select sortOrder from cmsTab where id = " + _id);
|
||||
_sortOrder = SqlHelper.ExecuteScalar<int>("select sortOrder from cmsPropertyTypeGroup where id = " + _id);
|
||||
}
|
||||
return _sortOrder.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery("update cmsTab set sortOrder = " + value + " where id =" + _id);
|
||||
SqlHelper.ExecuteNonQuery("update cmsPropertyTypeGroup set sortOrder = " + value + " where id =" + _id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,15 +49,15 @@ namespace umbraco.cms.businesslogic.propertytype
|
||||
public PropertyType(int id)
|
||||
{
|
||||
using (IRecordsReader dr = SqlHelper.ExecuteReader(
|
||||
"Select mandatory, DataTypeId, tabId, ContentTypeId, sortOrder, alias, name, validationRegExp, description from cmsPropertyType where id=@id",
|
||||
"Select mandatory, DataTypeId, propertyTypeGroupId, ContentTypeId, sortOrder, alias, name, validationRegExp, description from cmsPropertyType where id=@id",
|
||||
SqlHelper.CreateParameter("@id", id)))
|
||||
{
|
||||
if (!dr.Read())
|
||||
throw new ArgumentException("Propertytype with id: " + id + " doesnt exist!");
|
||||
_mandatory = dr.GetBoolean("mandatory");
|
||||
_id = id;
|
||||
if (!dr.IsNull("tabId"))
|
||||
_tabId = dr.GetInt("tabId");
|
||||
if (!dr.IsNull("propertyTypeGroupId"))
|
||||
_tabId = dr.GetInt("propertyTypeGroupId");
|
||||
_sortOrder = dr.GetInt("sortOrder");
|
||||
_alias = dr.GetString("alias");
|
||||
_name = dr.GetString("Name");
|
||||
@@ -109,7 +109,7 @@ namespace umbraco.cms.businesslogic.propertytype
|
||||
tabId = DBNull.Value;
|
||||
}
|
||||
|
||||
SqlHelper.ExecuteNonQuery("Update cmsPropertyType set tabId = @tabId where id = @id",
|
||||
SqlHelper.ExecuteNonQuery("Update cmsPropertyType set propertyTypeGroupId = @tabId where id = @id",
|
||||
SqlHelper.CreateParameter("@tabId", tabId),
|
||||
SqlHelper.CreateParameter("@id", Id));
|
||||
}
|
||||
|
||||
@@ -83,11 +83,11 @@ namespace umbraco.macroRenderings
|
||||
this.SelectionMode = System.Web.UI.WebControls.ListSelectionMode.Single;
|
||||
}
|
||||
|
||||
//SqlDataReader dr = SqlHelper.ExecuteReader(GlobalSettings.DbDSN, CommandType.Text, "select distinct text from cmsTab order by text");
|
||||
//SqlDataReader dr = SqlHelper.ExecuteReader(GlobalSettings.DbDSN, CommandType.Text, "select distinct text from cmsPropertyTypeGroup order by text");
|
||||
|
||||
|
||||
|
||||
using (IRecordsReader dr = SqlHelper.ExecuteReader("select distinct text from cmsTab order by text")) {
|
||||
using (IRecordsReader dr = SqlHelper.ExecuteReader("select distinct text from cmsPropertyTypeGroup order by text")) {
|
||||
while (dr.Read()) {
|
||||
|
||||
System.Web.UI.WebControls.ListItem li = new System.Web.UI.WebControls.ListItem(dr.GetString("text"), dr.GetString("text").ToLower());
|
||||
|
||||
Reference in New Issue
Block a user