示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            string time = context.Request["time"].ToString() != "undefined" ? context.Request["time"].ToString() : string.Empty;

            string times = string.Empty;

            //时间
            times += String.IsNullOrEmpty(time) ? string.Empty : time + "-01 00:00:00.0";
            //times = "2013-05-01 00:00:00.0";
            List <StatisticInfo> info = new List <StatisticInfo>();

            info = bt.GetHomeByTime(times, out errMsg);

            List <StatisticInfo> saveInfo = new List <StatisticInfo>();

            StatisticInfo tmp = new StatisticInfo();

            if (info.Count > 0)
            {
                //发电设备容量
                tmp = info.Where(infos => infos.T_INDICATORNAME == "设备容量").FirstOrDefault();
                saveInfo.Add(tmp);

                //发电设备利用小时
                tmp = info.Where(infos => infos.T_INDICATORNAME == "利用小时").FirstOrDefault();
                saveInfo.Add(tmp);
                //供电煤耗
                tmp = info.Where(infos => infos.T_INDICATORNAME == "供电煤耗").FirstOrDefault();
                saveInfo.Add(tmp);
                //厂用电率
                tmp = info.Where(infos => infos.T_INDICATORNAME == "厂用电率").FirstOrDefault();
                saveInfo.Add(tmp);
            }
            else
            {
                for (int i = 0; i < 4; i++)
                {
                    saveInfo.Add(tmp);
                }
            }
            string content = saveInfo.ToJsonItem();

            context.Response.ContentType = "text/json;charset=gb2312;";
            context.Response.Write(content);
        }
示例#2
0
        public void ProcessRequest(HttpContext context)
        {
            string time = context.Request["time"].ToString() != "undefined" ? context.Request["time"].ToString() : string.Empty;

            string times = string.Empty;

            //时间
            times += String.IsNullOrEmpty(time) ? string.Empty : time + "-01 00:00:00.0";
            //times = "2013-05-01 00:00:00.0";
            List<StatisticInfo> info = new List<StatisticInfo>();
            info=bt.GetHomeByTime(times,out errMsg);

            List<StatisticInfo> saveInfo = new List<StatisticInfo>();

            StatisticInfo tmp = new StatisticInfo();
            if (info.Count>0)
            {
                //发电设备容量
                tmp = info.Where(infos => infos.T_INDICATORNAME == "设备容量").FirstOrDefault();
                saveInfo.Add(tmp);

                //发电设备利用小时
                tmp = info.Where(infos => infos.T_INDICATORNAME == "利用小时").FirstOrDefault();
                saveInfo.Add(tmp);
                //供电煤耗
                tmp = info.Where(infos => infos.T_INDICATORNAME == "供电煤耗").FirstOrDefault();
                saveInfo.Add(tmp);
                //厂用电率
                tmp = info.Where(infos => infos.T_INDICATORNAME == "厂用电率").FirstOrDefault();
                saveInfo.Add(tmp);
            }
            else
            {
                for(int i=0;i<4;i++)
                { saveInfo.Add(tmp); }
            }
            string content = saveInfo.ToJsonItem();

            context.Response.ContentType = "text/json;charset=gb2312;";
            context.Response.Write(content);
        }
示例#3
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["time"].ToString())?  string.Empty:context.Request["time"].ToString() ;
            string beginTime   = String.IsNullOrEmpty(context.Request["beginTime"].ToString()) ? string.Empty : context.Request["beginTime"].ToString();
            string endTime     = String.IsNullOrEmpty(context.Request["endTime"].ToString()) ? string.Empty : context.Request["endTime"].ToString();
            string timeType    = String.IsNullOrEmpty(context.Request["timeType"].ToString()) ? string.Empty : context.Request["timeType"].ToString();
            string quarterType = String.IsNullOrEmpty(context.Request["quarterType"].ToString()) ? string.Empty : context.Request["quarterType"].ToString();

            //根据选择的时间段,设置开始时间和结束时间
            switch (quarterType)
            {
            case "0":     //指定时间段

                break;

            case "1":    //月度平均值
                DateTime dt1 = new DateTime();
                dt1       = Convert.ToDateTime(beginTime.Substring(0, 7) + "-01");
                beginTime = dh.GetFirstDayOfMonth(dt1).ToString();
                endTime   = dh.GetLastDayOfMonth(dt1).ToString();
                break;

            case "2":    //季度平均值
                switch (quarterType)
                {
                case "0":        //一季度
                    string ti = beginTime.Substring(0, 4) + "-01-01";
                    beginTime = ti;
                    endTime   = beginTime.Substring(0, 4) + "-03-31";
                    break;

                case "1":        //二季度
                    string ti1 = beginTime.Substring(0, 4) + "-04-01";
                    beginTime = ti1;
                    endTime   = beginTime.Substring(0, 4) + "-06-30";
                    break;

                case "2":        //三季度
                    string ti2 = beginTime.Substring(0, 4) + "-07-01";
                    beginTime = ti2;
                    endTime   = beginTime.Substring(0, 4) + "-09-30";
                    break;

                case "3":        //四季度
                    string ti3 = beginTime.Substring(0, 4) + "-10-01";
                    beginTime = ti3;
                    endTime   = beginTime.Substring(0, 4) + "-12-31";
                    break;
                }
                break;

            case "3":    //年度平均值
                string tim = beginTime.Substring(0, 4);
                beginTime = tim + "01-01";
                endTime   = tim + "-12-31";
                break;
            }

            List <IndicatorInfo> infoList = new List <IndicatorInfo>();

            //获取锅炉的所有耗差类型。
            infoList = bl.GetInfo(beginTime, endTime, unit, -1, 0, out errMsg);
            //foreach (var info in infoList)
            //{
            for (int i = 0; i < 10; i++)
            {
                IndicatorInfo infos = new IndicatorInfo();
                infos.Name          = "主汽温度(°C)";
                infos.StandardValue = 333.22;
                infos.RealValue     = 54.32;
                infos.ConsumeValue  = 87.09;
                //上线启用
                //infos.Name = info.Name;
                //infos.StandardValue = info.StandardValue;
                //infos.RealValue = info.RealValue;
                //infos.ConsumeValue = info.ConsumeValue;
                infoList.Add(infos);
            }
            //}

            string content = infoList.ToJsonItem();
            int    count   = 0;
            object obj     = new
            {
                total = count,
                rows  = infoList
            };

            string result = JsonConvert.SerializeObject(obj);

            context.Response.ContentType = "text/json;charset=gb2312;";
            context.Response.Write(result);
        }
