public string GetTab()
 {
     return(ListInvork <string>(() =>
     {
         RequesList <Etab> tab = new RequesList <Etab>()
         {
             isSec = 1,
             Model = new Etab(),
         };
         FactoryAgent f = new FactoryAgent(tab, ExecMethod.Query.Convert(""));
         f.InvokeFactory();
         return (RList <string>)f.Result;
     }));
 }
 public string UpdateMenu(long id, string name, string icon, string url)
 {
     return(TextInvork <string>(() =>
     {
         RequesList <Emenu> list = new RequesList <Emenu>();
         list.Model = new Emenu {
             Id = id, Mname = name, Micon = icon, Mlink = url
         };
         list.isNeedSync = true;
         FactoryAgent f = new FactoryAgent(list, ExecMethod.Update.Convert(""));
         f.InvokeFactory();
         if (!f.Result.sucess)
         {
             throw new ProcessException(f.Result.ToJson());
         }
         return (ReturnData)f.Result;
     }));
 }
        public string GetMenuList(int tabId)
        {
            return(ListInvork <string>(() =>
            {
                RequesList <Emenu> tab = new RequesList <Emenu>()
                {
                    isSec = 1,
                    Model = new Emenu {
                        TabId = tabId
                    },
                };
                FactoryAgent f = new FactoryAgent(tab, ExecMethod.Query.Convert(""));
                f.InvokeFactory();


                return (RList <string>)f.Result;
            }));
        }
Exemple #4
0
        /// <summary>
        /// 查询所有
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ReturnData Query(object request)
        {
            RequesList <Emenu> rp = (RequesList <Emenu>)request;

            if (rp.isSec == 10)
            {
            }
            string conditon = rp.Model.ToQueryCondition();

            Client.GetZsetMultiByValue(GetKey(), conditon);

            List <Emenu> listMenu = new List <Emenu>();

            if (Client.Sucess)
            {
                foreach (var c in Client.Result)
                {
                    var v = c.ToEntity <Emenu>();
                    listMenu.Add(v);
                }


                SetMenu("0", null, listMenu);
                List <string> str = new List <string>();
                foreach (var p in EmenuList)
                {
                    str.Add(p.ToJson());
                }
                return(new RList <string>()
                {
                    sucess = true,
                    data = str
                });
            }
            else
            {
                return(new ErrorData()
                {
                    sucess = true,
                    code = Client.Code,
                    Occurrencetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                });
            }
        }
 public string UpdateTab(long id, string tabName, string icon)
 {
     return(TextInvork <string>(() =>
     {
         RequesList <Etab> listTabs = new RequesList <Etab>();
         listTabs.Model = new Etab {
             Id = id, MName = tabName, MIcon = icon, Mid = id
         };
         listTabs.isNeedSync = true;
         int b = Math.Abs(Guid.NewGuid().GetHashCode());
         FactoryAgent f = new FactoryAgent(listTabs, ExecMethod.Update.Convert(""));
         f.InvokeFactory();
         if (!f.Result.sucess)
         {
             throw new ProcessException(f.Result.ToJson());
         }
         return (ReturnData)f.Result;
     }));
 }
 public string AddMenu(string pid, string name, string icon, string url, int tabId)
 {
     return(TextInvork <string>(() =>
     {
         RequesList <Emenu> list = new RequesList <Emenu>();
         list.Model = new Emenu {
             ParentId = pid, Mname = name, Micon = icon, Mlink = url, TabId = tabId
         };
         list.isNeedSync = true;
         int b = Math.Abs(Guid.NewGuid().GetHashCode());
         FactoryAgent f = new FactoryAgent(list, ExecMethod.Add.Convert(""));
         f.InvokeFactory();
         if (!f.Result.sucess)
         {
             throw new ProcessException(f.Result.ToJson());
         }
         return (ReturnData)f.Result;
     }));
 }
 public string DeleteMenu(int menuId)
 {
     return(TextInvork <string>(() =>
     {
         RequesList <Emenu> menu = new RequesList <Emenu>
         {
             isSec = 0
         };
         menu.isNeedSync = true;
         menu.Model.Id = menuId;
         FactoryAgent f = new FactoryAgent(menu, ExecMethod.Delete.Convert(""));
         f.InvokeFactory();
         if (!f.Result.sucess)
         {
             throw new ProcessException(f.Result.ToJson());
         }
         return (ReturnData)f.Result;
     }));
 }
 public string AddTab(string name, string icon)
 {
     return(TextInvork <string>(() =>
     {
         RequesList <Etab> listTab = new RequesList <Etab>();
         listTab.Model = new Etab {
             MName = name, MIcon = icon
         };
         listTab.isNeedSync = true;
         int b = Math.Abs(Guid.NewGuid().GetHashCode());
         FactoryAgent f = new FactoryAgent(listTab, ExecMethod.Add.Convert(""));
         f.InvokeFactory();
         if (!f.Result.sucess)
         {
             throw new ProcessException(f.Result.ToJson());
         }
         return (ReturnData)f.Result;
     }));
 }
