Beispiel #1
0
        public List <Project> QueryMyProject(WorkflowProcessStatus processStatus)
        {
            ISqlMapper  mapper     = Common.GetMapperFromSession();
            TaskDao     taskdao    = new TaskDao(mapper);
            WorkflowDao wfdao      = new WorkflowDao(mapper);
            ProjectDao  projectdao = new ProjectDao(mapper);
            UserBLL     userbll    = new UserBLL();
            var         user       = userbll.GetCurrentUser();
            string      userid     = user.User.ID;
            //string userid = "13";
            var tasks = taskdao.Query(new TaskQueryForm {
                UserID = userid
            });
            List <string> workflowids = (from t in tasks
                                         select t.WorkflowID).Distinct().ToList();
            var workflows = wfdao.Query(new WorkflowQueryForm {
                IDs = workflowids, Status = (int)processStatus
            });
            List <string> projectids = (from wf in workflows
                                        select wf.ProcessID).ToList();

            return(projectdao.Query(new ProjectQueryForm {
                IDs = projectids
            }));
        }
Beispiel #2
0
 public string Add(Asset form)
 {
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     form.Creator = form.LastUpdator = userid;
     return bll.Add(form);
 }
Beispiel #3
0
        public List <Menu> GetCurrentUserMenu(string token = null)
        {
            if (string.IsNullOrEmpty(token))
            {
                token = ServiceSession.Current.Context.Parameters["token"].ToString();
            }
            ISqlMapper     mapper  = Common.GetMapperFromSession();
            UserBLL        userbll = new UserBLL();
            Menu_RoleDao   dao     = new Menu_RoleDao(mapper);
            UserEntireInfo u       = userbll.GetUserFormCache(token);

            if (u == null)
            {
                u = userbll.GetCurrentUser(token);
            }
            if (u == null)
            {
                throw new Exception("该用户信息不存在!");
            }
            var menurole = dao.QueryByUserID(u.User.ID);
            var list     = GetAllMenu();
            var userMenu = list.FindAll(t => menurole.Exists(p => p.MenuID == t.ID) && t.Enabled == 1);

            return(userMenu);
        }
Beispiel #4
0
 public bool DeleteRole(Role form)
 {
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     form.LastUpdator = user.User.ID;
     return bll.DeleteRole(form.ID);
 }
Beispiel #5
0
 public bool UpdateRole(AddRoleServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     form.LastUpdator = user.User.ID;
     return bll.UpdateRole(form);
 }
 public List<string> Handle(ActivityAuth auth)
 {
     List<string> result = new List<string>();
     ISqlMapper mapper = Common.GetMapperFromSession();
     UserBLL bll = new UserBLL();
     string userid = bll.GetCurrentUser().User.ID;
     //string userid = "16";
     RoleDao roledao = new RoleDao(mapper);
     User_RoleDao urdao = new User_RoleDao(mapper);
     string[] roleids = auth.Value.Split(',');
     var subroles = roledao.Query(new RoleQueryForm { ParentIDs = roleids.ToList() });
     var urs = urdao.Query(new User_RoleQueryForm { UserID = userid });
     var roles = subroles.FindAll(t => urs.Exists(p => p.RoleID == t.ID));
     if (roles == null || roles.Count == 0)
     {
         result.Add(userid);
     }
     else
     {
         IWorkflowAuthorityHandler handler = new RoleWorkflowAuthorityHandler();
         foreach (var role in roles)
         {
             if (roleids.Any(t => t == role.ParentID))
             {
                 result.AddRange(handler.Handle(new ActivityAuth
                 {
                     Value = role.ParentID,
                 }));
             }
         }
     }
     return result;
 }
 public override bool OnActionExecuting(ActionContext context)
 {
     RoleBLL rolebll = new RoleBLL();
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     var list = rolebll.GetUserSubUserIDs(userid);
     //MonitorCache.GetInstance().PushMessage(new CacheMessage { Message = "id:"+ userid + " count:" + list.Count.ToString() }, SOAFramework.Library.CacheEnum.FormMonitor);
     context.Parameters[Common.DataAuthorityKey] = list;
     return true;
 }
