/// <summary>
 /// 获取设备列表
 /// </summary>
 /// <param name="schoolid"></param>
 /// <param name="campusid"></param>
 public void DateGet(string schoolno, string campusno)
 {
     try
     {
         List <AMS_DeviceModel> deviceinfolist = new List <AMS_DeviceModel>();
         if (string.IsNullOrEmpty(schoolno))
         {
             deviceinfolist = AMS_DeviceBLL.GeDeviceModelByCampusNum(null);
         }
         else
         {
             if (string.IsNullOrEmpty(campusno))
             {
                 deviceinfolist = AMS_DeviceBLL.GeDeviceModelBySchoolNum(schoolno, false);
             }
             else
             {
                 deviceinfolist = AMS_DeviceBLL.GeDeviceModelByCampusNum(campusno);
             }
         }
         _DeviceList.Clear();
         DateTime nowdt = ServerDateTime.Now.Value;
         foreach (AMS_DeviceModel device in deviceinfolist)
         {
             DeviceInfoViewModel deviceVM = new DeviceInfoViewModel();
             deviceVM.Campusid     = device.CampusId;
             deviceVM.Campusname   = device.CampusName;
             deviceVM.Campusnumber = device.CampusNumber;
             deviceVM.Caputrepath  = device.CaputrePath;
             if (device.CaputreTime != null)
             {
                 deviceVM.LastCaputreTime = (nowdt - device.CaputreTime.Value).TotalMinutes.ToString("0.0") + "分钟前";
             }
             deviceVM.Caputretime  = device.CaputreTime;
             deviceVM.Describe     = device.Describe;
             deviceVM.Flag         = device.Flag;
             deviceVM.Id           = device.Id;
             deviceVM.Isdel        = device.IsDel;
             deviceVM.Number       = device.Number;
             deviceVM.Schoolid     = device.SchoolId;
             deviceVM.Schoolnumber = device.SchoolNumber;
             deviceVM.Schooname    = device.SchooName;
             _DeviceList.Add(deviceVM);
         }
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.Message);
     }
 }
 /// <summary>
 /// 数据获取
 /// </summary>
 public bool DataGet()
 {
     try
     {
         _SchoolList.Clear();
         List <AMS_SchoolModel> schoolinfolist = AMS_SchoolBLL.GetAllSchoolInfo();
         foreach (AMS_SchoolModel school in schoolinfolist)
         {
             SchoolInfoViewModel schoolVM = new SchoolInfoViewModel();
             schoolVM.Id               = school.Id;
             schoolVM.Name             = school.Name;
             schoolVM.Number           = school.Number;
             schoolVM.ConnectionString = school.ConnectionString;
             schoolVM.Describe         = school.Describe;
             schoolVM.DTUip            = school.DTUip;
             if (school.Flag == 1)
             {
                 schoolVM.Flag = true;
             }
             else
             {
                 schoolVM.Flag = false;
             }
             List <AMS_CampusModel> campuslist = AMS_CampusBLL.GetCampusInfoListBySchoolNum(school.Number);
             List <AMS_DeviceModel> devicelist = AMS_DeviceBLL.GeDeviceModelBySchoolNum(school.Number, false);
             schoolVM.CampusCount = campuslist.Count;
             schoolVM.DeviceCount = devicelist.Count;
             _SchoolList.Add(schoolVM);
         }
         return(true);
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.Message);
         return(false);
     }
 }