Exemple #1
0
 public UIResult SearchRole(ROLEEntity Data)
 {
     var res = service.UserService.GetRoleElement(Data);
     return new UIResult(
         new
         {
             role = res.Item1,
             fee = res.Item2,
             module = res.Item3,
             ytTreeData = res.Item6,
             region = res.Item5,
             branch = res.Item7,
             alert = res.Item4
         }
     );
 }
Exemple #2
0
        public string SaveRole(ROLEEntity SaveData)
        {
            var v = GetVerify(SaveData);

            if (SaveData.ROLEID.IsEmpty())
            {
                SaveData.ROLEID = NewINC("ROLE");
            }
            v.IsUnique(a => a.ROLEID);
            v.IsUnique(a => a.ROLECODE);
            v.Require(a => a.ROLENAME);
            v.Require(a => a.ORGID);
            v.Verify();
            using (var Tran = DbHelper.BeginTransaction())
            {
                DbHelper.Save(SaveData);
                Tran.Commit();
            }
            return(SaveData.ROLEID);
        }
Exemple #3
0
 public void Delete(ROLEEntity DefineDelete)
 {
     var v = GetVerify(DefineDelete);
     CommenDelete(DefineDelete);
 }
Exemple #4
0
 public string Save(ROLEEntity SaveData)
 {
     return service.UserService.SaveRole(SaveData);
 }
Exemple #5
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));
        }