Example #1
0
    /// <summary>
    /// Initializes controls for attributre rule.
    /// </summary>
    private void InitAttributeRuleControls(int selectedFieldIndex)
    {
        FormInfo filterFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.CONTACT + ".ScoringAttributeRule", false);

        fields = filterFieldsForm.GetFields(true, false);

        // Sort alphabetically
        Array.Sort(fields, delegate(FormFieldInfo a, FormFieldInfo b) { return(String.Compare(ResHelper.LocalizeString(a.Caption), ResHelper.LocalizeString(b.Caption))); });

        if (filterFieldsForm != null)
        {
            if ((fields != null) && (fields.Length > 0) && (drpAttribute.Items.Count <= 0))
            {
                for (int i = 0; i < fields.Length; i++)
                {
                    drpAttribute.Items.Add(new ListItem(fields[i].Caption, fields[i].Name));
                }
            }
        }

        if ((EditForm.EditedObject != null) && !RequestHelper.IsPostBack())
        {
            drpAttribute.SelectedValue = ValidationHelper.GetString(EditForm.Data["RuleParameter"], null);
            selectedFieldIndex         = drpAttribute.SelectedIndex;
            PreviousField = selectedFieldIndex;
        }

        selectedField = fields[selectedFieldIndex];
        FormInfo fi = new FormInfo(null);

        fi.AddFormField(selectedField);

        LoadForm(formCondition, fi, null);
    }
Example #2
0
    /// <summary>
    /// Initializes controls for attributre rule.
    /// </summary>
    private void InitAttributeRuleControls(int selectedFieldIndex)
    {
        FormInfo filterFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.CONTACT + ".ScoringAttributeRule", false);

        var query = from formField in filterFieldsForm.GetFields(true, false)
                    orderby ResHelper.LocalizeString(formField.Caption)
                    select formField;

        fields = query.ToList <FormFieldInfo>();

        if ((fields != null) && (drpAttribute.Items.Count == 0))
        {
            foreach (FormFieldInfo field in fields)
            {
                drpAttribute.Items.Add(new ListItem(field.Caption, field.Name));
            }
        }

        if ((EditForm.EditedObject != null) && !RequestHelper.IsPostBack())
        {
            drpAttribute.SelectedValue = ValidationHelper.GetString(EditForm.Data["RuleParameter"], null);
            selectedFieldIndex         = drpAttribute.SelectedIndex;
            PreviousField = selectedFieldIndex;
        }

        selectedField = fields[selectedFieldIndex];
        FormInfo fi = new FormInfo(null);

        fi.AddFormField(selectedField);

        LoadForm(formCondition, fi, null);
    }
Example #3
0
    /// <summary>
    /// Selected field changed
    /// </summary>
    protected void drpAttribute_SelectedIndexChanged(object sender, EventArgs e)
    {
        PreviousField = drpAttribute.SelectedIndex;
        selectedField = fields[PreviousField];
        FormInfo fi = new FormInfo(null);

        fi.AddFormField(selectedField);
        LoadForm(formCondition, fi, null);
    }
Example #4
0
 /// <summary>
 /// Adds the extra activity fields to the form
 /// </summary>
 /// <param name="ignoredColumns">Ignored columns</param>
 /// <param name="fi">Form info with the result</param>
 /// <param name="additionalFieldsForm">Extra fields</param>
 private static void AddExtraFields(string ignoredColumns, FormInfo fi, FormInfo additionalFieldsForm)
 {
     if (additionalFieldsForm != null)
     {
         // Additional fields
         var formFields = additionalFieldsForm.GetFields(true, false);
         foreach (FormFieldInfo ffi in formFields)
         {
             if (ignoredColumns.IndexOfCSafe("|" + ffi.Name.ToLowerCSafe() + "|") >= 0)
             {
                 continue;
             }
             ffi.Settings["controlname"] = "textfilter";
             fi.AddFormField(ffi);
         }
     }
 }
    /// <summary>
    /// Initializes controls for attributre rule.
    /// </summary>
    private void InitAttributeRuleControls(int selectedFieldIndex)
    {
        FormInfo filterFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.CONTACT + ".ScoringAttributeRule", false);

        var query = from formField in filterFieldsForm.GetFields(true, false)
                    orderby ResHelper.LocalizeString(formField.Caption)
                    select formField;

        fields = query.ToList<FormFieldInfo>();

        if ((fields != null) && (drpAttribute.Items.Count == 0))
        {
            foreach (FormFieldInfo field in fields)
            {
                drpAttribute.Items.Add(new ListItem(field.Caption, field.Name));
            }
        }

        if ((EditForm.EditedObject != null) && !RequestHelper.IsPostBack())
        {
            drpAttribute.SelectedValue = ValidationHelper.GetString(EditForm.Data["RuleParameter"], null);
            selectedFieldIndex = drpAttribute.SelectedIndex;
            PreviousField = selectedFieldIndex;
        }

        selectedField = fields[selectedFieldIndex];
        FormInfo fi = new FormInfo(null);
        fi.AddFormField(selectedField);

        LoadForm(formCondition, fi, null);
    }
Example #6
0
 /// <summary>
 /// Selected field changed
 /// </summary>
 protected void drpAttribute_SelectedIndexChanged(object sender, EventArgs e)
 {
     PreviousField = drpAttribute.SelectedIndex;
     selectedField = fields[PreviousField];
     FormInfo fi = new FormInfo(null);
     fi.AddFormField(selectedField);
     LoadForm(formCondition, fi, null);
 }
    protected void EditForm_OnBeforeSave(object sender, EventArgs e)
    {
        MacroRuleInfo info = EditForm.EditedObject as MacroRuleInfo;
        if (info != null)
        {
            // Generate automatic fields when present in UserText
            FormEngineUserControl control = EditForm.FieldControls["MacroRuleText"];
            if (control != null)
            {
                string userText = ValidationHelper.GetString(control.Value, "");
                if (!string.IsNullOrEmpty(userText))
                {
                    Regex regex = RegexHelper.GetRegex("\\{[-_a-zA-Z0-9]*\\}");
                    MatchCollection match = regex.Matches(userText);
                    if (match.Count > 0)
                    {
                        FormInfo fi = new FormInfo(info.MacroRuleParameters);
                        foreach (Match m in match)
                        {
                            foreach (Capture c in m.Captures)
                            {
                                string name = c.Value.Substring(1, c.Value.Length - 2).ToLowerCSafe();
                                FormFieldInfo ffi = fi.GetFormField(name);
                                if (ffi == null)
                                {
                                    ffi = new FormFieldInfo();
                                    ffi.Name = name;
                                    ffi.DataType = FormFieldDataTypeEnum.Text;
                                    ffi.Size = 100;
                                    ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                    ffi.Caption = "select operation";
                                    ffi.AllowEmpty = true;
                                    switch (name)
                                    {
                                        case "_is":
                                            ffi.DefaultValue = ";is";
                                            ffi.Settings["controlname"] = "MacroNegationOperator";
                                            ffi.Settings["EditText"] = "false";
                                            ffi.Settings["Options"] = ";is\r\n!;is not";
                                            break;

                                        case "_was":
                                            ffi.DefaultValue = ";was";
                                            ffi.Settings["controlname"] = "MacroNegationOperator";
                                            ffi.Settings["EditText"] = "false";
                                            ffi.Settings["Options"] = ";was\r\n!;was not";
                                            break;

                                        case "_will":
                                            ffi.DefaultValue = ";will";
                                            ffi.Settings["controlname"] = "MacroNegationOperator";
                                            ffi.Settings["EditText"] = "false";
                                            ffi.Settings["Options"] = ";will\r\n!;will not";
                                            break;

                                        case "_has":
                                            ffi.DefaultValue = ";has";
                                            ffi.Settings["controlname"] = "MacroNegationOperator";
                                            ffi.Settings["EditText"] = "false";
                                            ffi.Settings["Options"] = ";has\r\n!;does not have";
                                            break;

                                        case "_perfectum":
                                            ffi.DefaultValue = ";has";
                                            ffi.Settings["controlname"] = "MacroNegationOperator";
                                            ffi.Settings["EditText"] = "false";
                                            ffi.Settings["Options"] = ";has\r\n!;has not";
                                            break;

                                        case "_any":
                                            ffi.DefaultValue = "false;any";
                                            ffi.Settings["controlname"] = "macro_any-all_bool_selector";
                                            ffi.Settings["EditText"] = "false";
                                            ffi.Settings["Options"] = "false;any\r\ntrue;all";
                                            break;

                                        default:
                                            ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
                                            ffi.Size = 1000;
                                            ffi.Caption = "enter text";
                                            break;
                                    }

                                    fi.AddFormField(ffi);
                                }
                            }
                        }
                        info.MacroRuleParameters = fi.GetXmlDefinition();
                    }
                }
            }
        }

        if (!string.IsNullOrEmpty(ResourceName))
        {
            EditForm.EditedObject.SetValue("MacroRuleResourceName", ResourceName);
        }
        EditForm.EditedObject.SetValue("MacroRuleIsCustom", !SettingsKeyProvider.DevelopmentMode);
    }
    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();
    }
