public void ProcessRequest(HttpContext context) { try { context.Response.ContentType = "text/plain"; if (null == context.Request.Form["fid"]) throw new Exception("未传文件名称!"); string fid = context.Request.Form["fid"].ToString(); OAEntity.FileInfo fl = new FileInfo(); FileInfoManager flMgr = new FileInfoManager(); fl=flMgr.GetItemById(new Guid(fid)); if (DeleteFile("../"+fl.FILEPATH, context))//删除文件 { flMgr.DelateById(new Guid(fid));//删除数据库记录 context.Response.Write("sucess"); } else { context.Response.Write("failed"); } } catch (Exception ex) { context.Response.Write(ex.Message); } }
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"; string sid = context.Request.Form["sid"].ToString();//获取id值 FileInfoManager manager = new FileInfoManager(); DataTable dt = manager.GetDataTable(sid); string result = JsonConvert.Convert2Json(dt); context.Response.Write(result); context.Response.End(); }