/// <summary> /// Handles the ServerClick event of the imbtnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void imbtnSave_ServerClick(object sender, EventArgs e) { Page.Validate(); if (!Page.IsValid) { return; } if (mc == null) // Create { try { mc = MetaDataWrapper.CreateCard(ddlClass.SelectedValue, txtClassName.Text.Trim(), txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim()); FormDocument fDocBase = FormController.CreateFormDocument(mc.Name, FormController.BaseFormName); fDocBase.Save(); FormDocument fDocCreate = FormController.CreateFormDocument(mc.Name, FormController.CreateFormName); fDocCreate.Save(); Response.Redirect(String.Format("~/Apps/MetaDataBase/Pages/Admin/MetaClassView.aspx?class={0}", mc.Name), true); } catch (MetaClassAlreadyExistsException) { lbError.Text = string.Format(GetGlobalResourceObject("GlobalMetaInfo", "CardExistsErrorMessage").ToString(), "'" + txtClassName.Text.Trim() + "'"); lbError.Visible = true; } } else // Update { MetaDataWrapper.UpdateCard(mc, txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim()); if (Back == "list") { Response.Redirect("~/Apps/MetaDataBase/Pages/Admin/MetaClassList.aspx", true); } else { Response.Redirect(String.Format("~/Apps/MetaDataBase/Pages/Admin/MetaClassView.aspx?class={0}", mc.Name), true); } } }
protected void btnRefresh_Click(object sender, EventArgs e) { CHelper.RequireDataBind(); string param = Request.Params.Get("__EVENTARGUMENT"); if (String.IsNullOrEmpty(param)) { return; } FormDocument FormDocumentData = (FormDocument)Session[param]; FormDocumentData.Save(); if (FormDocumentData.MetaUITypeId == FormController.GeneralViewFormType || FormDocumentData.MetaUITypeId == FormController.GeneralViewHistoryFormType) { MetaDataWrapper.AddClassAttribute(MetaDataWrapper.GetMetaClassByName(FormDocumentData.MetaClassName), "HasCompositePage", true); } }
//#region SaveXml //protected void btnSave2_Click(object sender, EventArgs e) //{ // FormDocumentData.LoadFormTableFromXml(txtXml.Text); // fRenderer.FormDocumentData = FormDocumentData; // fRenderer.DataBind(); //} //#endregion #region CreateDocument private void CreateDocument() { FormTable tL = new FormTable(); tL.Columns = "50%;*"; tL.Width = "100%"; tL.CellPadding = 5; FormRow row1 = new FormRow(); FormCell cell11 = new FormCell(); cell11.ColSpan = 2; cell11.Name = "cell_11"; row1.Cells.Add(cell11); tL.Rows.Add(row1); FormRow row2 = new FormRow(); FormCell cell21 = new FormCell(); FormCell cell22 = new FormCell(); cell21.ColSpan = 1; cell22.ColSpan = 1; cell21.Name = "cell_21"; cell22.Name = "cell_22"; row2.Cells.Add(cell21); row2.Cells.Add(cell22); tL.Rows.Add(row2); FormRow row3 = new FormRow(); FormCell cell31 = new FormCell(); cell31.ColSpan = 2; cell31.Name = "cell_31"; row3.Cells.Add(cell31); tL.Rows.Add(row3); FormSection sec1 = new FormSection(); sec1.BorderType = 1; sec1.ItemIndex = 1; sec1.ShowLabel = true; sec1.Uid = "dd6acdd98240403984e561399d33d9a9"; sec1.Labels.Add(new FormLabel("Sec1", Thread.CurrentThread.CurrentUICulture.Name)); cell11.Sections.Add(sec1); FormSection sec2 = new FormSection(); sec2.BorderType = 0; sec2.ItemIndex = 1; sec2.ShowLabel = true; sec2.Uid = "886cb9a3aae34e68ac8ef234d0ce8ce2"; sec2.Labels.Add(new FormLabel("Sec2", Thread.CurrentThread.CurrentUICulture.Name)); cell21.Sections.Add(sec2); FormSection sec3 = new FormSection(); sec3.BorderType = 0; sec3.ItemIndex = 1; sec3.ShowLabel = true; sec3.Uid = "bb6acbb98240403784e561397b33d7a7"; sec3.Labels.Add(new FormLabel("Sec3", Thread.CurrentThread.CurrentUICulture.Name)); cell22.Sections.Add(sec3); FormSection sec4 = new FormSection(); sec4.BorderType = 0; sec4.ItemIndex = 1; sec4.ShowLabel = true; sec4.Uid = Guid.NewGuid().ToString("N"); sec4.Labels.Add(new FormLabel("Sec4", Thread.CurrentThread.CurrentUICulture.Name)); cell31.Sections.Add(sec4); FormControl ctrl1 = new FormControl(FormController.SmartTableLayoutType); ctrl1.Columns = "50%;*"; ctrl1.Width = "100%"; ctrl1.CellPadding = 5; FormItem item1 = new FormItem(); item1.LabelWidth = "120px"; item1.ShowLabel = true; item1.Labels.Add(new FormLabel("test label1:", Thread.CurrentThread.CurrentUICulture.Name)); item1.Uid = "9b3c4642e59b405faa2a1f38559a06cc"; item1.RowIndex = 1; item1.CellIndex = 1; item1.RowSpan = 1; item1.ColSpan = 2; FormControl item1c = new FormControl(FormController.MetaPrimitiveControlType); item1c.Uid = Guid.NewGuid().ToString("N"); item1c.Source = "Title"; item1.Control = item1c; ctrl1.Items.Add(item1); FormItem item2 = new FormItem(); item2.LabelWidth = "120px"; item2.ShowLabel = true; item2.Labels.Add(new FormLabel("test label2:", Thread.CurrentThread.CurrentUICulture.Name)); item2.Uid = "cafa725a31b74ad6a069e3b6446d89c0"; item2.RowIndex = 2; item2.CellIndex = 1; item2.RowSpan = 1; item2.ColSpan = 1; FormControl item2c = new FormControl(FormController.MetaPrimitiveControlType); item2c.Uid = Guid.NewGuid().ToString("N"); item2c.Source = "Priority"; item2.Control = item2c; ctrl1.Items.Add(item2); FormItem item3 = new FormItem(); item3.LabelWidth = "120px"; item3.ShowLabel = true; item3.Labels.Add(new FormLabel("test label3:", Thread.CurrentThread.CurrentUICulture.Name)); item3.Uid = "8d36be893c3f4cf1b5295be6853eb246"; item3.RowIndex = 3; item3.CellIndex = 1; item3.RowSpan = 1; item3.ColSpan = 1; FormControl item3c = new FormControl(FormController.MetaPrimitiveControlType); item3c.Uid = Guid.NewGuid().ToString("N"); item3c.Source = "Created"; item3.Control = item3c; ctrl1.Items.Add(item3); FormItem item4 = new FormItem(); item4.LabelWidth = "120px"; item4.ShowLabel = true; item4.Labels.Add(new FormLabel("test label4:", Thread.CurrentThread.CurrentUICulture.Name)); item4.Uid = "a5d87024cbf849cea5d273d77a292e6f"; item4.RowIndex = 2; item4.CellIndex = 2; item4.RowSpan = 2; item4.ColSpan = 1; FormControl item4c = new FormControl(FormController.MetaPrimitiveControlType); item4c.Uid = Guid.NewGuid().ToString("N"); item4c.Source = "Description"; item4.Control = item4c; ctrl1.Items.Add(item4); sec1.Control = ctrl1; //FormDocument fd = new FormDocument(); FormDocument fd = FormDocument.Load("Task", "[MC_BaseForm]"); fd.MetaClassName = "Task"; fd.Name = "[MC_BaseForm]"; fd.FormTable = tL; fd.Save(); }