Example #9
0
    public static void Upgrade55R2()
    {
        EventLogProvider evp = new EventLogProvider();
        evp.LogEvent("I", DateTime.Now, "Upgrade to 5.5 R2", "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 = "UserSkype";
                    ffi.DataType = FormFieldDataTypeEnum.Text;
                    ffi.Size = 100;
                    ffi.AllowEmpty = true;
                    ffi.PublicField = false;
                    ffi.System = true;
                    ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
                    ffi.Visible = false;
                    ffi.Caption = "User Skype account";
                    ffi.DefaultValue = String.Empty;
                    ffi.Description = String.Empty;
                    ffi.RegularExpression = String.Empty;

                    fi.AddFormField(ffi);

                    ffi = new FormFieldInfo();
                    ffi.Name = "UserIM";
                    ffi.DataType = FormFieldDataTypeEnum.Text;
                    ffi.Size = 100;
                    ffi.AllowEmpty = true;
                    ffi.PublicField = false;
                    ffi.System = true;
                    ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
                    ffi.Visible = false;
                    ffi.Caption = "User instant messenger";
                    ffi.DefaultValue = String.Empty;
                    ffi.Description = String.Empty;
                    ffi.RegularExpression = String.Empty;

                    fi.AddFormField(ffi);

                    ffi = new FormFieldInfo();
                    ffi.Name = "UserPhone";
                    ffi.DataType = FormFieldDataTypeEnum.Text;
                    ffi.Size = 26;
                    ffi.AllowEmpty = true;
                    ffi.PublicField = false;
                    ffi.System = true;
                    ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
                    ffi.Visible = false;
                    ffi.Caption = "User phone";
                    ffi.DefaultValue = String.Empty;
                    ffi.Description = "User phone number.";
                    ffi.RegularExpression = String.Empty;

                    fi.AddFormField(ffi);

                    ffi = new FormFieldInfo();
                    ffi.Name = "UserPosition";
                    ffi.DataType = FormFieldDataTypeEnum.Text;
                    ffi.Size = 200;
                    ffi.AllowEmpty = true;
                    ffi.PublicField = false;
                    ffi.System = false;
                    ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
                    ffi.Visible = false;
                    ffi.Caption = "Position";
                    ffi.DefaultValue = String.Empty;
                    ffi.Description = String.Empty;
                    ffi.RegularExpression = String.Empty;

                    fi.AddFormField(ffi);

                    dci.ClassFormDefinition = fi.GetXmlDefinition();
                    dci.ClassXmlSchema = TableManager.GetXmlSchema("CMS_UserSettings");

                    DataClassInfoProvider.SetDataClass(dci);

                    // Generate queries
                    SqlGenerator.GenerateDefaultQueries(dci, true, false);
                }
            }

        }
        catch (Exception ex)
        {
            evp.LogEvent("CMS.UserSettings - Upgrade", "Upgrade", ex);
        }

        #endregion

        #region "WebTemplate meta file"

        try
        {
            WebTemplateInfo wti = WebTemplateInfoProvider.GetWebTemplateInfo("IntranetPortal");
            if (wti != null)
            {
                string imgPath = HttpContext.Current.Server.MapPath("~/App_Data/CMSTemp/intranetportal.gif");
                if (File.Exists(imgPath))
                {
                    MetaFileInfo mfi = new MetaFileInfo(imgPath, wti.WebTemplateId, "cms.webtemplate", "Thumbnail");
                    if (mfi != null)
                    {
                        MetaFileInfoProvider.SetMetaFileInfo(mfi);
                    }
                    File.Delete(imgPath);
                }
            }
        }
        catch (Exception ex)
        {
            evp.LogEvent("Upgrade to 5.5 R2", "Upgrade", ex);
        }

        #endregion

        // Clear hashtables
        CMSObjectHelper.ClearHashtables();

        // Set the path to the upgrade package
        mUpgradePackagePath = HttpContext.Current.Server.MapPath("~/CMSSiteUtils/Import/upgrade_55_55R2.zip");

        mWebsitePath = HttpContext.Current.Server.MapPath("~/");

        // Set data version
        ObjectHelper.SetSettingsKeyValue("CMSDataVersion", "5.5R2");

        CMSThread thread = new CMSThread(Upgrade55R2Import);
        thread.Start();
    }
    /// <summary>
    /// Loads the from definition from selected parameter into a BasicForm control.
    /// </summary>
    /// <param name="actual">If true, data from actual hiddens are loaded</param>
    private void LoadFormDefinition(bool actual)
    {
        MacroRuleTree selected = GetSelected((actual ? hdnParamSelected.Value : hdnLastSelected.Value));
        if (selected != null)
        {
            string paramName = (actual ? hdnParam.Value.ToLowerCSafe() : hdnLastParam.Value.ToLowerCSafe());
            MacroRuleParameter param = (MacroRuleParameter)selected.Parameters[paramName];
            if (param != null)
            {
                FormInfo fi = new FormInfo(selected.RuleParameters);
                FormFieldInfo ffi = fi.GetFormField(paramName);
                if (ffi != null)
                {
                    fi = new FormInfo(null);
                    fi.AddFormField(ffi);

                    // Add fake DisplayName field
                    FormFieldInfo displayName = new FormFieldInfo();
                    displayName.Visible = false;
                    displayName.Name = "DisplayName";
                    displayName.DataType = FormFieldDataTypeEnum.Text;
                    fi.AddFormField(displayName);

                    DataRow row = fi.GetDataRow().Table.NewRow();

                    if (ffi.AllowEmpty && string.IsNullOrEmpty(param.Value))
                    {
                        if ((ffi.DataType != FormFieldDataTypeEnum.Text) && (ffi.DataType != FormFieldDataTypeEnum.LongText))
                        {
                            row[paramName] = DBNull.Value;
                        }
                    }
                    else
                    {
                        switch (ffi.DataType)
                        {
                            case FormFieldDataTypeEnum.Decimal:
                                row[paramName] = ValidationHelper.GetDouble(param.Value, 0, CultureHelper.EnglishCulture);
                                break;

                            case FormFieldDataTypeEnum.Boolean:
                                row[paramName] = ValidationHelper.GetBoolean(param.Value, false);
                                break;

                            case FormFieldDataTypeEnum.Integer:
                                row[paramName] = ValidationHelper.GetInteger(param.Value, 0);
                                break;

                            case FormFieldDataTypeEnum.DateTime:
                                row[paramName] = ValidationHelper.GetDateTime(param.Value, DataHelper.DATETIME_NOT_SELECTED, CultureHelper.EnglishCulture);
                                break;

                            case FormFieldDataTypeEnum.GUID:
                                Guid guid = ValidationHelper.GetGuid(param.Value, Guid.Empty);
                                if (guid != Guid.Empty)
                                {
                                    row[paramName] = guid;
                                }
                                break;

                            default:
                                row[paramName] = param.Value;
                                break;
                        }
                    }

                    formElem.DataRow = row;
                    formElem.FormInformation = fi;
                    formElem.ReloadData();
                }
            }
        }
    }
Example #11
0
    protected void EditForm_OnBeforeSave(object sender, EventArgs e)
    {
        MacroRuleInfo info = EditForm.EditedObject as MacroRuleInfo;

        if (info != null)
        {
            // Generate automatic fields when present in UserText
            FormEngineUserControl control = EditForm.FieldControls["MacroRuleText"];
            if (control != null)
            {
                string userText = ValidationHelper.GetString(control.Value, "");
                if (!string.IsNullOrEmpty(userText))
                {
                    Regex           regex = RegexHelper.GetRegex("\\{[-_a-zA-Z0-9]*\\}");
                    MatchCollection match = regex.Matches(userText);
                    if (match.Count > 0)
                    {
                        FormInfo fi = new FormInfo(info.MacroRuleParameters);
                        foreach (Match m in match)
                        {
                            foreach (Capture c in m.Captures)
                            {
                                string        name = c.Value.Substring(1, c.Value.Length - 2).ToLowerCSafe();
                                FormFieldInfo ffi  = fi.GetFormField(name);
                                if (ffi == null)
                                {
                                    ffi            = new FormFieldInfo();
                                    ffi.Name       = name;
                                    ffi.DataType   = FormFieldDataTypeEnum.Text;
                                    ffi.Size       = 100;
                                    ffi.FieldType  = FormFieldControlTypeEnum.CustomUserControl;
                                    ffi.Caption    = "select operation";
                                    ffi.AllowEmpty = true;
                                    switch (name)
                                    {
                                    case "_is":
                                        ffi.DefaultValue            = ";is";
                                        ffi.Settings["controlname"] = "MacroNegationOperator";
                                        ffi.Settings["EditText"]    = "false";
                                        ffi.Settings["Options"]     = ";is\r\n!;is not";
                                        break;

                                    case "_was":
                                        ffi.DefaultValue            = ";was";
                                        ffi.Settings["controlname"] = "MacroNegationOperator";
                                        ffi.Settings["EditText"]    = "false";
                                        ffi.Settings["Options"]     = ";was\r\n!;was not";
                                        break;

                                    case "_will":
                                        ffi.DefaultValue            = ";will";
                                        ffi.Settings["controlname"] = "MacroNegationOperator";
                                        ffi.Settings["EditText"]    = "false";
                                        ffi.Settings["Options"]     = ";will\r\n!;will not";
                                        break;

                                    case "_has":
                                        ffi.DefaultValue            = ";has";
                                        ffi.Settings["controlname"] = "MacroNegationOperator";
                                        ffi.Settings["EditText"]    = "false";
                                        ffi.Settings["Options"]     = ";has\r\n!;does not have";
                                        break;

                                    case "_perfectum":
                                        ffi.DefaultValue            = ";has";
                                        ffi.Settings["controlname"] = "MacroNegationOperator";
                                        ffi.Settings["EditText"]    = "false";
                                        ffi.Settings["Options"]     = ";has\r\n!;has not";
                                        break;

                                    case "_any":
                                        ffi.DefaultValue            = "false;any";
                                        ffi.Settings["controlname"] = "macro_any-all_bool_selector";
                                        ffi.Settings["EditText"]    = "false";
                                        ffi.Settings["Options"]     = "false;any\r\ntrue;all";
                                        break;

                                    default:
                                        ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
                                        ffi.Size      = 1000;
                                        ffi.Caption   = "enter text";
                                        break;
                                    }

                                    fi.AddFormField(ffi);
                                }
                            }
                        }
                        info.MacroRuleParameters = fi.GetXmlDefinition();
                    }
                }
            }
        }

        if (!string.IsNullOrEmpty(ResourceName))
        {
            EditForm.EditedObject.SetValue("MacroRuleResourceName", ResourceName);
        }
        EditForm.EditedObject.SetValue("MacroRuleIsCustom", !SettingsKeyProvider.DevelopmentMode);
    }
    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();
    }