示例#4
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["time"].ToString())?  string.Empty:context.Request["time"].ToString() ;
            string beginTime = String.IsNullOrEmpty(context.Request["beginTime"].ToString()) ? string.Empty : context.Request["beginTime"].ToString();
            string endTime = String.IsNullOrEmpty(context.Request["endTime"].ToString()) ? string.Empty : context.Request["endTime"].ToString();
            string timeType = String.IsNullOrEmpty(context.Request["timeType"].ToString()) ? string.Empty : context.Request["timeType"].ToString();
            string quarterType = String.IsNullOrEmpty(context.Request["quarterType"].ToString()) ? string.Empty : context.Request["quarterType"].ToString();

            //根据选择的时间段,设置开始时间和结束时间
            switch (quarterType)
            {
                case "0": //指定时间段

                    break;
                case "1"://月度平均值
                    DateTime dt1 = new DateTime();
                    dt1 = Convert.ToDateTime(beginTime.Substring(0,7) + "-01");
                    beginTime = dh.GetFirstDayOfMonth(dt1).ToString();
                    endTime = dh.GetLastDayOfMonth(dt1).ToString();
                    break;
                case "2"://季度平均值
                    switch (quarterType)
                    {
                        case "0"://一季度
                            string  ti = beginTime.Substring(0,4)+"-01-01";
                            beginTime = ti;
                            endTime = beginTime.Substring(0, 4) + "-03-31";
                            break;
                        case "1"://二季度
                             string  ti1 = beginTime.Substring(0,4)+"-04-01";
                            beginTime = ti1;
                            endTime = beginTime.Substring(0, 4) + "-06-30";
                            break;
                        case "2"://三季度
                             string  ti2 = beginTime.Substring(0,4)+"-07-01";
                            beginTime = ti2;
                            endTime = beginTime.Substring(0, 4) + "-09-30";
                            break;
                        case "3"://四季度
                             string  ti3 = beginTime.Substring(0,4)+"-10-01";
                            beginTime = ti3;
                            endTime = beginTime.Substring(0, 4) + "-12-31";
                            break;
                    }
                    break;
                case "3"://年度平均值
                    string tim = beginTime.Substring(0, 4);
                    beginTime = tim + "01-01";
                    endTime = tim + "-12-31";
                    break;
            }

            List<IndicatorInfo> infoList = new List<IndicatorInfo>();

            //获取汽机和锅炉的所有耗差类型。
            infoList = bl.GetInfo(beginTime, endTime, unit, -1, -1, out errMsg);
            //上线启用
            foreach (var info in infoList)
            {
                IndicatorInfo infos = new IndicatorInfo();
                //info.Name = "主汽温度(°C)";
                //info.StandardValue = 333.22;
                //info.RealValue = 54.32;
                //info.ConsumeValue = 87.09;
                infos.Name = info.Name;
                infos.StandardValue = info.StandardValue;
                infos.RealValue = info.RealValue;
                infos.ConsumeValue = info.ConsumeValue;
                infoList.Add(infos);
            }
            //IndicatorInfo infos = new IndicatorInfo();

            //infos.Name = "主汽温度(°C)";
            //infos.StandardValue = 538.22;
            //infos.RealValue = 533.32;
            //infos.ConsumeValue = 0.64;
            //infoList.Add(infos);
            //infos = new IndicatorInfo();
            //infos.Name = "主汽压力(Mpa)";
            //infos.StandardValue = 16.70;
            //infos.RealValue = 16.43;
            //infos.ConsumeValue = 0.21;
            //infoList.Add(infos);

            string content = infoList.ToJsonItem();
            int count = 0;
            object obj = new
            {
                total = count,
                rows = infoList
            };

            string result = JsonConvert.SerializeObject(obj);
            context.Response.ContentType = "text/json;charset=gb2312;";
            context.Response.Write(result);
        }