Example #1
0
 /// <summary>
 /// 获取所有的宣传图片
 /// </summary>
 /// <returns></returns>
 public IList<Adpic> GetAdpicPage(Pager page)
 {
     return _adpic.GetAdpicPage(page);
 }
        public void Run()
        {
            try
            {
                InitData();
                Hashtable table = new Hashtable();
                string inforank = ErrorType.ERROR_TYPE_INFORMATRION + "," + ErrorType.ERROR_TYPE_FAULT + "," + ErrorType.ERROR_TYPE_ERROR + "," + ErrorType.ERROR_TYPE_WARN;
                DateTime endTime = DateTime.Now.AddDays(1);//结束时间
                DateTime startTime = DateTime.Now.AddDays(-1);//开始时间
                Pager page = new Pager() { PageIndex = 1, PageSize = 50 };

                Fault fault = new Fault() { sendTime = startTime, confirmed = "1,0", inforank = inforank };
                table.Add("page", page);
                table.Add("fault", fault);
                table.Add("endTime", endTime);
                table.Add("fromview", true);
                if (allPlants != null && allPlants.Count > 0)

                    foreach (Plant plant in allPlants)
                    {
                        if (plant.plantUnits == null || plant.plantUnits.Count == 0 || plant.hasFaultDevice == false)
                            continue;
                        string collectorString = string.Empty;

                        foreach (PlantUnit unit in plant.plantUnits)
                        {
                            if (unit.collector == null)
                                continue;
                            collectorString += string.Format("{0},", unit.collector.id);//电站下所有采集器
                        }
                        if (collectorString.Length > 1)
                            collectorString = collectorString.Substring(0, collectorString.Length - 1);
                        if (string.IsNullOrEmpty(collectorString)) continue;
                        fault.collectorString = collectorString;
                        IList<Fault> plantFaults = null;
                        try
                        {
                            plantFaults = faultService.GetPlantLoglist(table);//查询时间是倒序排列
                            if (plantFaults.Count == 0)
                            {
                                ConsoleColor color = Console.ForegroundColor;
                                Console.ForegroundColor = ConsoleColor.Blue;
                                Console.WriteLine(string.Format("there was no fault msg in the plant of {0}", plant.name));
                                Console.ForegroundColor = color;

                            }
                        }
                        catch
                        {
                            throw;
                        }
                        if (plantFaults != null && plantFaults.Count > 0)
                            if (plantFaults[0].sendTime > plant.waringLastSendTime)
                            {
                                User user = UserService.GetInstance().Get((int)plant.userID);
                                if (user != null)
                                {
                                    string lang = "en-us";
                                    if (user.Language != null)
                                        lang = user.Language.codename;
                                    SendWarningHtml(lang, plant.id, plant.name, user.email, user.id);
                                    //更新最后发送时间
                                    plantService.UpdataWarningLastSendTime(plant.id, DateTime.Now);
                                    plant.waringLastSendTime = DateTime.Now;
                                    ConsoleColor color = Console.ForegroundColor;
                                    Console.ForegroundColor = ConsoleColor.Blue;
                                    Console.WriteLine(string.Format("warning device list of plant {0} sent success", plant.name));
                                    Console.ForegroundColor = color;
                                }
                            }
                    }
            }
            catch (Exception e )
            {
                Console.WriteLine(e.Message);
            }
        }
Example #3
0
 public IList<User> GetUsersByPage(Pager page)
 {
     return _userDao.GetUsersByPage(page);
 }
Example #4
0
 public IList<Plant> GetPlantByPage(Pager page)
 {
     return _plantInfo.GetPlantsByPage(page);
 }
 /// <summary>
 /// 获取所有的产品图片
 /// </summary>
 /// <returns></returns>
 public IList<ProductPicture> GetProductPicturePage(Pager table)
 {
     return _productpicture.GetProductPicturePage(table);
 }
 public IList<ReportDataItem> GetDataItemsByPage(Pager page)
 {
     return _dataItemDao.GetDataItemList(page);
 }
Example #7
0
 private void LoadingPageCount(Pager page)
 {
     _faultDao.LoadingPageCount(page);
 }
Example #8
0
 public IList<Fault> Getlist(Pager page)
 {
     LoadingPageCount(page);
     return _faultDao.Getlist(page);
 }
Example #9
0
 public IList<DeviceModel> GetDevicemodelsByPage(Pager page)
 {
     return _DeviceModelDao.GetDevicemodelsByPage(page);
 }
Example #10
0
 public void LoadingPageCount(Pager page)
 {
     _faultDao.LoadingPageCount(page);
 }
Example #11
0
 public IList<MonitorItem> GetMonitorItemsByPage(Pager page)
 {
     return _monitorItemDao.GetMonitorItemsByPage(page);
 }