예제 #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 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));
        }
예제 #3
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");
            }
        }