Beispiel #1
0
        private bool DetectChange(ContactInfo contact, params string[] columnNames)
        {
            foreach (string columnName in columnNames)
            {
                object current  = contact.GetValue(columnName);
                object original = contact.GetOriginalValue(columnName);
                if (current != original)
                {
                    return(true);
                }
            }

            return(false);
        }
        private bool DetectChange(ContactInfo contact, params string[] columnNames)
        {
            foreach (string columnName in columnNames)
            {
                object current = contact.GetValue(columnName);
                object original = contact.GetOriginalValue(columnName);
                if (current != original)
                {
                    return true;
                }
            }

            return false;
        }
Beispiel #3
0
    /// <summary>
    /// Loads custom fields collisions.
    /// </summary>
    private void LoadCustomFields()
    {
        // Check if contact has any custom fields
        FormInfo formInfo = FormHelper.GetFormInfo(mParentContact.ClassName, false);
        var      list     = formInfo.GetFormElements(true, false, true);

        if (list.OfType <FormFieldInfo>().Any())
        {
            FormFieldInfo  ffi;
            Literal        content;
            LocalizedLabel lbl;
            CMSTextBox     txt;
            content      = new Literal();
            content.Text = "<div class=\"form-horizontal form-merge-collisions\">";
            plcCustomFields.Controls.Add(content);

            foreach (IDataDefinitionItem item in list)
            {
                ffi = item as FormFieldInfo;
                if (ffi != null)
                {
                    // Display layout
                    content      = new Literal();
                    content.Text = "<div class=\"form-group\"><div class=\"editing-form-label-cell\">";
                    plcCustomFields.Controls.Add(content);
                    lbl                     = new LocalizedLabel();
                    lbl.Text                = ffi.GetDisplayName(MacroContext.CurrentResolver);
                    lbl.DisplayColon        = true;
                    lbl.EnableViewState     = false;
                    lbl.CssClass            = "control-label";
                    content                 = new Literal();
                    content.Text            = "</div><div class=\"editing-form-value-cell\"><div class=\"control-group-inline-forced\">";
                    txt                     = new CMSTextBox();
                    txt.ID                  = "txt" + ffi.Name;
                    lbl.AssociatedControlID = txt.ID;
                    plcCustomFields.Controls.Add(lbl);
                    plcCustomFields.Controls.Add(content);
                    plcCustomFields.Controls.Add(txt);
                    mCustomFields.Add(ffi.Name, new object[]
                    {
                        txt,
                        ffi.DataType
                    });
                    DataTable dt;

                    // Get grouped dataset
                    if (DataTypeManager.IsString(TypeEnum.Field, ffi.DataType))
                    {
                        dt = SortGroupContactsByColumn(ffi.Name + SqlHelper.ORDERBY_ASC, ffi.Name + " NOT LIKE ''", ffi.Name);
                    }
                    else
                    {
                        dt = SortGroupContactsByColumn(ffi.Name + SqlHelper.ORDERBY_ASC, ffi.Name + " IS NOT NULL", ffi.Name);
                    }

                    // Load value into textbox
                    txt.Text = ValidationHelper.GetString(mParentContact.GetValue(ffi.Name), null);
                    if (string.IsNullOrEmpty(txt.Text) && (dt.Rows.Count > 0))
                    {
                        txt.Text = ValidationHelper.GetString(dt.Rows[0][ffi.Name], null);
                    }

                    var img = new HtmlGenericControl("i");
                    img.Attributes["class"] = "validation-warning icon-exclamation-triangle form-control-icon";
                    DisplayTooltip(img, dt, ffi.Name, ValidationHelper.GetString(mParentContact.GetValue(ffi.Name), ""), ffi.DataType);
                    plcCustomFields.Controls.Add(img);
                    content      = new Literal();
                    content.Text = "</div></div></div>";
                    plcCustomFields.Controls.Add(content);
                    mMergedContacts.Tables[0].DefaultView.RowFilter = null;
                }
            }
            content      = new Literal();
            content.Text = "</div>";
            plcCustomFields.Controls.Add(content);
        }
        else
        {
            tabCustomFields.Visible    = false;
            tabCustomFields.HeaderText = null;
        }
    }