Beispiel #8
0
 public string AddRole(AddRoleServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     form.Creator = user.User.ID;
     string weixinid = "20";
     if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["WeiXinDepartmentID"])) weixinid = ConfigurationManager.AppSettings["WeiXinDepartmentID"];
     form.WeiXinID = weixinid;
     return bll.AddRole(form);
 }
Beispiel #9
0
 /// <summary>
 /// 新增数组字典组
 /// </summary>
 /// <param name="form"></param>
 /// <returns></returns>
 public string AddGroup(DataDictionaryGroup form)
 {
     if (form == null)
     {
         return null;
     }
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     form.Creator = user.User.ID;
     return bll.AddGroup(form);
 }
Beispiel #10
0
 public bool Update(Asset form)
 {
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     form.LastUpdator = userid;
     AssetUpdateForm updateform = new AssetUpdateForm
     {
         Entity = form,
         AssetQueryForm = new AssetQueryForm { ID = form.ID },
     };
     return bll.Update(updateform);
 }
Beispiel #11
0
 /// <summary>
 /// 新增数据字典项
 /// </summary>
 /// <param name="form"></param>
 /// <returns>如果有新增的项,则会自动加上ID,以便前端绑定ID</returns>
 public List<DataDictionary> AddItems(List<DataDictionary> form)
 {
     if (form == null)
     {
         return null;
     }
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     foreach (var dic in form)
     {
         dic.Creator = user.User.ID;
     }
     return bll.AddItems(form);
 }
        public List <string> Handle(ActivityAuth auth)
        {
            List <string> result = new List <string>();
            ISqlMapper    mapper = Common.GetMapperFromSession();
            UserBLL       bll    = new UserBLL();
            string        userid = bll.GetCurrentUser().User.ID;
            //string userid = "16";
            RoleDao      roledao = new RoleDao(mapper);
            User_RoleDao urdao   = new User_RoleDao(mapper);

            string[] roleids  = auth.Value.Split(',');
            var      subroles = roledao.Query(new RoleQueryForm {
                ParentIDs = roleids.ToList()
            });
            var urs = urdao.Query(new User_RoleQueryForm {
                UserID = userid
            });
            var roles = subroles.FindAll(t => urs.Exists(p => p.RoleID == t.ID));

            if (roles == null || roles.Count == 0)
            {
                result.Add(userid);
            }
            else
            {
                IWorkflowAuthorityHandler handler = new RoleWorkflowAuthorityHandler();
                foreach (var role in roles)
                {
                    if (roleids.Any(t => t == role.ParentID))
                    {
                        result.AddRange(handler.Handle(new ActivityAuth
                        {
                            Value = role.ParentID,
                        }));
                    }
                }
            }
            return(result);
        }
Beispiel #13
0
 public IndexInitResultForm InitPage()
 {
     IndexInitResultForm form = new IndexInitResultForm();
     MenuBLL menubll = new MenuBLL();
     UserBLL userbll = new UserBLL();
     TaskBLL taskbll = new TaskBLL();
     form.Menu = menubll.GetCurrentUserMenu();
     form.User = userbll.GetCurrentUser();
     var task = taskbll.Query(new QueryMyTaskServiceForm { UserID = form.User.User.ID, Status = (int)TaskProcessStatus.Started });
     task.Sort((l, r) =>
     {
         if (l.CreateTime > r.CreateTime)
         {
             return 0;
         }
         else
         {
             return 1;
         }
     });
     form.ProcessingTask = task;
     return form;
 }
Beispiel #14
0
 public bool UpdateUser(UpdateUserServiceForm form)
 {
     UserBLL bll = new UserBLL();
     var currentUser = bll.GetCurrentUser();
     User u = new User
     {
         ID = currentUser.User.ID,
         LastUpdator = currentUser.User.ID,
         Enabled = form.Enabled,
     };
     UserInfo ui = new UserInfo
     {
         ID = currentUser.User.ID,
         Address = form.Address,
         CnName = form.CnName,
         Identity = form.Identity,
         Mobile = form.Mobile,
         QQ = form.QQ,
         Remark = form.Remark,
         WX = form.WX,
     };
     return bll.Update(u, ui, null);
 }
