/// <summary>
        /// 根据当前的Org信息,获取子节点
        /// </summary>
        /// <param name="orgs">如果参数为null,则返回顶级列表</param>
        /// <returns></returns>
        public PartlyCollection <WdOrg> GetChildOrg(WdOrg orgs = null)
        {
            PartlyCollection <WdOrg> result = new PartlyCollection <WdOrg>();
            string sqlCommand = string.Empty;

            if (orgs == null)
            {
                sqlCommand = "SELECT parentUnitID  ParentID,OrgID, OrgName,ShortName,[order] OrderID, FullPath FROM dbo.wd_org WHERE isRoot = 1  AND  parentStatus = 1 ORDER BY [order]";
            }
            else
            {
                sqlCommand = string.Format("SELECT parentUnitID  ParentID,OrgID, OrgName,ShortName,[order] OrderID FROM dbo.wd_org WHERE parentUnitID = {0}  AND  parentStatus = 1 ORDER BY [order]", orgs.OrgID);;
            }
            DataSet ds = DbHelper.RunSqlReturnDS(sqlCommand, ConnectionName);

            if (ds != null)
            {
                DataTable table = ds.Tables[0];
                if (table != null && table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        WdOrg view = new WdOrg();
                        ORMapping.DataRowToObject <WdOrg>(row, view);
                        result.Add(view);
                    }
                }
            }
            return(result);
        }
        /// <summary>
        /// 根据orgID获取用户信息
        /// </summary>
        /// <param name="orgid">wd_org.orgID</param>
        /// <returns></returns>
        public PartlyCollection <WD_User> GetSearchOrgUser(string orgid)
        {
            PartlyCollection <WD_User> result = new PartlyCollection <WD_User>();
            string sqlCommand = string.Empty;

            if (orgid != null)
            {
                sqlCommand = string.Format(@"
                    SELECT b.employeeCode as Wd_UserID,b.username as LoginName,b.employeeName as Name,
                    b.orgName as OrgName,b.orgID as Wd_OrgID,b.jobID as JobID,b.joinUnitDate as StartTime, NULL as EndTime,
                    b.jobName as JobTitle
                    FROM dbo.wd_user_org_rel a
                    INNER JOIN dbo.Wd_User b ON a.username = b.username
                    WHERE b.unitID ='{0}' AND a.username IS NOT NULL and b.employeeStatus='2'", SqlTextHelper.SafeQuote(orgid));
                DataSet ds = DbHelper.RunSqlReturnDS(sqlCommand, ConnectionName);
                if (ds != null)
                {
                    DataTable table = ds.Tables[0];
                    if (table != null && table.Rows.Count > 0)
                    {
                        foreach (DataRow row in table.Rows)
                        {
                            WD_User view = new WD_User();
                            ORMapping.DataRowToObject <WD_User>(row, view);
                            result.Add(view);
                        }
                    }
                }
            }
            return(result);
        }
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="keyword">用户名称</param>
        /// <param name="deptName">部门名称</param>
        /// <param name="jobName">岗位名称</param>
        /// <returns></returns>
        public PartlyCollection <WD_User> GetSearchOrgUsers(string keyword, string deptName, string jobName)
        {
            PartlyCollection <WD_User> result = new PartlyCollection <WD_User>();
            string sqlCommand = string.Empty;

            {
                sqlCommand = string.Format(@"SELECT DISTINCT  TOP(100) b.employeeCode as Wd_UserID,b.username as LoginName,b.employeeName as Name,
                                            b.orgName as OrgName,b.orgID as Wd_OrgID,b.jobID as JobID,b.joinUnitDate as StartTime, NULL as EndTime,
                                            b.jobName as JobTitle
                                            FROM dbo.Wd_User b
                                            WHERE (b.username LIKE '%{0}%' or b.employeeName LIKE '%{0}%')
                                            and b.unitName LIKE '%{1}%'
                                            and b.jobName LIKE '%{2}%' and b.employeeStatus='2'",
                                           string.IsNullOrEmpty(keyword) == false ? SqlTextHelper.SafeQuote(keyword) : keyword,
                                           string.IsNullOrEmpty(deptName) == false ? SqlTextHelper.SafeQuote(deptName) : deptName,
                                           string.IsNullOrEmpty(jobName) == false ? SqlTextHelper.SafeQuote(jobName) : jobName);

                DataSet ds = DbHelper.RunSqlReturnDS(sqlCommand, ConnectionName);
                if (ds != null)
                {
                    DataTable table = ds.Tables[0];
                    if (table != null && table.Rows.Count > 0)
                    {
                        foreach (DataRow row in table.Rows)
                        {
                            WD_User view = new WD_User();
                            ORMapping.DataRowToObject <WD_User>(row, view);
                            result.Add(view);
                        }
                    }
                }
            }
            return(result);
        }
Example #4
0
        /// <summary>
        /// 根据查询条件获取流程列表(我的流程)
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="whereString">查询条件</param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public PartlyCollection <WorkflowInstance> GetWorkflowInstanceListByCreateUserID(WorkFlowFilter filter)
        {
            filter.ExcludeProcessCode = GetExcludeProcessCode();
            PartlyCollection <ProcessInstance>  processInstanceList = ProcessInstanceAdapter.Instance.LoadListByCreateUserID(filter);
            PartlyCollection <WorkflowInstance> result = new PartlyCollection <WorkflowInstance>();

            foreach (ProcessInstance processInstance in processInstanceList)
            {
                result.Add(new WorkflowInstance(processInstance));
            }
            return(result);
        }
Example #5
0
        internal PartlyCollection <BBizProcess> LoadList(WorkFlowFilter filter)
        {
            StringBuilder strSql = new StringBuilder();

            WhereSqlClauseBuilder where = filter.ConvertToWhereBuilder();
            where.AppendItem("Isdeleted", 0);
            where.AppendItem("ProcessType", DBNull.Value);
            //string sql =new VTodoWorkAndUser().TodoViewSql;

            QueryCondition qc = new QueryCondition(
                filter.RowIndex,
                filter.PageSize,
                "*",
                ORMapping.GetTableName(typeof(BBizProcess)),
                " Createtime desc",
                where.ToSqlString(TSqlBuilder.Instance)
                );

            PartlyCollection <VBizProcess> tuple  = GetPageSplitedCollection(qc);
            PartlyCollection <BBizProcess> result = new PartlyCollection <BBizProcess>();

            foreach (VBizProcess vBizProcess in tuple)
            {
                result.Add(new BBizProcess
                {
                    TaskID             = vBizProcess.TaskID,
                    ProcessType        = vBizProcess.ProcessType,
                    Title              = vBizProcess.Title,
                    ParentID           = vBizProcess.ParentID,
                    Status             = vBizProcess.Status,
                    IsCurrentVersion   = vBizProcess.IsCurrentVersion,
                    AlarmAction        = vBizProcess.AlarmAction,
                    AlarmPlanSplitDate = vBizProcess.AlarmPlanSplitDate
                });
            }
            return(result);
        }