Exemplo n.º 1
0
        public Tuple <dynamic, DataTable, List <TreeEntity>, TreeModel[], DataTable, DataTable, DataTable> GetRoleInit()
        {
            var org = DataService.GetTreeOrg();

            //更改权限列表为树 by:DZK
            string sql1 = @" (select NVL(U.MENUID,0) MENUID,U.MODULECODE,U.MODULENAME,nvl(substr(MODULECODE,0,LENGTH(MODULECODE)-2),0) parentid  FROM USERMODULE U,MENU M 
                        WHERE U.MENUID=M.ID  AND U.ENABLE_FLAG=1 
                        UNION ALL 
                        select  NVL(MENUID,0),MODULECODE,MODULENAME,nvl(substr(MODULECODE,0,LENGTH(MODULECODE)-2),0) parentid FROM USERMODULE 
                        WHERE ENABLE_FLAG=1 and (MENUID is null or MENUID =0)) 
	                        ORDER BY MODULECODE "    ;
            List <USERMODULEEntity> um       = DbHelper.ExecuteTable(sql1).ToList <USERMODULEEntity>();
            List <TreeEntity>       treeList = new List <TreeEntity>();

            foreach (var item in um)
            {
                TreeEntity node = new TreeEntity();
                node.value    = item.MENUID;
                node.code     = item.MODULECODE;
                node.title    = item.MODULENAME;
                node.expand   = false;
                node.parentId = item.PARENTID;
                treeList.Add(node);
            }
            var module = treeList.ToTree();
            //费用
            string    sqlitem2 = $@"select A.TRIMID,A.NAME from FEESUBJECT A  order by A.TRIMID";
            DataTable fee      = DbHelper.ExecuteTable(sqlitem2);
            //区域
            string    sqlitemRegion = $@"select A.REGIONID,A.NAME from REGION A  order by A.REGIONID";
            DataTable region        = DbHelper.ExecuteTable(sqlitemRegion);
            //业态树
            List <CATEGORYEntity> p = DbHelper.SelectList(new CATEGORYEntity()).OrderBy(a => a.CATEGORYCODE).ToList();
            var ytTreeData          = TreeModel.Create(p,
                                                       a => a.CATEGORYCODE,
                                                       a => new TreeModel()
            {
                value  = a.CATEGORYID,
                code   = a.CATEGORYCODE,
                title  = a.CATEGORYCODE + " " + a.CATEGORYNAME,
                expand = false
            })?.ToArray();

            //门店
            string    sqlbranch = $@"select B.ID BRANCHID,B.NAME from BRANCH B  order by B.ID";
            DataTable branch    = DbHelper.ExecuteTable(sqlbranch);
            //预警
            string    sqlalert = $@"select B.ID ALERTID,B.MC NAME from DEF_ALERT B  order by B.ID";
            DataTable alert    = DbHelper.ExecuteTable(sqlalert);

            return(new Tuple <dynamic, DataTable, List <TreeEntity>, TreeModel[], DataTable, DataTable, DataTable>(org.Item1, fee, module, ytTreeData, region, branch, alert));
        }
Exemplo n.º 2
0
        public virtual UIResult TreeGoodsKindList()
        {
            List <GOODS_KINDEntity> p = DbHelper.SelectList(new GOODS_KINDEntity()).OrderBy(a => a.CODE).ToList();

            return(new UIResult(TreeModel.Create(p,
                                                 a => a.CODE,
                                                 a => new TreeModel()
            {
                code = a.CODE,
                title = a.CODE + " " + a.NAME,
                expand = true
            })?.ToArray()));
        }
Exemplo n.º 3
0
        public virtual UIResult TreeOrgList()
        {
            List <ORGEntity> p = DbHelper.SelectList(new ORGEntity()).OrderBy(a => a.ORGCODE).ToList();

            return(new UIResult(TreeModel.Create(p,
                                                 a => a.ORGCODE,
                                                 a => new TreeModel()
            {
                code = a.ORGCODE,
                title = a.ORGCODE + " " + a.ORGNAME,
                expand = true
            })?.ToArray()));
        }
