public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; WorkInfoManager manager = new WorkInfoManager(); int currentPage = int.Parse(rp["pagenum"]); int pageSize = int.Parse(rp["pagesize"]); int count = 0, recordCount = 0; string workstatus = rp["Workstatus"]; WhereClip where = null; if (!string.IsNullOrEmpty(workstatus)) { where = WorkInfo._.Status == workstatus; } string UserId = string.Empty; if (!string.IsNullOrEmpty(rp["IsDaiBan"])) { UserId = context.Session["UserID"].ToString() + ";" + rp["IsDaiBan"]; } else { if (context.Session["AllDepart"] != null) { List <AdministrativeRegions> list = context.Session["AllDepart"] as List <AdministrativeRegions>; if (list != null && list.Count > 0) { string[] dparr = new string[list.Count]; for (int i = 0; i < list.Count; i++) { dparr[i] = list[i].ID.ToString(); } if (WhereClip.IsNullOrEmpty(where)) { where = ShebeiInfo._.SocrceDepart.In(dparr); } else { where = where && ShebeiInfo._.SocrceDepart.In(dparr); } } } } DataTable dt = manager.GetDataTable(currentPage + 1, pageSize, UserId, where, WorkInfo._.CreateDate.Desc, ref count, ref recordCount); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}"); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string desc_tmpl = "报工设备:{0} 报工时间:{1} <br/><br/>处理意见:{2}"; if (!IsPostBack) { WorkInfoManager wkMgr = new WorkInfoManager(); string id = Request.QueryString.Get("id"); WhereClip where = WorkInfo._.ID == new Guid(id); OrderByClip order = WorkInfo._.CreateDate.Desc; int count = 0; DataTable dtwk = wkMgr.GetDataTable(1, 1, where, order, ref count, ref count); news_title.InnerHtml = "报修设备:" + dtwk.Rows[0]["Name"].ToString(); //news_desc.InnerHtml = string.Format(desc_tmpl, dtwk.Rows[0]["Name"], dtwk.Rows[0]["GuZhangXx"], dtwk.Rows[0]["ChuLiYiJian"]); news_content.InnerHtml = string.Format(desc_tmpl, dtwk.Rows[0]["Name"], dtwk.Rows[0]["GuZhangXx"], dtwk.Rows[0]["ChuLiYiJian"]);; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; WorkInfoManager manager = new WorkInfoManager(); int currentPage = int.Parse(rp["pagenum"]); int pageSize = int.Parse(rp["pagesize"]); int count = 0, recordCount = 0; string workstatus = rp["Workstatus"]; WhereClip where = new WhereClip(); if (context.Session["AllDepart"] != null) { List <AdministrativeRegions> list = context.Session["AllDepart"] as List <AdministrativeRegions>; if (list != null && list.Count > 0) { string[] dparr = new string[list.Count]; for (int i = 0; i < list.Count; i++) { dparr[i] = list[i].ID.ToString(); } if (WhereClip.IsNullOrEmpty(where)) { where = ShebeiInfo._.SocrceDepart.In(dparr); } else { where = where && ShebeiInfo._.SocrceDepart.In(dparr); } } } if (!string.IsNullOrEmpty(workstatus)) { where.And(WorkInfo._.Status == workstatus); } if (!string.IsNullOrEmpty(context.Request["begindate"])) { string begin = context.Request["begindate"]; if (!string.IsNullOrEmpty(begin)) { where = where && WorkInfo._.CreateDate >= begin; } } if (!string.IsNullOrEmpty(context.Request["enddate"])) { string enddate = context.Request["enddate"]; if (!string.IsNullOrEmpty(enddate)) { where = where && WorkInfo._.CreateDate <= enddate; } } if (!string.IsNullOrEmpty(context.Request["username"])) { where = where && WorkInfo._.CurrentUser.Contains(context.Request["username"]); } if (!string.IsNullOrEmpty(context.Request["sbcode"])) { where = where && ShebeiInfo._.Code.Contains(context.Request["sbcode"]); } if (!string.IsNullOrEmpty(context.Request["sbname"])) { where = where && ShebeiInfo._.Name.Contains(context.Request["sbname"]); } OrderByClip or = WorkInfo._.CreateDate.Desc; if (!string.IsNullOrEmpty(context.Request["sortdatafield"])) { if (!string.IsNullOrEmpty(context.Request["sortorder"]) && context.Request["sortorder"] == "desc") { or = new OrderByClip(context.Request["sortdatafield"] + " desc"); } else { or = new OrderByClip(context.Request["sortdatafield"]); } } DataTable dt = manager.GetDataTable(currentPage + 1, pageSize, where, or, ref count, ref recordCount); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}"); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; WorkInfoManager manager = new WorkInfoManager(); int currentPage = int.Parse(rp["pagenum"]); int pageSize = int.Parse(rp["pagesize"]); int count = 0, recordCount = 0; string workstatus = rp["Workstatus"]; WhereClip where = null; where = WorkInfo._.CreateDate.Like("%%"); if (!string.IsNullOrEmpty(workstatus)) { where.And(WorkInfo._.Status == workstatus); } if (!string.IsNullOrEmpty(context.Request["RQ"])) { string[] datestr = context.Request["RQ"].ToString().Split('@'); string begin = datestr[0]; if (!string.IsNullOrEmpty(begin)) { where.And(WorkInfo._.CreateDate >= begin); } string end = datestr[1]; if (!string.IsNullOrEmpty(end)) { where.And(WorkInfo._.CreateDate <= end); } } if (!string.IsNullOrEmpty(context.Request["USERNAME"])) { where.And(WorkInfo._.CreaterName.Like("%" + context.Request["USERNAME"].ToString() + "%")); } if (!string.IsNullOrEmpty(context.Request["SBNAME"])) { where.And(ShebeiInfo._.Name.Like("%" + context.Request["SBNAME"].ToString() + "%")); } if (!string.IsNullOrEmpty(context.Request["SBZT"])) { where.And(WorkInfo._.Status.Like("%" + context.Request["SBZT"].ToString() + "%")); } if (!string.IsNullOrEmpty(context.Request["GZXX"])) { where.And(WorkInfo._.GuZhangXx.Like("%" + context.Request["GZXX"].ToString() + "%")); } if (context.Session["AllDepart"] != null) { List <AdministrativeRegions> list = context.Session["AllDepart"] as List <AdministrativeRegions>; if (list != null && list.Count > 0) { string[] dparr = new string[list.Count]; for (int i = 0; i < list.Count; i++) { dparr[i] = list[i].ID.ToString(); } if (WhereClip.IsNullOrEmpty(where)) { where = ShebeiInfo._.SocrceDepart.In(dparr); } else { where = where && ShebeiInfo._.SocrceDepart.In(dparr); } } } OrderByClip or = WorkInfo._.CreateDate.Desc; if (!string.IsNullOrEmpty(context.Request["sortdatafield"])) { if (!string.IsNullOrEmpty(context.Request["sortorder"]) && context.Request["sortorder"] == "desc") { or = new OrderByClip(context.Request["sortdatafield"] + " desc"); } else { or = new OrderByClip(context.Request["sortdatafield"]); } } if (!string.IsNullOrEmpty(context.Request["index"])) { pageSize = 4; } DataTable dt = manager.GetDataTable(currentPage + 1, pageSize, where, or, ref count, ref recordCount); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}"); context.Response.End(); }