예제 #1
0
        public void TestWorkflowAdd()
        {
            Workflow wf = new Workflow
            {
                Creator = "test add",
                Name = "testing add",
                Status = 0,
                CreateTime = DateTime.Now,
                WorkflowDefinitionID = "1",
            };
            dao.Add(wf);
            WorkflowQueryForm form = new WorkflowQueryForm
            {
                ID = wf.ID,
            };

            var statement = dao.Mapper.GetMappedStatement("QueryWorkflow");
            if (!dao.Mapper.IsSessionStarted)
            {
                dao.Mapper.OpenConnection();
            }
            RequestScope scope = statement.Statement.Sql.GetRequestScope(statement, form, dao.Mapper.LocalSession);
            string result = scope.PreparedStatement.PreparedSql;
            var list = dao.Query(form);
            Assert.AreEqual(1, list.Count);
            Assert.AreEqual("testing add", list[0].Name);
            Assert.AreEqual("1", list[0].WorkflowDefinitionID);
            Assert.AreEqual("test add", list[0].Creator);
            Assert.AreEqual(0, list[0].Status);
            dao.Delete(form);
        }
예제 #2
0
 public void Init()
 {
     #region workflow
     Cleanup();
     Workflow wf = new Workflow
     {
         ID = "11",
         Creator = "test",
         Name = "testing",
         Status = 0,
         CreateTime = DateTime.Now,
         WorkflowDefinitionID = "1",
     };
     Workflow wf2 = new Workflow
     {
         ID = "22",
         Creator = "test2",
         Name = "testing2",
         Status = 0,
         CreateTime = DateTime.Now,
         WorkflowDefinitionID = "1",
     };
     Workflow wf3 = new Workflow
     {
         ID = "33",
         Creator = "test3",
         Name = "testing3",
         Status = 0,
         CreateTime = DateTime.Now,
         WorkflowDefinitionID = "1",
     };
     dao.Add(wf);
     dao.Add(wf2);
     dao.Add(wf3);
     #endregion
 }
예제 #3
0
 public void TestWorkflowDelete()
 {
     Workflow wf = new Workflow
     {
         Creator = "test for delete",
         Name = "testing for delete",
         Status = 0,
         CreateTime = DateTime.Now,
         WorkflowDefinitionID = "1",
     };
     dao.Add(wf);
     WorkflowQueryForm form = new WorkflowQueryForm
     {
         ID = wf.ID,
     };
     var list = dao.Query(form);
     Assert.AreEqual(1, list.Count);
     dao.Delete(form);
     list = dao.Query(form);
     Assert.AreEqual(0, list.Count);
 }
예제 #4
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 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" });
 }
예제 #5
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button6_Click(object sender, EventArgs e)
 {
     Workflow wf = new Workflow();
     UserBLL bll = new UserBLL();
     var users = bll.Query(new FullUserQueryForm { });
 }
예제 #6
0
파일: Index.cs 프로젝트: franknew/RiskMgr
        private void button10_Click(object sender, EventArgs e)
        {
            Workflow wf = new Workflow();
            string userid = "9";
            //ProjectBLL bll = new ProjectBLL();
            //bll.Add(new Project
            //{
            //    Creator = "9",
            //    Name = "test",
            //}, new List<Asset>(), new List<Customer_Project>(), new List<Customer>(), new List<Guarantor>(), "9"

            //);
            //处理流程
            ProjectBLL bll = new ProjectBLL();
            bll.Save(new Project
            {
                ID = "111",
            }, new List<Asset>
            {
                new Asset
                {
                    Code = "test",
                    Address = "test",
                    Joint = new List<Joint> {
                        new Joint { Name="test1", JointType = 1 }
                    },
                    Remark = "hello"
                }
            }, new List<Customer>
            {
                new Customer
                {
                    Name = "test3",
                    Remark = "world",
                    Gender = 2,
                }
            }, new List<Customer>
            {
                new Customer
                {
                    Name = "test4",
                    Remark = "yes",
                    Gender = 2,
                }
            }, null, null, null, "1");

            //WorkflowDefinitionModel wfdm = WorkflowDefinitionModel.LoadByName("额度申请");
            //var workflow = wfdm.StartNew(userid, "", new WorkflowAuthority());
            ////如果流程当前处理人等于申请人,就直接审批通过,进入下一个流程
            //var task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid);
            //if (task != null)
            //{
            //    workflow.ProcessActivity(new Approval
            //    {
            //        Creator = userid,
            //        LastUpdator = userid,
            //        Remark = "test",
            //        Status = (int)ApprovalStatus.Agree,
            //        ActivityID = workflow.CurrentActivity.Value.ID,
            //        WorkflowID = workflow.Value.ID,
            //    }, userid, new WorkflowAuthority());
            //}
        }
