protected override TASKTODOLISTPoco[] GetFinishedList(int size) { List <TASKTODOLISTPoco> getToDoTasklist = new List <TASKTODOLISTPoco>(); string userId = GTP.Runtime.Common.Context.DataContextManager.SessionContext.UserID; string gsql = "SELECT TOP " + size + " f_id as Id,f_name as Title,F_EXECUTOR_ID as Name,F_CREATE_TIME as NewTime FROM T_WF_TASK task WITH (NOLOCK) WHERE task.F_EXECUTOR_ID IN ('" + userId + ".S') AND task.F_STATUS='Finished' "; gsql += "UNION ALL SELECT TOP " + size + " f_id as Id,f_name as Title,F_EXECUTOR_ID as Name,F_CREATE_TIME as NewTime FROM T_WFM_TASK task WITH (NOLOCK) WHERE task.F_EXECUTOR_ID IN ('" + userId + ".S') AND task.F_STATUS='Finished' order by NewTime desc;"; DataSet ds = LiteDB.ExecuteDataSet(gsql); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { TASKTODOLISTPoco entity = new TASKTODOLISTPoco(); entity.Id = Convert.ToInt64(ds.Tables[0].Rows[i]["Id"]); entity.Title = ds.Tables[0].Rows[i]["Title"] == null ? "" : ds.Tables[0].Rows[i]["Title"].ToString(); entity.Name = GetTaskUserName(ds.Tables[0].Rows[i]["Name"].ToString()); entity.NewTime = Convert.ToDateTime(ds.Tables[0].Rows[i]["NewTime"]).ToString("yyyy-mm-dd"); getToDoTasklist.Add(entity); } } TASKTODOLISTPoco[] ToDoTasklist = (from fz in getToDoTasklist select fz).OrderByDescending(p => p.NewTime).Take(size).ToArray(); return(ToDoTasklist); }
private string GetTaskUserName(string code) { long id = Convert.ToInt64(code.Split('.')[0]); string gsql = "SELECT f_name as Name FROM T_ORG_USER WITH (NOLOCK) WHERE F_USER_ID=" + id; DataSet ds = LiteDB.ExecuteDataSet(gsql); return(ds.Tables[0].Rows[0]["Name"].ToString()); }
public void ProcessRequest(HttpContext context) { try { //本页禁止缓存 context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); context.Response.Cache.SetNoStore(); //TODO: 应加入网站身份验证,未登录用户禁止访问本页 context.Response.ContentType = "text/plain"; if (context.Request["type"] != null) { if (context.Request["type"].ToString() == "GetModuleData") { var gsql = "select f_id as id_,f_name as name_,F_PATTERN as pattern_,F_SETTING AS setting_ from t_pcenter_module with(nolock) where concat(',',(select f_modules from t_pcenter_role where f_type=0 and f_type_id='1009'),',') like concat('%,',TO_CHAR(f_id),',%')"; DataSet ds = LiteDB.ExecuteDataSet(gsql); if (ds != null) { var json = "["; foreach (DataRow row in ds.Tables[0].Rows) { json += "{"; json += "\"ModuleID\":" + row["id_"].ToString() + ","; json += "\"ModuleName\":\"" + row["name_"].ToString() + "\","; if (row["pattern_"].ToString() == "2") { json += "\"URL\":\"/PCenter/index.html?Id=" + row["id_"].ToString() + "\""; } else if (row["pattern_"].ToString() == "3") { json += "\"URL\":\"/PCenter/index.html?Id=" + row["id_"].ToString() + "\""; } else { json += "\"URL\":\"" + row["setting_"].ToString() + "\""; } json += "},"; } if (json.Length > 1) { json = json.Substring(0, json.Length - 1); } json += "]"; context.Response.Write(json); } else { context.Response.Write("[]"); } } } } catch (Exception ex) { context.Response.Write("[]"); } }
public void ProcessRequest(HttpContext context) { try { //本页禁止缓存 context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); context.Response.Cache.SetNoStore(); //TODO: 应加入网站身份验证,未登录用户禁止访问本页 context.Response.ContentType = "text/plain"; if (context.Request["type"] != null) { if (context.Request["type"].ToString() == "GetModuleData") { var gsql = "SELECT f_id AS id_, f_name AS name_, F_PATTERN as pattern_,F_SETTING AS setting_ FROM t_pcenter_module WITH (NOLOCK) WHERE (',' + (SELECT f_modules FROM t_pcenter_role WHERE f_type=0 AND f_type_id='1001' ) + ',') LIKE ('%,' + CONVERT(VARCHAR(max),f_id) + ',%')"; DataSet ds = LiteDB.ExecuteDataSet(gsql); if (ds != null) { var json = "["; foreach (DataRow row in ds.Tables[0].Rows) { json += "{"; json += "\"ModuleID\":" + row["id_"].ToString() + ","; json += "\"ModuleName\":\"" + row["name_"].ToString() + "\","; if (row["pattern_"].ToString() == "2") { json += "\"URL\":\"ShowUp/PagingPattern/PagingPattern.html?Id=" + row["id_"].ToString() + "\""; } else if (row["pattern_"].ToString() == "3") { json += "\"URL\":\"ShowUp/ScroolPattern/ScroolPattern.html?Id=" + row["id_"].ToString() + "\""; } else { json += "\"URL\":\"" + row["setting_"].ToString() + "\""; } json += "},"; } if (json.Length > 1) { json = json.Substring(0, json.Length - 1); } json += "]"; context.Response.Write(json); } else { context.Response.Write("[]"); } } } } catch (Exception ex) { context.Response.Write("[]"); } }
protected override Int32 GetFinishedMessageCount(String userId) { if (string.IsNullOrEmpty(userId)) { userId = GTP.Runtime.Common.Context.DataContextManager.SessionContext.UserID; } var gsql = "SELECT COUNT(1) AS F_COUNT FROM T_WFM_TASK task WITH (NOLOCK) WHERE task.F_EXECUTOR_ID='" + userId + ".S' AND task.F_STATUS='Finished';"; DataSet ds = LiteDB.ExecuteDataSet(gsql); if (ds != null) { return(Int32.Parse(ds.Tables[0].Rows[0][0].ToString())); } else { return(0); } }
protected override Int32 GetFinishedTaskCount(String userId) { if (string.IsNullOrEmpty(userId)) { userId = GTP.Runtime.Common.Context.DataContextManager.SessionContext.UserID; } var gsql = "select count(*) as f_count from (SELECT distinct f_flow_id FROM T_WF_TASK task WITH (NOLOCK) WHERE task.F_EXECUTOR_ID IN ('" + userId + ".S') AND task.F_STATUS ='Finished') a;"; DataSet ds = LiteDB.ExecuteDataSet(gsql); if (ds != null) { return(Int32.Parse(ds.Tables[0].Rows[0][0].ToString())); } else { return(0); } }
protected override Int32 GetToDoTaskFilterCount(String userId, String filter) { if (string.IsNullOrEmpty(userId)) { userId = GTP.Runtime.Common.Context.DataContextManager.SessionContext.UserID; } var gsql = "SELECT COUNT(1) AS F_COUNT FROM T_WF_TASK task WITH (NOLOCK) WHERE task.F_EXECUTOR_ID IN ('" + userId + ".S') AND task.F_STATUS='Running' and F_MODULE_FCODE like '%" + filter + "%';"; DataSet ds = LiteDB.ExecuteDataSet(gsql); if (ds != null) { return(Int32.Parse(ds.Tables[0].Rows[0][0].ToString())); } else { return(0); } }
protected override DictPoco[] GetTaskStatusCount() { var gsql = "select f_status as status_,count(f_status) as count_ from t_wf_task with(nolock) where f_kind='Flow' and f_status in ('Running','Finished','Deleted','Aborted') GROUP BY f_status order by f_status desc"; DataSet ds = LiteDB.ExecuteDataSet(gsql); if (ds != null) { List <DictPoco> dictList = new List <DictPoco>(); foreach (DataRow row in ds.Tables[0].Rows) { DictPoco dict = new DictPoco(); dict.Key = row["status_"].ToString(); dict.Value = row["count_"].ToString(); dictList.Add(dict); } return(dictList.ToArray()); } else { return(null); } }
protected override DictPoco[] GetModuleUseCount() { var gsql = "SELECT f_module_fname as name_, COUNT(f_id) as count_ from t_wf_task with(nolock) GROUP BY f_module_fcode,f_module_fname order by count(f_id) desc"; DataSet ds = LiteDB.ExecuteDataSet(gsql); if (ds != null) { List <DictPoco> dictList = new List <DictPoco>(); foreach (DataRow row in ds.Tables[0].Rows) { DictPoco dict = new DictPoco(); dict.Key = row["name_"].ToString(); dict.Value = row["count_"].ToString(); dictList.Add(dict); } return(dictList.ToArray()); } else { return(null); } }