示例#1
0
文件: Rule.cs 项目: zhangwxyc/BPM
 public WR_Rule GetModel(int id)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.WR_Rule.Where(p => p.Record_Status == 0 && p.ID == id).FirstOrDefault());
     }
 }
示例#2
0
        public bool CheckPermission(string flowId, string loginName, string deptCode)
        {
            //loginName 域账号
            //deptCode 部门ID

            bool flag = false;

            flowId = flowId + ",";

            using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
            {
                //Reject_Users
                if (db.WR_Permission.Where(p => p.Record_Status == 0 && (p.Flow_Ids + ",").Contains(flowId) && (p.Reject_Users + ",").Contains(loginName + ",")).Any())
                {
                    flag = false;
                }
                //Allow_Users
                else if (db.WR_Permission.Where(p => p.Record_Status == 0 && (p.Flow_Ids + ",").Contains(flowId) && (p.Allow_Users + ",").Contains(loginName + ",")).Any())
                {
                    flag = true;
                }
                else
                {
                    flag = CheckPermissionByDept(flowId, deptCode);
                }
            }
            return(flag);
        }
示例#3
0
文件: Setting.cs 项目: zhangwxyc/BPM
 public List <WR_Setting> GetSettingByCategory(string category)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.WR_Setting.Where(p => p.Record_Status == 0).ToList());
     }
 }
示例#4
0
文件: Rule.cs 项目: zhangwxyc/BPM
 /// <summary>
 /// 判断是否流程管理员
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public bool CheckIsCagegoryAdmin(string userCode)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.WR_Category.Where(p => p.Record_Status == 0 && ((p.Category_Admin + ",").Contains(userCode + ","))).Any());
     }
 }
示例#5
0
文件: Focus.cs 项目: zhangwxyc/BPM
 public bool CheckIsFocus(string type, int id, string createdBy)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.WR_Focus.Where(p => p.Record_Status == 0 && p.Rule_ID == id && p.Created_By == createdBy).Any());
     }
 }
示例#6
0
 public List <WR_Permission> GetList()
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.WR_Permission.Where(p => p.Record_Status == 0).ToList());
     }
 }
示例#7
0
文件: Setting.cs 项目: zhangwxyc/BPM
 public string GetValueByName(string name)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         WR_Setting obj = db.WR_Setting.Where(p => p.Record_Status == 0 && p.Name == name).FirstOrDefault();
         return(obj != null ? obj.Value : "");
     }
 }
示例#8
0
文件: Rule.cs 项目: zhangwxyc/BPM
 public void Insert(WR_Rule model)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         db.WR_Rule.InsertOnSubmit(model);
         db.SubmitChanges();
     }
 }
示例#9
0
文件: Rule.cs 项目: zhangwxyc/BPM
 /// <summary>
 /// 获取最新3个月发布的制度
 /// </summary>
 /// <returns></returns>
 public List <V_WR_Rule> GetTopRuleList()
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.V_WR_Rule
                .Where(p => p.Record_Status == 0 && p.Publish_Date.HasValue && p.Publish_Date.Value > DateTime.Now.AddMonths(-3))
                .OrderByDescending(p => p.Publish_Date.Value).ToList());
     }
 }
示例#10
0
文件: Focus.cs 项目: zhangwxyc/BPM
 /// <summary>
 /// 获取收藏制度的总数
 /// </summary>
 /// <param name="userCode"></param>
 /// <returns></returns>
 public int GetRuleFocusCount(string userCode)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.V_WR_RuleFocus
                .Where(p => p.Record_Status == 0 && p.Focus_By == userCode)
                .Count());
     }
 }
示例#11
0
文件: Rule.cs 项目: zhangwxyc/BPM
 /// <summary>
 /// 获取流程分类
 /// </summary>
 /// <param name="userCode"></param>
 /// <param name="isRuleAdmin"></param>
 /// <returns></returns>
 public List <WR_Category> GetCategoryList(string userCode, bool isRuleAdmin)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.WR_Category
                .Where(p => p.Record_Status == 0)
                .Where(p => isRuleAdmin ? true : ((p.Category_Admin + ",").Contains(userCode + ","))).ToList());
     }
 }
示例#12
0
文件: Focus.cs 项目: zhangwxyc/BPM
 /// <summary>
 /// 获取收藏制度
 /// </summary>
 /// <param name="pageIndex"></param>
 /// <param name="pageCount"></param>
 /// <param name="userCode"></param>
 /// <returns></returns>
 public List <V_WR_RuleFocus> GetRuleFocusList(int pageIndex, int pageCount, string userCode)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.V_WR_RuleFocus
                .Where(p => p.Record_Status == 0 && p.Focus_By == userCode)
                .OrderByDescending(p => p.Created_On).Skip(pageCount * (pageIndex - 1)).Take(pageCount).ToList());
     }
 }
示例#13
0
文件: Rule.cs 项目: zhangwxyc/BPM
 public int GetRuleCount(int categoryId, string key)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.V_WR_Rule
                .Where(p => categoryId == -1 ? true : p.Category_ID == categoryId)
                .Where(p => string.IsNullOrEmpty(key) ? true : p.Title.Contains(key))
                .Where(p => p.Record_Status == 0)
                .Count());
     }
 }
