Esempio n. 1
0
        public HttpResponseMessage Get_tb_Alarm()
        {
            ResponseMessage     responseMessage = new ResponseMessage(0);
            HttpResponseMessage result          = new HttpResponseMessage();

            try
            {
                HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];//获取传统context
                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
                Dictionary <string, object> dcParams = new Dictionary <string, object>();
                dcParams = DictionaryPro.RequestToDic(context);
                int      cnt         = 0;
                string   ProjectCode = DictionaryPro.GetDicValue(dcParams, "ProjectCode");           //工程编号
                int      pageNumber  = int.Parse(DictionaryPro.GetDicValue(dcParams, "pageNumber")); //页码
                int      pageSize    = int.Parse(DictionaryPro.GetDicValue(dcParams, "pageSize"));   //页面信息数量
                DateTime startm      = DateTime.Parse(DictionaryPro.GetDicValue(dcParams, "startm"));
                DateTime endtm       = DateTime.Parse(DictionaryPro.GetDicValue(dcParams, "endtm"));
                //DAL
                tb_Alarm_DAL dal  = new tb_Alarm_DAL();
                string       list = dal.Get_tb_Alarm(startm, endtm, pageNumber, pageSize, out cnt);

                //返回数据
                responseMessage.message = new { total = cnt, rows = list };
                result.Content          = new StringContent(JsonHelper.Object2Json(responseMessage), Encoding.GetEncoding("utf-8"), "application/json");
            }
            catch (Exception ex)
            {
                //返回错误信息
                //responseMessage.status = -1;
                //responseMessage.message = ex.Message;
            }

            return(result);
        }
Esempio n. 2
0
        public HttpResponseMessage GetRealtimedata()
        {
            ResponseMessage     responseMessage = new ResponseMessage(0);
            HttpResponseMessage result          = new HttpResponseMessage();

            try
            {
                bool            flag    = false;
                HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];//获取传统context
                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
                Dictionary <string, object> dcParams = new Dictionary <string, object>();
                dcParams = DictionaryPro.RequestToDic(context);

                DataTable   td  = new DataTable();
                系统采集器实时_DAL dal = new 系统采集器实时_DAL();
                td = dal.GetLastDate();

                responseMessage.message = new { rows = td };
                result.Content          = new StringContent(JsonHelper.Object2Json(responseMessage), Encoding.GetEncoding("utf-8"), "application/json");
            }

            catch (Exception ex)
            {
                //返回错误信息
                //返回错误信息
                responseMessage.status  = -1;
                responseMessage.message = ex.Message;
            }
            return(result);
        }
Esempio n. 3
0
        public HttpResponseMessage GetMonitoringcurve()
        {
            ResponseMessage     responseMessage = new ResponseMessage(0);
            HttpResponseMessage result          = new HttpResponseMessage();

            try
            {
                HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; //获取传统context
                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");      //解决跨域问题
                Dictionary <string, object> dcParams = new Dictionary <string, object>();
                dcParams = DictionaryPro.RequestToDic(context);
                string stcd = DictionaryPro.GetDicValue(dcParams, "stcd");
                string list = "";
                //DAL
                VW_Monitoringindex_DAL dal = new VW_Monitoringindex_DAL();

                if (stcd != "")
                {
                    list = dal.GetMonitoringcurve(stcd);
                }

                int cnt = 0;
                //返回数据
                responseMessage.message = new { total = cnt, rows = list };
                result.Content          = new StringContent(JsonHelper.Object2Json(responseMessage), Encoding.GetEncoding("utf-8"), "application/json");
            }
            catch (Exception ex)
            {
                //返回错误信息
                //responseMessage.status = -1;
                //responseMessage.message = ex.Message;
            }

            return(result);
        }
Esempio n. 4
0
        public HttpResponseMessage GettrueName()
        {
            ResponseMessage     responseMessage = new ResponseMessage(0);
            HttpResponseMessage result          = new HttpResponseMessage();

            try
            {
                bool            flag    = false;
                HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];//获取传统context
                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
                Dictionary <string, object> dcParams = new Dictionary <string, object>();
                dcParams = DictionaryPro.RequestToDic(context);
                string          UserID  = DictionaryPro.GetDicValue(dcParams, "UserID");//用户名
                DataTable       account = new DataTable();
                ProjectInfo_DAL dal     = new ProjectInfo_DAL();
                account = dal.Getaccount(UserID);

                responseMessage.message = new { rows = account };
                result.Content          = new StringContent(JsonHelper.Object2Json(responseMessage), Encoding.GetEncoding("utf-8"), "application/json");
            }

            catch (Exception ex)
            {
                //返回错误信息
                //返回错误信息
                responseMessage.status  = -1;
                responseMessage.message = ex.Message;
            }
            return(result);
        }