Beispiel #15
0
 public List<Menu> GetCurrentUserMenu(string token = null)
 {
     if (string.IsNullOrEmpty(token))
     {
         token = ServiceSession.Current.Context.Parameters["token"].ToString();
     }
     ISqlMapper mapper = Common.GetMapperFromSession();
     UserBLL userbll = new UserBLL();
     Menu_RoleDao dao = new Menu_RoleDao(mapper);
     UserEntireInfo u = userbll.GetUserFormCache(token);
     if (u == null)
     {
         u = userbll.GetCurrentUser(token);
     }
     if (u == null)
     {
         throw new Exception("该用户信息不存在!");
     }
     var menurole = dao.QueryByUserID(u.User.ID);
     var list = GetAllMenu();
     var userMenu = list.FindAll(t => menurole.Exists(p => p.MenuID == t.ID) && t.Enabled == 1);
     return userMenu;
 }
Beispiel #16
0
        /// <summary>
        /// 更新数据字典
        /// </summary>
        /// <param name="form"></param>
        /// <returns>如果有新增的项,则会自动加上ID,以便前端绑定ID</returns>
        public List<DataDictionary> Update(DataDictionaryResultForm form)
        {
            if (form == null || form.Group == null)
            {
                return null;
            }

            UserBLL userbll = new UserBLL();
            var user = userbll.GetCurrentUser();
            form.Group.LastUpdator = user.User.ID;
            return bll.Update(form.Group, form.Items);
        }
Beispiel #17
0
 public bool Update(Customer form)
 {
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     form.LastUpdator = userid;
     CustomerUpdateForm updateform = new CustomerUpdateForm
     {
         Entity = form,
         CustomerQueryForm = new CustomerQueryForm { ID = form.ID },
     };
     return bll.Update(updateform);
 }
Beispiel #18
0
 public bool Approval(ApprovalServiceForm form)
 {
     WorkflowBLL wfbll = new WorkflowBLL();
     if (string.IsNullOrEmpty(form.WorkflowID))
     {
         throw new Exception("没有WorkflowID");
     }
     if (string.IsNullOrEmpty(form.ActivityID))
     {
         throw new Exception("没有ActivityID");
     }
     if (string.IsNullOrEmpty(form.TaskID))
     {
         throw new Exception("没有TaskID");
     }
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     string userid = user.User.ID;
     return wfbll.Approval(form.WorkflowID, userid, form.Approval);
 }
Beispiel #19
0
 public bool FinanceConfirmSave(FinanceConfirmServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     return bll.FinanceConfirmSave(form.ID, 0, userid,form.RefundName, form.RefundAccount,
         form.RefundBankName, form.RefundMoney, form.RefundDate, form.DelayFee, form.DelayTimeEnd,
         form.DelayTime, form.ReturnBackRemark, form.RollFee, form.RollRemark, form.ReturnBackMoneyInfo);
 }
Beispiel #20
0
 public InitApprovalResultForm InitApproval(InitApprovalServiceForm form)
 {
     if (string.IsNullOrEmpty(form.ID) && string.IsNullOrEmpty(form.TaskID))
     {
         throw new Exception("没有项目ID和任务ID");
     }
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     return bll.QueryDetail(form.ID, form.TaskID, userid);
 }
Beispiel #21
0
 public PagingEntity<InitApprovalResultForm> Query(QueryProjectServiceForm form)
 {
     var list = bll.QueryProjectByRelationship(form);
     if (list.Count == 0)
     {
         return new PagingEntity<InitApprovalResultForm> { };
     }
     var projectids = (from p in list select p.ID).Distinct().ToList();
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     var record = bll.Query(projectids, null, userid);
     PagingEntity<InitApprovalResultForm> result = new PagingEntity<InitApprovalResultForm>
     {
         Record = record,
         PageCount = form.PageCount,
         RecordCount = form.RecordCount,
     };
     return result;
 }
Beispiel #22
0
 public PagingEntity<InitApprovalResultForm> QueryMyApply(QueryMyApplyServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     form.UserID = userid;
     form.Creators = Common.GetDataAuthorityUserIDList();
     PagingEntity<InitApprovalResultForm> result = new PagingEntity<InitApprovalResultForm>();
     result.Record = bll.QueryMyApply(form);
     result.PageCount = form.PageCount;
     result.RecordCount = form.RecordCount;
     return result;
 }