Exemple #9
0
        public ReturnData Update(object request)
        {
            RequesList <Emenu> menu        = (RequesList <Emenu>)request;
            Interactive        interactive = new Interactive();

            interactive.Update(menu.Model);
            if (interactive.Result.Item1)
            {
                var items = new List <KeyValuePair <long, string> >();
                items.Add(new KeyValuePair <long, string>(menu.Model.Id, Convert.ToString(menu.Model.Id)));
                Client.UpdateAsyc <Emenu>(GetKey(), items, menu.Model, "Id");
                return(new ReturnData {
                    sucess = Client.Sucess
                });
            }
            else
            {
                return(new ErrorData {
                    sucess = Client.Sucess, code = Client.Code
                });
            }
        }
 public string DeleteTab(int Id)
 {
     return(TextInvork <string>(() =>
     {
         RequesList <Etab> tab = new RequesList <Etab>
         {
             isSec = 0
         };
         tab.isNeedSync = true;
         tab.Model = new Etab
         {
             Id = Id
         };
         FactoryAgent f = new FactoryAgent(tab, ExecMethod.Delete.Convert(""));
         f.InvokeFactory();
         if (!f.Result.sucess)
         {
             throw new ProcessException(f.Result.ToJson());
         }
         return (ReturnData)f.Result;
     }));
 }
Exemple #11
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public override ReturnData Delete(object request)
        {
            RequesList <Emenu> menu        = (RequesList <Emenu>)request;
            Interactive        interactive = new Interactive();

            interactive.Delete(menu.Model);
            var items = new List <KeyValuePair <long, string> >();

            if (interactive.Result.Item1)
            {
                items.Add(new KeyValuePair <long, string>(menu.Model.Id, Convert.ToString(menu.Model.Id)));
                Client.RemoveAsync <Emenu>(GetKey(), items, "Id");
                return(new ReturnData {
                    sucess = Client.Sucess, msg = menu.Model.Id.ToString()
                });
            }
            else
            {
                return(new ErrorData {
                    sucess = Client.Sucess, code = Client.Code, msg = "关系型数据库出错"
                });
            }
        }
Exemple #12
0
        /// <summary>
        /// 新增修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public override ReturnData Add(object request)
        {
            RequesList <Emenu> menu        = (RequesList <Emenu>)request;
            Interactive        interactive = new Interactive();

            interactive.Insert(menu.Model);
            if (interactive.Result.Item1)
            {
                menu.Model.Id = interactive.Result.Item2;
                var values = new List <KeyValuePair <long, string> >();
                values.Add(new KeyValuePair <long, string>(menu.Model.Id, menu.Model.ToJson()));
                Client.AddZsetAsync(GetKey(), values);
                return(new ReturnData {
                    sucess = Client.Sucess, msg = interactive.Result.Item2.ToString()
                });
            }
            else
            {
                return(new ErrorData {
                    sucess = Client.Sucess, code = Client.Code
                });
            }
        }
Exemple #13
0
        /// <summary>
        /// 查询所有选项卡
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ReturnData Query(object request)
        {
            RequesList <Etab> rp       = (RequesList <Etab>)request;
            string            conditon = rp.Model.ToQueryCondition();

            Client.GetZsetMultiByValue(GetKey(), conditon);
            if (Client.Sucess)
            {
                return(new RList <string>()
                {
                    sucess = true,
                    data = Client.Result
                });
            }
            else
            {
                return(new ErrorData()
                {
                    sucess = true,
                    code = Client.Code,
                    Occurrencetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                });
            }
        }