Пример #1
0
        public DataTable GetWarningListByPage(WarningAnalysisModel model)
        {
            //return dal.GetWarningListByPage(pageIndex, pageSize, startTime, endTime, warningTypeId, areaId);
            DataTable dt_result = new DataTable();
            dt_result.TableName = "GetWarningListByPage";
            //dt_result.Columns.Add("id",typeof(int));
            dt_result.Columns.Add("datetime", typeof(DateTime));
            dt_result.Columns.Add("Alarmcontent");
            dt_result.Columns.Add("Devicename");
            DataTable dt = dal.GetWarningListByPage(model);
            ht = new Hashtable();

            foreach (DataRow dr in dt.Rows)
            {

                if (!ht.ContainsKey(dr["Devicename"].ToString()))
                {

                    ht.Add(dr["Devicename"].ToString(), dal.GetWaringContentPref(dr["Devicename"].ToString()));
                }
                string Alarmcontent = ht[dr["Devicename"].ToString()].ToString();
                dt_result.Rows.Add(dr["datetime"], Alarmcontent + dr["Alarmcontent"].ToString(), dr["Devicename"]);
            }

            //DataTable dt_result = dal.GetWarningListByPage(model);
            //dt_result.TableName = "GetWarningListByPage";
            return dt_result;
        }
Пример #2
0
 public DataTable GetWarningListByPage(WarningAnalysisModel model)
 {
     try
     {
         return page.GetDataByPage(InitPageModel(model));
     }
     catch (Exception ee)
     {
         throw ee;
     }
 }
Пример #3
0
 public int GetWarningPageCount(WarningAnalysisModel model)
 {
     return dal.GetWarningPageCount(model);
 }
Пример #4
0
 public int GetWarningPageCount(WarningAnalysisModel model)
 {
     return new NTS.WEB.BLL.WarningAnalysis().GetWarningPageCount(model);
 }
Пример #5
0
 public DataTable GetWarningListByPage(WarningAnalysisModel model)
 {
     return new NTS.WEB.BLL.WarningAnalysis().GetWarningListByPage(model);
 }
Пример #6
0
        private PageModel InitPageModel(WarningAnalysisModel model)
        {
            WarningTypeModel wt = wt_List.Find(s => s.Value == model.SelectTypeId);
            if (wt == null)
            {
                throw new Exception("报警类型xml配置有误");
            }
            if (string.IsNullOrEmpty(wt.CValue) || string.IsNullOrEmpty(wt.keycol))
            {
                throw new Exception(wt.Text + "缺少数据库参数信息");
            }
            PageModel pmodel = new PageModel();
            DateTime starttime = model.StartDate;
            DateTime endtime = model.EndDate.AddDays(1);

            pmodel.tablename = wt.CValue;
            pmodel.keycol = wt.keycol;
            pmodel.page = model.PageCurrent;
            pmodel.pagesize = model.PageSize;

            pmodel.wherestr = " DATETIME >= '" + starttime.ToShortDateString() + "' and DATETIME < '" + endtime.ToShortDateString() + "'";

            pmodel.wherestr += string.Format(@" and devicename in (select cname from tb_device where devarea in (SELECT a.id
            FROM tb_area a,f_Cid({0}) b
            WHERE a.id=b.ID ))", model.BuildId);
            pmodel.orderby = wt.keycol;
            return pmodel;
        }
Пример #7
0
        public int GetWarningPageCount(WarningAnalysisModel model)
        {
            try
            {

                var count = page.GetPageCount(InitPageModel(model));
                // return count;
                return count % model.PageSize == 0 ? count / model.PageSize : Convert.ToInt32(count / model.PageSize) + 1;
            }
            catch (Exception ee)
            {
                throw ee;
            }
        }