Beispiel #23
0
 public string Save(AddProjectServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     string userid = user.User.ID;
     form.Project.Report = form.Report;
     return bll.Save(form.Project, form.Assets, form.Buyers, form.Sellers, form.ThirdParty, form.Guarantor, form.Project.CreditReceiverInfo, userid);
 }
Beispiel #24
0
 public bool StopWorkflow(StopWorkflowServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     string userid = user.User.ID;
     return bll.StopWorkflow(form.WorkflowID, userid);
 }
Beispiel #25
0
 public bool UpdateCharge(FinaceApprovalServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     form.Project.LastUpdator = userid;
     return bll.UpdateFinance(form.WorkflowID, form.Project, userid);
 }
Beispiel #26
0
        public bool UpdateFinance(FinaceApprovalServiceForm form)
        {
            UserBLL userbll = new UserBLL();
            string userid = userbll.GetCurrentUser().User.ID;
            form.Project.LastUpdator = userid;

            //MonitorCache.GetInstance().PushMessage(new CacheMessage { Message = "entry activity id:" + form.ActivityID }, SOAFramework.Library.CacheEnum.FormMonitor);
            return bll.UpdateFinance(form.WorkflowID, form.Project, userid);
        }
Beispiel #27
0
 public bool UpdateTracking(UpdateTrackingServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     form.LastUpdator = userid;
     return bll.UpdateTracking(form, form.WorkflowID,userid);
 }
Beispiel #28
0
        public string Add(AddProjectServiceForm form)
        {
            ISqlMapper mapper = Common.GetMapperFromSession();
            List<Customer_Project> customers = new List<Customer_Project>();
            List<Customer> updateCustomers = new List<Customer>();
            WorkflowDao workflowdao = new WorkflowDao(mapper);
            UserBLL userbll = new UserBLL();
            var user = userbll.GetCurrentUser();
            string userid = user.User.ID;
            form.Project.Report = form.Report;
            var result = bll.Save(form.Project, form.Assets, form.Buyers, form.Sellers, form.ThirdParty, form.Guarantor, form.Project.CreditReceiverInfo, userid);

            //处理流程
            WorkflowDefinitionModel wfdm = WorkflowDefinitionModel.LoadByName("额度申请");
            Workflow wf = workflowdao.Query(new WorkflowQueryForm { ProcessID = result }).FirstOrDefault();
            WorkflowModel workflow = null;
            if (wf == null)
            {
                workflow = wfdm.StartNew(user.User.ID, result, new WorkflowAuthority());
                //如果流程当前处理人等于申请人,就直接审批通过,进入下一个流程
                var task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid);
                if (task != null)
                {
                    workflow.ProcessActivity(new Approval
                    {
                        Creator = user.User.ID,
                        LastUpdator = user.User.ID,
                        Remark = form.Report,
                        Status = (int)ApprovalStatus.Agree,
                        ActivityID = workflow.CurrentActivity.Value.ID,
                        WorkflowID = workflow.Value.ID,
                    }, user.User.ID, new WorkflowAuthority());
                }
            }
            else
            {
                workflow = WorkflowModel.Load(wf.ID);
                //如果流程当前处理人等于申请人,就直接审批通过,进入下一个流程
                var task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid);
                if (task != null)
                {
                    workflow.ProcessActivity(new Approval
                    {
                        Creator = user.User.ID,
                        LastUpdator = user.User.ID,
                        Status = (int)ApprovalStatus.None,
                        ActivityID = workflow.CurrentActivity.Value.ID,
                        WorkflowID = workflow.Value.ID,
                    }, user.User.ID, new WorkflowAuthority());
                    task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid);
                    if (task != null)
                    {
                        workflow.ProcessActivity(new Approval
                        {
                            Creator = user.User.ID,
                            LastUpdator = user.User.ID,
                            Remark = form.Report,
                            Status = (int)ApprovalStatus.Agree,
                            ActivityID = workflow.CurrentActivity.Value.ID,
                            WorkflowID = workflow.Value.ID,
                        }, user.User.ID, new WorkflowAuthority());
                    }
                }
            }

            return result;
        }