Beispiel #1
0
        private void BindPropertiesControl(string type)
        {
            Control control = null;

            switch (type)
            {
            case FormController.SmartTableLayoutType:
                _propertyPath = "~/Apps/MetaUI/Modules/MetaFormControls/SmartTableLayoutProperties.ascx";
                control       = this.Page.LoadControl(_propertyPath);
                control.ID    = "propCtrl";
                phProperties.Controls.Clear();
                phProperties.Controls.Add(control);
                SmartTableLayoutProperties sp = (SmartTableLayoutProperties)control;
                if (FormSectionData != null && FormSectionData.Control != null)
                {
                    sp.Columns     = FormSectionData.Control.Columns;
                    sp.CellPadding = FormSectionData.Control.CellPadding;
                }
                break;

            default:
                //CUSTOM
                //FormSectionData.Control.Property
                //FormControlProperty fcp = new FormControlProperty();
                //fcp.Data = string
                break;
            }
            if (control == null)
            {
                divProperties.Visible = false;
            }
        }
Beispiel #2
0
        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            FormController fc = new FormController(FormDocumentData);

            if (!String.IsNullOrEmpty(itemUid))             //edit
            {
                FormSectionData = fc.GetSectionByUid(new Guid(itemUid));

                FormSectionData.BorderType = (cbShowBorder.Checked ? 1 : 0);
                FormSectionData.ShowLabel  = cbShowTitle.Checked;
                FormLabel lbl = null;
                foreach (FormLabel temp in FormSectionData.Labels)
                {
                    if (temp.Code.ToLower().Equals(Thread.CurrentThread.CurrentUICulture.Name.ToLower()))
                    {
                        lbl = temp;
                    }
                }
                if (lbl == null)
                {
                    lbl      = new FormLabel();
                    lbl.Code = Thread.CurrentThread.CurrentUICulture.Name.ToLower();
                    FormSectionData.Labels.Add(lbl);
                }
                lbl.Title = txtTitle.Text;
                foreach (Control c in phProperties.Controls)
                {
                    if (c is SmartTableLayoutProperties)
                    {
                        SmartTableLayoutProperties sp = (SmartTableLayoutProperties)c;
                        FormSectionData.Control.CellPadding = sp.CellPadding;
                        if (!String.IsNullOrEmpty(sp.Columns))
                        {
                            FormSectionData.Control.Columns = sp.Columns;
                        }
                    }
                }
            }
            else             //create
            {
                if (ddControl.SelectedValue.Equals(FormController.SmartTableLayoutType))
                {
                    int    cellPadding = 5;
                    string columns     = "50%;*";
                    foreach (Control c in phProperties.Controls)
                    {
                        if (c is SmartTableLayoutProperties)
                        {
                            SmartTableLayoutProperties sp = (SmartTableLayoutProperties)c;
                            cellPadding = sp.CellPadding;
                            if (!String.IsNullOrEmpty(sp.Columns))
                            {
                                columns = sp.Columns;
                            }
                        }
                    }
                    BorderType  bType      = (cbShowBorder.Checked ? BorderType.TemplateBorder : BorderType.None);
                    FormSection newSection = FormController.CreateSectionSTL(bType, cbShowBorder.Checked, txtTitle.Text, Unit.Percentage(100), columns, cellPadding);
                    fc.AddSection(newSection);
                }
            }

            string newUid = Guid.NewGuid().ToString("N");

            Session[newUid] = FormDocumentData;
            CloseAndRefresh(newUid);
        }