Пример #1
0
        public void ProcessRequest(HttpContext context)
        {
            //string unit = String.IsNullOrEmpty(context.Request["unit"].ToString()) ? string.Empty : context.Request["unit"].ToString();
            //传过来的文本框内容
            string time = String.IsNullOrEmpty(context.Request["beginTime"].ToString()) ? "1900-01" : context.Request["beginTime"].ToString();
            //月,季,年
            string timeType = String.IsNullOrEmpty(context.Request["timeType"].ToString()) ? string.Empty : context.Request["timeType"].ToString();
            //传过来的季度
            string quarterType = String.IsNullOrEmpty(context.Request["quarterType"].ToString()) ? "-1" : context.Request["quarterType"].ToString();

            //先根据paraId,取出所有paraId的outtable,循环outtable,取平均值。

            info allInfo = new info();

            List<ConsumeInfo> infoList = new List<ConsumeInfo>();
            infoList = bl.get(time, timeType, quarterType, out errMsg);

            ConsumeInfo info = new ConsumeInfo();
            info.ConsumeValue = 23;
            info.Name = "七月份耗差平均";
            info.RealValue = 34;
            info.StandardValue = 12.4;
            infoList.Add(info);

            info = new ConsumeInfo();
            info.ConsumeValue = 23;
            info.Name = "七月份分项比例";
            info.RealValue = 34;
            info.StandardValue = 12.4;
            infoList.Add(info);
            //表格
            //string content = infoList.ToJsonItem();
            int count = 0;
            object obj = new
            {
                total = count,
                rows = infoList
            };

            //列名
            //List<column> col = new List<column>();

            //foreach (var info in infoList)
            //{
            //    column c = new column();
            //    c.field = info.Name;
            //    c.title = info.Name;
            //    c.width = "150px";
            //    c.align = "center";
            //}
            //string lm = JsonConvert.SerializeObject(col);

            string result = JsonConvert.SerializeObject(infoList);
            context.Response.ContentType = "text/json;charset=gb2312;";
            context.Response.Write(result);
        }
Пример #2
0
 /// <summary>
 /// 获取第一次全取出来的数据。再过滤。 在GetBase函数中 循环。。。 paraId+_el_B再循环得到实际值.....
 /// </summary>
 /// <param name="unitId"></param>
 /// <param name="errMsg"></param>
 /// <returns></returns>
 public List<info> GetFirstInfo(string unitId, out string errMsg)
 {
     DataTable dt = el.GetTableName(unitId, out errMsg);
     List<info> infoList = new List<info>();
     if (dt != null)
     {
         foreach (DataRow dr in dt.Rows)
         {
             if (!string.IsNullOrEmpty(dr["T_OUTTABLE"].ToString()))
             {
                 info tmp = new info();
                 tmp.TableName = dr["T_OUTTABLE"].ToString();
                 tmp.UnitId = dr["T_UNITID"].ToString();
                 tmp.ParaId = dr["T_PARAID"].ToString();
                 tmp.Unit = dr["T_UNIT"].ToString();
                 tmp.TargetType = Convert.ToInt32(dr["I_TARGETTYPE"].ToString());
                 tmp.ConsumeType = Convert.ToInt32(dr["I_CONSUMETYPE"].ToString());
                 tmp.Order = Convert.ToInt32(dr["I_ORDER"].ToString());
                 infoList.Add(tmp);
             }
             else
             {
                 continue;
             }
         }
     }
     return infoList;
 }