Exemplo n.º 1
0
        public string GetListNew(HttpContext context)
        {
            string start_time = context.Request["start_time"];
            string end_time   = context.Request["end_time"];
            int    PageSize   = Convert.ToInt32(context.Request["rows"]);
            int    PageIndex  = Convert.ToInt32(context.Request["page"]);

            StringBuilder commandText = new StringBuilder();

            string where = "";

            if (string.IsNullOrEmpty(start_time))
            {
                DateTime t = DateTime.Now.AddMonths(-1);
                start_time = t.ToString("yyyy-MM-dd");
            }
            string StartTime = start_time.Substring(0, 10);

            if (string.IsNullOrEmpty(end_time))
            {
                DateTime t = DateTime.Now;
                end_time = t.ToString("yyyy-MM-dd");
            }
            string EndTime    = end_time.Substring(0, 10);
            int    StartIndex = (PageIndex - 1) * PageSize + 1;
            int    EndIndex   = PageIndex * PageSize;
            DataListModel <Production_AlarmModel> userList = Production_AlarmTrendReport_BLL.GetListNew(StartTime, EndTime, StartIndex, EndIndex);
            string json = JSONTools.ScriptSerialize <DataListModel <Production_AlarmModel> >(userList);

            return(json);
        }
Exemplo n.º 2
0
        public void Print(HttpContext context)
        {
            string start_time = context.Request["start_time"];
            string end_time   = context.Request["end_time"];
            int    PageSize   = Convert.ToInt32(context.Request["rows"]);
            int    PageIndex  = Convert.ToInt32(context.Request["page"]);

            StringBuilder commandText = new StringBuilder();

            string where = "";

            if (string.IsNullOrEmpty(start_time))
            {
                DateTime t = DateTime.Now.AddMonths(-1);
                start_time = t.ToString("yyyy-MM-dd");
            }
            string StartTime = start_time.Substring(0, 10);

            if (string.IsNullOrEmpty(end_time))
            {
                DateTime t = DateTime.Now;
                end_time = t.ToString("yyyy-MM-dd");
            }
            string EndTime = end_time.Substring(0, 10);
            string sidx    = RequstString("sidx"); //排序名称
            string sort    = RequstString("sord"); //排序方式

            if ("-1" == sort)
            {
                sort = "id";
            }
            if ("-1" == order)
            {
                order = "asc";
            }
            string json     = "";
            string fileName = HttpContext.Current.Request.MapPath("~/App_Data/生产线报警趋势报表.xlsx");

            try
            {
                int       StartIndex = 1;
                int       EndIndex   = -1;
                int       totalcount = 0;
                string    title      = StartTime + " - " + EndTime + "生产线报警趋势分析";
                DataTable resTable   = Production_AlarmTrendReport_BLL.getTable(StartTime, EndTime, PageSize, StartIndex, EndIndex, sort, order, where, out totalcount);
                string    html       = DataHelper.ExportDatatableToHtml(resTable, title);
                string    ss         = "true";
                json = "{\"Result\":\"" + ss + "\"," + "\"Html\":\"" + html + "\"}";
            }
            catch (Exception e)
            {
                string ss1 = "false";
                json = "{\"Result\":\"" + ss1 + "\"}";
            }


            context.Response.ContentType = "json";
            context.Response.Write(json);
        }
Exemplo n.º 3
0
        public void Print(HttpContext context)
        {
            string start_time = context.Request["start_time"];
            string end_time   = context.Request["end_time"];
            string fl_id      = context.Request["fl_id"];
            int    PageSize   = Convert.ToInt32(context.Request["rows"]);
            int    PageIndex  = Convert.ToInt32(context.Request["page"]);

            StringBuilder commandText = new StringBuilder();

            string where = "";

            if (string.IsNullOrEmpty(start_time))
            {
                DateTime t = DateTime.Now;
                start_time = t.ToString("yyyy-MM-dd HH:mm:ss");
            }
            string StartTime = start_time;

            if (string.IsNullOrEmpty(end_time))
            {
                DateTime t = DateTime.Now;
                end_time = t.ToString("yyyy-MM-dd HH:mm:ss");
            }
            string EndTime = end_time;

            // DataListModel<Production_AlarmModel> userList = Production_AlarmTrendReport_BLL.GetWaringListNew(fl_id, StartTime, EndTime, StartIndex, EndIndex);
            // string json = JSONTools.ScriptSerialize<DataListModel<Production_AlarmModel>>(userList);

            string json     = "";
            string fileName = HttpContext.Current.Request.MapPath("~/App_Data/报警信息报表.xlsx");

            try
            {
                int       StartIndex = 1;
                int       EndIndex   = -1;
                int       totalcount = 0;
                string    title      = StartTime + " - " + EndTime + "报警信息报表";
                DataTable resTable   = Production_AlarmTrendReport_BLL.GetWaringDataTable(fl_id, StartTime, EndTime, StartIndex, EndIndex);
                string    html       = DataHelper.ExportDatatableToHtml(resTable, title);
                string    ss         = "true";
                json = "{\"Result\":\"" + ss + "\"," + "\"Html\":\"" + html + "\"}";
            }
            catch (Exception e)
            {
                string ss1 = "false";
                json = "{\"Result\":\"" + ss1 + "\"}";
            }


            context.Response.ContentType = "json";
            context.Response.Write(json);
        }
Exemplo n.º 4
0
        public string GetList(HttpContext context)
        {
            string start_time = context.Request["start_time"];
            string end_time   = context.Request["end_time"];
            int    PageSize   = Convert.ToInt32(context.Request["rows"]);
            int    PageIndex  = Convert.ToInt32(context.Request["page"]);

            StringBuilder commandText = new StringBuilder();

            string where = "";

            if (string.IsNullOrEmpty(start_time))
            {
                DateTime t = DateTime.Now.AddMonths(-1);
                start_time = t.ToString("yyyy-MM-dd hh:mm:ss");
            }
            string StartTime = start_time.Substring(0, 10) + " 00:00:00";

            if (string.IsNullOrEmpty(end_time))
            {
                DateTime t = DateTime.Now;
                end_time = t.ToString("yyyy-MM-dd hh:mm:ss");
            }
            string EndTime = end_time.Substring(0, 10) + " 23:59:59";

            where += " and [AlarmStartTime]>='" + StartTime + "'";
            where += " and [AlarmEndTime]<='" + EndTime + "'";



            string sidx = RequstString("sidx");    //排序名称
            string sort = RequstString("sord");    //排序方式

            if ("-1" == sort)
            {
                sort = "id";
            }
            if ("-1" == order)
            {
                order = "asc";
            }
            DataListModel <Production_AlarmModel> userList = Production_AlarmTrendReport_BLL.GetList(PageIndex, PageSize, sort, order, where);
            string json = JSONTools.ScriptSerialize <DataListModel <Production_AlarmModel> >(userList);

            return(json);
        }