/// <summary> /// /// </summary> /// <param name="clientid"></param> /// <param name="formids"></param> /// <returns></returns> public static List <Form> GetForms(string clientid, string formids) { DataTable dt; var Forms = new List <Form>(); string conn = Common.GetConnection(clientid); Data.UIForm.Form form = new Data.UIForm.Form(Common.GetConnection(clientid)); dt = form.GetForms(clientid, formids); foreach (DataRow dr in dt.Rows) { var f = new Form(clientid); f.FormID = dr["FormID"] == null ? "" : dr["FormID"].ToString(); f.Name = dr["Name"] == null ? "" : dr["Name"].ToString(); f.Description = dr["Description"] == null ? "" : dr["Description"].ToString(); f.ComponentID = dr["ComponentID"] == null ? "" : dr["ComponentID"].ToString(); f.FormType = dr["FormType"] == DBNull.Value ? UIForms.FormType.MAIN : (UIForms.FormType)Convert.ToInt32(dr["FormType"]); string fkey = dr["FormKeys"] == null ? "" : (string)dr["FormKeys"]; f.FormKeys = Newtonsoft.Json.JsonConvert.DeserializeObject <List <UIFormKey> >(fkey); f.FormProperties.CaptureLocation = dr["CaptureLocation"] == DBNull.Value ? false : Convert.ToBoolean(dr["CaptureLocation"]); f.FormProperties.CaptureIPaddress = dr["CaptureIPaddress"] == DBNull.Value ? false : Convert.ToBoolean(dr["CaptureIPaddress"]); f.FormProperties.ErrorMessage = dr["ErrorMessage"] == null ? "" : (string)dr["ErrorMessage"]; f.FormProperties.EnableDefaultAction = dr["EnableDefaultAction"] == DBNull.Value ? false : Convert.ToBoolean(dr["EnableDefaultAction"]); f.FormProperties.Submit = dr["Submit"] == null ? "" : (string)dr["Submit"]; f.FormProperties.Reset = dr["Reset"] == null ? "" : (string)dr["Reset"]; f.FormProperties.Update = dr["Update"] == null ? "" : (string)dr["Update"]; f.FormProperties.Cancel = dr["Cancel"] == null ? "" : (string)dr["Cancel"]; Forms.Add(f); } return(Forms); }
/// <summary> /// /// </summary> private void Load() { DataTable dt; string conn = Common.GetConnection(this.ClientID); Data.UIForm.Form form = new Data.UIForm.Form(Common.GetConnection(this.ClientID)); dt = form.GetForm(this.ClientID, this.FormID); foreach (DataRow dr in dt.Rows) { this.Name = dr["Name"] == null ? "" : dr["Name"].ToString(); this.Description = dr["Description"] == null ? "" : dr["Description"].ToString(); this.ComponentID = dr["ComponentID"] == null ? "" : dr["ComponentID"].ToString(); this.FormType = dr["FormType"] == null ? FormType.MAIN : (FormType)dr["FormType"]; string fkey = dr["FormKeys"] == null ? "" : (string)dr["FormKeys"]; this.FormKeys = Newtonsoft.Json.JsonConvert.DeserializeObject <List <UIFormKey> >(fkey); this.FormProperties.CaptureLocation = dr["CaptureLocation"] == null ? false: (bool)dr["CaptureLocation"]; this.FormProperties.CaptureIPaddress = dr["CaptureIPaddress"] == null ? false : (bool)dr["CaptureIPaddress"]; this.FormProperties.ErrorMessage = dr["ErrorMessage"] == null ? "" : (string)dr["ErrorMessage"]; this.FormProperties.EnableDefaultAction = dr["EnableDefaultAction"] == null ?false : (bool)dr["EnableDefaultAction"]; this.FormProperties.Submit = dr["Submit"] == null ? "" : (string)dr["Submit"]; this.FormProperties.Reset = dr["Reset"] == null ? "" : (string)dr["Reset"]; this.FormProperties.Update = dr["Update"] == null ? "" : (string)dr["Update"]; this.FormProperties.Cancel = dr["Cancel"] == null ? "" : (string)dr["Cancel"]; } }
public bool SaveComponent(string compID) { if (this.ComponentID == "") { Data.UIForm.Form form = new Data.UIForm.Form(Common.GetConnection(this.ClientID)); form.UpdateComponent(this.ClientID, this.FormID, compID); this.ComponentID = compID; return(true); } else { return(false); } }
/// <summary> /// /// </summary> /// <returns></returns> public bool Save() { Data.UIForm.Form form = new Data.UIForm.Form(Common.GetConnection(this.ClientID)); if (this.FormID == "") { this.FormID = form.Save(this.ClientID, this.Name, this.ComponentID, (int)this.FormType, Newtonsoft.Json.JsonConvert.SerializeObject(this.FormKeys), this.FormProperties.SuccessMessage, this.FormProperties.CaptureLocation, this.FormProperties.CaptureIPaddress, this.FormProperties.ErrorMessage, this.FormProperties.EnableDefaultAction, this.FormProperties.Submit, this.FormProperties.Reset, this.FormProperties.Update, this.FormProperties.Cancel, this.Description ); if (this.FormID == "") { return(false); } else { return(true); } } else { return(form.Update(this.ClientID, this.Name, this.Description, this.FormID, Newtonsoft.Json.JsonConvert.SerializeObject(this.FormKeys), this.FormProperties.SuccessMessage, this.FormProperties.CaptureLocation, this.FormProperties.CaptureIPaddress, this.FormProperties.ErrorMessage, this.FormProperties.EnableDefaultAction, this.FormProperties.Submit, this.FormProperties.Reset, this.FormProperties.Update, this.FormProperties.Cancel, this.ComponentID, Newtonsoft.Json.JsonConvert.SerializeObject(this.FormKeys))); } }
/// <summary> /// /// </summary> /// <returns></returns> internal bool Remove() { Data.UIForm.Form form = new Data.UIForm.Form(Common.GetConnection(this.ClientID)); return(form.Remove(this.ClientID, this.FormID)); }