示例#1
0
        private string GetNode()
        {
            string             functionid = Get("id");
            List <Ua_function> listAll    = ImplementFactory.GetSelectTransaction <Ua_function>("Ua_functionSelectTransaction", new Dictionary <string, string> {
                { "FUNCTIONID", functionid }
            }).SelectAll();
            string json = "{}";

            if (listAll.Count > 0)
            {
                model = listAll[0];
                JsonObj jsonObj = new JsonObj();
                jsonObj.DESCRIPTION = model.DESCRIPTION;
                jsonObj.FUNCTIONID  = model.FUNCTIONID;
                jsonObj.ICON        = model.ICON;
                jsonObj.NAME        = model.NAME;
                jsonObj.NOTICE_FLAG = model.NOTICE_FLAG;
                jsonObj.SEQUENCE    = model.SEQUENCE.ToString();
                jsonObj.SHOWINMENU  = model.SHOWINMENU;
                jsonObj.QUICK_FLAG  = model.QUICK_FLAG;
                jsonObj.YJS_FLAG    = model.YJS_FLAG;
                jsonObj.URL         = model.URL;
                jsonObj.HASROLE     = getRole4FunId(model.FUNCTIONID);
                json = JsonConvert.SerializeObject(jsonObj);
            }
            return(json);
        }
示例#2
0
 private void GetValue(Ua_function model)
 {
     model.NAME        = Post("NAME");
     model.URL         = Post("URL");
     model.SEQUENCE    = cod.ChangeInt(Post("SEQUENCE"));
     model.DESCRIPTION = Post("DESCRIPTION");
     model.SHOWINMENU  = Post("SHOWINMENU");
     model.ICON        = Post("ICON");
     model.NOTICE_FLAG = Post("NOTICE_FLAG");
     model.QUICK_FLAG  = Post("QUICK_FLAG");
     model.YJS_FLAG    = Post("YJS_FLAG");
 }
示例#3
0
        private string GetJson(string id)
        {
            #region 设置功能

            StringBuilder      sb      = new StringBuilder();
            List <Ua_function> listAll = ImplementFactory.GetSelectTransaction <Ua_function>("Ua_functionSelectTransaction", new Dictionary <string, string>()).SelectAll();

            if (listAll.Count > 0)
            {
                Dictionary <string, string> param = new Dictionary <string, string>();

                string NAME = "1";
                string Type = " 1' AND ROLEID ='" + Request.QueryString["roleid"] + "' AND 1='1";
                param.Add(NAME, Type);

                funcAll = ImplementFactory.GetSelectTransaction <Ua_role_func>("Ua_role_funcSelectTransaction", param).SelectAll();
                Ua_function root = listAll.Find(p => p.FUNCTIONID.Equals(ConfigurationManager.AppSettings["GenericTreeId"].ToString()));
                if (root != null)
                {
                    sb.AppendFormat("[{{\"id\":\"{0}\",\"text\":\"{1}\",\"state\":{{\"checked\":{2}}},\"attributes\":{{\"code\":\"{3}\"}}", root.FUNCTIONID, root.NAME, CheckFuncSelect(root.FUNCTIONID, root.FUNCTIONID, listAll), root.FUNCTIONID);
                    List <Ua_function> listParent = listAll.FindAll(p => p.PARENTID == root.FUNCTIONID);
                    if (listParent.Count > 0)
                    {
                        listParent.Sort(delegate(Ua_function small, Ua_function big) { return(Comparer <string> .Default.Compare(small.SEQUENCE.ToString(), big.SEQUENCE.ToString())); });                      //按顺序排列
                        sb.Append(",\"nodes\":[");
                        foreach (Ua_function model in listParent)
                        {
                            sb.AppendFormat("{{\"id\":\"{0}\",\"text\":\"{1}\",\"state\":{{\"checked\":{2}}},\"attributes\":{{\"code\":\"{3}\"}}", model.FUNCTIONID, model.NAME, CheckFuncSelect(model.FUNCTIONID, model.FUNCTIONID, listAll), model.FUNCTIONID);
                            AddChild(listAll, sb, model.FUNCTIONID);
                            sb.Append("},");
                        }
                        if (sb[sb.Length - 1] == ',')
                        {
                            sb.Remove(sb.Length - 1, 1);
                        }
                        sb.Append("]");
                    }
                    sb.Append("}]");
                }
            }
            return(sb.ToString());

            #endregion 设置功能
        }
示例#4
0
        private string GetJson()
        {
            StringBuilder sb = new StringBuilder();

            Dictionary <string, string> param = new Dictionary <string, string>();
            var selectTran             = ImplementFactory.GetSelectTransaction <Ua_function>("Ua_functionSelectTransaction", param);
            List <Ua_function> listAll = selectTran.SelectAll();

            if (listAll.Count > 0)
            {
                Ua_function root = listAll.Find(p => p.FUNCTIONID.Equals(ConfigurationManager.AppSettings["GenericTreeId"].ToString()));
                if (root != null)
                {
                    sb.AppendFormat("[{{\"id\":\"{0}\",\"nodeId\":\"{0}\",\"text\":\"{1}\"", root.FUNCTIONID, root.NAME);
                    List <Ua_function> listParent = listAll.FindAll(p => p.PARENTID == root.FUNCTIONID);
                    if (listParent.Count > 0)
                    {
                        listParent.Sort(delegate(Ua_function small, Ua_function big) { return(Comparer <decimal> .Default.Compare(small.SEQUENCE, big.SEQUENCE)); });//按顺序排列
                        sb.Append(",\"nodes\":[");
                        foreach (Ua_function model in listParent)
                        {
                            sb.AppendFormat("{{\"id\":\"{0}\",\"nodeId\":\"{0}\",\"text\":\"{1}\"", model.FUNCTIONID, model.NAME);
                            AddChild(listAll, sb, model.FUNCTIONID);
                            sb.Append("},");
                        }
                        if (sb[sb.Length - 1] == ',')
                        {
                            sb.Remove(sb.Length - 1, 1);
                        }
                        sb.Append("]");
                    }
                    sb.Append("}]");
                }
            }
            return(sb.ToString());
        }