public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            if (string.IsNullOrWhiteSpace(entity["RoleId"]))
            {
                throw new ArgumentNullException("RoleId");
            }
            /*基本查询语句*/
            var sql = @"SELECT a.* FROM WF_M_USER a where 1=1";

            /*查询条件*/

            sql += " and a.UserId not in (select UserId from WF_M_USERROLE where RoleId=@RoleId)";
            sql += " order by a.UserName";
            using (var db = Pub.DB)
            {
                var parameters = new
                {
                    DeptId       = string.Format("%{0}%", entity["DeptId"]),
                    RoleId       = entity["RoleId"],
                    EmployeeName = string.Format("%{0}%", entity["EmployeeName"])
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_M_USER>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
Ejemplo n.º 2
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            try
            {
                /*基本查询语句*/
                var sql = @"select a.* from WF_M_RES a where 1=1";

                /*查询条件*/
                if (!string.IsNullOrWhiteSpace(entity["ResId"]))
                {
                    sql += " and a.ResId like @ResId";
                }
                sql += " order by a.ResId";
                using (var db = Pub.DB)
                {
                    var parameters = new
                    {
                        ResId = string.Format("%{0}%", entity["ResId"])
                    };
                    vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                    var list = db.Query <VM_WF_M_RES>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                    vm.rows = list;
                    return(DFPub.EXECUTE_SUCCESS);
                }
            }
            catch (Exception ex)
            {
                vm.hasError = true;
                vm.error    = ex.Message;
                message     = ex.Message;
                return(DFPub.EXECUTE_ERROR);
            }
        }
Ejemplo n.º 3
0
 public static List <VM_WF_M_USER> GetList(DFDictionary dict, ref int count, int start, int limit)
 {
     using (var db = Pub.DB)
     {
         var sql = @"select u.*,d.DeptName from WF_M_USER u
                     left join WF_M_DEPT d on d.DeptId=u.DeptId
                 where 1=1";
         if (!string.IsNullOrWhiteSpace(dict["UserId"]))
         {
             sql += " and u.UserId=@UserId";
         }
         if (!string.IsNullOrWhiteSpace(dict["UserName"]))
         {
             sql += " and u.UserName like @UserName";
         }
         if (!string.IsNullOrWhiteSpace(dict["DeptId"]))
         {
             sql += " and d.DeptId=@DeptId";
         }
         sql += " order by u.LastModifyTime desc";
         var parameters = new
         {
             UserId   = dict["UserId"],
             DeptId   = dict["DeptId"],
             UserName = string.Format("%{0}%", dict["UserName"])
         };
         count = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
         return(db.Query <VM_WF_M_USER>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList());
     }
 }
        public static List <VM_WF_T_INSTANCE> GetReimbursement(DFDictionary dict, ref int count, int start, int limit)
        {
            using (var db = Pub.DB)
            {
                var sql = @"
select * from wf_t_instance a
where a.modelid='09ec1ea5-9ed7-4c62-8563-cc82db23afa9'
and a.InstanceStatus='Finished'
and not exists (select 1 from xdsw_t_certificate_d c where c.InstanceId=a.InstanceId)
 ";
                if (!string.IsNullOrWhiteSpace(dict["InstanceId"]))
                {
                    sql += " and a.InstanceId like @InstanceId";
                }

                sql += " order by a.InstanceId desc";
                var parameters = new
                {
                    InstanceId = string.Format("%{0}%", dict["InstanceId"])
                };
                count = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_T_INSTANCE>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                return(list);
            }
        }
Ejemplo n.º 5
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            try
            {
                /*基本查询语句*/
                var sql = @"select a.*,(case when c.RoleId is not null then 1 else 0 end) as selected from WF_M_ROLE a
LEFT OUTER JOIN WF_M_USERROLE c ON a.RoleId=c.RoleId AND c.UserId=@UserId";

                sql += " order by a.RoleId";

                using (var db = Pub.DB)
                {
                    var parameters = new
                    {
                        UserId = entity["UserId"]
                    };
                    vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                    var list = db.Query <VM_WF_M_ROLE>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                    vm.rows = list;
                    return(DFPub.EXECUTE_SUCCESS);
                }
            }
            catch (Exception ex)
            {
                vm.hasError = true;
                vm.error    = ex.Message;
                message     = ex.Message;
                return(DFPub.EXECUTE_ERROR);
            }
        }
        public static void GetList(DFDictionary entity, DataGridVM vm, int start, int limit)
        {
            using (var db = Pub.DB)
            {
                var sql = @"select a.InstanceId,a.InstanceStepId,a.StepId,a.StepName,a.InstanceStepStatus,b.ExecutorId,b.ExecutorName,
b.ExecuteResult,b.ExecuteStatus,b.ExecuteComment,b.Memo,b.LastModifyTime,b.LastModifyUser,c.ChineseName,b.Extend01 as AdditionalApprove
FROM WF_T_INSTANCESTEP a
left outer join WF_T_INSTANCESTEPEXECUTOR b on a.InstanceStepId=b.InstanceStepId 
LEFT OUTER JOIN dbo.WF_M_USER c ON b.ExecutorId=c.UserId
WHERE 1=1";
                sql += " and a.InstanceId=@InstanceId";
                sql += " order by a.CreateTime desc,b.CreateTime desc";
                var parameters = new
                {
                    InstanceId = entity["InstanceId"]
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_T_INSTANCESTEP>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                list.ForEach(a =>
                {
                    if (!string.IsNullOrWhiteSpace(a.AdditionalApprove))
                    {
                        a.StepName = string.Format("{0}-{1}", a.StepName, a.AdditionalApprove.Replace("来源".GetRes(), string.Empty));
                    }
                });
                vm.rows = list;
            }
        }
Ejemplo n.º 7
0
        public static List <VM_WF_M_USERDEPT> GetListForUpdate(DFDictionary dict, ref int count, int start, int limit)
        {
            using (var db = Pub.DB)
            {
                var sql = @"select a.*,(case when c.DeptId is not null then 1 else 0 end) as selected from WF_M_DEPT a
LEFT OUTER JOIN WF_M_USERDEPT c ON a.DeptId=c.DeptId AND c.UserId=@UserId";
                if (!string.IsNullOrWhiteSpace(dict["UserDeptId"]))
                {
                    sql += " and c.UserDeptId=@UserDeptId";
                }
                if (!string.IsNullOrWhiteSpace(dict["UserId"]))
                {
                    sql += " and c.UserId=@UserId";
                }
                if (!string.IsNullOrWhiteSpace(dict["DeptId"]))
                {
                    sql += " and c.DeptId=@DeptId";
                }
                sql += " order by a.Extend01";
                var parameters = new
                {
                    UserDeptId = dict["UserDeptId"],
                    UserId     = dict["UserId"],
                    DeptId     = dict["DeptId"]
                };
                count = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();

                return(db.Query <VM_WF_M_USERDEPT>(DFPub.GetPageSql(db, sql, start + 1, start + limit), parameters).ToList());
            }
        }
Ejemplo n.º 8
0
        public static List <VM_WF_M_USERDEPT> GetList(DFDictionary dict, ref int count, int start, int limit)
        {
            using (var db = Pub.DB)
            {
                var sql = "select * from WF_M_USERDEPT where 1=1";
                if (!string.IsNullOrWhiteSpace(dict["UserDeptId"]))
                {
                    sql += " and UserDeptId=@UserDeptId";
                }
                if (!string.IsNullOrWhiteSpace(dict["UserId"]))
                {
                    sql += " and UserId=@UserId";
                }
                if (!string.IsNullOrWhiteSpace(dict["DeptId"]))
                {
                    sql += " and DeptId=@DeptId";
                }
                sql += " order by LastModifyTime desc";
                var parameters = new
                {
                    UserDeptId = dict["UserDeptId"],
                    UserId     = dict["UserId"],
                    DeptId     = dict["DeptId"]
                };
                count = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();

                return(db.Query <VM_WF_M_USERDEPT>(DFPub.GetPageSql(db, sql, start + 1, start + limit), parameters).ToList());
            }
        }
Ejemplo n.º 9
0
        public static List <VM_WF_M_ROLE_MODEL> GetList(DFDictionary dict, ref int count, int start, int limit)
        {
            using (var db = Pub.DB)
            {
                var sql = @"select rm.*,m.modelname,r.rolename from WF_M_ROLE_MODEL rm
                    left join wf_m_model m on rm.modelid=m.modelid
                    left join wf_m_role r on r.roleid=rm.roleid        
                    where 1=1";
                if (!string.IsNullOrWhiteSpace(dict["ModelId"]))
                {
                    sql += " and rm.ModelId=@ModelId";
                }
                if (!string.IsNullOrWhiteSpace(dict["RoleId"]))
                {
                    sql += " and rm.RoleId=@RoleId";
                }
                sql += " order by m.ModelName";
                var parameters = new
                {
                    ModelId = dict["ModelId"],
                    RoleId  = dict["RoleId"]
                };
                count = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();

                return(db.Query <VM_WF_M_ROLE_MODEL>(DFPub.GetPageSql(db, sql, start + 1, start + limit), parameters).ToList());
            }
        }
Ejemplo n.º 10
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            if (entity["action"] == "querylist")
            {
                vm.rows = WF_M_PUBLICCODELoader.Query(entity["CodeType"]).Select(a =>
                                                                                 new WFItem()
                {
                    text = a.CodeName, value = string.Format("{0}{1}", a.CodeValue, a.CodeLongValue)
                }).ToList();
                return(DFPub.EXECUTE_SUCCESS);
            }


            /*基本查询语句*/
            var sql = @"select a.* from WF_M_PUBLICCODE a where 1=1";

            /*查询条件*/
            if (!string.IsNullOrWhiteSpace(entity["CodeType"]))
            {
                sql += " and a.CodeType like @CodeType";
            }
            sql += " order by a.CodeType";
            using (var db = Pub.DB)
            {
                var parameters = new
                {
                    CodeType = string.Format("%{0}%", entity["CodeType"])
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <WF_M_PUBLICCODE>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
Ejemplo n.º 11
0
 public static void GetList(DFDictionary entity, DataGridVM vm, int start, int limit, string userId)
 {
     using (var db = Pub.DB)
     {
         var sql = @"select a.*,user1.ChineseName + ISNULL('[' + user2.ChineseName + ' 代理申请]','') AS ChineseName,dept.DeptDisplayText
         from WF_T_INSTANCE a
         LEFT OUTER JOIN dbo.WF_M_USER user1 ON a.Requestor=user1.UserId
         LEFT OUTER JOIN dbo.WF_M_DEPT dept ON dept.DeptId = user1.DeptId
         LEFT OUTER JOIN dbo.WF_M_USER user2 ON a.RequestorProxy=user2.UserId
         WHERE 1=1";
         //var sql = @"select * from v_ad_mywf a where 1=1 ";
         sql += " and (a.Requestor=@UserId or a.RequestorProxy=@UserId)";
         if (!string.IsNullOrWhiteSpace(entity["InstanceStatus"]))
         {
             sql += " and a.InstanceStatus in @InstanceStatus";
         }
         if (!string.IsNullOrWhiteSpace(entity["InstanceId"]))
         {
             sql += " and a.InstanceId like @InstanceId";
         }
         if (!string.IsNullOrWhiteSpace(entity["ModelName"]))
         {
             sql += " and a.ModelName like @ModelName";
         }
         if (!string.IsNullOrWhiteSpace(entity["RequestTimeFrom"]))
         {
             sql += " and a.RequestTime>=@RequestTimeFrom";
         }
         if (!string.IsNullOrWhiteSpace(entity["RequestTimeTo"]))
         {
             sql += " and a.RequestTime<=@RequestTimeTo";
         }
         if (!string.IsNullOrWhiteSpace(entity["AFENumber"]))
         {
             sql += " and a.AFENumber like @AFENumber";
         }
         if (!string.IsNullOrWhiteSpace(entity["ProjectName"]))
         {
             sql += " and a.ProjectName like @ProjectName";
         }
         sql += " order by a.LastModifyTime desc";
         var parameters = new
         {
             UserId          = userId,
             InstanceStatus  = entity["InstanceStatus"].Split(',').ToList(),
             InstanceId      = string.Format("%{0}%", entity["InstanceId"]),
             ModelName       = string.Format("%{0}%", entity["ModelName"]),
             RequestTimeFrom = ParseHelper.ParseDate(entity["RequestTimeFrom"]).GetValueOrDefault().ToString("yyyy-MM-dd"),
             RequestTimeTo   = ParseHelper.ParseDate(entity["RequestTimeTo"]).GetValueOrDefault().ToString("yyyy-MM-dd 23:59:59.999"),
             AFENumber       = string.Format("%{0}%", entity["AFENumber"].ToUpper()),
             ProjectName     = string.Format("%{0}%", entity["ProjectName"])
         };
         vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
         var list = db.Query <VM_WF_T_INSTANCE>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
         vm.rows = list;
     }
 }
Ejemplo n.º 12
0
        public static void GetList(DFDictionary entity, DataGridVM vm, int start, int limit, string userId, string additionalSql = "")
        {
            using (var db = Pub.DB)
            {
                var sql = @"select a.*,b.Requestor,b.RequestorName,b.RequestorProxy,b.RequestorProxyName,b.InstanceStatus,b.RequestTime
                ,user1.ChineseName + ISNULL('[' + user2.ChineseName + ' 代理申请]','') AS ChineseName,dept.DeptDisplayText
                from WF_T_INSTANCESTEPEXECUTOR a left outer join WF_T_INSTANCE b on a.InstanceId=b.InstanceId
                LEFT OUTER JOIN dbo.WF_M_USER user1 ON b.Requestor=user1.UserId
                LEFT OUTER JOIN dbo.WF_M_DEPT dept ON dept.DeptId = user1.DeptId
                LEFT OUTER JOIN dbo.WF_M_USER user2 ON b.RequestorProxy=user2.UserId
                WHERE 1=1";

                //var sql = @"select * from v_ad_mytask a where 1=1 ";
                sql += " and a.ExecutorId=@UserId";
                if (!string.IsNullOrWhiteSpace(entity["ExecuteStatus"]))
                {
                    sql += " and a.ExecuteStatus in @ExecuteStatus";
                }
                if (!string.IsNullOrWhiteSpace(entity["InstanceId"]))
                {
                    sql += " and a.InstanceId like @InstanceId";
                }
                if (!string.IsNullOrWhiteSpace(entity["ModelName"]))
                {
                    sql += " and a.ModelName like @ModelName";
                }
                if (!string.IsNullOrWhiteSpace(entity["AFENumber"]))
                {
                    sql += " and a.AFENumber like @AFENumber";
                }
                if (!string.IsNullOrWhiteSpace(entity["ProjectName"]))
                {
                    sql += " and a.ProjectName like @ProjectName";
                }
                if (!string.IsNullOrWhiteSpace(entity["RequestorName"]))
                {
                    sql += " and a.RequestorName like @RequestorName";
                }
                sql += additionalSql;
                sql += " order by a.LastModifyTime desc";
                var parameters = new
                {
                    UserId        = userId,
                    ExecuteStatus = entity["ExecuteStatus"].Split(',').ToList(),
                    InstanceId    = string.Format("%{0}%", entity["InstanceId"]),
                    ModelName     = string.Format("%{0}%", entity["ModelName"]),
                    AFENumber     = string.Format("%{0}%", entity["AFENumber"].ToUpper()),
                    ProjectName   = string.Format("%{0}%", entity["ProjectName"]),
                    RequestorName = string.Format("%{0}%", entity["RequestorName"])
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_T_INSTANCESTEPEXECUTOR>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                list.ForEach(a => a.InstanceStatus = a.InstanceStatus.GetRes());
                vm.rows = list;
            }
        }
Ejemplo n.º 13
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            if (entity["action"] == "querylist")
            {
                if (entity["subAction"] == "queryVariables")
                {
                    var data1 = WFBusinessData.AddPrefix("WF_T_INSTANCE_", WFBusinessData.CreateInstance <WF_T_INSTANCE>(new WFInstance()));
                    var data2 = WFBusinessData.AddPrefix("WF_T_INSTANCESTEP_", WFBusinessData.CreateInstance <WF_T_INSTANCESTEP>(new WFInstanceStep()));
                    var data3 = WFBusinessData.AddPrefix("WF_T_INSTANCESTEPEXECUTOR_", WFBusinessData.CreateInstance <WF_T_INSTANCESTEPEXECUTOR>(new WF_T_INSTANCESTEPEXECUTOR()));
                    WFBusinessData.Merge(data2, data1);
                    WFBusinessData.Merge(data3, data1);
                    var businessData = data1;
                    vm.rows = businessData.Keys.OrderBy(a => a).Select(a => new WFItem()
                    {
                        text = string.Format("@{0}", a), value = string.Format("@{0}", a)
                    }).ToList();
                    return(DFPub.EXECUTE_SUCCESS);
                }
                else
                {
                    var list  = new List <WFItem>();
                    var model = WFDA.Instance.GetModelById(entity["ModelId"]);
                    if (model != null)
                    {
                        list.Add(new WFItem()
                        {
                            text = model.ModelName, value = string.Format("{0}", model.ModelName).Trim()
                        });
                    }
                    list.AddRange(WFDA.Instance.GetSteps(entity["ModelId"]).Select(a =>
                                                                                   new WFItem()
                    {
                        text = a.StepName, value = string.Format("{0}", a.StepName).Trim()
                    }).ToList());

                    vm.rows = list;
                    return(DFPub.EXECUTE_SUCCESS);
                }
            }
            using (var db = Pub.DB)
            {
                var sql = "select * from WF_M_STEP where 1=1";
                sql += " and ModelId=@ModelId";
                sql += " order by StepOrder";
                var parameters = new
                {
                    ModelId = entity["ModelId"]
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_M_STEP>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
Ejemplo n.º 14
0
 public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
 {
     using (var db = Pub.DB)
     {
         var sql        = "select * from WF_M_MODEL where 1=1";
         var parameters = new
         {
         };
         sql       += " order by ModelName";
         vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
         var list = db.Query <VM_WF_M_MODEL>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
         vm.rows = list;
         return(DFPub.EXECUTE_SUCCESS);
     }
 }
Ejemplo n.º 15
0
        public static List <WF_M_DEPT> GetList(DFDictionary dict, ref int count, int start, int limit)
        {
            using (var db = Pub.DB)
            {
                var sql = "select * from WF_M_DEPT where 1=1";

                var parameters = new
                {
                    DeptId   = QueryBuilder.Like(ref sql, dict, "DeptId", "DeptId"),
                    DeptName = QueryBuilder.Like(ref sql, dict, "DeptName", "DeptName")
                };
                sql  += " order by LastModifyTime desc";
                count = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();

                return(db.Query <WF_M_DEPT>(DFPub.GetPageSql(db, sql, start + 1, start + limit), parameters).ToList());
            }
        }
Ejemplo n.º 16
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            var currentUser = Util.GetCurrentUser();

            if (!string.IsNullOrWhiteSpace(entity["MsgId"]))
            {
                MsgCenter.MarkRead(new List <string>()
                {
                    entity["MsgId"]
                }, currentUser.UserName);
                MsgCenter.RefreshUserMessage(currentUser.UserId);
                return(EmptyQuery(vm));
            }
            using (var db = Pub.DB)
            {
                var sql = "select * from WF_T_MSG where 1=1";
                sql += " and UserId=@UserId";

                if (!string.IsNullOrWhiteSpace(entity["IsRead"]))
                {
                    sql += " and IsRead=@IsRead";
                }
                if (!string.IsNullOrWhiteSpace(entity["CreateTimeFrom"]))
                {
                    sql += " and CreateTime>=@CreateTimeFrom";
                }
                if (!string.IsNullOrWhiteSpace(entity["CreateTimeTo"]))
                {
                    sql += " and CreateTime<=@CreateTimeTo";
                }
                sql += " order by CreateTime desc";

                var parameters = new
                {
                    UserId         = currentUser.UserId,
                    IsRead         = ParseHelper.ParseInt(entity["IsRead"]).GetValueOrDefault(),
                    CreateTimeFrom = ParseHelper.ParseDate(entity["CreateTimeFrom"]).GetValueOrDefault(),
                    CreateTimeTo   = ParseHelper.ParseDate(entity["CreateTimeTo"]).GetValueOrDefault().AddDays(1).AddSeconds(-1),
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_T_MSG>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
Ejemplo n.º 17
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            /*基本查询语句*/
            var sql = @"select * from WF_T_LOG where 1=1";

            /*查询条件*/
            if (!string.IsNullOrWhiteSpace(entity["FuncModule"]))
            {
                sql += " and FuncModule like @FuncModule";
            }
            if (!string.IsNullOrWhiteSpace(entity["LogLevel"]))
            {
                sql += " and LogLevel like @LogLevel";
            }
            if (!string.IsNullOrWhiteSpace(entity["UserName"]))
            {
                sql += " and UserName like @UserName";
            }
            if (!string.IsNullOrWhiteSpace(entity["CreateTimeFrom"])) // 日志时间从
            {
                sql += " and CreateTime>=@CreateTimeFrom";
            }

            if (!string.IsNullOrWhiteSpace(entity["CreateTimeTo"])) // 日志时间到
            {
                sql += " and CreateTime<=@CreateTimeTo";
            }
            sql += " order by CreateTime desc";
            using (var db = Pub.DB)
            {
                var parameters = new
                {
                    FuncModule     = string.Format("%{0}%", entity["FuncModule"]),
                    UserName       = string.Format("%{0}%", entity["UserName"]),
                    LogLevel       = string.Format("%{0}%", entity["LogLevel"]),
                    CreateTimeFrom = ParseHelper.ParseDate(entity["CreateTimeFrom"]).GetValueOrDefault(),
                    CreateTimeTo   = ParseHelper.ParseDate(entity["CreateTimeTo"]).GetValueOrDefault().AddDays(1).AddSeconds(-1),
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <WF_T_LOG>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
Ejemplo n.º 18
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            using (var db = Pub.DB)
            {
                var sql = "select * from WF_M_STEPEXECUTOR where 1=1";

                sql += " and ModelId=@ModelId and StepId=@StepId";
                sql += " order by ExecutorPriority";
                var parameters = new
                {
                    ModelId = entity["ModelId"],
                    StepId  = entity["StepId"]
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_M_STEPEXECUTOR>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
Ejemplo n.º 19
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            using (var db = Pub.DB)
            {
                var sql = @"select a.*,b.Requestor,b.RequestorName,b.RequestorProxy,b.RequestorProxyName,b.InstanceStatus,b.RequestTime
                from WF_T_INSTANCESTEPEXECUTOR a left outer join WF_T_INSTANCE b on a.InstanceId=b.InstanceId where 1=1";

                //var sql = @"select * from v_ad_alltask a where 1=1 ";
                if (!string.IsNullOrWhiteSpace(entity["ExecuteStatus"]))
                {
                    sql += " and a.ExecuteStatus in @ExecuteStatus";
                }
                if (!string.IsNullOrWhiteSpace(entity["InstanceId"]))
                {
                    sql += " and a.InstanceId like @InstanceId";
                }
                if (!string.IsNullOrWhiteSpace(entity["ModelName"]))
                {
                    sql += " and a.ModelName like @ModelName";
                }
                if (!string.IsNullOrWhiteSpace(entity["AFENumber"]))
                {
                    sql += " and a.AFENumber like @AFENumber";
                }
                if (!string.IsNullOrWhiteSpace(entity["ProjectName"]))
                {
                    sql += " and a.ProjectName like @ProjectName";
                }
                sql += " order by a.LastModifyTime desc";
                var parameters = new
                {
                    ExecuteStatus = entity["ExecuteStatus"].Split(',').ToList(),
                    InstanceId    = string.Format("%{0}%", entity["InstanceId"]),
                    ModelName     = string.Format("%{0}%", entity["ModelName"]),
                    AFENumber     = string.Format("%{0}%", entity["AFENumber"].ToUpper()),
                    ProjectName   = string.Format("%{0}%", entity["ProjectName"]),
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_T_INSTANCESTEPEXECUTOR>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
        public static List <VM_XDSW_T_FILE> GetList(DFDictionary dict, ref int count, int start, int limit)
        {
            using (var db = Pub.DB)
            {
                var sql = "select * from XDSW_T_FILE where 1=1";
                if (!string.IsNullOrWhiteSpace(dict["FileId"]))
                {
                    sql += " and FileId=@FileId";
                }
                sql += " order by LastModifyTime desc";
                var parameters = new
                {
                    FileId = dict["FileId"]
                };
                count = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();

                return(db.Query <VM_XDSW_T_FILE>(DFPub.GetPageSql(db, sql, start + 1, start + limit), parameters).ToList());
            }
        }
Ejemplo n.º 21
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            /*基本查询语句*/
            var sql = @"SELECT a.*,b.UserName FROM WF_M_USERROLE a
JOIN WF_M_USER b ON a.UserId=b.UserId
WHERE 1=1";

            /*查询条件*/
            sql += " and a.RoleId=@RoleId";
            sql += " order by b.UserName";

            using (var db = Pub.DB)
            {
                var parameters = new { RoleId = entity["RoleId"] };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_M_USERROLE>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            using (var db = Pub.DB)
            {
                var sql = @"select a.*,b.StepName as FromStepName,c.StepName as ToStepName from WF_M_CONNECTOR a 
left outer join WF_M_STEP b on a.FromStepId=b.StepId 
left outer join WF_M_STEP c on a.ToStepId=c.StepId 
where 1=1";
                sql += " and a.ModelId=@ModelId";
                var parameters = new
                {
                    ModelId = entity["ModelId"]
                };
                sql       += " order by b.StepOrder";
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_M_CONNECTOR>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
Ejemplo n.º 23
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            try
            {
                /*基本查询语句*/
                var sql = @"select a.*,b.DeptName from WF_M_USER a left outer join WF_M_DEPT b on a.DeptId=b.DeptId where 1=1";

                /*查询条件*/
                if (!string.IsNullOrWhiteSpace(entity["UserName"]))
                {
                    sql += " and a.UserName like @UserName";
                }
                sql += " order by a.UserName";
                using (var db = Pub.DB)
                {
                    var parameters = new
                    {
                        UserName = string.Format("%{0}%", entity["UserName"])
                    };
                    vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                    var list = db.Query <VM_WF_M_USER>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                    list.ForEach(a =>
                    {
                        a.Roles = string.Join(",", UserRoleLoader.QueryByUserId(a.UserId).Where(b => !string.IsNullOrWhiteSpace(b.RoleName)).Select(b => b.RoleName));
                    });
                    vm.rows = list;
                    return(DFPub.EXECUTE_SUCCESS);
                }
            }
            catch (Exception ex)
            {
                vm.hasError = true;
                vm.error    = ex.Message;
                message     = ex.Message;
                return(DFPub.EXECUTE_ERROR);
            }
        }
Ejemplo n.º 24
0
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            using (var db = Pub.DB)
            {
                var sql = "select * from WF_M_MODEL where 1=1";
                //sql += " and ModelId in @ModelId";
                if (!string.IsNullOrWhiteSpace(entity["ModelName"]))
                {
                    sql += " and ModelName like @ModelName";
                }
                var parameters = new
                {
                    ModelName = string.Format("%{0}%", entity["ModelName"]),
                    //ModelId = WF_M_ROLE_MODELLoader.GetRoleModel(Util.GetCurrentUser().UserId)
                };

                sql       += " order by ModelName";
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <WF_M_MODEL>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                list.ForEach(a => a.ModelName = a.ModelName.GetRes());
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
Ejemplo n.º 25
0
        public static List <VM_WF_M_METADATA> GetList(DFDictionary dict, ref int count, int start, int limit)
        {
            using (var db = Pub.DB)
            {
                var sql = "select * from WF_M_METADATA where 1=1";
                if (!string.IsNullOrWhiteSpace(dict["TableName"]))
                {
                    sql += " and TableName=@TableName";
                }
                if (!string.IsNullOrWhiteSpace(dict["ColumnName"]))
                {
                    sql += " and ColumnName=@ColumnName";
                }
                sql += " order by LastModifyTime desc";
                var parameters = new
                {
                    TableName  = dict["TableName"],
                    ColumnName = dict["ColumnName"]
                };
                count = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();

                return(db.Query <VM_WF_M_METADATA>(DFPub.GetPageSql(db, sql, start + 1, start + limit), parameters).ToList());
            }
        }
        public override int Query(FormM form, DFDictionary entity, DataGridVM vm, int start, int limit, ref string message)
        {
            using (var db = Pub.DB)
            {
                var sql = @"select ins.*,u.chinesename,u.EmployeeId from WF_T_INSTANCE ins 
            left join wf_m_user u on ins.Requestor=u.userid
                  left join wf_m_userdept ud on  u.deptid=ud.deptid
                where 1=1 and ud.UserId=@UserId";
                if (!string.IsNullOrWhiteSpace(entity["DeptId"]))
                {
                    sql += " and ud.DeptId in (SELECT DeptId FROM dbo.WF_M_DEPT WHERE DeptLabel LIKE (SELECT DeptLabel+'%' FROM dbo.WF_M_DEPT WHERE DeptId=@DeptId))";
                }
                if (!string.IsNullOrWhiteSpace(entity["InstanceStatus"]))
                {
                    sql += " and InstanceStatus in @InstanceStatus";
                }
                if (!string.IsNullOrWhiteSpace(entity["InstanceId"]))
                {
                    sql += " and InstanceId like @InstanceId";
                }
                if (!string.IsNullOrWhiteSpace(entity["ModelName"]))
                {
                    sql += " and ModelName like @ModelName";
                }
                if (!string.IsNullOrWhiteSpace(entity["RequestTimeFrom"]))
                {
                    sql += " and RequestTime>=@RequestTimeFrom";
                }
                if (!string.IsNullOrWhiteSpace(entity["RequestTimeTo"]))
                {
                    sql += " and RequestTime<=@RequestTimeTo";
                }
                if (!string.IsNullOrWhiteSpace(entity["RequestorName"]))
                {
                    sql += " and (RequestorName like @RequestorName or u.EmployeeId like @RequestorName or u.ChineseName like @RequestorName)";
                }
                if (!string.IsNullOrWhiteSpace(entity["EndDateFrom"]))
                {
                    sql += " and (ins.instancestatus='Finished' and ins.lastmodifytime>=@EndDateFrom)";
                }
                if (!string.IsNullOrWhiteSpace(entity["EndDateTo"]))
                {
                    sql += " and (ins.instancestatus='Finished' and ins.lastmodifytime<=@EndDateTo)";
                }

                sql += " order by ins.LastModifyTime desc";
                var parameters = new
                {
                    UserId          = Util.GetCurrentUser().UserId,
                    DeptId          = entity["DeptId"],
                    InstanceStatus  = entity["InstanceStatus"].Split(',').ToList(),
                    InstanceId      = string.Format("%{0}%", entity["InstanceId"]),
                    ModelName       = string.Format("%{0}%", entity["ModelName"]),
                    RequestTimeFrom = ParseHelper.ParseDate(entity["RequestTimeFrom"]).GetValueOrDefault().ToString("yyyy-MM-dd"),
                    RequestTimeTo   = ParseHelper.ParseDate(entity["RequestTimeTo"]).GetValueOrDefault().ToString("yyyy-MM-dd 23:59:59.999"),
                    RequestorName   = "%" + entity["RequestorName"] + "%",
                    EndDateFrom     = ParseHelper.ParseDate(entity["EndDateFrom"]).GetValueOrDefault().ToString("yyyy-MM-dd"),
                    EndDateTo       = ParseHelper.ParseDate(entity["EndDateTo"]).GetValueOrDefault().ToString("yyyy-MM-dd 23:59:59.999")
                };
                vm.results = db.Query <int>(DFPub.GetCountSql(sql), parameters).FirstOrDefault();
                var list = db.Query <VM_WF_T_INSTANCE>(DFPub.GetPageSql(sql, start + 1, start + limit), parameters).ToList();
                foreach (var l in list)
                {
                    l.CurrentExecutorName = StepExecutorLoader.GetCurrentExecutorName(l.InstanceId);
                }
                vm.rows = list;
                return(DFPub.EXECUTE_SUCCESS);
            }
        }