public override List <WorkflowActor> GetActor(string actorIDs) { if (String.IsNullOrEmpty(actorIDs)) { return(new List <WorkflowActor>()); } else { string conditionStr = string.Format(" AND IDENTIFICATION IN ({0})", CommonMethods.BindQuot(actorIDs)); string query = String.Format(" SELECT * FROM T_USER WHERE 1=1 {0} ORDER BY IDENTIFICATION ASC ", conditionStr); List <WorkflowActor> actors = new List <WorkflowActor>(); using (var dr = connection.ExecuteReader(query)) { while (dr.Read()) { actors.Add(new WorkflowActor() { ID = dr["IDENTIFICATION"].ToString(), Name = string.Format("{0}", dr["USERNAME"]), Data = new { OrgName = dr["ORGNAME"], OrgCode = dr["ORGCODE"] } }); } } return(actors); } }
public override List <WorkflowActor> GetActor(int pageIndex, int pageSize, out int total, string actorIDs, string searchKey) { string conditionStr = string.Empty; if (!String.IsNullOrEmpty(actorIDs)) { conditionStr = string.Format("{0} AND IDENTIFICATION NOT IN ({1})", conditionStr, CommonMethods.BindQuot(actorIDs)); } if (!String.IsNullOrEmpty(searchKey)) { conditionStr = string.Format("{0} AND USERNAME LIKE '%{1}%'", conditionStr, searchKey); } string query = String.Format("SELECT TOP {0} * FROM T_USER WHERE IDENTIFICATION NOT IN (SELECT TOP {1} IDENTIFICATION FROM T_USER WHERE 1=1 {2} ORDER BY IDENTIFICATION ASC) {2} ORDER BY IDENTIFICATION ASC ", pageSize, pageSize * (pageIndex - 1), conditionStr); total = connection.ExecuteScalar <int>(String.Format("SELECT COUNT(1) FROM T_USER WHERE 1=1 {0}", conditionStr)); List <WorkflowActor> actors = new List <WorkflowActor>(); using (var dr = connection.ExecuteReader(query)) { while (dr.Read()) { actors.Add(new WorkflowActor() { ID = dr["IDENTIFICATION"].ToString(), Name = string.Format("{0}", dr["USERNAME"]), Data = new { OrgName = dr["ORGNAME"], OrgCode = dr["ORGCODE"] } }); } } return(actors); }