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); }
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); }