/// <summary> /// Deprecated Method for adding a new object to the DesignFormTabs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDesignFormTabs(DesignFormTab designFormTab) { base.AddObject("DesignFormTabs", designFormTab); }
/// <summary> /// Create a new DesignFormTab object. /// </summary> /// <param name="formTabID">Initial value of the FormTabID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="formID">Initial value of the FormID property.</param> /// <param name="sequence">Initial value of the Sequence property.</param> /// <param name="isSysUse">Initial value of the IsSysUse property.</param> /// <param name="isVisible">Initial value of the IsVisible property.</param> /// <param name="isEnabled">Initial value of the IsEnabled property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> /// <param name="createdBy">Initial value of the CreatedBy property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> /// <param name="updatedBy">Initial value of the UpdatedBy property.</param> /// <param name="updatedDate">Initial value of the UpdatedDate property.</param> /// <param name="sysIdentity">Initial value of the SysIdentity property.</param> public static DesignFormTab CreateDesignFormTab(global::System.Int32 formTabID, global::System.String name, global::System.Int32 formID, global::System.Int32 sequence, global::System.Boolean isSysUse, global::System.Boolean isVisible, global::System.Boolean isEnabled, global::System.Boolean isDeleted, global::System.Int32 createdBy, global::System.DateTime createdDate, global::System.Int32 updatedBy, global::System.DateTime updatedDate, global::System.String sysIdentity) { DesignFormTab designFormTab = new DesignFormTab(); designFormTab.FormTabID = formTabID; designFormTab.Name = name; designFormTab.FormID = formID; designFormTab.Sequence = sequence; designFormTab.IsSysUse = isSysUse; designFormTab.IsVisible = isVisible; designFormTab.IsEnabled = isEnabled; designFormTab.IsDeleted = isDeleted; designFormTab.CreatedBy = createdBy; designFormTab.CreatedDate = createdDate; designFormTab.UpdatedBy = updatedBy; designFormTab.UpdatedDate = updatedDate; designFormTab.SysIdentity = sysIdentity; return designFormTab; }
protected void TabAdd(object sender, EventArgs e) { // SetControlPosition(ddlCurrentTab.SelectedValue == string.Empty ? string.Empty : ddlCurrentTab.SelectedValue); SetAllPositions(); if (eFormID > 0) { if (!IsValidNewTab()) { return; } } string Error = AjexTabs.AddNewTabToTabContainer(CurrentTab, this.txtTabName.Text, this.txtIdentify.Text, this.txtDesc.Text, AciveHidClient, this.chkActive.Checked); if (Error == string.Empty) { if (Session[SessionTabList] == null) { return; } List<DesignFormTab> oTabList =Session[SessionTabList] as List<DesignFormTab>; int? MaxDisplay = (from o in oTabList select o.Sequence).Max(); // save it to database DesignFormTab oTab = new DesignFormTab(); oTab.Name = txtTabName.Text; oTab.SysIdentity = txtIdentify.Text; oTab.Description = txtDesc.Text; oTab.IsEnabled = chkActive.Checked; oTab.IsVisible = chkVisible.Checked; oTab.FormID = eFormID; oTab.IsSysUse = false; if (MaxDisplay.HasValue) { oTab.Sequence = Convert.ToInt32(MaxDisplay +1); } else { oTab.Sequence = 1; } //DesignFormTab.Save<DesignFormTab>(oTab); oTabList.Add(oTab); Session[SessionTabList] = oTabList; LoadTabs(false); if (lstTabList.Items.Count > 0) { lstTabList.SelectedIndex = lstTabList.Items.Count-2; SetTab(lstTabList.SelectedValue); } this.bntAdd.Enabled = false; this.IsTabChanged = true; string msg = Action_TabAdd_Message; // "A new tab was added sucessfully. Thank you!"; TabContainer1.Tabs[1].Enabled = true; Guid oguid = new Guid(); ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oguid.ToString(), "callBoxFancy('eFormSucessStatus','" + msg + "');", true); // this.jsfunction.Text = "<script>callBoxFancy('" + this.lblStatusMsg.ClientID + "','"+ lblStatusMsg.Text +"');</script>"; if (this.ddlCurrentTab.SelectedValue != "-1") { this.bntFieldAdd.Enabled = true; } else { this.bntFieldAdd.Enabled = false; } } }
public void LoadTabs(bool IsIni) { lstTabList.Items.Clear(); //Load tabs if (IsIni) { this.lstTabList.DataTextField = "Name"; this.lstTabList.DataValueField = "SysIdentity"; if (_eFormID == 0) { //Does not find any exsting tab in db //Figur out currnet tabs if (Session[SessionTabList] != null) { List<DesignFormTab> oList = Session[SessionTabList] as List<DesignFormTab>; foreach (DesignFormTab oTab in oList) { if (oTab.IsSysUse == false && oTab.Name != string.Empty ) { lstTabList.Items.Add(new ListItem(oTab.Name, oTab.SysIdentity)); } } lstTabList.Items.Add(new ListItem("New...", "-1")); Session[SessionTabList] = oList; } else if (CurrentTab != null) { List<DesignFormTab> oTabList = new List<Pelesys.Scheduling.DesignFormTab>(); int count = 0; foreach (TabPanel otp in CurrentTab.Tabs) { DesignFormTab oTab = new DesignFormTab(); Guid gNewidentifier = Guid.NewGuid(); oTab.Name = otp.HeaderText; if (otp.ID.ToLower() == "tabs") { oTab.SysIdentity = gNewidentifier.ToString(); otp.ID =otp.ID.ToLower().ToString(); } else { oTab.SysIdentity = otp.ID; } oTab.IsVisible = this.chkActive.Checked; oTab.IsEnabled = this.chkVisible.Checked; if (count == 0) { oTab.IsSysUse = true; } else { oTab.IsSysUse = false; } oTab.Sequence = count; if (oTab.Name.ToLower() != "") { lstTabList.Items.Add(new ListItem(oTab.Name, oTab.SysIdentity)); oTabList.Add(oTab); } count++; } Session[SessionTabList] = oTabList; } // lstTabList.Items.RemoveAt(0); // lstTabList.Items.Add(new ListItem("New...", "-1")); } else { List<DesignFormTab> oFormTabList = DesignFormTab.GetDataBy(eFormID); lstTabList.DataSource = oFormTabList; lstTabList.DataBind(); lstTabList.Items.Add(new ListItem("New...", "-1")); if (lstTabList.Items.Count > 0) { lstTabList.SelectedIndex = 0; SetTab(lstTabList.SelectedValue); } Session[SessionTabList] = oFormTabList; } } else { if (Session[SessionTabList] != null) { List<DesignFormTab> oList = Session[SessionTabList] as List<DesignFormTab>; foreach (DesignFormTab oTab in oList) { if (oTab.IsSysUse == false) { lstTabList.Items.Add(new ListItem(oTab.Name, oTab.SysIdentity)); } } lstTabList.Items.Add(new ListItem("New...", "-1")); } } LoadFieldTab(); }
protected void FieldAdd(object sender, EventArgs e) { // SaveAllFields(); SetAllPositions(); GetNewFieldName(); foreach (AccordionPane Panes in accordionFormDesign.Panes) { Panes.Enabled = true; } // SetControlPosition(ddlCurrentTab.SelectedValue == string.Empty ? string.Empty : ddlCurrentTab.SelectedValue); if (!IsAControlbeingSelected()) { return; } if (!IsValidNewField()) { return; }; if (!IsValidControlName(true)) { return; } DesignFormField.checkFieldMax(true, eFormID); if (DesignFormField.error != string.Empty) { Guid oMaxguid = new Guid(); ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oMaxguid.ToString(), "callBoxFancy('eFormWarnStatus','" + DesignFormField.error + "');", true); return; } if (lstTabList.SelectedValue == "-1") { Guid oNewTab = new Guid(); ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oNewTab.ToString(), "callBoxFancy('eFormWarnStatus','" + ValidationNewTabMessage_Message + "');", true); return; } // ini position string StartPos = "0"; string ControlLeft = "0"; //string ImageStartPos = "10"; //string ImageLeftPos = "300"; DesignFormField oDesign = new DesignFormField(); // get control name and field name System.Web.UI.Control oControl = new System.Web.UI.Control(); System.Web.UI.Control oLabel = CreateLabel(txtLabelName.Text, txtLabelName.Text); oLabel.SkinID = "Editorlabel"; if (this.accordionFormDesign.SelectedIndex == 0) { oControl = CreateTextBox(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 1) { oControl = CreateDropDownList(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 2) { oControl = CreateCheckbox(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 3) { oControl = CreateDate(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 4) { oControl = CreateImage(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 5) { oControl = CreateHyperLink(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } oDesign.Name = txtTextBoxName.Text.Replace(" ", string.Empty); Label oAtLabel = oLabel as Label; if (this.accordionFormDesign.SelectedIndex != 5) { oDesign.Label = oAtLabel.Text; } oDesign.ControlType = iControlType; oDesign.IsVisible = this.chkFieldVisible.Checked == true ? true : false; oDesign.IsEnabled = this.chkFieldEnabled.Checked == true ? true : false; DesignFormTab otab = new DesignFormTab(); if (ddlCurrentTab.SelectedValue != string.Empty) { //add form first if form id is 0 if (eFormID == 0) { DesignForm oform = new DesignForm(); oform.Name = txtFormName.Text; eFormName = txtFormName.Text; oform.Type = 1; DesignForm.Save(oform); eFormID = oform.FormID; } if (Session[SessionTabList] != null) { List<DesignFormTab> oList = Session[SessionTabList] as List<DesignFormTab>; // save all table if form id is 0 foreach (DesignFormTab ot in oList) { if (!DesignFormTab.IsTabNameExist(eFormID, string.Empty, ot.Name)) { //string Tabmsg = ValidationTabNameAlreadyExist_Message; //Guid oTabguid = new Guid(); //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oTabguid.ToString(), "callBoxFancy('eFormWarnStatus','" + Tabmsg + "');", true); if (!ot.IsSysUse) { //return; ot.FormID = eFormID; DesignFormTab.Save<DesignFormTab>(ot); } // update tab list //List<DesignFormTab> oNewList = DesignFormTab.GetDataBy(eFormID); //Session[SessionTabList] = oNewList; } } this.ActiveTabID = ddlCurrentTab.SelectedValue; var otablist = from o in oList where o.SysIdentity == ddlCurrentTab.SelectedValue select o; if (otablist != null && otablist.Count() > 0) { DesignFormTab ofield = otablist.FirstOrDefault(); oDesign.TabID = ofield.FormTabID; oDesign.FormID = eFormID; otab = ofield; } else { oDesign.TabID = 1; } } } else { oDesign.TabID = 1; } oDesign.SkinID = oControl.SkinID; oDesign.IsSearch = false; oDesign.FormID = eFormID; int fieldId = oDesign.FieldID; //Label css position style String cssStyle = string.Empty; cssStyle = FormDesign.ccsRelative + FormDesign.ccsTop + StartPos + FormDesign.ccsPX; cssStyle = cssStyle + FormDesign.ccsLeft + StartPos + FormDesign.ccsPX; int labelLength = txtLabelName.Text.Length + 80; // add control to panel if (CurrentTab != null) { if (this.ddlCurrentTab.SelectedValue != string.Empty) { // DesignFormTab otab = DesignFormTab.GetDataBySysIdentity(eFormID,ddlCurrentTab.SelectedValue); TabPanel oPanel = CurrentTab.FindControl(otab.SysIdentity) as TabPanel; if (oPanel != null) { LiteralControl oLabelLiteral = new LiteralControl(); oLabelLiteral.Text = "<div id=\"DIV" + oControl.ID + "\" Style='" + cssStyle + "' class='" + this.dragcssClass + "' >"; oPanel.Controls.Add(oLabelLiteral); oPanel.Controls.Add(oLabel); LiteralControl oLabelEndLiteral = new LiteralControl(); string endDiv = "</div>"; if ((this.accordionFormDesign.SelectedIndex == 0) && (this.chkMandatory.Checked)) { endDiv = "<span style='Color: red'>*</span></div>"; } oLabelEndLiteral.Text = endDiv; //redefine css style cssStyle = FormDesign.ccsRelative + FormDesign.ccsTop + StartPos + FormDesign.ccsPX; cssStyle = cssStyle + FormDesign.ccsLeft + " " + labelLength.ToString() + FormDesign.ccsPX; oPanel.Controls.Add(oLabelEndLiteral); LiteralControl oLiteral = new LiteralControl(); oLiteral.Text = "<Div id=\"DIV" + oControl.ID + "\" Style='" + cssStyle + "' class='" + this.dragcssClass + "' >"; // oLabel.Attributes.Add(AppConstManager.cStyle, cssStyle); oPanel.Controls.Add(oLiteral); oPanel.Controls.Add(oControl); LiteralControl oEndLiteral = new LiteralControl(); oEndLiteral.Text = "</Div>"; oPanel.Controls.Add(oEndLiteral); } } } else { CurrentPanel.Controls.Add(oLabel); CurrentPanel.Controls.Add(oControl); } oDesign.ControlLeft = labelLength; oDesign.ControlTop = Convert.ToInt16(StartPos); oDesign.LabelLeft = 0; oDesign.LabelTop = Convert.ToInt16(StartPos); DesignFormField.Save<DesignFormField>(oDesign); Guid gMessage = Guid.NewGuid(); //string sJavascript = "eFormChangeClassForDrag('" + cssDragClass + "', true);editbox_init()"; LoadFieldDetail(); bntFieldAdd.Enabled = false; int count = 0; foreach (ListItem oItem in ddlFields.Items) { if (oItem.Value == oDesign.FieldID.ToString()) { ddlFields.SelectedIndex = count; break; } count++; } hidFieldID.Value = oDesign.FieldID.ToString(); hidControlList.Value = hidControlList.Value + ""; hidLabelList.Value = hidLabelList.Value + ""; string sJavascript = "editbox_init()"; ScriptManager.RegisterStartupScript(this.UpdatePanel1, GetType(), gMessage.ToString(), sJavascript, true); string msg = Action_FieldAdd_Message; CreateFormDesignScript("Main", UpdatePanel1, TabContainer1); IsEnable = true; AccordingIndex = accordionFormDesign.SelectedIndex; string SelectedValue = string.Empty; if (lstTabList.SelectedValue == string.Empty) { SelectedValue = lstTabList.Items[0].Value; } else { SelectedValue = lstTabList.SelectedValue; } SetTab(SelectedValue); if (ddlFields.SelectedValue != "-1") { bntFieldDelete.Enabled = true; } SelectedValue = this.ddlCurrentTab.SelectedValue; TabContainer1.Tabs[1].Enabled = true; bntSaveAllFields.Enabled = true; Guid oguid = new Guid(); ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oguid.ToString(), "callBoxFancy('eFormSucessStatus','" + msg + "');", true); }