Example #13
0
    /// <summary>
    /// Initializes controls for activity rule.
    /// </summary>
    private void InitActivityRuleControls(string selectedActivityType)
    {
        ucActivityType.OnSelectedIndexChanged += new EventHandler(ucActivityType_OnSelectedIndexChanged);

        // Init activity selector from  edited object if any
        string activityType = selectedActivityType;

        if ((EditForm.EditedObject != null) && !RequestHelper.IsPostBack())
        {
            ucActivityType.Value = ValidationHelper.GetString(EditForm.Data["RuleParameter"], PredefinedActivityType.ABUSE_REPORT);
            activityType         = ucActivityType.SelectedValue;
            PreviousActivityType = activityType;
        }

        // List of ignored columns
        string ignoredColumns = "|activitytype|activitysiteid|activityguid|activityactivecontactid|activityoriginalcontactid|pagevisitid|pagevisitactivityid|searchid|searchactivityid|";

        // List of activities with "ActivityValue"
        StringBuilder sb = new StringBuilder();

        sb.Append("|");
        sb.Append(PredefinedActivityType.PURCHASE);
        sb.Append("|");
        sb.Append(PredefinedActivityType.PURCHASEDPRODUCT);
        sb.Append("|");
        sb.Append(PredefinedActivityType.RATING);
        sb.Append("|");
        sb.Append(PredefinedActivityType.POLL_VOTING);
        sb.Append("|");
        sb.Append(PredefinedActivityType.PRODUCT_ADDED_TO_SHOPPINGCART);
        sb.Append("|");
        string showActivityValueFor = sb.ToString();

        // Get columns from OM_Activity (i.e. base table for all activities)
        ActivityTypeInfo ati = ActivityTypeInfoProvider.GetActivityTypeInfo(activityType);

        FormInfo fi = new FormInfo(null);

        // Get columns from additional table (if any) according to selected activity type (page visit, search)
        FormInfo additionalFieldsForm = null;
        bool     extraFieldsAtEnd     = true;

        switch (activityType)
        {
        case PredefinedActivityType.PAGE_VISIT:
        case PredefinedActivityType.LANDING_PAGE:
            // Page visits
            additionalFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.PAGEVISIT, false);
            break;

        case PredefinedActivityType.INTERNAL_SEARCH:
        case PredefinedActivityType.EXTERNAL_SEARCH:
            // Search
            additionalFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.SEARCH, false);
            extraFieldsAtEnd     = false;
            break;
        }

        // Get the activity form elements
        FormInfo filterFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.ACTIVITY, true);
        var      elements         = filterFieldsForm.GetFormElements(true, false);

        FormCategoryInfo newCategory = null;

        string caption    = null;
        string captionKey = null;

        foreach (var elem in elements)
        {
            if (elem is FormCategoryInfo)
            {
                // Form category
                newCategory = (FormCategoryInfo)elem;
            }
            else if (elem is FormFieldInfo)
            {
                // Form field
                FormFieldInfo ffi = (FormFieldInfo)elem;

                // Skip ignored columns
                if (ignoredColumns.IndexOfCSafe("|" + ffi.Name.ToLowerCSafe() + "|") >= 0)
                {
                    continue;
                }

                string controlName = null;
                if (!ffi.PrimaryKey && (fi.GetFormField(ffi.Name) == null))
                {
                    // Set default filters
                    switch (ffi.DataType)
                    {
                    case FormFieldDataTypeEnum.Text:
                    case FormFieldDataTypeEnum.LongText:
                        controlName = "textfilter";
                        ffi.Settings["OperatorFieldName"] = ffi.Name + ".operator";
                        break;

                    case FormFieldDataTypeEnum.DateTime:
                        controlName = "datetimefilter";
                        ffi.Settings["SecondDateFieldName"] = ffi.Name + ".seconddatetime";
                        break;

                    case FormFieldDataTypeEnum.Integer:
                    case FormFieldDataTypeEnum.LongInteger:
                        controlName = "numberfilter";
                        ffi.Settings["OperatorFieldName"] = ffi.Name + ".operator";
                        break;

                    case FormFieldDataTypeEnum.GUID:
                        continue;
                    }

                    // For item ID and detail ID fields use control defined in activity type
                    if (CMSString.Compare(ffi.Name, "ActivityItemID", true) == 0)
                    {
                        if (ati.ActivityTypeMainFormControl == null)
                        {
                            continue;
                        }

                        if (ati.ActivityTypeMainFormControl != String.Empty)
                        {
                            // Check if user defined control exists
                            FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(ati.ActivityTypeMainFormControl);
                            if (fui != null)
                            {
                                controlName = ati.ActivityTypeMainFormControl;
                            }
                        }

                        // Set detailed caption
                        captionKey = "activityitem." + activityType;
                        caption    = GetString(captionKey);
                        if (!caption.EqualsCSafe(captionKey, true))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (CMSString.Compare(ffi.Name, "ActivityItemDetailID", true) == 0)
                    {
                        if (ati.ActivityTypeDetailFormControl == null)
                        {
                            continue;
                        }

                        if (ati.ActivityTypeDetailFormControl != String.Empty)
                        {
                            // Check if user defined control exists
                            FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(ati.ActivityTypeDetailFormControl);
                            if (fui != null)
                            {
                                controlName = ati.ActivityTypeDetailFormControl;
                            }
                        }

                        // Set detailed caption
                        captionKey = "activityitemdetail." + activityType;
                        caption    = GetString(captionKey);
                        if (!caption.EqualsCSafe(captionKey, true))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (CMSString.Compare(ffi.Name, "ActivityNodeID", true) == 0)
                    {
                        // Document selector for NodeID
                        controlName = "selectdocument";
                    }
                    else if (CMSString.Compare(ffi.Name, "ActivityCulture", true) == 0)
                    {
                        // Culture selector for culture
                        controlName = "sitecultureselector";
                    }
                    else if (CMSString.Compare(ffi.Name, "ActivityValue", true) == 0)
                    {
                        // Show activity value only for relevant activity types
                        if (!ati.ActivityTypeIsCustom && (showActivityValueFor.IndexOfCSafe("|" + activityType + "|", true) < 0))
                        {
                            continue;
                        }
                    }

                    if (controlName != null)
                    {
                        // SKU selector for product
                        ffi.Settings["controlname"] = controlName;
                        if (CMSString.Compare(controlName, "skuselector", true) == 0)
                        {
                            ffi.Settings["allowempty"] = true;
                        }
                    }

                    // Ensure the category
                    if (newCategory != null)
                    {
                        fi.AddFormCategory(newCategory);

                        newCategory = null;

                        // // Extra fields at the beginning
                        if (!extraFieldsAtEnd && (additionalFieldsForm != null))
                        {
                            AddExtraFields(ignoredColumns, fi, additionalFieldsForm);

                            additionalFieldsForm = null;
                        }
                    }

                    fi.AddFormField(ffi);
                }
            }
        }

        // Extra fields at end
        if (extraFieldsAtEnd && (additionalFieldsForm != null))
        {
            // Ensure the category for extra fields
            if (newCategory != null)
            {
                fi.AddFormCategory(newCategory);

                newCategory = null;
            }

            AddExtraFields(ignoredColumns, fi, additionalFieldsForm);
        }

        LoadForm(activityFormCondition, fi, activityType);
    }
Example #14
0
    /// <summary>
    /// Initializes controls for attributre rule.
    /// </summary>
    private void InitAttributeRuleControls(int selectedFieldIndex)
    {
        FormInfo filterFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.CONTACT + ".ScoringAttributeRule", false);
        fields = filterFieldsForm.GetFields(true, false);

        // Sort alphabetically
        Array.Sort(fields, delegate(FormFieldInfo a, FormFieldInfo b) { return String.Compare(ResHelper.LocalizeString(a.Caption), ResHelper.LocalizeString(b.Caption)); });

        if (filterFieldsForm != null)
        {
            if ((fields != null) && (fields.Length > 0) && (drpAttribute.Items.Count <= 0))
            {
                for (int i = 0; i < fields.Length; i++)
                {
                    drpAttribute.Items.Add(new ListItem(fields[i].Caption, fields[i].Name));
                }
            }
        }

        if ((EditForm.EditedObject != null) && !RequestHelper.IsPostBack())
        {
            drpAttribute.SelectedValue = ValidationHelper.GetString(EditForm.Data["RuleParameter"], null);
            selectedFieldIndex = drpAttribute.SelectedIndex;
            PreviousField = selectedFieldIndex;
        }

        selectedField = fields[selectedFieldIndex];
        FormInfo fi = new FormInfo(null);
        fi.AddFormField(selectedField);

        LoadForm(formCondition, fi, null);
    }