예제 #7
0
파일: Index.cs 프로젝트: franknew/RiskMgr
        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" });
        }
예제 #8
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button16_Click(object sender, EventArgs e)
 {
     Workflow workflow = new Workflow();
     RoleBLL rolebll = new RoleBLL();
     CustomerBLL customerbll = new CustomerBLL();
     List<string> ids = rolebll.GetUserSubUserIDs("13");
     CustomerQueryForm form = new CustomerQueryForm();
     form.Creators = ids;
     var list = customerbll.Query(form);
     PagingEntity<Customer> paggingList = new PagingEntity<Customer>();
     paggingList.Record = list;
     paggingList.PageCount = form.PageCount;
     paggingList.RecordCount = form.RecordCount;
 }
예제 #9
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button25_Click(object sender, EventArgs e)
 {
     Workflow wf = new Workflow();
     RoleBLL bll = new RoleBLL();
     bll.UpdateRole(new AddRoleServiceForm
     {
         Authority = new List<AuthorityNodeForCheck>
         {
             new AuthorityNodeForCheck
             {
                 ID = "1",
                 Checked = true,
             },
             new AuthorityNodeForCheck
             {
                 ID="2",
                 Checked = true,
             }
         },
         ID = "3",
     });
     var roles = bll.Query(new RoleQueryForm { ID = "3" });
 }
예제 #10
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button22_Click(object sender, EventArgs e)
 {
     Workflow wf = new Workflow();
     RoleBLL bll = new RoleBLL();
     bll.UpdateRole(new AddRoleServiceForm
     {
         ID = "be7c181f2e194a57bc66abcf1cd1e374",
     });
     var roles = bll.Query(new RoleQueryForm { ID = "be7c181f2e194a57bc66abcf1cd1e374" });
 }
예제 #11
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button21_Click(object sender, EventArgs e)
 {
     Workflow wf = new Workflow();
     //RoleBLL bll = new RoleBLL();
     //bll.AddRole(new AddRoleServiceForm
     //{
     //    Name = "testrole",
     //    ParentID = "2",
     //    CanManageEmployeeAndAuth = true,
     //    CanApply = true,
     //    CanManageAsset = true,
     //});
     //var roles = bll.Query(new RoleQueryForm { Name = "testrole" });
     RoleBLL rolebll = new RoleBLL();
     var roles = rolebll.Query(new RoleQueryForm { ID="14" }).ToList<Role>();
     Role_Module_ActionDao dao = new Role_Module_ActionDao();
     string actionID = "3";
     string moduleID = "4";
     Role_Module_ActionQueryForm query = new Role_Module_ActionQueryForm
     {
         ActionID = actionID,
         ModuleID = moduleID
     };
     var role_module_action = dao.Query(query);
     bool hasRight = false;
     foreach (var item in role_module_action)
     {
         if (roles != null && roles.Exists(t => t.ID == item.RoleID))
         {
             hasRight = true;
             break;
         }
     }
 }
예제 #12
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button20_Click(object sender, EventArgs e)
 {
     Workflow workflow = new Workflow();
     ProjectBLL bll = new ProjectBLL();
     //bll.FinanceConfirm("3ed1b947f1d9401fa1b799a802d9d00a", "14", null, null, null, null, null, null, null);
 }
예제 #13
0
파일: Index.cs 프로젝트: franknew/RiskMgr
        private void button1_Click(object sender, EventArgs e)
        {
            //string dt = "{\"dt\":\"2010-01-01\"}";
            //string dt1 = "{\"2010-01-01\"}";
            //jsonTest t = JsonHelper.Deserialize<jsonTest>(dt);
            //var t1 = JsonHelper.Deserialize<DateTime?>(dt1);
            Workflow wf = new Workflow();
            RoleBLL rolebll = new RoleBLL();
            //AssetBLL assetbll = new AssetBLL();

            //var list = rolebll.GetUserSubUserIDs("13");
            //var roles = assetbll.Query(new AssetQueryForm
            //{
            //    Creators = list,
            //});
            //LogonRequest request = new LogonRequest();
            //request.form = new LogonServiceForm
            //{
            //    username = "******",
            //    password = "******",
            //};
            //var response = SDKFactory.Client.Execute(request);
            //token = response.form.token;
            //MessageBox.Show(response.ResponseBody);
            LogonBLL bll = new LogonBLL();
            var result = bll.Logon("admin", "123456");
            token = result.token;
        }
