コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="schoolNum"></param>
 /// <param name="flag"></param>
 /// <returns></returns>
 public List <Model.AMS_Device> GeDeviceModelBySchoolNum(string schoolNum, bool flag)
 {
     try
     {
         StringBuilder           strWhere = new StringBuilder();
         List <Model.AMS_Device> list     = new List <Model.AMS_Device>();
         if (!string.IsNullOrEmpty(schoolNum))
         {
             strWhere.AppendFormat(" SchoolNumber='{0}' ", schoolNum);
             if (flag)
             {
                 strWhere.AppendFormat(" and Flag='{0}'", flag);
             }
             DataSet ds = VDal.GetList(strWhere.ToString());
             for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
             {
                 Model.AMS_Device model = DataRowToAMS_DeviceModel(ds.Tables[0].Rows[i]);
                 list.Add(model);
             }
         }
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public List <Model.AMS_Device> GeDeviceModelByCampusNum(string campusNum)
        {
            try
            {
                StringBuilder           strWhere = new StringBuilder();
                DataSet                 ds       = new DataSet();
                List <Model.AMS_Device> list     = new List <Model.AMS_Device>();
                if (!string.IsNullOrEmpty(campusNum))
                {
                    strWhere.AppendFormat(" CampusNumber='{0}'  ", campusNum);
                    ds = DeDAL.GetList(strWhere.ToString());
                }
                else
                {
                    ds = DeDAL.GetList(strWhere.ToString());
                }
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Model.AMS_Device model = DataRowToAMS_DeviceModel(ds.Tables[0].Rows[i]);
                    list.Add(model);
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        /// <summary>
        /// 更新设备信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Model.Enum.HandleResult UpdateDeviceModel(Model.AMS_Device model)
        {
            AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
            bool error = false;

            try
            {
                return(bllService.UpdateDeviceModel(model));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManage.SeatManageComm.WriteLog.Write(string.Format("根据学校编号获取设备列表遇到错误,异常来自:{0};信息:{1}", ex.Source, ex.Message));
                throw ex;
            }
            finally
            {
                ICommunicationObject ICommObjectService = bllService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
コード例 #4
0
        Model.AMS_Device DataRowToAMS_DeviceModel(DataRow dr)
        {
            Model.AMS_Device model = new Model.AMS_Device();

            if (dr["Id"] != null && dr["Id"].ToString() != "")
            {
                model.Id = int.Parse(dr["Id"].ToString());
            }
            if (dr["Number"] != null && dr["Number"].ToString() != "")
            {
                model.Number = dr["Number"].ToString();
            }
            if (dr["CampusId"] != null && dr["CampusId"].ToString() != "")
            {
                model.CampusId = int.Parse(dr["CampusId"].ToString());
            }
            if (dr["IsDel"] != null && dr["IsDel"].ToString() != "")
            {
                if ((dr["IsDel"].ToString() == "1") || (dr["IsDel"].ToString().ToLower() == "true"))
                {
                    model.IsDel = true;
                }
                else
                {
                    model.IsDel = false;
                }
            }
            if (dr["Flag"] != null && dr["Flag"].ToString() != "")
            {
                if ((dr["Flag"].ToString() == "1") || (dr["Flag"].ToString().ToLower() == "true"))
                {
                    model.Flag = true;
                }
                else
                {
                    model.Flag = false;
                }
            }
            if (dr["Describe"] != null && dr["Describe"].ToString() != "")
            {
                model.Describe = dr["Describe"].ToString();
            }
            if (dr["CaputrePath"] != null && dr["CaputrePath"].ToString() != "")
            {
                model.CaputrePath = dr["CaputrePath"].ToString();
            }
            if (dr["CaputreTime"] != null && dr["CaputreTime"].ToString() != "")
            {
                model.CaputreTime = DateTime.Parse(dr["CaputreTime"].ToString());
            }
            if (dr["DeviceType"] != null && dr["DeviceType"].ToString() != "")
            {
                model.DeviceType = int.Parse(dr["DeviceType"].ToString());
            }
            return(model);
        }
コード例 #5
0
 public Model.Enum.HandleResult UpdateDeviceStatus(string DeviceNo, DateTime stateUpdateTime)
 {
     Model.AMS_Device model = GetDevicebyNo(DeviceNo);
     if (model == null)
     {
         return(HandleResult.Failed);
     }
     model.CaputreTime = stateUpdateTime;
     return(UpdateDeviceModel(model));
 }
 public string DeleteDevice(Model.AMS_Device model)
 {
     try
     {
         dal_device.Delete(model.Id);
         return("");
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("添加设备信息失败:{0}", ex.Message));
     }
 }
コード例 #7
0
 public Model.Enum.HandleResult AddDeviceModel(Model.AMS_Device model)
 {
     try
     {
         if (DeDAL.Add(model) > 0)
         {
             return(HandleResult.Successed);
         }
         else
         {
             return(HandleResult.Failed);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public string AddDevice(Model.AMS_Device model)
 {
     try
     {
         AMS_Device device = dal_device.GetModel(string.Format(" Number='{0}'", model.Number));
         if (device != null)
         {
             return("添加失败,设备编号已存在");
         }
         else
         {
             dal_device.Add(model);
             return("");
         }
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("添加设备信息失败:{0}", ex.Message));
     }
 }