Example #15
0
    /// <summary>
    /// Initializes controls for activity rule.
    /// </summary>
    private void InitActivityRuleControls(string selectedActivityType)
    {
        ucActivityType.OnSelectedIndexChanged += new EventHandler(ucActivityType_OnSelectedIndexChanged);

        // Init activity selector from  edited object if any
        string activityType = selectedActivityType;
        if ((EditForm.EditedObject != null) && !RequestHelper.IsPostBack())
        {
            ucActivityType.Value = ValidationHelper.GetString(EditForm.Data["RuleParameter"], PredefinedActivityType.ABUSE_REPORT);
            activityType = ucActivityType.SelectedValue;
            PreviousActivityType = activityType;
        }

        // List of ignored columns
        string ignoredColumns = "|activitytype|activitysiteid|activityguid|activityactivecontactid|activityoriginalcontactid|pagevisitid|pagevisitactivityid|searchid|searchactivityid|";

        // List of activities with "ActivityValue"
        StringBuilder sb = new StringBuilder();
        sb.Append("|"); sb.Append(PredefinedActivityType.PURCHASE);
        sb.Append("|"); sb.Append(PredefinedActivityType.PURCHASEDPRODUCT);
        sb.Append("|"); sb.Append(PredefinedActivityType.RATING);
        sb.Append("|"); sb.Append(PredefinedActivityType.POLL_VOTING);
        sb.Append("|"); sb.Append(PredefinedActivityType.PRODUCT_ADDED_TO_SHOPPINGCART);
        sb.Append("|");
        string showActivityValueFor = sb.ToString();

        // Get columns from OM_Activity (i.e. base table for all activities)
        ActivityTypeInfo ati = ActivityTypeInfoProvider.GetActivityTypeInfo(activityType);

        FormInfo fi = new FormInfo(null);

        // Get columns from additional table (if any) according to selected activity type (page visit, search)
        FormInfo additionalFieldsForm = null;
        bool extraFieldsAtEnd = true;

        switch (activityType)
        {
            case PredefinedActivityType.PAGE_VISIT:
            case PredefinedActivityType.LANDING_PAGE:
                // Page visits
                additionalFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.PAGEVISIT, false);
                break;

            case PredefinedActivityType.INTERNAL_SEARCH:
            case PredefinedActivityType.EXTERNAL_SEARCH:
                // Search
                additionalFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.SEARCH, false);
                extraFieldsAtEnd = false;
                break;
        }

        // Get the activity form elements
        FormInfo filterFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.ACTIVITY, true);
        ArrayList elements = filterFieldsForm.GetFormElements(true, false);

        FormCategoryInfo newCategory = null;

        string caption = null;
        string captionKey = null;

        foreach (var elem in elements)
        {
            if (elem is FormCategoryInfo)
            {
                // Form category
                newCategory = (FormCategoryInfo)elem;
            }
            else if (elem is FormFieldInfo)
            {
                // Form field
                FormFieldInfo ffi = (FormFieldInfo)elem;

                // Skip ignored columns
                if (ignoredColumns.IndexOf("|" + ffi.Name.ToLower() + "|") >= 0)
                {
                    continue;
                }

                string controlName = null;
                if (!ffi.PrimaryKey && (fi.GetFormField(ffi.Name) == null))
                {
                    // Set default filters
                    switch (ffi.DataType)
                    {
                        case FormFieldDataTypeEnum.Text:
                        case FormFieldDataTypeEnum.LongText:
                            controlName = "textfilter";
                            ffi.Settings["OperatorFieldName"] = ffi.Name + ".operator";
                            break;

                        case FormFieldDataTypeEnum.DateTime:
                            controlName = "datetimefilter";
                            ffi.Settings["SecondDateFieldName"] = ffi.Name + ".seconddatetime";
                            break;

                        case FormFieldDataTypeEnum.Integer:
                        case FormFieldDataTypeEnum.LongInteger:
                            controlName = "numberfilter";
                            ffi.Settings["OperatorFieldName"] = ffi.Name + ".operator";
                            break;

                        case FormFieldDataTypeEnum.GUID:
                            continue;
                    }

                    // For item ID and detail ID fields use control defined in activity type
                    if (String.Compare(ffi.Name, "ActivityItemID", true) == 0)
                    {
                        if (ati.ActivityTypeMainFormControl == null)
                        {
                            continue;
                        }

                        if (ati.ActivityTypeMainFormControl != String.Empty)
                        {
                            // Check if user defined control exists
                            FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(ati.ActivityTypeMainFormControl);
                            if (fui != null)
                            {
                                controlName = ati.ActivityTypeMainFormControl;
                            }
                        }

                        // Set detailed caption
                        captionKey = "activityitem." + activityType;
                        caption = GetString(captionKey);
                        if (!caption.Equals(captionKey, StringComparison.InvariantCultureIgnoreCase))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (String.Compare(ffi.Name, "ActivityItemDetailID", true) == 0)
                    {
                        if (ati.ActivityTypeDetailFormControl == null)
                        {
                            continue;
                        }

                        if (ati.ActivityTypeDetailFormControl != String.Empty)
                        {
                            // Check if user defined control exists
                            FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(ati.ActivityTypeDetailFormControl);
                            if (fui != null)
                            {
                                controlName = ati.ActivityTypeDetailFormControl;
                            }
                        }

                        // Set detailed caption
                        captionKey = "activityitemdetail." + activityType;
                        caption = GetString(captionKey);
                        if (!caption.Equals(captionKey, StringComparison.InvariantCultureIgnoreCase))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (String.Compare(ffi.Name, "ActivityNodeID", true) == 0)
                    {
                        // Document selector for NodeID
                        controlName = "selectdocument";
                    }
                    else if (String.Compare(ffi.Name, "ActivityCulture", true) == 0)
                    {
                        // Culture selector for culture
                        controlName = "sitecultureselector";
                    }
                    else if (String.Compare(ffi.Name, "ActivityValue", true) == 0)
                    {
                        // Show activity value only for relevant activity types
                        if (!ati.ActivityTypeIsCustom && (showActivityValueFor.IndexOf("|" + activityType + "|",  StringComparison.InvariantCultureIgnoreCase) < 0))
                        {
                            continue;
                        }
                    }

                    if (controlName != null)
                    {
                        // SKU selector for product
                        ffi.Settings["controlname"] = controlName;
                        if (String.Compare(controlName, "skuselector", StringComparison.InvariantCultureIgnoreCase) == 0)
                        {
                            ffi.Settings["allowempty"] = true;
                        }
                    }

                    // Ensure the category
                    if (newCategory != null)
                    {
                        fi.AddFormCategory(newCategory);

                        newCategory = null;

                        // // Extra fields at the beginning
                        if (!extraFieldsAtEnd && (additionalFieldsForm != null))
                        {
                            AddExtraFields(ignoredColumns, fi, additionalFieldsForm);

                            additionalFieldsForm = null;
                        }
                    }

                    fi.AddFormField(ffi);
                }
            }
        }

        // Extra fields at end
        if (extraFieldsAtEnd && (additionalFieldsForm != null))
        {
            // Ensure the category for extra fields
            if (newCategory != null)
            {
                fi.AddFormCategory(newCategory);

                newCategory = null;
            }

            AddExtraFields(ignoredColumns, fi, additionalFieldsForm);
        }

        LoadForm(activityFormCondition, fi, activityType);
    }
Example #16
0
 /// <summary>
 /// Adds the extra activity fields to the form
 /// </summary>
 /// <param name="ignoredColumns">Ignored columns</param>
 /// <param name="fi">Form info with the result</param>
 /// <param name="additionalFieldsForm">Extra fields</param>
 private static void AddExtraFields(string ignoredColumns, FormInfo fi, FormInfo additionalFieldsForm)
 {
     if (additionalFieldsForm != null)
     {
         // Additional fields
         var formFields = additionalFieldsForm.GetFields(true, false);
         foreach (FormFieldInfo ffi in formFields)
         {
             if (ignoredColumns.IndexOf("|" + ffi.Name.ToLower() + "|") >= 0)
             {
                 continue;
             }
             ffi.Settings["controlname"] = "textfilter";
             fi.AddFormField(ffi);
         }
     }
 }
Example #17
0
    /// <summary>
    /// 'Next' button is clicked.
    /// </summary>
    protected void wzdNewDocType_NextButtonClick(object sender, WizardNavigationEventArgs e)
    {
        DataClassInfo dci = null;
        FormInfo fi = null;

        switch (e.CurrentStepIndex)
        {
            // Step 1
            case 0:
                {
                    // Actions after next button click

                    // Validate checkboxes first
                    string errorMessage = "";

                    // Display proper error message based on development mode wizzard setting
                    switch (this.Mode)
                    {
                        case NewClassWizardModeEnum.DocumentType:
                            errorMessage = new Validator().NotEmpty(txtDisplayName.Text.Trim(), GetString("DocumentType_New.ErrorEmptyDisplayName")).
                            NotEmpty(txtCodeName.Text.Trim(), GetString("DocumentType_New.ErrorEmptyCodeName")).
                            NotEmpty(txtNamespaceName.Text.Trim(), GetString("DocumentType_New.ErrorEmptyNamespaceName")).
                            IsCodeName(txtCodeName.Text.Trim(), GetString("DocumentType_New.CodeNameIdentificator")).
                            IsIdentificator(txtNamespaceName.Text.Trim(), GetString("DocumentType_New.NamespaceNameIdentificator")).Result;
                            break;

                        case NewClassWizardModeEnum.Class:
                            errorMessage = new Validator().NotEmpty(txtDisplayName.Text.Trim(), GetString("sysdev.class_new.ErrorEmptyDisplayName")).
                            NotEmpty(txtCodeName.Text.Trim(), GetString("sysdev.class_new.ErrorEmptyCodeName")).
                            NotEmpty(txtNamespaceName.Text.Trim(), GetString("sysdev.class_new.ErrorEmptyNamespaceName")).
                            IsCodeName(txtCodeName.Text.Trim(), GetString("sysdev.class_new.CodeNameIdentificator")).
                            IsIdentificator(txtNamespaceName.Text.Trim(), GetString("sysdev.class_new.NamespaceNameIdentificator")).Result;
                            break;

                        case NewClassWizardModeEnum.CustomTable:
                            errorMessage = new Validator().NotEmpty(txtDisplayName.Text.Trim(), GetString("customtable.newwizzard.ErrorEmptyDisplayName")).
                            NotEmpty(txtCodeName.Text.Trim(), GetString("customtable.newwizzard.ErrorEmptyCodeName")).
                            NotEmpty(txtNamespaceName.Text.Trim(), GetString("customtable.newwizzard.ErrorEmptyNamespaceName")).
                            IsCodeName(txtCodeName.Text.Trim(), GetString("customtable.newwizzard.CodeNameIdentificator")).
                            IsIdentificator(txtNamespaceName.Text.Trim(), GetString("customtable.newwizzard.NamespaceNameIdentificator")).Result;
                            break;
                    }

                    if (errorMessage == "")
                    {
                        // Set new class info
                        dci = new DataClassInfo();
                        dci.ClassDisplayName = txtDisplayName.Text.Trim();
                        dci.ClassName = txtNamespaceName.Text.Trim() + "." + txtCodeName.Text.Trim();

                        // Set class type according development mode setting
                        switch (this.Mode)
                        {
                            case NewClassWizardModeEnum.DocumentType:
                                dci.ClassIsDocumentType = true;
                                dci.ClassUsePublishFromTo = true;
                                break;

                            case NewClassWizardModeEnum.Class:
                                dci.ClassShowAsSystemTable = false;
                                dci.ClassShowTemplateSelection = false;
                                dci.ClassIsDocumentType = false;
                                dci.ClassCreateSKU = false;
                                dci.ClassIsProduct = false;
                                dci.ClassIsMenuItemType = false;
                                dci.ClassUsesVersioning = false;
                                dci.ClassUsePublishFromTo = false;
                                break;

                            case NewClassWizardModeEnum.CustomTable:
                                dci.ClassShowAsSystemTable = false;
                                dci.ClassShowTemplateSelection = false;
                                dci.ClassIsDocumentType = false;
                                dci.ClassCreateSKU = false;
                                dci.ClassIsProduct = false;
                                dci.ClassIsMenuItemType = false;
                                dci.ClassUsesVersioning = false;
                                dci.ClassUsePublishFromTo = false;
                                // Sets custom table
                                dci.ClassIsCustomTable = true;
                                break;
                        }

                        try
                        {
                            // Insert new class into DB
                            DataClassInfoProvider.SetDataClass(dci);

                            // Set permissions and queries
                            switch (this.Mode)
                            {
                                case NewClassWizardModeEnum.DocumentType:
                                    // Ensure default permissions
                                    PermissionNameInfoProvider.CreateDefaultClassPermissions(dci.ClassID);

                                    // Generate special document queries, for possible premature exit from wizzard
                                    SqlGenerator.GenerateQuery(dci.ClassName, SqlGenerator.QUERYNAME_SEARCHTREE, SqlOperationTypeEnum.SearchTree, false, false);
                                    SqlGenerator.GenerateQuery(dci.ClassName, SqlGenerator.QUERYNAME_SELECTDOCUMENTS, SqlOperationTypeEnum.SelectDocuments, false, false);
                                    SqlGenerator.GenerateQuery(dci.ClassName, SqlGenerator.QUERYNAME_SELECTVERSIONS, SqlOperationTypeEnum.SelectVersions, false, false);
                                    break;

                                case NewClassWizardModeEnum.Class:
                                    break;

                                case NewClassWizardModeEnum.CustomTable:
                                    // Ensure default custom table permissions
                                    PermissionNameInfoProvider.CreateDefaultCustomTablePermissions(dci.ClassID);
                                    break;
                            }
                        }
                        catch (Exception ex)
                        {
                            // No movement to the next step
                            e.Cancel = true;

                            // Class with the same class name already exists
                            lblErrorStep1.Visible = true;
                            lblErrorStep1.Text = ex.Message;
                        }

                        // Prepare next step (2)
                        if (lblErrorStep1.Text == "")
                        {
                            // Disable previous steps' viewstates
                            DisablePreviousStepsViewStates(e.CurrentStepIndex);

                            // Enable next step's viewstate
                            EnableNextStepViewState(e.CurrentStepIndex);

                            // Save ClassName to viewstate to use in the next steps
                            ClassName = dci.ClassName;

                            // Prefill textboxes in the next step with default values
                            txtTableName.Text = txtNamespaceName.Text.Trim() + "_" + txtCodeName.Text.Trim();
                            txtPKName.Text = FirstLetterToUpper(txtCodeName.Text.Trim() + "ID");

                            wzdStep2.Title = GetString("DocumentType_New_Step2.Title");

                            // Prepare next step by mode setting
                            switch (this.Mode)
                            {
                                case NewClassWizardModeEnum.DocumentType:
                                    // Initialize other conrols
                                    lblPKName.Text = GetString("DocumentType_New.PrimaryKeyName");
                                    lblTableName.Text = GetString("DocumentType_New.TableName");
                                    radCustom.Text = GetString("DocumentType_New.Custom");

                                    // Display container option based on the development mode setting
                                    radContainer.Text = GetString("DocumentType_New.Container");
                                    radContainer.Visible = true;

                                    ucHeader.Description = GetString("DocumentType_New_Step2.Description");

                                    // Setup the inheritance selector
                                    this.plcDocTypeOptions.Visible = true;
                                    break;

                                case NewClassWizardModeEnum.Class:
                                    // Initialize other conrols
                                    lblPKName.Text = GetString("sysdev.class_new.PrimaryKeyName");
                                    lblTableName.Text = GetString("sysdev.class_new.TableName");
                                    radCustom.Text = GetString("sysdev.class_new.Custom");
                                    lblIsMNTable.Text = GetString("sysdev.class_new.MNTable");

                                    radContainer.Visible = false;
                                    if (this.SystemDevelopmentMode)
                                    {
                                        plcMNClassOptions.Visible = true;
                                    }

                                    ucHeader.Description = GetString("sysdev.class_new_Step2.Description");
                                    break;

                                case NewClassWizardModeEnum.CustomTable:

                                    lblPKName.Text = GetString("customtable.newwizzard.PrimaryKeyName");
                                    lblTableName.Text = GetString("customtable.newwizzard.TableName");

                                    radCustom.Visible = false;
                                    radContainer.Visible = false;

                                    // Custom tables have always ItemID as primary key
                                    txtPKName.Text = "ItemID";
                                    // Primary key name can't be editted
                                    txtPKName.Enabled = false;

                                    // Show custom tables columns options
                                    plcCustomTablesOptions.Visible = true;
                                    lblItemCreatedBy.Text = GetString("customtable.newwizzard.lblItemCreatedBy");
                                    lblItemCreatedWhen.Text = GetString("customtable.newwizzard.lblItemCreatedWhen");
                                    lblItemModifiedBy.Text = GetString("customtable.newwizzard.lblItemModifiedBy");
                                    lblItemModifiedWhen.Text = GetString("customtable.newwizzard.lblItemModifiedWhen");
                                    lblItemOrder.Text = GetString("customtable.newwizzard.lblItemOrder");

                                    ucHeader.Description = GetString("customtable.newwizzard.Step2Description");
                                    break;
                            }
                        }
                    }
                    else
                    {
                        // No movement to the next step
                        e.Cancel = true;

                        // Textboxes are not filled correctly
                        lblErrorStep1.Visible = true;
                        lblErrorStep1.Text = errorMessage;
                    }

                    break;
                }

            // Step 2
            case 1:
                {
                    FormFieldInfo ffiPrimaryKey = null;
                    dci = DataClassInfoProvider.GetDataClass(ClassName);

                    if (dci != null)
                    {
                        var genDci = dci.Generalized;

                        // New document type has custom attributes -> no wizard steps will be omitted
                        if (radCustom.Checked)
                        {
                            // Actions after next button click

                            // Validate checkboxes first
                            string tableNameEmpty = new Validator().NotEmpty(txtTableName.Text.Trim(), GetString("DocumentType_New.ErrorEmptyTableName")).Result;
                            string tableNameNotIdentificator = new Validator().IsIdentificator(txtTableName.Text.Trim(), GetString("class.ErrorIdentificator")).Result;
                            string primaryKeyNameEmpty = new Validator().NotEmpty(txtPKName.Text.Trim(), GetString("DocumentType_New.ErrorEmptyPKName")).Result;
                            bool columnExists = DocumentHelper.ColumnExistsInSystemTable(txtPKName.Text.Trim());
                            string tableNameError = (tableNameEmpty == "") ? tableNameNotIdentificator : tableNameEmpty;

                            // Textboxes are filled correctly
                            if ((tableNameError == "") && (primaryKeyNameEmpty == "") && (!columnExists))
                            {
                                string tableName = txtTableName.Text.Trim();

                                try
                                {
                                    // Create new table in DB
                                    if (this.SystemDevelopmentMode && this.Mode == NewClassWizardModeEnum.Class)
                                    {
                                        TableManager.CreateTable(tableName, txtPKName.Text.Trim(), !chbIsMNTable.Checked);
                                    }
                                    else
                                    {
                                        TableManager.CreateTable(tableName, txtPKName.Text.Trim());
                                    }
                                }
                                catch (Exception ex)
                                {
                                    // No movement to the next step
                                    e.Cancel = true;

                                    // Table with the same name already exists
                                    lblErrorStep2.Visible = true;
                                    lblErrorStep2.Text = ex.Message;
                                }

                                if (lblErrorStep2.Text == "")
                                {
                                    // Change table owner
                                    try
                                    {
                                        string owner = "";

                                        // Get site related DB object owner setting when creating new wizzard and global otherwise
                                        switch (this.Mode)
                                        {
                                            case NewClassWizardModeEnum.DocumentType:
                                            case NewClassWizardModeEnum.Class:
                                            case NewClassWizardModeEnum.CustomTable:
                                                owner = SqlHelperClass.GetDBSchema(CMSContext.CurrentSiteName);
                                                break;
                                        }

                                        if ((owner != "") && (owner.ToLower() != "dbo"))
                                        {
                                            TableManager.ChangeDBObjectOwner(tableName, owner);
                                            tableName = DataHelper.GetSafeOwner(owner) + "." + tableName;
                                        }
                                    }
                                    catch
                                    {
                                    }
                                    // Create empty form definition
                                    fi = new FormInfo("<form></form>");
                                    ffiPrimaryKey = new FormFieldInfo();

                                    // Fill FormInfo object
                                    ffiPrimaryKey.Name = txtPKName.Text;
                                    ffiPrimaryKey.Caption = txtPKName.Text;
                                    ffiPrimaryKey.DataType = FormFieldDataTypeEnum.Integer;
                                    ffiPrimaryKey.DefaultValue = "";
                                    ffiPrimaryKey.Description = "";
                                    ffiPrimaryKey.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                    ffiPrimaryKey.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLower();
                                    ffiPrimaryKey.PrimaryKey = true;
                                    ffiPrimaryKey.System = false;
                                    ffiPrimaryKey.Visible = true;
                                    ffiPrimaryKey.Size = 0;
                                    ffiPrimaryKey.AllowEmpty = false;

                                    // Add field to form definition
                                    fi.AddFormField(ffiPrimaryKey);

                                    dci.ClassTableName = tableName;
                                    dci.ClassXmlSchema = TableManager.GetXmlSchema(dci.ClassTableName);
                                    dci.ClassFormDefinition = fi.GetXmlDefinition();
                                    dci.ClassIsCoupledClass = true;

                                    dci.ClassInheritsFromClassID = ValidationHelper.GetInteger(selInherits.Value, 0);

                                    // Update class in DB
                                    using (CMSActionContext context = new CMSActionContext())
                                    {
                                        // Disable logging into event log
                                        context.LogEvents = false;

                                        DataClassInfoProvider.SetDataClass(dci);

                                        // Ensure inherited fields
                                        if (dci.ClassInheritsFromClassID > 0)
                                        {
                                            DataClassInfo parentCi = DataClassInfoProvider.GetDataClass(dci.ClassInheritsFromClassID);
                                            if (parentCi != null)
                                            {
                                                FormHelper.UpdateInheritedClass(parentCi, dci);
                                            }
                                        }
                                    }

                                    if (this.Mode == NewClassWizardModeEnum.CustomTable)
                                    {
                                        #region "Custom tables optional columns"

                                        if (chkItemCreatedBy.Checked)
                                        {
                                            FormFieldInfo ffi = new FormFieldInfo();

                                            // Fill FormInfo object
                                            ffi.Name = "ItemCreatedBy";
                                            ffi.Caption = "Created by";
                                            ffi.DataType = FormFieldDataTypeEnum.Integer;
                                            ffi.DefaultValue = "";
                                            ffi.Description = "";
                                            ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                            ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLower();
                                            ffi.PrimaryKey = false;
                                            ffi.System = true;
                                            ffi.Visible = false;
                                            ffi.Size = 0;
                                            ffi.AllowEmpty = true;

                                            fi.AddFormField(ffi);
                                        }
                                        if (chkItemCreatedWhen.Checked)
                                        {
                                            FormFieldInfo ffi = new FormFieldInfo();

                                            // Fill FormInfo object
                                            ffi.Name = "ItemCreatedWhen";
                                            ffi.Caption = "Created when";
                                            ffi.DataType = FormFieldDataTypeEnum.DateTime;
                                            ffi.DefaultValue = "";
                                            ffi.Description = "";
                                            ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                            ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLower();
                                            ffi.PrimaryKey = false;
                                            ffi.System = true;
                                            ffi.Visible = false;
                                            ffi.Size = 0;
                                            ffi.AllowEmpty = true;

                                            fi.AddFormField(ffi);
                                        }
                                        if (chkItemModifiedBy.Checked)
                                        {
                                            FormFieldInfo ffi = new FormFieldInfo();

                                            // Fill FormInfo object
                                            ffi.Name = "ItemModifiedBy";
                                            ffi.Caption = "Modified by";
                                            ffi.DataType = FormFieldDataTypeEnum.Integer;
                                            ffi.DefaultValue = "";
                                            ffi.Description = "";
                                            ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                            ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLower();
                                            ffi.PrimaryKey = false;
                                            ffi.System = true;
                                            ffi.Visible = false;
                                            ffi.Size = 0;
                                            ffi.AllowEmpty = true;

                                            fi.AddFormField(ffi);
                                        }
                                        if (chkItemModifiedWhen.Checked)
                                        {
                                            FormFieldInfo ffi = new FormFieldInfo();

                                            // Fill FormInfo object
                                            ffi.Name = "ItemModifiedWhen";
                                            ffi.Caption = "Modified when";
                                            ffi.DataType = FormFieldDataTypeEnum.DateTime;
                                            ffi.DefaultValue = "";
                                            ffi.Description = "";
                                            ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                            ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLower();
                                            ffi.PrimaryKey = false;
                                            ffi.System = true;
                                            ffi.Visible = false;
                                            ffi.Size = 0;
                                            ffi.AllowEmpty = true;

                                            fi.AddFormField(ffi);
                                        }
                                        if (chkItemOrder.Checked)
                                        {
                                            FormFieldInfo ffi = new FormFieldInfo();

                                            // Fill FormInfo object
                                            ffi.Name = "ItemOrder";
                                            ffi.Caption = "Order";
                                            ffi.DataType = FormFieldDataTypeEnum.Integer;
                                            ffi.DefaultValue = "";
                                            ffi.Description = "";
                                            ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                            ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLower();
                                            ffi.PrimaryKey = false;
                                            ffi.System = true;
                                            ffi.Visible = false;
                                            ffi.Size = 0;
                                            ffi.AllowEmpty = true;

                                            fi.AddFormField(ffi);
                                        }

                                        #endregion

                                        FormFieldInfo ffiGuid = new FormFieldInfo();

                                        // Fill FormInfo object
                                        ffiGuid.Name = "ItemGUID";
                                        ffiGuid.Caption = "GUID";
                                        ffiGuid.DataType = FormFieldDataTypeEnum.GUID;
                                        ffiGuid.DefaultValue = "";
                                        ffiGuid.Description = "";
                                        ffiGuid.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                        ffiGuid.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLower();
                                        ffiGuid.PrimaryKey = false;
                                        ffiGuid.System = true;
                                        ffiGuid.Visible = false;
                                        ffiGuid.Size = 0;
                                        ffiGuid.AllowEmpty = false;

                                        fi.AddFormField(ffiGuid);

                                        // Update table structure - columns could be added
                                        bool old = TableManager.UpdateSystemFields;
                                        TableManager.UpdateSystemFields = true;
                                        string schema = fi.GetXmlDefinition();
                                        TableManager.UpdateTableBySchema(tableName, schema);
                                        TableManager.UpdateSystemFields = old;

                                        // Update xml schema and form definition
                                        dci.ClassFormDefinition = schema;
                                        dci.ClassXmlSchema = TableManager.GetXmlSchema(dci.ClassTableName);

                                        using (CMSActionContext context = new CMSActionContext())
                                        {
                                            // Disable logging into event log
                                            context.LogEvents = false;

                                            DataClassInfoProvider.SetDataClass(dci);
                                        }
                                    }

                                    // Remember that no steps were omitted
                                    SomeStepsOmitted = false;

                                    // Prepare next step (3)

                                    // Disable previous steps' viewstates
                                    DisablePreviousStepsViewStates(e.CurrentStepIndex);

                                    // Enable next step's viewstate
                                    EnableNextStepViewState(e.CurrentStepIndex);

                                    // Set field editor class name
                                    FieldEditor.ClassName = ClassName;

                                    // Fill field editor in the next step
                                    FieldEditor.Reload(null);

                                    wzdStep3.Title = GetString("general.fields");

                                    // Set new step header based on the development mode setting
                                    switch (this.Mode)
                                    {
                                        case NewClassWizardModeEnum.DocumentType:
                                            ucHeader.Description = GetString("DocumentType_New_Step3.Description");
                                            break;

                                        case NewClassWizardModeEnum.Class:
                                            ucHeader.Description = GetString("sysdev.class_new_Step3.Description");
                                            break;

                                        case NewClassWizardModeEnum.CustomTable:
                                            ucHeader.Description = GetString("customtable.newwizzard.Step3Description");
                                            break;
                                    }
                                }
                            }
                            // Some textboxes are not filled correctly
                            else
                            {
                                // Prepare current step (2)

                                // No movement to the next step
                                e.Cancel = true;

                                // Show errors
                                lblTableNameError.Text = tableNameError;
                                lblPKNameError.Text = primaryKeyNameEmpty;
                                if (columnExists)
                                {
                                    lblErrorStep2.Text = GetString("DocumentType_New_Step2.ErrorColumnExists");
                                    lblErrorStep2.Visible = true;
                                }

                                wzdStep2.Title = GetString("DocumentType_New_Step2.Title");

                                // Reset the header
                                switch (this.Mode)
                                {
                                    case NewClassWizardModeEnum.DocumentType:
                                        ucHeader.Description = GetString("DocumentType_New_Step2.Description");
                                        break;

                                    case NewClassWizardModeEnum.Class:
                                        ucHeader.Description = GetString("sysdev.class_new_Step2.Description");
                                        break;

                                    case NewClassWizardModeEnum.CustomTable:
                                        ucHeader.Description = GetString("customtable.newwizzard.Step2Description");
                                        break;
                                }

                            }
                        }
                        // New document type is only the container -> some wizard steps will be omitted
                        else
                        {
                            // Actions after next button click

                            dci.ClassIsCoupledClass = false;

                            // Update class in DB
                            using (CMSActionContext context = new CMSActionContext())
                            {
                                // Disable logging into event log
                                context.LogEvents = false;

                                DataClassInfoProvider.SetDataClass(dci);
                            }

                            // Remember that some steps were omitted
                            SomeStepsOmitted = true;
                            IsContainer = true;

                            // Prepare next step (5) - skip steps 3 and 4

                            // Disable previous steps' viewstates
                            DisablePreviousStepsViewStates(3);

                            // Enable next step's viewstate
                            EnableNextStepViewState(3);

                            PrepareStep5();
                            // Go to the step 5 (indexed from 0)
                            wzdNewDocType.ActiveStepIndex = 4;
                        }

                        // Create new icon if the wizzard is used to create new document type
                        if (this.Mode == NewClassWizardModeEnum.DocumentType)
                        {
                            string sourceFile = "";
                            string destFile = GetDocumentTypeIconUrl(ClassName, false);
                            string sourceLargeFile = "";
                            string destLargeFile = GetDocumentTypeIconUrl(ClassName, "48x48", false);

                            // If class is not coupled class
                            if (SomeStepsOmitted)
                            {
                                sourceFile = GetDocumentTypeIconUrl("defaultcontainer", true);
                                sourceLargeFile = GetDocumentTypeIconUrl("defaultcontainer", "48x48", true);
                            }
                            else
                            {
                                sourceFile = GetDocumentTypeIconUrl("default", true);
                                sourceLargeFile = GetDocumentTypeIconUrl("default", "48x48", true);
                            }

                            if (SettingsKeyProvider.DevelopmentMode)
                            {
                                // Ensure '.gif' image for large icon in development mode
                                sourceLargeFile = sourceLargeFile.Replace(".png", ".gif");
                            }

                            // Ensure same extension
                            if (sourceFile.ToLower().EndsWith(".gif"))
                            {
                                destFile = destFile.Replace(".png", ".gif");
                            }
                            // Ensure same extension
                            if (sourceLargeFile.ToLower().EndsWith(".gif"))
                            {
                                destLargeFile = destLargeFile.Replace(".png", ".gif");
                            }

                            if (!FileHelper.FileExists(destFile))
                            {
                                try
                                {
                                    // Create new document type icon via copying default icon
                                    File.Copy(Server.MapPath(sourceFile), Server.MapPath(destFile), false);
                                }
                                catch
                                {
                                    lblErrorStep3.Visible = true;
                                    lblErrorStep3.Text = string.Format(GetString("DocumentType_New_Step2.ErrorCopyIcon"), sourceFile, destFile);
                                }
                            }

                            // Copy large file icon
                            if (!File.Exists(Server.MapPath(destLargeFile)))
                            {
                                try
                                {
                                    // Create new document type large icon via copying default icon
                                    File.Copy(Server.MapPath(sourceLargeFile), Server.MapPath(destLargeFile), false);
                                }
                                catch
                                {
                                    lblErrorStep3.Visible = true;
                                    lblErrorStep3.Text = string.Format(GetString("DocumentType_New_Step2.ErrorCopyIcon"), sourceLargeFile, destLargeFile);
                                }
                            }
                        }
                    }
                    break;
                }

            // Step 3
            case 2:
                {
                    // Actions after next button click
                    dci = DataClassInfoProvider.GetDataClass(ClassName);

                    var genDci = dci.Generalized;

                    FormFieldInfo[] ffiVisibleFields = null;

                    // Ensure actual form info
                    FormHelper.ClearFormInfos(true);

                    // Get and load form definition
                    fi = FormHelper.GetFormInfo(dci.ClassName, false);

                    // Get all visible fields
                    ffiVisibleFields = fi.GetFields(true, false);

                    if (fi.GetFields(true, true).Length < 2)
                    {
                        e.Cancel = true;
                        lblErrorStep3.Visible = true;
                        lblErrorStep3.Text = GetString("DocumentType_New_Step3.TableMustHaveCustomField");
                    }
                    else
                    {
                        // Generate basic queries
                        SqlGenerator.GenerateQuery(ClassName, SqlGenerator.QUERYNAME_SELECT, SqlOperationTypeEnum.SelectQuery, false, false);
                        SqlGenerator.GenerateQuery(ClassName, SqlGenerator.QUERYNAME_DELETE, SqlOperationTypeEnum.DeleteQuery, false, false);
                        SqlGenerator.GenerateQuery(ClassName, SqlGenerator.QUERYNAME_INSERT, SqlOperationTypeEnum.InsertQuery, true, false);
                        SqlGenerator.GenerateQuery(ClassName, SqlGenerator.QUERYNAME_UPDATE, SqlOperationTypeEnum.UpdateQuery, false, false);
                        SqlGenerator.GenerateQuery(ClassName, SqlGenerator.QUERYNAME_SELECTALL, SqlOperationTypeEnum.SelectAll, false, false);

                        // Different behaviour by mode
                        switch (this.Mode)
                        {
                            case NewClassWizardModeEnum.DocumentType:
                                {
                                    // Create new view if doesn't exist
                                    string viewName = DataHelper.GetViewName(dci.ClassTableName, null);

                                    // Create view for document types
                                    if (!TableManager.ViewExists(viewName))
                                    {
                                        TableManager.CreateView(viewName, SqlGenerator.GetSqlQuery(ClassName, SqlOperationTypeEnum.SelectView, null));
                                    }

                                    // Generate additional queries when creating new document type
                                    SqlGenerator.GenerateQuery(ClassName, SqlGenerator.QUERYNAME_SEARCHTREE, SqlOperationTypeEnum.SearchTree, false, false);
                                    SqlGenerator.GenerateQuery(ClassName, SqlGenerator.QUERYNAME_SELECTDOCUMENTS, SqlOperationTypeEnum.SelectDocuments, false, false);
                                    SqlGenerator.GenerateQuery(ClassName, SqlGenerator.QUERYNAME_SELECTVERSIONS, SqlOperationTypeEnum.SelectVersions, false, false);

                                    // If new document type is created prepare next step otherwise skip steps 4, 5 and 6

                                    // Disable previous steps' viewstates
                                    DisablePreviousStepsViewStates(e.CurrentStepIndex);

                                    // Enable next step's viewstate
                                    EnableNextStepViewState(e.CurrentStepIndex);

                                    // Add implicit value to the list
                                    lstFields.Items.Add(new ListItem(GetString("DocumentType_New_Step4.ImplicitDocumentName"), ""));

                                    if (ffiVisibleFields != null)
                                    {
                                        // Add visible fields' names to the list except primary-key field
                                        foreach (FormFieldInfo ffi in ffiVisibleFields)
                                        {
                                            if (!ffi.PrimaryKey)
                                            {
                                                lstFields.Attributes.Add(ffi.Name, ffi.Name);
                                                lstFields.Items.Add(new ListItem(ffi.Name, ffi.Name));
                                            }
                                        }
                                    }

                                    lblSelectField.Text = GetString("DocumentType_New_Step4.DocumentName");
                                    wzdStep4.Title = GetString("DocumentType_New_Step4.Title");
                                    ucHeader.Description = GetString("DocumentType_New_Step4.Description");
                                }
                                break;

                            case NewClassWizardModeEnum.Class:
                                {
                                    // Update class in DB
                                    using (CMSActionContext context = new CMSActionContext())
                                    {
                                        // Disable logging into event log
                                        context.LogEvents = false;

                                        DataClassInfoProvider.SetDataClass(dci);
                                    }

                                    // Remember that some steps were omitted
                                    SomeStepsOmitted = true;

                                    // Prepare next step (7) - skip steps 4, 5 and 6

                                    // Disable previous steps' viewstates
                                    DisablePreviousStepsViewStates(5);

                                    // Enable next step's viewstate
                                    EnableNextStepViewState(5);

                                    PrepareStep8();
                                    // Go to the step 8 (indexed from 0)
                                    wzdNewDocType.ActiveStepIndex = 7;
                                }
                                break;

                            case NewClassWizardModeEnum.CustomTable:
                                {
                                    // Generate additional delete all query
                                    SqlGenerator.GenerateQuery(ClassName, SqlGenerator.QUERYNAME_DELETEALL, SqlOperationTypeEnum.DeleteAll, false, false);

                                    // Update class in DB
                                    using (CMSActionContext context = new CMSActionContext())
                                    {
                                        // Disable logging into event log
                                        context.LogEvents = false;

                                        DataClassInfoProvider.SetDataClass(dci);
                                    }

                                    // Remember that some steps were omitted,
                                    SomeStepsOmitted = true;

                                    // Prepare next step (6) - skip steps 4, 5

                                    // Disable previous steps' viewstates
                                    DisablePreviousStepsViewStates(4);

                                    // Enable next step's viewstate
                                    EnableNextStepViewState(4);

                                    PrepareStep6();
                                    // Go to the step 6 (indexed from 0)
                                    wzdNewDocType.ActiveStepIndex = 5;
                                }
                                break;
                        }
                    }
                    break;
                }
            // Step 4
            case 3:
                {
                    // Actions after next button click
                    dci = DataClassInfoProvider.GetDataClass(ClassName);
                    dci.ClassNodeNameSource = lstFields.SelectedValue;

                    // Update node name source in DB
                    using (CMSActionContext context = new CMSActionContext())
                    {
                        // Disable logging into event log
                        context.LogEvents = false;

                        DataClassInfoProvider.SetDataClass(dci);
                    }

                    // Prepare next step (5)

                    // Disable previous steps' viewstates
                    DisablePreviousStepsViewStates(e.CurrentStepIndex);

                    // Enable next step's viewstate
                    EnableNextStepViewState(e.CurrentStepIndex);

                    PrepareStep5();

                    break;
                }
            // Step 5
            case 4:
                {
                    // Actions after next button click

                    int parentClassID = 0;
                    int childClassID = DataClassInfoProvider.GetDataClass(ClassName).ClassID;

                    // Add parent classes
                    string selectedClasses = ValidationHelper.GetString(usParentTypes.Value, String.Empty);
                    if (!String.IsNullOrEmpty(selectedClasses))
                    {
                        string[] classes = selectedClasses.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                        if (classes != null)
                        {
                            // Add all new items to site
                            foreach (string item in classes)
                            {
                                parentClassID = ValidationHelper.GetInteger(item, 0);
                                AllowedChildClassInfoProvider.AddAllowedChildClass(parentClassID, childClassID);
                            }
                        }
                    }

                    // Prepare next step (6)

                    // Disable previous steps' viewstates
                    DisablePreviousStepsViewStates(e.CurrentStepIndex);

                    // Enable next step's viewstate
                    EnableNextStepViewState(e.CurrentStepIndex);

                    PrepareStep6();

                    break;
                }

            // Step 6
            case 5:
                {
                    // Actions after next button click

                    int siteId = 0;
                    dci = DataClassInfoProvider.GetDataClass(ClassName);
                    int classId = dci.ClassID;
                    bool isCustomTable = dci.ClassIsCustomTable;
                    bool licenseCheck = true;

                    string selectedSite = ValidationHelper.GetString(usSites.Value, String.Empty);
                    if (selectedSite == "0")
                    {
                        selectedSite = "";
                    }
                    string[] sites = selectedSite.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    if ((licenseCheck) && (sites != null))
                    {
                        foreach (string site in sites)
                        {
                            siteId = ValidationHelper.GetInteger(site, 0);

                            SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);
                            if (si != null)
                            {
                                if (isCustomTable)
                                {
                                    if (!CustomTableItemProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.CustomTables, VersionActionEnum.Insert))
                                    {
                                        lblErrorStep6.Visible = true;
                                        lblErrorStep6.Text = GetString("LicenseVersion.CustomTables");
                                        e.Cancel = true;
                                        licenseCheck = false;
                                    }
                                }

                                if (licenseCheck)
                                {
                                    ClassSiteInfoProvider.AddClassToSite(classId, siteId);

                                    // Clear custom tables count
                                    if (isCustomTable)
                                    {
                                        CustomTableItemProvider.ClearCustomLicHash();
                                    }
                                }
                            }
                        }
                    }

                    // If is moving to the new step
                    if (licenseCheck)
                    {
                        // Create default transformations
                        switch (this.Mode)
                        {
                            case NewClassWizardModeEnum.DocumentType:

                                if (!SomeStepsOmitted)
                                {
                                    CreateDefaultTransformations(classId, true);
                                }
                                else
                                {
                                    // Apply on if new document type was created
                                    lblTableCreated.Visible = false;
                                }
                                break;

                            case NewClassWizardModeEnum.CustomTable:
                                CreateDefaultTransformations(classId, false);
                                break;
                        }
                    }
                    else
                    {
                        PrepareStep5();
                        break;
                    }

                    if (((this.Mode == NewClassWizardModeEnum.DocumentType) && (dci.ClassIsCoupledClass)) || (this.Mode == NewClassWizardModeEnum.CustomTable))
                    {
                        PrepareStep7();
                        SearchFields.DisplayOkButton = false;
                        SearchFields.ItemID = dci.ClassID;
                        SearchFields.ReloadSearch(true);
                    }
                    else
                    {
                        DisablePreviousStepsViewStates(6);
                        EnableNextStepViewState(6);
                        PrepareStep8();
                        wzdNewDocType.ActiveStepIndex = 7;

                        // Explicitly log the synchronization with all changes
                        using (CMSActionContext context = new CMSActionContext())
                        {
                            // Disable logging into event log
                            context.LogEvents = false;

                            SynchronizationHelper.LogObjectUpdate(dci);
                        }
                    }

                    break;
                }
            // STEP 7
            case 6:
                {
                    // Prepare next step (7) - Finish step
                    dci = DataClassInfoProvider.GetDataClass(ClassName);
                    SearchFields.SaveData();

                    // Disable previous steps' viewstates
                    DisablePreviousStepsViewStates(e.CurrentStepIndex);

                    // Enable next step's viewstate
                    EnableNextStepViewState(e.CurrentStepIndex);

                    PrepareStep8();

                    // Explicitly log the synchronization with all changes
                    using (CMSActionContext context = new CMSActionContext())
                    {
                        // Disable logging into event log
                        context.LogEvents = false;

                        SynchronizationHelper.LogObjectUpdate(dci);
                    }

                    break;
                }
        }
    }
    /// <summary>
    /// Processes the step 2 of the wizard
    /// </summary>
    private void ProcessStep2(WizardNavigationEventArgs e)
    {
        FormFieldInfo ffiPrimaryKey = null;
        DataClassInfo dci = DataClassInfoProvider.GetDataClass(ClassName);
        FormInfo fi = null;

        if (dci != null)
        {
            TableManager tm = new TableManager(null);

            using (var tr = new CMSTransactionScope())
            {
                var genDci = dci.Generalized;

                // New document type has custom attributes -> no wizard steps will be omitted
                if (radCustom.Checked)
                {
                    // Actions after next button click
                    bool fromExisting = (Mode == NewClassWizardModeEnum.CustomTable) && radExistingTable.Checked;

                    string tableName = txtTableName.Text.Trim();
                    if (fromExisting)
                    {
                        tableName = drpExistingTables.SelectedValue;
                    }

                    // Validate checkboxes first
                    string tableNameError = new Validator()
                        .NotEmpty(tableName, GetString("DocumentType_New.ErrorEmptyTableName"))
                        .IsIdentifier(tableName, GetString("class.ErrorIdentifier"))
                        .Result;

                    string primaryKeyNameEmpty = new Validator().NotEmpty(txtPKName.Text.Trim(), GetString("DocumentType_New.ErrorEmptyPKName")).Result;

                    bool columnExists = DocumentHelper.ColumnExistsInSystemTable(txtPKName.Text.Trim());

                    // Textboxes are filled correctly
                    if ((tableNameError == "") && (primaryKeyNameEmpty == "") && (!columnExists))
                    {
                        try
                        {
                            if (fromExisting)
                            {
                                // Custom table from existing table - validate the table name
                                if (!tm.TableExists(tableName))
                                {
                                    e.Cancel = true;

                                    // Table with the same name already exists
                                    ShowError(GetString("customtable.newwizard.tablenotexists"));
                                }

                                // Check primary key
                                List<string> primaryKeys = tm.GetPrimaryKeyColumns(tableName);
                                if ((primaryKeys == null) || (primaryKeys.Count != 1))
                                {
                                    e.Cancel = true;

                                    ShowError(GetString("customtable.newwizard.musthaveprimarykey"));
                                }
                            }
                            else if (SystemDevelopmentMode && (Mode == NewClassWizardModeEnum.Class))
                            {
                                // Standard class in development mode
                                tm.CreateTable(tableName, txtPKName.Text.Trim(), !chbIsMNTable.Checked);
                            }
                            else
                            {
                                tm.CreateTable(tableName, txtPKName.Text.Trim());
                            }
                        }
                        catch (Exception ex)
                        {
                            // No movement to the next step
                            e.Cancel = true;

                            // Table with the same name already exists
                            ShowError(ex.Message);
                        }

                        if ((lblErrorStep2.Text == "") && !e.Cancel)
                        {
                            // Change table owner
                            try
                            {
                                string owner = "";

                                // Get site related DB object owner setting when creating new wizard and global otherwise
                                switch (Mode)
                                {
                                    case NewClassWizardModeEnum.DocumentType:
                                    case NewClassWizardModeEnum.Class:
                                    case NewClassWizardModeEnum.CustomTable:
                                        owner = SqlHelperClass.GetDBSchema(CMSContext.CurrentSiteName);
                                        break;
                                }

                                if ((owner != "") && (owner.ToLowerCSafe() != "dbo"))
                                {
                                    tm.ChangeDBObjectOwner(tableName, owner);
                                    tableName = DataHelper.GetSafeOwner(owner) + "." + tableName;
                                }
                            }
                            catch
                            {
                            }

                            if (fromExisting)
                            {
                                // From existing DB table
                                dci.ClassXmlSchema = tm.GetXmlSchema(tableName);

                                string formDef = FormHelper.GetXmlFormDefinitionFromXmlSchema(dci.ClassXmlSchema, false);
                                fi = new FormInfo(formDef);
                            }
                            else
                            {
                                // Create empty form definition
                                fi = new FormInfo("<form></form>");
                                ffiPrimaryKey = new FormFieldInfo();

                                // Fill FormInfo object
                                ffiPrimaryKey.Name = txtPKName.Text;
                                ffiPrimaryKey.Caption = txtPKName.Text;
                                ffiPrimaryKey.DataType = FormFieldDataTypeEnum.Integer;
                                ffiPrimaryKey.DefaultValue = "";
                                ffiPrimaryKey.Description = "";
                                ffiPrimaryKey.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                ffiPrimaryKey.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
                                ffiPrimaryKey.PrimaryKey = true;
                                ffiPrimaryKey.System = false;
                                ffiPrimaryKey.Visible = false;
                                ffiPrimaryKey.Size = 0;
                                ffiPrimaryKey.AllowEmpty = false;

                                // Add field to form definition
                                fi.AddFormField(ffiPrimaryKey);

                                dci.ClassXmlSchema = tm.GetXmlSchema(tableName);
                            }

                            dci.ClassTableName = tableName;
                            dci.ClassFormDefinition = fi.GetXmlDefinition();
                            dci.ClassIsCoupledClass = true;

                            dci.ClassInheritsFromClassID = ValidationHelper.GetInteger(selInherits.Value, 0);

                            // Update class in DB
                            using (CMSActionContext context = new CMSActionContext())
                            {
                                // Disable logging into event log
                                context.LogEvents = false;

                                DataClassInfoProvider.SetDataClass(dci);

                                // Ensure inherited fields
                                if (dci.ClassInheritsFromClassID > 0)
                                {
                                    DataClassInfo parentCi = DataClassInfoProvider.GetDataClass(dci.ClassInheritsFromClassID);
                                    if (parentCi != null)
                                    {
                                        FormHelper.UpdateInheritedClass(parentCi, dci);
                                    }
                                }
                            }

                            if (Mode == NewClassWizardModeEnum.CustomTable)
                            {
                                #region "Custom tables optional columns"

                                // Created by
                                if (chkItemCreatedBy.Checked && !fi.FieldExists("ItemCreatedBy"))
                                {
                                    FormFieldInfo ffi = new FormFieldInfo();

                                    // Fill FormInfo object
                                    ffi.Name = "ItemCreatedBy";
                                    ffi.Caption = "Created by";
                                    ffi.DataType = FormFieldDataTypeEnum.Integer;
                                    ffi.DefaultValue = "";
                                    ffi.Description = "";
                                    ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                    ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
                                    ffi.PrimaryKey = false;
                                    ffi.System = true;
                                    ffi.Visible = false;
                                    ffi.Size = 0;
                                    ffi.AllowEmpty = true;

                                    fi.AddFormField(ffi);
                                }

                                // Created when
                                if (chkItemCreatedWhen.Checked && !fi.FieldExists("ItemCreatedWhen"))
                                {
                                    FormFieldInfo ffi = new FormFieldInfo();

                                    // Fill FormInfo object
                                    ffi.Name = "ItemCreatedWhen";
                                    ffi.Caption = "Created when";
                                    ffi.DataType = FormFieldDataTypeEnum.DateTime;
                                    ffi.DefaultValue = "";
                                    ffi.Description = "";
                                    ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                    ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
                                    ffi.PrimaryKey = false;
                                    ffi.System = true;
                                    ffi.Visible = false;
                                    ffi.Size = 0;
                                    ffi.AllowEmpty = true;

                                    fi.AddFormField(ffi);
                                }

                                // Modified by
                                if (chkItemModifiedBy.Checked && !fi.FieldExists("ItemModifiedBy"))
                                {
                                    FormFieldInfo ffi = new FormFieldInfo();

                                    // Fill FormInfo object
                                    ffi.Name = "ItemModifiedBy";
                                    ffi.Caption = "Modified by";
                                    ffi.DataType = FormFieldDataTypeEnum.Integer;
                                    ffi.DefaultValue = "";
                                    ffi.Description = "";
                                    ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                    ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
                                    ffi.PrimaryKey = false;
                                    ffi.System = true;
                                    ffi.Visible = false;
                                    ffi.Size = 0;
                                    ffi.AllowEmpty = true;

                                    fi.AddFormField(ffi);
                                }

                                // Modified when
                                if (chkItemModifiedWhen.Checked && !fi.FieldExists("ItemModifiedWhen"))
                                {
                                    FormFieldInfo ffi = new FormFieldInfo();

                                    // Fill FormInfo object
                                    ffi.Name = "ItemModifiedWhen";
                                    ffi.Caption = "Modified when";
                                    ffi.DataType = FormFieldDataTypeEnum.DateTime;
                                    ffi.DefaultValue = "";
                                    ffi.Description = "";
                                    ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                    ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
                                    ffi.PrimaryKey = false;
                                    ffi.System = true;
                                    ffi.Visible = false;
                                    ffi.Size = 0;
                                    ffi.AllowEmpty = true;

                                    fi.AddFormField(ffi);
                                }

                                // Item order
                                if (chkItemOrder.Checked && !fi.FieldExists("ItemOrder"))
                                {
                                    FormFieldInfo ffi = new FormFieldInfo();

                                    // Fill FormInfo object
                                    ffi.Name = "ItemOrder";
                                    ffi.Caption = "Order";
                                    ffi.DataType = FormFieldDataTypeEnum.Integer;
                                    ffi.DefaultValue = "";
                                    ffi.Description = "";
                                    ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                    ffi.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
                                    ffi.PrimaryKey = false;
                                    ffi.System = true;
                                    ffi.Visible = false;
                                    ffi.Size = 0;
                                    ffi.AllowEmpty = true;

                                    fi.AddFormField(ffi);
                                }

                                #endregion

                                if (chkItemGUID.Checked && !fi.FieldExists("ItemGUID"))
                                {
                                    FormFieldInfo ffiGuid = new FormFieldInfo();

                                    // Fill FormInfo object
                                    ffiGuid.Name = "ItemGUID";
                                    ffiGuid.Caption = "GUID";
                                    ffiGuid.DataType = FormFieldDataTypeEnum.GUID;
                                    ffiGuid.DefaultValue = "";
                                    ffiGuid.Description = "";
                                    ffiGuid.FieldType = FormFieldControlTypeEnum.CustomUserControl;
                                    ffiGuid.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
                                    ffiGuid.PrimaryKey = false;
                                    ffiGuid.System = true;
                                    ffiGuid.Visible = false;
                                    ffiGuid.Size = 0;
                                    ffiGuid.AllowEmpty = false;

                                    fi.AddFormField(ffiGuid);
                                }

                                // Update table structure - columns could be added
                                bool old = TableManager.UpdateSystemFields;

                                TableManager.UpdateSystemFields = true;

                                string schema = fi.GetXmlDefinition();
                                tm.UpdateTableBySchema(tableName, schema);

                                TableManager.UpdateSystemFields = old;

                                // Update xml schema and form definition
                                dci.ClassFormDefinition = schema;
                                dci.ClassXmlSchema = tm.GetXmlSchema(dci.ClassTableName);

                                using (CMSActionContext context = new CMSActionContext())
                                {
                                    // Disable logging into event log
                                    context.LogEvents = false;

                                    DataClassInfoProvider.SetDataClass(dci);
                                }
                            }

                            // Remember that no steps were omitted
                            SomeStepsOmitted = false;

                            // Prepare next step (3)

                            // Disable previous steps' viewstates
                            DisablePreviousStepsViewStates(e.CurrentStepIndex);

                            // Enable next step's viewstate
                            EnableNextStepViewState(e.CurrentStepIndex);

                            // Set field editor class name
                            FieldEditor.ClassName = ClassName;

                            // Fill field editor in the next step
                            FieldEditor.Reload(null);

                            wzdStep3.Title = GetString("general.fields");

                            // Set new step header based on the development mode setting
                            switch (Mode)
                            {
                                case NewClassWizardModeEnum.DocumentType:
                                    ucHeader.Description = GetString("DocumentType_New_Step3.Description");
                                    break;

                                case NewClassWizardModeEnum.Class:
                                    ucHeader.Description = GetString("sysdev.class_new_Step3.Description");
                                    break;

                                case NewClassWizardModeEnum.CustomTable:
                                    ucHeader.Description = GetString("customtable.newwizzard.Step3Description");
                                    break;
                            }
                        }
                    }
                    // Some textboxes are not filled correctly
                    else
                    {
                        // Prepare current step (2)

                        // No movement to the next step
                        e.Cancel = true;

                        // Show errors
                        lblTableNameError.Text = tableNameError;
                        lblPKNameError.Text = primaryKeyNameEmpty;

                        if (columnExists)
                        {
                            lblErrorStep2.Text = GetString("DocumentType_New_Step2.ErrorColumnExists");
                            lblErrorStep2.Visible = true;
                        }

                        wzdStep2.Title = GetString("DocumentType_New_Step2.Title");

                        // Reset the header
                        switch (Mode)
                        {
                            case NewClassWizardModeEnum.DocumentType:
                                ucHeader.Description = GetString("DocumentType_New_Step2.Description");
                                break;

                            case NewClassWizardModeEnum.Class:
                                ucHeader.Description = GetString("sysdev.class_new_Step2.Description");
                                break;

                            case NewClassWizardModeEnum.CustomTable:
                                ucHeader.Description = GetString("customtable.newwizzard.Step2Description");
                                break;
                        }
                    }
                }
                // New document type is only the container -> some wizard steps will be omitted
                else
                {
                    // Actions after next button click

                    dci.ClassIsCoupledClass = false;

                    // Update class in DB
                    using (CMSActionContext context = new CMSActionContext())
                    {
                        // Disable logging into event log
                        context.LogEvents = false;

                        DataClassInfoProvider.SetDataClass(dci);
                    }

                    // Remember that some steps were omitted
                    SomeStepsOmitted = true;
                    IsContainer = true;

                    // Prepare next step (5) - skip steps 3 and 4

                    // Disable previous steps' viewstates
                    DisablePreviousStepsViewStates(3);

                    // Enable next step's viewstate
                    EnableNextStepViewState(3);

                    PrepareStep5();
                    // Go to the step 5 (indexed from 0)
                    wzdNewDocType.ActiveStepIndex = 4;
                }

                // Create new icon if the wizard is used to create new document type
                if (Mode == NewClassWizardModeEnum.DocumentType)
                {
                    string sourceFile = "";
                    string destFile = GetDocumentTypeIconUrl(ClassName, false);
                    string sourceLargeFile = "";
                    string destLargeFile = GetDocumentTypeIconPath(ClassName, "48x48", false);

                    // If class is not coupled class
                    if (SomeStepsOmitted)
                    {
                        sourceFile = GetDocumentTypeIconPath("defaultcontainer", "", true);
                        sourceLargeFile = GetDocumentTypeIconPath("defaultcontainer", "48x48", true);
                    }
                    else
                    {
                        sourceFile = GetDocumentTypeIconPath("default", "", true);
                        sourceLargeFile = GetDocumentTypeIconPath("default", "48x48", true);
                    }

                    if (SettingsKeyProvider.DevelopmentMode)
                    {
                        // Ensure '.gif' image for large icon in development mode
                        sourceLargeFile = sourceLargeFile.Replace(".png", ".gif");
                    }

                    // Ensure same extension
                    if (sourceFile.ToLowerCSafe().EndsWithCSafe(".gif"))
                    {
                        destFile = destFile.Replace(".png", ".gif");
                    }
                    // Ensure same extension
                    if (sourceLargeFile.ToLowerCSafe().EndsWithCSafe(".gif"))
                    {
                        destLargeFile = destLargeFile.Replace(".png", ".gif");
                    }

                    if (!FileHelper.FileExists(destFile))
                    {
                        try
                        {
                            // Create new document type icon via copying default icon
                            File.Copy(Server.MapPath(sourceFile), Server.MapPath(destFile), false);
                        }
                        catch
                        {
                            FieldEditor.ShowError(string.Format(GetString("DocumentType_New_Step2.ErrorCopyIcon"), sourceFile, destFile));
                        }
                    }

                    // Copy large file icon
                    if (!FileHelper.FileExists(destLargeFile))
                    {
                        try
                        {
                            // Create new document type large icon via copying default icon
                            File.Copy(Server.MapPath(sourceLargeFile), Server.MapPath(destLargeFile), false);
                        }
                        catch
                        {
                            FieldEditor.ShowError(string.Format(GetString("DocumentType_New_Step2.ErrorCopyIcon"), sourceLargeFile, destLargeFile));
                        }
                    }
                }

                if (!e.Cancel)
                {
                    tr.Commit();
                }
            }
        }
    }
    /// <summary>
    /// Loads the from definition from selected parameter into a BasicForm control.
    /// </summary>
    /// <param name="actual">If true, data from actual hiddens are loaded</param>
    private void LoadFormDefinition(bool actual)
    {
        MacroRuleTree selected = GetSelected((actual ? hdnParamSelected.Value : hdnLastSelected.Value));

        if (selected != null)
        {
            string             paramName = (actual ? hdnParam.Value.ToLowerCSafe() : hdnLastParam.Value.ToLowerCSafe());
            MacroRuleParameter param     = (MacroRuleParameter)selected.Parameters[paramName];
            if (param != null)
            {
                FormInfo      fi  = new FormInfo(selected.RuleParameters);
                FormFieldInfo ffi = fi.GetFormField(paramName);
                if (ffi != null)
                {
                    fi = new FormInfo(null);
                    fi.AddFormField(ffi);

                    // Add fake DisplayName field
                    FormFieldInfo displayName = new FormFieldInfo();
                    displayName.Visible  = false;
                    displayName.Name     = "DisplayName";
                    displayName.DataType = FormFieldDataTypeEnum.Text;
                    fi.AddFormField(displayName);

                    DataRow row = fi.GetDataRow().Table.NewRow();

                    if (ffi.AllowEmpty && string.IsNullOrEmpty(param.Value))
                    {
                        if ((ffi.DataType != FormFieldDataTypeEnum.Text) && (ffi.DataType != FormFieldDataTypeEnum.LongText))
                        {
                            row[paramName] = DBNull.Value;
                        }
                    }
                    else
                    {
                        switch (ffi.DataType)
                        {
                        case FormFieldDataTypeEnum.Decimal:
                            row[paramName] = ValidationHelper.GetDouble(param.Value, 0, CultureHelper.EnglishCulture);
                            break;

                        case FormFieldDataTypeEnum.Boolean:
                            row[paramName] = ValidationHelper.GetBoolean(param.Value, false);
                            break;

                        case FormFieldDataTypeEnum.Integer:
                            row[paramName] = ValidationHelper.GetInteger(param.Value, 0);
                            break;

                        case FormFieldDataTypeEnum.DateTime:
                            row[paramName] = ValidationHelper.GetDateTime(param.Value, DataHelper.DATETIME_NOT_SELECTED, CultureHelper.EnglishCulture);
                            break;

                        case FormFieldDataTypeEnum.GUID:
                            Guid guid = ValidationHelper.GetGuid(param.Value, Guid.Empty);
                            if (guid != Guid.Empty)
                            {
                                row[paramName] = guid;
                            }
                            break;

                        default:
                            row[paramName] = param.Value;
                            break;
                        }
                    }

                    formElem.DataRow         = row;
                    formElem.FormInformation = fi;
                    formElem.ReloadData();
                }
            }
        }
    }