Пример #1
0
        /// <summary>
        /// 验证是否登录,Code返回1为没有登录或者token失效,要重新登录
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override bool OnActionExecuting(ActionContext context)
        {
            LogonBLL logonbll = new LogonBLL();
            UserBLL userbll = new UserBLL();
            //验证没有token
            if (!context.Parameters.ContainsKey("token") || context.Parameters["token"] == null)
            {
                this.Message = "没有token!";
                context.Code = 2;
                return false;
            }
            //验证有没有登录
            string token = context.Parameters["token"].ToString();

            int result = userbll.CheckUserAuth(token);
            switch (result)
            {
                case 3:
                    this.Message = "token失效,请重新登录!";
                    context.Code = result;
                    return false;
                case 4:
                    this.Message = "您没有权限进行该操作!";
                    context.Code = result;
                    return false;
            }

            return true;
        }
Пример #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);
 }
Пример #3
0
 public bool DeleteRole(Role form)
 {
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     form.LastUpdator = user.User.ID;
     return bll.DeleteRole(form.ID);
 }
Пример #4
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;
 }
Пример #6
0
 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;
 }
Пример #7
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);
 }
Пример #8
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);
 }
Пример #9
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);
 }
Пример #10
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);
 }
Пример #11
0
 public List<string> GetUserIDList(List<ActivityAuth> auth)
 {
     var mapper = Common.GetMapperFromSession();
     List<string> result = new List<string>();
     RoleDao roledao = new RoleDao(mapper);
     User_RoleDao urdao = new User_RoleDao(mapper);
     UserBLL userbll = new UserBLL();
     foreach (var au in auth)
     {
         IWorkflowAuthorityHandler handler = WorkflowAuthorityFactory.CreateHandler(au.Type.ToLower());
         result.AddRange(handler.Handle(au));
     }
     return result;
 }
Пример #12
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;
 }
Пример #13
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;
 }
Пример #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);
 }
Пример #15
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);
 }
Пример #16
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);
 }
Пример #17
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;
 }
Пример #18
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;
 }
Пример #19
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);
 }
Пример #20
0
        /// <summary>
        /// 获得用户角色子级下的所有用户
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public List<string> GetUserSubUserIDs(string userid)
        {
            UserBLL userbll = new UserBLL();
            ISqlMapper mapper = Common.GetMapperFromSession();
            User_RoleDao urdao = new User_RoleDao(mapper);
            RoleDao roledao = new RoleDao(mapper);
            var urs = urdao.Query(new User_RoleQueryForm { UserID = userid });
            List<string> useridlist = new List<string>();
            //检查用户的角色有没有全数据权限
            var roles = roledao.QueryRoleByUserID(userid);
            foreach (var role in roles)
            {
                if (role.DataAccessType == (int)DataAccesssEnum.All)
                {
                    return null;
                }
            }

            useridlist.Add(userid);
            List<Role> list = new List<Role>();
            foreach (var ur in urs)
            {
                list.AddRange(GetAllSubRoles(ur.RoleID));
            }
            var roleids = (from r in list select r.ID).ToList();
            if (roleids.Count == 0)
            {
                return useridlist;
            }
            var users = urdao.Query(new User_RoleQueryForm { RoleIDs = roleids });
            useridlist.AddRange((from u in users select u.UserID).ToList());
            return useridlist;
        }
Пример #21
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);
 }
Пример #22
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);
        }
Пример #23
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);
 }
Пример #24
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);
        }
Пример #25
0
 private void button7_Click(object sender, EventArgs e)
 {
     Workflow wf = new Workflow();
     //UpdateUserRequest request = new UpdateUserRequest();
     //request.token = token;
     //request.form = new Form.UpdateUserServiceForm
     //{
     //    ID = user.ID,
     //    CnName = "测试",
     //    Remark = "hello world",
     //};
     //var response = SDKFactory.Client.Execute(request);
     //MessageBox.Show(response.ResponseBody);
     UserBLL bll = new UserBLL();
     var result = bll.Update(new User { ID = "9", Name = "xiyimei" }, new UserInfo { ID = "9", Mobile = "11111111111" }, new List<string> { "7" });
 }
Пример #26
0
        private void button4_Click(object sender, EventArgs e)
        {
            //AddUserRequest req = new AddUserRequest();
            //req.token = token;
            //req.form = new Form.AddUserServiceForm
            //{
            //    ID = Guid.NewGuid().ToString().Replace("-", ""),
            //    Enabled = 1,
            //    Name = "manualtest",
            //    Password = "******",
            //    CnName = "中文测试",
            //    RoleIDList = new List<string>
            //    {
            //        "3",
            //    }
            //};
            //user = new User
            //{
            //    ID = req.form.ID,
            //};
            //var res = SDKFactory.Client.Execute(req);
            //MessageBox.Show(res.ResponseBody);
            Workflow wf = new Workflow();
            UserBLL bll = new UserBLL();
            bll.Add(new User
            {
                Name = "manualtest8",
                Password = "******",

            }, new UserInfo
            {
                Mobile = "1111111111",
                CnName = "manualtest8"
            }, new List<string> { "14" });
        }
Пример #27
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);
 }
Пример #28
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);
 }
Пример #29
0
 private void button6_Click(object sender, EventArgs e)
 {
     Workflow wf = new Workflow();
     UserBLL bll = new UserBLL();
     var users = bll.Query(new FullUserQueryForm { });
 }
Пример #30
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;
        }