public bool ChangeShape() { Data.UIForm.UIFields uIFields = new Data.UIForm.UIFields(UIForms.Common.GetConnection(this.ClientID)); uIFields.ChangeShape(this.FormID , this.FormFieldID, this.ClientID, Newtonsoft.Json.JsonConvert.SerializeObject(this)); return(true); }
/// <summary> /// /// </summary> /// <returns></returns> internal bool Remove() { Data.UIForm.UIFields uIFields = new Data.UIForm.UIFields(UIForms.Common.GetConnection(this.ClientID)); uIFields.Remove(this.FormID, this.FormFieldID, this.ClientID); return(true); }
private void Load() { Data.UIForm.UIFields uIFields = new Data.UIForm.UIFields(UIForms.Common.GetConnection(this.ClientID)); System.Data.DataTable dt = new System.Data.DataTable(); if (this.FormFieldID != "") { dt = uIFields.GetField(this.ClientID, this.FormID, this.FormFieldID); foreach (System.Data.DataRow row in dt.Rows) { this.FormFieldID = row["FieldID"] == null ? "" : (string)row["FieldID"]; this.FieldRenderType = row["FieldRenderType"] == null ? RenderType.TEXT : (RenderType)row["FieldRenderType"]; var fatt = row["FieldAttribute"] == null ? "" : (string)row["FieldAttribute"]; var ff = Newtonsoft.Json.JsonConvert.DeserializeObject <FormField>(fatt); this.Attribute = ff.Attribute; } } }
new public bool Save() { Data.UIForm.UIFields uIFields = new Data.UIForm.UIFields(UIForms.Common.GetConnection(this.ClientID)); if (this.FormFieldID != "") { uIFields.Save(this.FormID, this.ClientID, (int)this.FieldRenderType, this.Attribute.DataField, Newtonsoft.Json.JsonConvert.SerializeObject(this) ); } else { uIFields.Update(this.FormID, this.FormFieldID, this.ClientID, (int)this.FieldRenderType, Newtonsoft.Json.JsonConvert.SerializeObject(this)); } return(true); }
/// <summary> /// /// </summary> public void LoadFormFields() { Data.UIForm.UIFields form = new Data.UIForm.UIFields(Common.GetConnection(this.ClientID)); DataTable dt = form.GetFormFields(this.ClientID, this.FormID); FormFields = new List <FormField>(); foreach (System.Data.DataRow row in dt.Rows) { var serial = new JsonSerializer(); serial.Formatting = Formatting.Indented; var ff = new FormField(this.ClientID); RenderType rt = row["FieldRenderType"] == null ? RenderType.TEXT : (RenderType)row["FieldRenderType"]; var fatt = row["FieldAttribute"] == null ? "" : (string)row["FieldAttribute"]; if (rt == RenderType.BOOLEAN) { using (var sr = new StringReader(fatt)) using (var jr = new JsonTextReader(sr)) ff = serial.Deserialize <FormFields.Boolean>(jr); } else if (rt == RenderType.NUMBER) { using (var sr = new StringReader(fatt)) using (var jr = new JsonTextReader(sr)) ff = serial.Deserialize <FormFields.Numeric>(jr); // ff = Newtonsoft.Json.JsonConvert.DeserializeObject<FormFields.Numeric>(fatt); } else if (rt == RenderType.PICKER) { using (var sr = new StringReader(fatt)) using (var jr = new JsonTextReader(sr)) ff = serial.Deserialize <FormFields.Date>(jr); // ff = Newtonsoft.Json.JsonConvert.DeserializeObject<FormFields.Date>(fatt); } else if (rt == RenderType.SELECTION) { using (var sr = new StringReader(fatt)) using (var jr = new JsonTextReader(sr)) ff = serial.Deserialize <FormFields.Selection>(jr); if (((FormFields.Selection)ff).LookUpSource != "") { } } else if (rt == RenderType.TEXT) { using (var sr = new StringReader(fatt)) using (var jr = new JsonTextReader(sr)) ff = serial.Deserialize <FormFields.Text>(jr); // ff = Newtonsoft.Json.JsonConvert.DeserializeObject<FormFields.Text>(fatt); } else if (rt == RenderType.UPLOAD) { using (var sr = new StringReader(fatt)) using (var jr = new JsonTextReader(sr)) ff = serial.Deserialize <FormFields.Upload>(jr); // ff = Newtonsoft.Json.JsonConvert.DeserializeObject<FormFields.Upload>(fatt); } ff.SetForm(this.FormID); ff.FormFieldID = row["FieldID"] == null ? "" : (string)row["FieldID"]; // ff.Attribute.DataField = row["DataField"] == null ? "" : (string)row["DataField"]; ff.FieldRenderType = rt; FormFields.Add(ff); } }