Exemplo n.º 4
0
        public virtual UIResult TreeCategoryList()
        {
            List <CATEGORYEntity> p = DbHelper.SelectList(new CATEGORYEntity()).OrderBy(a => a.CATEGORYCODE).ToList();

            return(new UIResult(TreeModel.Create(p,
                                                 a => a.CATEGORYCODE,
                                                 a => new TreeModel()
            {
                code = a.CATEGORYCODE,
                title = a.CATEGORYCODE + " " + a.CATEGORYNAME,
                expand = true
            })?.ToArray()));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 树形业态
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        public Tuple <dynamic> GetTreeCategory()
        {
            List <CATEGORYEntity> p = DbHelper.SelectList(new CATEGORYEntity()).OrderBy(a => a.CATEGORYCODE).ToList();
            var treeOrg             = new UIResult(TreeModel.Create(p,
                                                                    a => a.CATEGORYCODE,
                                                                    a => new TreeModel()
            {
                code   = a.CATEGORYCODE,
                title  = a.CATEGORYNAME,
                value  = a.CATEGORYID,
                label  = a.CATEGORYNAME,
                expand = true
            })?.ToArray());

            return(new Tuple <dynamic>(treeOrg));
        }
Exemplo n.º 6
0
        public Tuple <dynamic> GetKindInit()
        {
            List <GOODS_KINDEntity> p = DbHelper.SelectList(new GOODS_KINDEntity()).OrderBy(a => a.CODE).ToList();
            var treeOrg = new UIResult(TreeModel.Create(p,
                                                        a => a.CODE,
                                                        a => new TreeModel()
            {
                code   = a.CODE,
                title  = a.NAME,
                value  = a.ID,
                label  = a.NAME,
                expand = true
            })?.ToArray());

            return(new Tuple <dynamic>(treeOrg));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 从列表页编辑跳转到编辑页数据的展示查询
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        public Tuple <dynamic, DataTable, dynamic> GetMerchantElement(MERCHANTEntity Data)
        {
            if (Data.MERCHANTID.IsEmpty())
            {
                throw new LogicException("请确认商户编号!");
            }
            string sql = $@"SELECT * FROM MERCHANT WHERE 1=1 ";

            if (!Data.MERCHANTID.IsEmpty())
            {
                sql += (" AND MERCHANTID= " + Data.MERCHANTID);
            }
            DataTable merchant = DbHelper.ExecuteTable(sql);

            merchant.NewEnumColumns <普通单据状态>("STATUS", "STATUSMC");

            string sqlitem = $@"SELECT M.BRANDID,C.NAME,D.CATEGORYCODE,D.CATEGORYNAME " +
                             " FROM MERCHANT_BRAND M,MERCHANT E,BRAND C,CATEGORY D " +
                             " where M.MERCHANTID = E.MERCHANTID AND M.BRANDID=C.ID AND  C.CATEGORYID = D.CATEGORYID ";

            if (!Data.MERCHANTID.IsEmpty())
            {
                sqlitem += (" and E.MERCHANTID= " + Data.MERCHANTID);
            }
            DataTable merchantBrand = DbHelper.ExecuteTable(sqlitem);


            List <ORGEntity> p = DbHelper.SelectList(new ORGEntity()).OrderBy(a => a.ORGCODE).ToList();
            var treeOrg        = new UIResult(TreeModel.Create(p,
                                                               a => a.ORGCODE,
                                                               a => new TreeModel()
            {
                code   = a.ORGCODE,
                title  = a.ORGNAME,
                value  = a.ORGID,
                label  = a.ORGNAME,
                expand = true
            })?.ToArray());

            return(new Tuple <dynamic, DataTable, dynamic>(merchant.ToOneLine(), merchantBrand, treeOrg));
        }
Exemplo n.º 8
0
        public Tuple <dynamic, DataTable, List <TreeEntity>, DataTable, DataTable, TreeModel[], DataTable> GetRoleElement(ROLEEntity Data)
        {
            string sql = $@"SELECT A.*,B.ORGIDCASCADER  FROM ROLE A,ORG B  WHERE A.ORGID=B.ORGID ";

            if (!Data.ROLEID.IsEmpty())
            {
                sql += (" AND ROLEID= " + Data.ROLEID);
            }
            DataTable role = DbHelper.ExecuteTable(sql);

            //更改权限列表为树 by:DZK
            string sql1 = @" SELECT NVL(U.MENUID,0) MENUID,U.MODULECODE,U.MODULENAME,nvl(substr(U.MODULECODE,0,LENGTH(U.MODULECODE)-2),0) parentid,R.ROLEID IsChecked FROM USERMODULE U
                    LEFT JOIN ROLE_MENU R ON U.MODULECODE=R.MODULECODE  AND U.MENUID=R.MENUID AND R.ROLEID = " + Data.ROLEID + @"
                    WHERE U.ENABLE_FLAG=1                       
	                    ORDER BY U.MODULECODE"    ;
            List <USERMODULEEntity> um       = DbHelper.ExecuteTable(sql1).ToList <USERMODULEEntity>();;
            List <TreeEntity>       treeList = new List <TreeEntity>();

            foreach (var item in um)
            {
                TreeEntity node = new TreeEntity();
                node.value    = item.MENUID;
                node.code     = item.MODULECODE;
                node.@checked = !item.IsChecked.IsNullValue();
                node.title    = item.MODULENAME;
                node.expand   = false;
                node.parentId = item.PARENTID;
                treeList.Add(node);
            }
            var module = treeList.ToTree();

            //费用
            string sqlFee = $@" SELECT TRIMID FROM  ROLE_FEE WHERE 1=1";

            if (!Data.ROLEID.IsEmpty())
            {
                sqlFee += (" AND ROLEID= " + Data.ROLEID);
            }
            DataTable fee = DbHelper.ExecuteTable(sqlFee);


            //业态
            string sqlYt = $@" SELECT YTID ID FROM  ROLE_YT WHERE 1=1";

            if (!Data.ROLEID.IsEmpty())
            {
                sqlYt += (" AND ROLEID= " + Data.ROLEID);
            }
            DataTable yt = DbHelper.ExecuteTable(sqlYt);

            //区域
            string sqlRegion = $@" SELECT REGIONID FROM  ROLE_REGION WHERE 1=1";

            if (!Data.ROLEID.IsEmpty())
            {
                sqlRegion += (" AND ROLEID= " + Data.ROLEID);
            }
            DataTable region = DbHelper.ExecuteTable(sqlRegion);
            //业态
            string sqlYt2 = "select G.CATEGORYID,G.CATEGORYCODE,G.CATEGORYNAME,Y.YTID LEVEL_LAST from CATEGORY G,ROLE_YT Y where G.CATEGORYID =Y.YTID(+) ";

            sqlYt2 += (" AND Y.ROLEID(+)= " + Data.ROLEID);
            sqlYt2 += " order by G.CATEGORYCODE";

            List <CATEGORYEntity> p = DbHelper.ExecuteTable(sqlYt2).ToList <CATEGORYEntity>();

            var ytTreeData = TreeModel.Create(p,
                                              a => a.CATEGORYCODE,
                                              a => new TreeModel()
            {
                value    = a.CATEGORYID,
                @checked = !a.LEVEL_LAST.IsNullValue(),
                code     = a.CATEGORYCODE,
                title    = a.CATEGORYCODE + " " + a.CATEGORYNAME,
                expand   = false
            })?.ToArray();
            //门店
            string sqlbranch = $@"select B.ID BRANCHID,B.NAME from BRANCH B,ROLE_BRANCH R WHERE B.ID=R.BRANCHID ";

            if (!Data.ROLEID.IsEmpty())
            {
                sqlbranch += (" AND ROLEID= " + Data.ROLEID);
            }
            DataTable branch = DbHelper.ExecuteTable(sqlbranch);

            //预警
            string sqlalert = $@"select B.ID ALERTID,B.MC NAME from DEF_ALERT B,ROLE_ALERT R WHERE B.ID=R.ALERTID";

            if (!Data.ROLEID.IsEmpty())
            {
                sqlalert += (" AND ROLEID= " + Data.ROLEID);
            }
            DataTable alert = DbHelper.ExecuteTable(sqlalert);

            return(new Tuple <dynamic, DataTable, List <TreeEntity>, DataTable, DataTable, TreeModel[], DataTable>(role.ToOneLine(), fee, module, alert, region, ytTreeData, branch));
        }