/// <summary> /// Creates table. /// </summary> private void CreateTable(bool setAutomatically) { Table table = new Table(); table.CssClass = "table table-hover"; table.CellPadding = -1; table.CellSpacing = -1; // Create table header TableHeaderRow header = new TableHeaderRow(); header.TableSection = TableRowSection.TableHeader; TableHeaderCell thc = new TableHeaderCell(); thc.Text = GetString("srch.settings.fieldname"); thc.Scope = TableHeaderScope.Column; header.Cells.Add(thc); thc = new TableHeaderCell(); thc.Text = GetString("development.content"); thc.Scope = TableHeaderScope.Column; header.Cells.Add(thc); thc = new TableHeaderCell(); thc.Text = GetString("srch.settings.searchable"); thc.Scope = TableHeaderScope.Column; header.Cells.Add(thc); thc = new TableHeaderCell(); thc.Text = GetString("srch.settings.tokenized"); thc.Scope = TableHeaderScope.Column; header.Cells.Add(thc); if (DisplayIField) { thc = new TableHeaderCell(); thc.Text = GetString("srch.settings.ifield"); header.Cells.Add(thc); } thc = new TableHeaderCell(); thc.CssClass = "main-column-100"; header.Cells.Add(thc); table.Rows.Add(header); pnlContent.Controls.Add(table); // Create table content if ((mAttributes != null) && (mAttributes.Count > 0)) { // Create row for each field foreach (ColumnDefinition column in mAttributes) { SearchSettingsInfo ssi = null; TableRow tr = new TableRow(); if (!DataHelper.DataSourceIsEmpty(mInfos)) { DataRow[] dr = mInfos.Tables[0].Select("name = '" + column.ColumnName + "'"); if ((dr.Length > 0) && (mSearchSettings != null)) { ssi = mSearchSettings.GetSettingsInfo((string)dr[0]["id"]); } } // Add cell with field name TableCell tc = new TableCell(); Label lbl = new Label(); lbl.Text = column.ColumnName; tc.Controls.Add(lbl); tr.Cells.Add(tc); // Add cell with 'Content' value tc = new TableCell(); CMSCheckBox chk = new CMSCheckBox(); chk.ID = column.ColumnName + SearchSettings.CONTENT; if (setAutomatically) { chk.Checked = SearchHelper.GetSearchFieldDefaultValue(SearchSettings.CONTENT, column.ColumnType); } else if (ssi != null) { chk.Checked = ssi.Content; } tc.Controls.Add(chk); tr.Cells.Add(tc); // Add cell with 'Searchable' value tc = new TableCell(); chk = new CMSCheckBox(); chk.ID = column.ColumnName + SearchSettings.SEARCHABLE; if (setAutomatically) { chk.Checked = SearchHelper.GetSearchFieldDefaultValue(SearchSettings.SEARCHABLE, column.ColumnType); } else if (ssi != null) { chk.Checked = ssi.Searchable; } tc.Controls.Add(chk); tr.Cells.Add(tc); // Add cell with 'Tokenized' value tc = new TableCell(); chk = new CMSCheckBox(); chk.ID = column.ColumnName + SearchSettings.TOKENIZED; if (setAutomatically) { chk.Checked = SearchHelper.GetSearchFieldDefaultValue(SearchSettings.TOKENIZED, column.ColumnType); } else if (ssi != null) { chk.Checked = ssi.Tokenized; } tc.Controls.Add(chk); tr.Cells.Add(tc); // Add cell with 'iFieldname' value if (DisplayIField) { tc = new TableCell(); CMSTextBox txt = new CMSTextBox(); txt.ID = column.ColumnName + SearchSettings.IFIELDNAME; txt.CssClass += " form-control"; txt.MaxLength = 200; if (ssi != null) { txt.Text = ssi.FieldName; } tc.Controls.Add(txt); tr.Cells.Add(tc); } tc = new TableCell(); tr.Cells.Add(tc); table.Rows.Add(tr); } } }
/// <summary> /// Creates table. /// </summary> private void CreateTable(bool useDefaultValue) { Table table = new Table(); table.CssClass = "table table-hover"; table.CellPadding = -1; table.CellSpacing = -1; // Create table header TableHeaderRow topHeader = new TableHeaderRow(); TableHeaderRow header = new TableHeaderRow(); topHeader.TableSection = TableRowSection.TableHeader; header.TableSection = TableRowSection.TableHeader; AddTableHeaderCell(topHeader, ""); AddTableHeaderCell(topHeader, GetString("srch.local"), false, 3); AddTableHeaderCell(header, GetString("srch.settings.fieldname"), true); AddTableHeaderCell(header, GetString("development.content"), true); AddTableHeaderCell(header, GetString("srch.settings.searchable"), true); AddTableHeaderCell(header, GetString("srch.settings.tokenized"), true); if (DisplayAzureFields) { AddTableHeaderCell(topHeader, GetString("srch.azure"), false, 6); AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.CONTENT), true); AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.RETRIEVABLE), true); AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.SEARCHABLE), true); AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.FACETABLE), true); AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.FILTERABLE), true); AddTableHeaderCell(header, GetString("srch.settings." + AzureSearchFieldFlags.SORTABLE), true); } if (DisplayIField) { AddTableHeaderCell(topHeader, GetString("general.general")); AddTableHeaderCell(header, GetString("srch.settings.ifield"), true); } var thc = new TableHeaderCell(); thc.CssClass = "main-column-100"; topHeader.Cells.Add(thc); thc = new TableHeaderCell(); thc.CssClass = "main-column-100"; header.Cells.Add(thc); table.Rows.Add(topHeader); table.Rows.Add(header); pnlContent.Controls.Add(table); // Create table content if ((mAttributes != null) && (mAttributes.Count > 0)) { // Create row for each field foreach (ColumnDefinition column in mAttributes) { SearchSettingsInfo ssi = null; TableRow tr = new TableRow(); if (!DataHelper.DataSourceIsEmpty(mInfos)) { DataRow[] dr = mInfos.Tables[0].Select("name = '" + column.ColumnName + "'"); if ((dr.Length > 0) && (mSearchSettings != null)) { ssi = mSearchSettings.GetSettingsInfo((string)dr[0]["id"]); } } // Add cell with field name TableCell tc = new TableCell(); Label lbl = new Label(); lbl.Text = column.ColumnName; tc.Controls.Add(lbl); tr.Cells.Add(tc); var defaultSearchSettings = useDefaultValue ? SearchHelper.CreateDefaultSearchSettings(column.ColumnName, column.ColumnType) : null; tr.Cells.Add(CreateTableCell(SearchSettings.CONTENT, column, useDefaultValue ? defaultSearchSettings.GetFlag(SearchSettings.CONTENT) : ssi?.GetFlag(SearchSettings.CONTENT) ?? false, "development.content")); tr.Cells.Add(CreateTableCell(SearchSettings.SEARCHABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(SearchSettings.SEARCHABLE) : ssi?.GetFlag(SearchSettings.SEARCHABLE) ?? false, "srch.settings.searchable")); tr.Cells.Add(CreateTableCell(SearchSettings.TOKENIZED, column, useDefaultValue ? defaultSearchSettings.GetFlag(SearchSettings.TOKENIZED) : ssi?.GetFlag(SearchSettings.TOKENIZED) ?? false, "srch.settings.tokenized")); if (DisplayAzureFields) { tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.CONTENT, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.CONTENT) : ssi?.GetFlag(AzureSearchFieldFlags.CONTENT) ?? false, "srch.settings." + AzureSearchFieldFlags.CONTENT)); tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.RETRIEVABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.RETRIEVABLE) : ssi?.GetFlag(AzureSearchFieldFlags.RETRIEVABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.RETRIEVABLE)); tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.SEARCHABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.SEARCHABLE) : ssi?.GetFlag(AzureSearchFieldFlags.SEARCHABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.SEARCHABLE)); tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.FACETABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.FACETABLE) : ssi?.GetFlag(AzureSearchFieldFlags.FACETABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.FACETABLE)); tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.FILTERABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.FILTERABLE) : ssi?.GetFlag(AzureSearchFieldFlags.FILTERABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.FILTERABLE)); tr.Cells.Add(CreateTableCell(AzureSearchFieldFlags.SORTABLE, column, useDefaultValue ? defaultSearchSettings.GetFlag(AzureSearchFieldFlags.SORTABLE) : ssi?.GetFlag(AzureSearchFieldFlags.SORTABLE) ?? false, "srch.settings." + AzureSearchFieldFlags.SORTABLE)); } // Add cell with 'iFieldname' value if (DisplayIField) { tc = new TableCell(); CMSTextBox txt = new CMSTextBox(); txt.ID = column.ColumnName + SearchSettings.IFIELDNAME; txt.CssClass += " form-control"; txt.MaxLength = 200; if (ssi != null) { txt.Text = ssi.FieldName; } tc.Controls.Add(txt); tr.Cells.Add(tc); } tc = new TableCell(); tr.Cells.Add(tc); table.Rows.Add(tr); } } }
public static void Update60() { EventLogProvider evp = new EventLogProvider(); evp.LogEvent("I", DateTime.Now, "Upgrade to 6.0", "Upgrade - Start"); DataClassInfo dci = null; #region "CMS.UserSettings" try { dci = DataClassInfoProvider.GetDataClass("cms.usersettings"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "UserAuthenticationGUID"; ffi.DataType = FormFieldDataTypeEnum.GUID; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "UserBounces"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl; ffi.Visible = false; ffi.Caption = "UserBounces"; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "UserLinkedInID"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 100; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "UserLogActivities"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "UserPasswordRequestHash"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 100; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("CMS_UserSettings"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("CMS_UserSettings"); } } } catch (Exception ex) { evp.LogEvent("CMS.UserSettings - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - Customer" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.customer"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "CustomerSiteID"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl; ffi.Visible = false; fi.AddFormField(ffi); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassFormDefinition = fi.GetXmlDefinition(); dci.ClassXmlSchema = tm.GetXmlSchema("COM_Customer"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_Customer"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.Customer - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - Order" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.order"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "OrderCulture"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 10; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderIsPaid"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderTotalPriceInMainCurrency"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = fi.GetFormField("OrderStatusID"); if (ffi != null) { ffi.AllowEmpty = true; fi.UpdateFormField("OrderStatusID", ffi); } ffi = fi.GetFormField("OrderShippingAddressID"); if (ffi != null) { ffi.AllowEmpty = true; fi.UpdateFormField("OrderShippingAddressID", ffi); } dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("COM_Order"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_Order"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.Order - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - OrderItem" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.orderitem"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "OrderItemBundleGUID"; ffi.DataType = FormFieldDataTypeEnum.GUID; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemIsPrivate"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemPrice"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemSendNotification"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemSKU"; ffi.DataType = FormFieldDataTypeEnum.LongText; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemText"; ffi.DataType = FormFieldDataTypeEnum.LongText; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemTotalPriceInMainCurrency"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemValidTo"; ffi.DataType = FormFieldDataTypeEnum.DateTime; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("COM_OrderItem"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_OrderItem"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.OrderItem - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - Shopping cart item" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.shoppingcartitem"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "CartItemBundleGUID"; ffi.DataType = FormFieldDataTypeEnum.GUID; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "CartItemIsPrivate"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "CartItemPrice"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "CartItemText"; ffi.DataType = FormFieldDataTypeEnum.LongText; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "CartItemValidTo"; ffi.DataType = FormFieldDataTypeEnum.DateTime; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = fi.GetFormField("CartItemGuid"); if (ffi != null) { ffi.AllowEmpty = true; fi.UpdateFormField("CartItemGuid", ffi); } dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("COM_ShoppingCartSKU"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_ShoppingCartSKU"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.ShoppingCartItem - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - SKU" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.sku"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "SKUBundleInventoryType"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 50; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUConversionName"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 100; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUConversionValue"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 200; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMaxDownloads"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMaxItemsInOrder"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMaxPrice"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMembershipGUID"; ffi.DataType = FormFieldDataTypeEnum.GUID; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMinPrice"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUNeedsShipping"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUPrivateDonation"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUProductType"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 50; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUSiteID"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUValidFor"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUValidity"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 50; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUValidUntil"; ffi.DataType = FormFieldDataTypeEnum.DateTime; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = fi.GetFormField("SKUDepartmentID"); if (ffi != null) { ffi.AllowEmpty = true; fi.UpdateFormField("SKUDepartmentID", ffi); } dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("COM_SKU"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_SKU"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.SKU - Upgrade", "Upgrade", ex); } #endregion #region "Community - Group" try { dci = DataClassInfoProvider.GetDataClass("Community.Group"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "GroupLogActivity"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.CheckBoxControl; ffi.Visible = true; ffi.DefaultValue = "true"; ffi.Caption = "GroupLogActivity"; fi.AddFormField(ffi); dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("Community_Group"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("Community_Group"); } } } catch (Exception ex) { evp.LogEvent("Community.Group - Upgrade", "Upgrade", ex); } #endregion #region "Newsletter - Subscriber" try { dci = DataClassInfoProvider.GetDataClass("newsletter.subscriber"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "SubscriberBounces"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("Newsletter_Subscriber"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("Newsletter_Subscriber"); } } } catch (Exception ex) { evp.LogEvent("Newsletter.Subscriber - Upgrade", "Upgrade", ex); } #endregion #region "CMS.Document" try { dci = DataClassInfoProvider.GetDataClass("cms.document"); if (dci != null) { SearchSettings ss = dci.ClassSearchSettingsInfos; SearchSettingsInfo ssi = ss.GetSettingsInfo("42f446ee-9818-4596-8124-54a38f64aa05"); if (ssi != null) { ssi.Searchable = true; ss.SetSettingsInfo(ssi); } DataClassInfoProvider.SetDataClass(dci); } } catch (Exception ex) { evp.LogEvent("CMS.Document - Upgrade", "Upgrade", ex); } #endregion // Set the path to the upgrade package mUpgradePackagePath = HttpContext.Current.Server.MapPath("~/CMSSiteUtils/Import/upgrade_55R2_60.zip"); mWebsitePath = HttpContext.Current.Server.MapPath("~/"); TableManager dtm = new TableManager(null); // Update all views dtm.RefreshDocumentViews(); // Set data version ObjectHelper.SetSettingsKeyValue("CMSDataVersion", "6.0"); // Clear hashtables CMSObjectHelper.ClearHashtables(); // Clear the cache CacheHelper.ClearCache(null, true); // Drop the routes CMSMvcHandler.DropAllRoutes(); // Init the Mimetype helper (required for the Import) MimeTypeHelper.LoadMimeTypes(); CMSThread thread = new CMSThread(Upgrade60Import); thread.Start(); }
/// <summary> /// Creates table. /// </summary> private void CreateTable(bool setAutomatically) { Table table = new Table(); table.GridLines = GridLines.Horizontal; table.CssClass = "UniGridGrid"; table.CellPadding = 3; table.CellSpacing = 0; table.BorderWidth = 1; // Create table header TableHeaderRow header = new TableHeaderRow(); header.HorizontalAlign = HorizontalAlign.Left; header.CssClass = "UniGridHead"; TableHeaderCell thc = new TableHeaderCell(); thc.HorizontalAlign = HorizontalAlign.Center; thc.Text = GetString("srch.settings.fieldname"); thc.Scope = TableHeaderScope.Column; thc.Style.Add("text-align", "left"); thc.Wrap = false; thc.CssClass = "ClassFieldsHeaderCell"; header.Cells.Add(thc); thc = new TableHeaderCell(); thc.Text = GetString("development.content"); thc.Scope = TableHeaderScope.Column; thc.Wrap = false; thc.CssClass = "ClassFieldsHeaderCell"; header.Cells.Add(thc); thc = new TableHeaderCell(); thc.Text = GetString("srch.settings.searchable"); thc.Scope = TableHeaderScope.Column; thc.Wrap = false; thc.CssClass = "ClassFieldsHeaderCell"; header.Cells.Add(thc); thc = new TableHeaderCell(); thc.Text = GetString("srch.settings.tokenized"); thc.Scope = TableHeaderScope.Column; thc.Wrap = false; thc.CssClass = "ClassFieldsHeaderCell"; header.Cells.Add(thc); if (DisplayIField) { thc = new TableHeaderCell(); thc.Text = GetString("srch.settings.ifield"); header.Cells.Add(thc); } thc = new TableHeaderCell(); thc.Width = Unit.Percentage(100); header.Cells.Add(thc); table.Rows.Add(header); pnlContent.Controls.Add(table); // Create table content if ((attributes != null) && (attributes.Count > 0)) { TableRow tr = null; TableCell tc = null; Label lbl = null; CheckBox chk = null; TextBox txt = null; SearchSettingsInfo ssi = null; int i = 0; // Create row for each field foreach (object[] item in attributes) { ssi = null; object[] obj = item; tr = new TableRow(); tr.CssClass = ((i % 2) == 0) ? "EvenRow" : "OddRow"; if (!DataHelper.DataSourceIsEmpty(infos)) { DataRow[] dr = infos.Tables[0].Select("name = '" + (string)obj[0] + "'"); if ((dr != null) && (dr.Length > 0) && (ss != null)) { ssi = ss.GetSettingsInfo((string)dr[0]["id"]); } } // Add cell with field name tc = new TableCell(); tc.CssClass = "ClassFieldsTableCell"; lbl = new Label(); lbl.Text = obj[0].ToString(); tc.Controls.Add(lbl); tr.Cells.Add(tc); // Add cell with 'Content' value tc = new TableCell(); tc.HorizontalAlign = HorizontalAlign.Center; chk = new CheckBox(); chk.ID = obj[0] + CONTENT; if (setAutomatically) { chk.Checked = GetPreset(CONTENT, (Type)obj[1]); } else if (ssi != null) { chk.Checked = ssi.Content; } tc.Controls.Add(chk); tr.Cells.Add(tc); // Add cell with 'Searchable' value tc = new TableCell(); tc.HorizontalAlign = HorizontalAlign.Center; chk = new CheckBox(); chk.ID = obj[0] + SEARCHABLE; if (setAutomatically) { chk.Checked = GetPreset(SEARCHABLE, (Type)obj[1]); } else if (ssi != null) { chk.Checked = ssi.Searchable; } tc.Controls.Add(chk); tr.Cells.Add(tc); // Add cell with 'Tokenized' value tc = new TableCell(); tc.HorizontalAlign = HorizontalAlign.Center; chk = new CheckBox(); chk.ID = obj[0] + TOKENIZED; if (setAutomatically) { chk.Checked = GetPreset(TOKENIZED, (Type)obj[1]); } else if (ssi != null) { chk.Checked = ssi.Tokenized; } tc.Controls.Add(chk); tr.Cells.Add(tc); // Add cell with 'iFieldname' value if (DisplayIField) { tc = new TableCell(); tc.HorizontalAlign = HorizontalAlign.Center; txt = new TextBox(); txt.ID = obj[0] + IFIELDNAME; txt.MaxLength = 200; if (ssi != null) { txt.Text = ssi.FieldName; } tc.Controls.Add(txt); tr.Cells.Add(tc); } tc = new TableCell(); tr.Cells.Add(tc); table.Rows.Add(tr); ++i; } } }