示例#14
0
文件: Rule.cs 项目: zhangwxyc/BPM
 /// <summary>
 /// 获取列表分页
 /// </summary>
 /// <param name="pageIndex"></param>
 /// <param name="pageCount"></param>
 /// <param name="categoryId"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 public List <V_WR_Rule> GetRuleList(int pageIndex, int pageCount, int categoryId, string key)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         return(db.V_WR_Rule
                .Where(p => categoryId == -1 ? true : p.Category_ID == categoryId)
                .Where(p => string.IsNullOrEmpty(key) ? true : p.Title.Contains(key))
                .Where(p => p.Record_Status == 0)
                .OrderByDescending(p => p.Created_On).OrderByDescending(p => p.Publish_Date).Skip(pageCount * (pageIndex - 1)).Take(pageCount).ToList());
     }
 }
示例#15
0
文件: Focus.cs 项目: zhangwxyc/BPM
 public void Insert(WR_Focus model)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         bool flag = db.WR_Focus.Where(p => p.Record_Status == 0 && p.Rule_ID == model.Rule_ID && p.Created_By == model.Created_By).Any();
         if (!flag)
         {
             db.WR_Focus.InsertOnSubmit(model);
             db.SubmitChanges();
         }
     }
 }
示例#16
0
文件: Focus.cs 项目: zhangwxyc/BPM
 public void Delete(string type, int id, string createdBy)
 {
     using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
     {
         WR_Focus model = db.WR_Focus.Where(p => p.Record_Status == 0 && p.Rule_ID == id && p.Created_By == createdBy).FirstOrDefault();
         if (model != null)
         {
             db.WR_Focus.DeleteOnSubmit(model);
             db.SubmitChanges();
         }
     }
 }
示例#17
0
文件: Rule.cs 项目: zhangwxyc/BPM
        /// <summary>
        /// 获取列表总数
        /// </summary>
        /// <param name="userCode"></param>
        /// <param name="isRuleAdmin"></param>
        /// <param name="category_Id"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public int GetViewListCount(string userCode, bool isRuleAdmin, int categoryId, string key)
        {
            using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
            {
                string[]           categoryIds = new string[] { };
                List <WR_Category> categorys   = db.WR_Category.Where(p => p.Record_Status == 0 && (p.Category_Admin + ",").Contains(userCode + ",")).ToList();
                if (categorys != null && categorys.Count > 0)
                {
                    categoryIds = categorys.Select(p => p.ID.ToString()).ToArray();
                }

                return(db.V_WR_Rule
                       .Where(p => p.Record_Status == 0)
                       .Where(p => categoryId == -1 ? true : p.Category_ID == categoryId)
                       .Where(p => string.IsNullOrEmpty(key) ? true : p.Title.Contains(key))
                       .Where(p => isRuleAdmin ? true : categoryIds.Contains(p.Category_ID.ToString()))
                       .Count());
            }
        }
示例#18
0
文件: Rule.cs 项目: zhangwxyc/BPM
        /// <summary>
        /// 获取列表分页
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageCount"></param>
        /// <param name="userCode"></param>
        /// <param name="isRuleAdmin"></param>
        /// <param name="categoryId"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public List <V_WR_Rule> GetViewList(int pageIndex, int pageCount, string userCode, bool isRuleAdmin, int categoryId, string key)
        {
            using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
            {
                string[]           categoryIds = new string[] { };
                List <WR_Category> categorys   = db.WR_Category.Where(p => p.Record_Status == 0 && (p.Category_Admin + ",").Contains(userCode + ",")).ToList();
                if (categorys != null && categorys.Count > 0)
                {
                    categoryIds = categorys.Select(p => p.ID.ToString()).ToArray();
                }

                return(db.V_WR_Rule
                       .Where(p => p.Record_Status == 0)
                       .Where(p => isRuleAdmin ? true : categoryIds.Contains(p.Category_ID.ToString()))
                       .Where(p => categoryId == -1 ? true : p.Category_ID == categoryId)
                       .Where(p => string.IsNullOrEmpty(key) ? true : p.Title.Contains(key))
                       .OrderByDescending(p => p.Created_On).OrderByDescending(p => p.Publish_Date).Skip(pageCount * (pageIndex - 1)).Take(pageCount).ToList());
            }
        }
示例#19
0
        ////递归
        bool CheckPermissionByDept(string flowId, string deptCode)
        {
            //loginName 域账号
            //deptCode 部门ID
            bool change = false;
            bool flag   = false;

            using (WorkFlowRuleDataContext db = new WorkFlowRuleDataContext())
            {
                //Reject_Depts
                if (db.WR_Permission.Where(p => p.Record_Status == 0 && (p.Flow_Ids + ",").Contains(flowId) && (p.Reject_Depts + ",").Contains(deptCode + ",")).Any())
                {
                    change = true;
                    flag   = false;
                }
                //Allow_Depts
                else if (db.WR_Permission.Where(p => p.Record_Status == 0 && (p.Flow_Ids + ",").Contains(flowId) && (p.Allow_Depts + ",").Contains(deptCode + ",")).Any())
                {
                    change = true;
                    flag   = true;
                }
            }

            if (change)
            {
                return(flag);
            }
            else
            {
                //递归
                if (deptCode.Contains('-') && !change)
                {
                    return(CheckPermissionByDept(flowId, deptCode.Substring(0, deptCode.LastIndexOf('-'))));
                }
                return(flag);
            }
        }