public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; ShebeiInfoManager manager = new ShebeiInfoManager(); DataTable dt = manager.GetDataTable(); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{\"rows\":" + result + "}"); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { //修改\ txtID.Value = Request.QueryString["ID"].ToString(); ShebeiInfo sb = new ShebeiInfoManager().GetItemById(new Guid(txtID.Value)); txtSbName.InnerText = sb.Name + "(" + sb.Code + ")"; } }
protected void Page_Load(object sender, EventArgs e) { string sbtmpl = @" <tr> <td height='30' align='center' bgcolor='#FFFFFF' class='zx'>{0}</td> <td align='center' bgcolor='#FFFFFF' class='zx'> <font class='book_kk'>{1}</font><!--故障设备置顶--></td> <td align='center' bgcolor='#FFFFFF' class='zx'>{2}</td> <td align='center' bgcolor='#FFFFFF' class='zx'>{3}</td> <td align='center' bgcolor='#FFFFFF' class='zx'>共<span class='title12b'>{4}</span>次故障</td> <td align='center' bgcolor='#FFFFFF' class='zx'>共<span class='title12b'>{5}</span>次更换</td> </tr>"; if (!IsPostBack) { string sresult = @"<table width='100%' border='0' cellpadding='0' cellspacing='0' class='dx'> <tbody><tr> <td width='12%' height='25' align='center' bgcolor='#F8F8F8' class='zx'>编号</td> <td width='14%' align='center' bgcolor='#F8F8F8' class='zx'>设备状态</td> <td width='22%' align='center' bgcolor='#F8F8F8' class='zx'>设备名称</td> <td width='16%' align='center' bgcolor='#F8F8F8' class='zx'>缩略图</td> <td width='18%' align='center' bgcolor='#F8F8F8' class='zx'>故障统计</td> <td width='18%' align='center' bgcolor='#F8F8F8' class='zx'>更换统计</td> </tr>"; ShebeiInfoManager sbMgr = new ShebeiInfoManager(); DataTable dt_sb = sbMgr.GetDataTable(); int scount = 0; foreach (DataRow row in dt_sb.Rows) { scount++; if (scount > 100) return; OAManager.FileInfoManager flMgr = new FileInfoManager(); DataTable dtimg = flMgr.GetDataTable(row["ID"].ToString()); string img_html = string.Empty; if (dtimg.Rows.Count > 0) { string src = dtimg.Rows[0]["FILEPATH"].ToString(); img_html = "<a href='" + src + "'><img src='" + src + "' width='50' height='40' alt='图标'></a>"; } else { img_html = "无缩略图"; } sresult += string.Format(sbtmpl, row["Code"].ToString(), row["State"].ToString(), "<a href='" + row["PATH"].ToString() + "' target='sbiframe'>" + row["Name"].ToString() + "</a>", img_html, row["GZTJ"].ToString(), row["GHTJ"].ToString()); } sresult += "</tbody></table>"; sbinfo.InnerHtml = sresult; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; ShebeiInfoManager manager = new ShebeiInfoManager(); int pageNum = int.Parse(context.Request.QueryString.Get("pagenum")); int pagesize = int.Parse(context.Request.QueryString.Get("pagesize")); int recordCount = 0; WhereClip where = new WhereClip(); if (!string.IsNullOrEmpty(context.Request["status"])) { where = ShebeiInfo._.State == context.Request["status"]; } string filter = context.Request["filtervalue0"]; //获取当前用户的部们 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(); } where = where && ShebeiInfo._.SocrceDepart.In(dparr); } } if (!string.IsNullOrEmpty(filter)) { filter = filter.Trim(); where = where && (ShebeiInfo._.Code.Contains(filter) || ShebeiInfo._.Name.Contains(filter) || ShebeiInfo._.Address.Contains(filter)); } DataTable dt = manager.GetDataTable(pageNum + 1, pagesize, where, ref pagesize, ref recordCount); //manager.GetDataTable(); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{\"total\":\"" + recordCount.ToString() + "\",\"rows\":" + result + "}"); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; string msg = string.Empty; try { if (string.IsNullOrEmpty(rp["ID"])) { msg = "请选择要删除的数据!"; } else { int i = new ShebeiInfoManager().DelateById(new Guid(rp["ID"])); if (i > 0) { context.Response.Write("{\"success\":\"true\"}"); } else { context.Response.Write("{\"success\":\"true\"}"); msg = "删除失败!"; } } } catch (Exception ex) { msg = ex.Message; } if (!string.IsNullOrEmpty(msg)) { byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>")); string encode = Convert.ToBase64String(bytes); context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}"); } context.Response.End(); }
private void LoadData(string ID) { ShebeiInfo sb = new ShebeiInfoManager().GetItemById(new Guid(ID)); txtID.Value = sb.ID.ToString(); txtName.Value = sb.Name; txtGuiGe.Value = sb.GuiGe; txtCode.Value = sb.Code; txtIsEnable.Checked = sb.IsEnable; txtNote.Value = sb.Note; txtPATH.Value = sb.PATH; txtState.Value = sb.State; txtAddress.Value = sb.Address; txtDepartID.Value = sb.SocrceDepart.HasValue ? sb.SocrceDepart.Value.ToString() : string.Empty; if (sb.SocrceDepart.HasValue) { AdministrativeRegions ar = Sharp.Data.SessionFactory.Default.Find<AdministrativeRegions>(sb.SocrceDepart); if (ar != null) { txtSocrceDepart.Value = ar.Name; } } txtIsNeiWai.SelectedValue = sb.IsNeiWai?"0":"1"; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; string msg = string.Empty; try { if (string.IsNullOrEmpty(rp["txtID"])) { entity.ID = Guid.NewGuid(); } else { entity.ID = new Guid(rp["txtID"]); //entity.RecordStatus = StatusType.update; } entity.Code = rp["txtCode"]; entity.Name = rp["txtName"]; entity.GuiGe = rp["txtGuiGe"]; entity.IsEnable = rp["txtIsEnable"] == "on"; entity.IsNeiWai = rp["txtIsNeiWai"] == "0"; if (string.IsNullOrEmpty(rp["txtDepartID"])) { entity.SocrceDepart = null; } else { entity.SocrceDepart = new Guid(rp["txtDepartID"]); } entity.Note = rp["txtNote"]; entity.State = rp["txtState"]; entity.PATH = rp["txtPATH"]; entity.Address = rp["txtAddress"]; //if (!string.IsNullOrEmpty(rp["txtParentId"]))//父ID传值参考 //{ // entity.ParentId = new Guid(rp["txtParentId"]); // } // entity.IsEnable = rp["txtIsEnable"] == "on";//checkbox传值参考 ShebeiInfoManager manager = new ShebeiInfoManager(); // bool IsExit = manager.ExitCodeAndName(entity);//重复校验参考 // if (IsExit) // { // msg = "已存在相同编号或名称!"; // } // else // { manager.DelateById(entity.ID);//先删除 manager.Save(entity);//后新增 context.Response.Write("{\"success\":\"true\",\"ID\":\"" + entity.ID + "\"}"); // } } catch (Exception ex) { msg = ex.Message; } if (!string.IsNullOrEmpty(msg)) { byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>")); string encode = Convert.ToBase64String(bytes); context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}"); } context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; string msg = string.Empty; try { WorkInfoManager manager = new WorkInfoManager(); List<BaseEntity> entityList = new List<BaseEntity>(); int maxsequenc = manager.GetMaxSequence(new Guid(rp["txtWorkID"])); string zt = rp["txtHandResult"]; WorkInfo work = new WorkInfo(); work.ID = new Guid(rp["txtWorkID"]); work = manager.GetItemById(work.ID); work.RecordStatus = StatusType.update; work.Status = zt; ShebeiInfo s = new ShebeiInfo(); s = new ShebeiInfoManager().GetItemById(work.SbID); if (zt == "处理中") { string[] zprid = rp["txtZprID"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] zprName = rp["txtZprName"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); work.CurrentUser = rp["txtZprName"]; for (int i = 0; i < zprid.Length; i++) { WorkHandLog tem = SetValue(rp, context); tem.DownEr = new Guid(zprid[i]); tem.DownName = zprName[i]; tem.HandSequence = maxsequenc; entityList.Add(tem); } s.State = zt; } else { work.RealTime = DateTime.Now; work.CurrentUser = manager.GetLastUserName(work.ID) ; WorkHandLog tem = SetValue(rp, context); tem.HandSequence = maxsequenc; int handType = 0; int.TryParse(rp["txtHandType"], out handType); tem.HandType = handType; entityList.Add(tem); s.State = "正常"; if (rp["txtHandType"] == "0") { //维修 string sql = "update ShebeiInfo set GZTJ=isnull(GZTJ,0)+1 where id='" + s.ID + "'"; Sharp.Data.SessionFactory.Default.FromCustomSql(sql).ExecuteNonQuery(); } else if (rp["txtHandType"] == "1") { //更换 string sql = "update ShebeiInfo set GHTJ=isnull(GHTJ,0)+1 where id='" + s.ID + "'"; Sharp.Data.SessionFactory.Default.FromCustomSql(sql).ExecuteNonQuery(); } } entityList.Add(work); entityList.Add(s); manager.Save(entityList); context.Response.Write("{\"success\":\"true\"}"); } catch (Exception ex) { msg = ex.Message; } if (!string.IsNullOrEmpty(msg)) { byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>")); string encode = Convert.ToBase64String(bytes); context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}"); } context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; ShebeiInfoManager manager = new ShebeiInfoManager(); int pageNum = int.Parse(context.Request.QueryString.Get("pagenum")); int pagesize = int.Parse(context.Request.QueryString.Get("pagesize")); int recordCount = 0; WhereClip where = new WhereClip(); if (!string.IsNullOrEmpty(context.Request.QueryString["nb"])) { if (context.Request.QueryString["nb"] == "1") { where = where && ShebeiInfo._.IsNeiWai == true; } else if (context.Request.QueryString["nb"] == "0") { where = where && ShebeiInfo._.IsNeiWai == false; } } if (!string.IsNullOrEmpty(context.Request["sbzt"])) { where = where && ShebeiInfo._.State == context.Request["sbzt"]; } 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"]); } 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); } } } string or = " state, CODE "; if (!string.IsNullOrEmpty(context.Request["sortdatafield"])) { if (!string.IsNullOrEmpty(context.Request["sortorder"]) && context.Request["sortorder"] == "desc") { or = context.Request["sortdatafield"] + " desc"; } else { or = context.Request["sortdatafield"]; } } DataTable dt = manager.GetDataTableWithImg(pageNum + 1, pagesize, where, or, ref pagesize, ref recordCount); //manager.GetDataTable(); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{\"totalRecords\":\"" + recordCount.ToString() + "\",\"rows\":" + result + "}"); context.Response.End(); }