Пример #1
0
        public JsonpResult SaveAttribute(string appid, string compid, string attribute)
        {
            string clientid = Request.Params["clientkey"];
            var    apm      = new Tz.App.AppManager(clientid, appid);

            apm.GetComponents();
            var comp = apm.GetComponent(compid);

            Core.ComponentManager mg = new ComponentManager(comp);

            Models.Attribute att = new Models.Attribute();
            att = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Attribute>(attribute);
            //  Core.ComponentManager mg = new ComponentManager(clientid, compid);
            var natt = new ComponentAttribute(clientid)
            {
                AttributeName = att.AttributeName,
                AttributeType = (Core.ComponentAttribute.ComoponentAttributeType)att.AttributeType,
                ClientID      = clientid,
                DefaultValue  = att.DefaultValue,
                FileExtension = att.FileExtension,
                IsAuto        = att.IsAuto,
                IsCore        = att.IsCore,
                IsNullable    = att.IsNullable,
                IsPrimaryKey  = att.IsPrimaryKey,
                IsReadOnly    = att.IsReadOnly,
                IsRequired    = att.IsRequired,
                IsSecured     = att.IsSecured,
                IsUnique      = att.IsUnique,
                LookUpID      = att.LookUpID,
                Length        = att.Length,
                RegExp        = att.RegExp
            };

            return(new JsonpResult(mg.AddAttribute(natt)));
        }
        public JsonpResult GetComponents(string appid)
        {
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);

            return(new JsonpResult(a.GetComponents()));
        }
Пример #3
0
        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"));
        }
Пример #4
0
        public JsonpResult PublishComponent(string appid, string compid)
        {
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);

            return(new JsonpResult(a.PublishComponent(compid)));
        }
Пример #5
0
        public JsonpResult GetForms(string appid)
        {
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);

            a.LoadForms();
            return(new JsonpResult(a));
        }
Пример #6
0
        public JsonpResult GetLookUpItems(string appid, string lookupid)
        {
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);

            a.LoadLookUp();
            return(new JsonpResult(a.GetLookUp(lookupid)));
        }
        public JsonpResult RemoveComponent(string appid, string componentid)
        {
            //   Tz.Net.ClientServer c = new Net.ClientServer(clientid);
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);

            return(new JsonpResult(a.RemoveComponent(componentid)));
        }
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        public JsonpResult Save(string Name, string description)
        {
            string clientid = Request.Params["clientkey"];
            var    tzApp    = new Tz.App.AppManager(clientid);

            tzApp.AppName     = Name;
            tzApp.Description = description;
            tzApp.Category    = "None";
            return(new JsonpResult(tzApp.Save()));
        }
Пример #9
0
        public JsonpResult CreateLookUpItem(string appid, string lookupid, string label, string shortname, string value, string description)
        {
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);

            a.LoadLookUp();
            var lk = a.GetLookUp(lookupid);

            return(new JsonpResult(lk.SaveLookupItem(label, shortname, description, "", value)));
        }
Пример #10
0
        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 SaveComponent(string appid, string compName, string title)
        {
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);
            var    comp     = a.NewComponent(ComponentType.core);

            comp.ComponentName = compName;
            comp.Title         = title;
            return(new JsonpResult(a.SaveComponent(comp)));
        }
Пример #12
0
        public JsonpResult CreateLookup(string appid, string lookupname, string description, bool isCore)
        {
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);
            var    lok      = a.NewLookup();

            lok.Name        = lookupname;
            lok.Description = description;
            lok.IsCore      = isCore;
            return(new JsonpResult(a.SaveLookup(lok)));
        }
Пример #13
0
        public JsonpResult SaveMainForm(string appid, string formname,
                                        string description)
        {
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);
            var    f        = a.NewForm();

            f.Name        = formname;
            f.Description = description;
            return(new JsonpResult(a.SaveForm(f)));
        }
        public JsonpResult GetComponent(string appid, string compid)
        {
            //   Tz.Net.ClientServer c = new Net.ClientServer(clientid);
            //Tz.Core.ComponentManager cm = new Core.ComponentManager(clientid, componentID);
            //return new JsonpResult(cm);
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);

            a.GetComponents();
            var comp = a.GetComponent(compid);

            comp.LoadAttributes();
            return(new JsonpResult(comp));
        }
Пример #15
0
        public JsonpResult GetAttribute(string appid, string compid, string aid)
        {
            //   Tz.Net.ClientServer c = new Net.ClientServer(clientid);
            //Tz.Core.ComponentManager cm = new Core.ComponentManager(clientid, componentID);
            //return new JsonpResult(cm);
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);

            a.GetComponents();
            var comp = a.GetComponent(compid);

            comp.LoadAttributes();
            var all = comp.Attributes.Where(x => x.FieldID == aid).FirstOrDefault();

            return(new JsonpResult(all));
        }
        public JsonpResult UpdateComponent(string appid, string componentid, string compName, string title, string category, string titleformat)
        {
            string clientid = Request.Params["clientkey"];
            var    a        = new Tz.App.AppManager(clientid, appid);

            a.GetComponents();
            var comp = a.GetComponent(componentid);

            if (comp != null)
            {
                comp.ComponentName = compName;
                comp.Title         = title;
                comp.TitleFormat   = titleformat;
                comp.Category      = category;

                return(new JsonpResult(a.UpdateComponent(comp)));
            }
            else
            {
                throw new Exception("This component not exist. Please contact service provider");
            }
        }
Пример #17
0
        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");
        }