Esempio n. 5
0
        public HttpResponseMessage GetVW_TodayEmissionreduction()
        {
            ResponseMessage     responseMessage = new ResponseMessage(0);
            HttpResponseMessage result          = new HttpResponseMessage();

            try
            {
                HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];//获取传统context
                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
                Dictionary <string, object> dcParams = new Dictionary <string, object>();
                dcParams = DictionaryPro.RequestToDic(context);
                int       cnt         = 0;
                DateTime  starttm     = DateTime.Parse(DictionaryPro.GetDicValue(dcParams, "starttm"));
                DateTime  endtm       = DateTime.Parse(DictionaryPro.GetDicValue(dcParams, "endtm"));
                DataTable MyDataTable = new DataTable();
                //DAL
                系统采集器Index_DAL dal  = new 系统采集器Index_DAL();
                DataTable      list = dal.GetVW_TodayEmissionreduction(starttm, endtm);

                //构造列
                MyDataTable.Columns.Add(new DataColumn("AllQuse", typeof(float)));
                MyDataTable.Columns.Add(new DataColumn("AllQss", typeof(float)));
                MyDataTable.Columns.Add(new DataColumn("Allmco2", typeof(float)));
                MyDataTable.Columns.Add(new DataColumn("Allmso2", typeof(float)));
                MyDataTable.Columns.Add(new DataColumn("Allmnox", typeof(float)));
                MyDataTable.Columns.Add(new DataColumn("Allmfc", typeof(float)));
                //构造行
                DataRow dr;

                dr            = MyDataTable.NewRow();
                dr["AllQuse"] = Convert.ToDouble(list.Rows[list.Rows.Count - 1][1]) - Convert.ToDouble(list.Rows[0][1]);
                dr["AllQss"]  = (Convert.ToDouble(list.Rows[list.Rows.Count - 1][2]) - Convert.ToDouble(list.Rows[0][2])) * 0.001;    //*0.001是为了单位换算
                dr["Allmco2"] = (Convert.ToDouble(list.Rows[list.Rows.Count - 1][3]) - Convert.ToDouble(list.Rows[0][3])) * 0.001;
                dr["Allmso2"] = (Convert.ToDouble(list.Rows[list.Rows.Count - 1][4]) - Convert.ToDouble(list.Rows[0][4])) * 0.001;
                dr["Allmnox"] = (Convert.ToDouble(list.Rows[list.Rows.Count - 1][5]) - Convert.ToDouble(list.Rows[0][5])) * 0.001;
                dr["Allmfc"]  = (Convert.ToDouble(list.Rows[list.Rows.Count - 1][6]) - Convert.ToDouble(list.Rows[0][6])) * 0.001;
                MyDataTable.Rows.Add(dr);
                //返回数据
                responseMessage.message = new { total = cnt, rows = MyDataTable };
                result.Content          = new StringContent(JsonHelper.Object2Json(responseMessage), Encoding.GetEncoding("utf-8"), "application/json");
            }
            catch (Exception ex)
            {
                //返回错误信息
                //responseMessage.status = -1;
                //responseMessage.message = ex.Message;
            }

            return(result);
        }
Esempio n. 6
0
        public HttpResponseMessage UpdateProjectInfo()
        {
            ResponseMessage     responseMessage = new ResponseMessage(0);
            HttpResponseMessage result          = new HttpResponseMessage();

            try
            {
                bool            flag    = false;
                HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];//获取传统context
                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
                Dictionary <string, object> dcParams = new Dictionary <string, object>();
                dcParams = DictionaryPro.RequestToDic(context);
                string UserID          = DictionaryPro.GetDicValue(dcParams, "UserID");          //用户名
                string OldUserPassword = DictionaryPro.GetDicValue(dcParams, "OldUserPassword"); //密码
                string newUserPassword = DictionaryPro.GetDicValue(dcParams, "newUserPassword"); //密码

                DataTable       account = new DataTable();
                ProjectInfo_DAL dal     = new ProjectInfo_DAL();
                //验证密码
                account = dal.Getaccount(UserID);
                if (account != null)
                {
                    //验证通过标志

                    //用户名
                    string username = "";

                    if (account.Rows[0][7].Equals(OldUserPassword))
                    {
                        flag = dal.UpdateProjectInfo(UserID, newUserPassword);
                    }
                }

                responseMessage.message = new { rows = flag };
                result.Content          = new StringContent(JsonHelper.Object2Json(responseMessage), Encoding.GetEncoding("utf-8"), "application/json");
            }

            catch (Exception ex)
            {
                //返回错误信息
                //返回错误信息
                responseMessage.status  = -1;
                responseMessage.message = ex.Message;
            }
            return(result);
        }
Esempio n. 7
0
        public HttpResponseMessage GetTemperatureandswitch()
        {
            ResponseMessage     responseMessage = new ResponseMessage(0);
            HttpResponseMessage result          = new HttpResponseMessage();

            try
            {
                HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];//获取传统context
                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
                Dictionary <string, object> dcParams = new Dictionary <string, object>();
                dcParams = DictionaryPro.RequestToDic(context);
                int      cnt     = 0;
                string   stcd    = DictionaryPro.GetDicValue(dcParams, "stcd");
                DateTime starttm = DateTime.Parse(DictionaryPro.GetDicValue(dcParams, "starttm"));
                DateTime endtm   = DateTime.Parse(DictionaryPro.GetDicValue(dcParams, "endtm"));
                //DAL
                RealTime_DAL dal         = new RealTime_DAL();
                DataTable    list        = dal.GetTemperatureandswitch(starttm, endtm, stcd);
                DataTable    MyDataTable = new DataTable();
                //构造列
                MyDataTable.Columns.Add(new DataColumn("Num", typeof(float)));
                MyDataTable.Columns.Add(new DataColumn("time", typeof(DateTime)));
                DataRow dr;

                for (int i = 0; i < list.Rows.Count - 1; i++)
                {
                    dr         = MyDataTable.NewRow();
                    dr["time"] = list.Rows[i][0];
                    dr["Num"]  = list.Rows[i][1];
                    MyDataTable.Rows.Add(dr);
                }

                //返回数据
                responseMessage.message = new { total = cnt, rows = MyDataTable };
                result.Content          = new StringContent(JsonHelper.Object2Json(responseMessage), Encoding.GetEncoding("utf-8"), "application/json");
            }
            catch (Exception ex)
            {
                //返回错误信息
                //responseMessage.status = -1;
                //responseMessage.message = ex.Message;
            }

            return(result);
        }