예제 #14
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button18_Click(object sender, EventArgs e)
 {
     Workflow workflow = new Workflow();
     ProjectBLL bll = new ProjectBLL();
     bll.UpdateFinance("a074c5e65c96481db5af54dfd4f75f86", new Project
     {
         RefundAccount = "1",
         RefundBankName = "11",
         RefundDate = DateTime.Now,
         RefundMoney = 1,
         RefundName = "111",
         PaymentName = "2",
         PaymentAccount = "22",
         PaymentBankName = "222",
         PaymentDate = DateTime.Now,
         PaymentMoney = 2,
         ID = textBox1.Text,
     }, "14");
 }
예제 #15
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button17_Click(object sender, EventArgs e)
 {
     Workflow workflow = new Workflow();
     ProjectBLL bll = new ProjectBLL();
     bll.UpdateTracking(new UpdateTrackingServiceForm
     {
         LastUpdator = "7",
         ChangeOwnerRemark = "",
         MortgageRemark = "",
         NewAssetDate = new DateTime(2016, 1, 4),
         LogoutAssetTime = new DateTime(2016, 1, 4),
         ChangeOwnerProfileTime = new DateTime(2016, 1, 5),
         ChangeOwnerProfileCode = "9C-416001002",
         ID = textBox1.Text,
     }, "30590d6bcda743f9a4490e73b9d92fb3", "7");
 }
예제 #16
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button26_Click(object sender, EventArgs e)
 {
     Workflow wf = new Workflow();
     LogonBLL bll = new LogonBLL();
     var result = bll.Logon(textBox1.Text);
 }
예제 #17
0
        private static WorkflowModel BuildWorkflow(Workflow workflow, List<Activity> activities, List<Link> links,
            List<ActivityAuth> authes, List<Approval> approvals, List<Task> tasks)
        {
            if (workflow == null) throw new Exception("workflow不能为null");
            List<ActivityModel> activityInstanceList = new List<ActivityModel>();
            List<LinkModel> linkModelList = new List<LinkModel>();
            var activityList = activities.FindAll(t => t.WorkflowID.Equals(workflow.ID));
            var linkList = links.FindAll(t => t.WorkflowID.Equals(workflow.ID));
            var authList = authes.FindAll(t => t.WorkflowID.Equals(workflow.ID));
            var approvalList = approvals.FindAll(t => t.WorkflowID.Equals(workflow.ID));
            var taskList = tasks.FindAll(t => t.WorkflowID.Equals(workflow.ID));
            WorkflowModel model = new WorkflowModel
            {
                value = workflow,
                Approval = approvalList,
            };
            bool foundRoot = false;
            bool foundTail = false;
            foreach (var link in linkList)
            {
                linkModelList.Add(new LinkModel
                {
                    Value = link,
                });
            }
            foreach (var activity in activityList)
            {
                //pre link
                var preLink = linkModelList.FindAll(t => t.Value != null && t.Value.ToAcivityID == activity.ID);
                //next link
                var nextLink = linkModelList.FindAll(t => t.Value != null && t.Value.FromActivityID == activity.ID);

                var activityInstance = new ActivityModel
                {
                    Value = activity,
                    Approvals = model.Approval.FindAll(t => t.ActivityID == activity.ID),
                    PreLinks = preLink,
                    NextLinks = nextLink,
                    Tasks = tasks.FindAll(t => t.ActivityID == activity.ID),
                    OwnerWorkflow = model,
                };

                //处理权限
                var activityauth = authList.FindAll(t => t.ActivityID == activity.ID);
                activityInstance.Auth.AddRange(activityauth);
                //给审批排序
                activityInstance.Approvals.Sort((l, r) =>
                {
                    if (l.CreateTime > l.CreateTime) return 1;
                    else return 0;
                });
                if (!foundRoot && preLink.Count == 0)
                {
                    model.Root = activityInstance;
                    foundRoot = true;
                }
                if (!foundTail && nextLink.Count == 0)
                {
                    model.Tail = activityInstance;
                    foundTail = true;
                }
                activityInstanceList.Add(activityInstance);
            }
            return model;
        }
예제 #18
0
파일: Index.cs 프로젝트: franknew/RiskMgr
 private void button12_Click(object sender, EventArgs e)
 {
     //QueryMyApplyRequest request = new QueryMyApplyRequest();
     //request.token = token;
     //var response = SDKFactory.Client.Execute(request);
     //MessageBox.Show(response.ResponseBody);
     Workflow workflow = new Workflow();
     RoleBLL rolebll = new RoleBLL();
     ProjectBLL projectbll = new ProjectBLL();
     var list = rolebll.GetUserSubUserIDs("14");
     var data = projectbll.QueryMyApply(new QueryMyApplyServiceForm { Creators = list });
 }