Пример #1
0
 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();
 }
Пример #2
0
        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'>&nbsp;<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;

            }
        }
Пример #3
0
        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();
        }