public JsonpResult ChangeShape(string appid, string formid, string fieldPosition) { string clientid = Request.Params["clientkey"]; var a = new Tz.App.AppManager(clientid, appid); a.LoadForms(); var fm = a.GetForm(formid); fm.LoadFormFields(); var fposition = Newtonsoft.Json.JsonConvert.DeserializeObject <List <FieldPosition> >(fieldPosition); foreach (FieldPosition fp in fposition) { var ff = fm.FormFields.Where(x => x.FormFieldID == fp.FieldID || x.Attribute.FieldAttribute.FieldID == fp.FieldID).FirstOrDefault(); if (ff != null) { ff.Attribute.Top = fp.Top; ff.Attribute.Left = fp.Left; ff.Attribute.Width = fp.Width; ff.Attribute.Height = fp.Height; ff.ChangeShape(); } else { } } return(new JsonpResult("true")); }
public JsonpResult GetForms(string appid) { string clientid = Request.Params["clientkey"]; var a = new Tz.App.AppManager(clientid, appid); a.LoadForms(); return(new JsonpResult(a)); }
public JsonpResult AssignComponent(string appid, string formid, string compID) { string clientid = Request.Params["clientkey"]; var a = new Tz.App.AppManager(clientid, appid); a.LoadForms(); var fm = a.GetForm(formid); return(new JsonpResult(fm.SaveComponent(compID))); }
public JsonpResult AssignFormField(string appid, string formid, int renderType, string attributeID, string formelement) { string clientid = Request.Params["clientkey"]; var a = new Tz.App.AppManager(clientid, appid); a.LoadForms(); var fm = a.NewField(formid, (Tz.UIForms.RenderType)renderType, attributeID); var fAtt = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.FormField>(formelement); fm.Attribute.Top = fAtt.Top; fm.Attribute.Height = fAtt.Height; fm.Attribute.Left = fAtt.Left; fm.Attribute.Width = fAtt.Width; fm.Attribute.Category = (Tz.UIForms.RenderCategory)fAtt.Category; fm.FormFieldID = fAtt.FormFieldID; fm.Attribute.EnableLimit = fAtt.EnableLimit; switch ((Tz.UIForms.RenderType)renderType) { case Tz.UIForms.RenderType.BOOLEAN: Tz.UIForms.FormFields.Boolean ab = (Tz.UIForms.FormFields.Boolean)fm; a.AddFormField(formid, ab); return(new JsonpResult(ab)); case Tz.UIForms.RenderType.NUMBER: Tz.UIForms.FormFields.Numeric num = (Tz.UIForms.FormFields.Numeric)fm; num.Min = fAtt.Min; num.Max = fAtt.Max; num.DisplayFormat = fAtt.DisplayFormat; a.AddFormField(formid, num); return(new JsonpResult(num)); case Tz.UIForms.RenderType.PICKER: Tz.UIForms.FormFields.Date pick = (Tz.UIForms.FormFields.Date)fm; pick.DateFormat = fAtt.DateFormat; pick.TimeFormat = fAtt.TimeFormat; pick.DateTimeFormat = fAtt.DateTimeFormat; pick.pickerInterval = fAtt.pickerInterval; pick.AllowedDays = fAtt.AllowedDays; pick.AllowedFromHours = fAtt.AllowedFromHours; pick.AllowedToHours = fAtt.AllowedToHours; a.AddFormField(formid, pick); return(new JsonpResult(pick)); case Tz.UIForms.RenderType.SELECTION: Tz.UIForms.FormFields.Selection sel = (Tz.UIForms.FormFields.Selection)fm; sel.SeletionType = (Tz.UIForms.FormFields.SelectionType)fAtt.SeletionType; sel.ValueField = fAtt.ValueField; sel.DisplayField = fAtt.DisplayField; sel.DefineSource = fAtt.DefineSource; sel.LookUpSource = fAtt.LookUpSource; sel.ComponentSource = fAtt.ComponentSource; sel.AllowOrderbyAlphabet = fAtt.AllowOrderbyAlphabet; a.AddFormField(formid, sel); return(new JsonpResult(sel)); case Tz.UIForms.RenderType.TEXT: Tz.UIForms.FormFields.Text txt = (Tz.UIForms.FormFields.Text)fm; txt.Min = fAtt.Min; txt.Max = fAtt.Max; a.AddFormField(formid, txt); return(new JsonpResult(txt)); case Tz.UIForms.RenderType.UPLOAD: Tz.UIForms.FormFields.Upload upd = (Tz.UIForms.FormFields.Upload)fm; upd.MaxFileSize = fAtt.MaxFileSize; upd.FileExtension = fAtt.FileExtension; a.AddFormField(formid, upd); return(new JsonpResult(upd)); } throw new Exception("Invalid Render type"); }