/// <summary> /// 获取命令 /// </summary> /// <returns></returns> public static List <Model.AMS_IssureList> GetCommandState(Model.Enum.IsureCommandType command, int schoolID, Model.Enum.CommandHandleResult state) { AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel(); try { return(bllService.GetCommandState(command, schoolID, state)); } catch (EndpointNotFoundException ex) { throw new AMS.Model.CustomerException("连接服务器失败"); } catch (CommunicationException ex) { throw ex; } catch (Exception ex) { throw ex; } finally { ICommunicationObject ICommObjectService = bllService as ICommunicationObject; try { if (ICommObjectService.State == CommunicationState.Faulted) { ICommObjectService.Abort(); } else { ICommObjectService.Close(); } } catch { ICommObjectService.Abort(); } } }
/// <summary> /// 根据参数值获取命令列表 /// </summary> /// <param name="schoolId">学校Id</param> /// <param name="commandType">命令类型</param> /// <param name="handleResult">学校Id</param> /// <returns></returns> public static List <Model.AMS_CommandList> GetCommandListByCondition(int schoolId, Model.Enum.CommandType commandType, Model.Enum.CommandHandleResult handleResult) { AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel(); bool error = false; try { return(bllService.GetCommandListByCondition(schoolId, commandType, handleResult)); } 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(); } } }
public List <Model.AMS_CommandList> GetCommandListByCondition(int schoolId, Model.Enum.CommandType commandType, Model.Enum.CommandHandleResult handleResult) { StringBuilder strWhere = new StringBuilder(); if (schoolId != -1) { strWhere.AppendFormat(" SchoolId={0} ", schoolId); } if (commandType != Model.Enum.CommandType.None) { if (string.IsNullOrEmpty(strWhere.ToString())) { strWhere.AppendFormat(" Command={0}", (int)commandType); } else { strWhere.AppendFormat(" and Command={0}", (int)commandType); } } if (handleResult != Model.Enum.CommandHandleResult.None) { if (string.IsNullOrEmpty(strWhere.ToString())) { strWhere.AppendFormat(" FinishFlag={0}", (int)handleResult); } else { strWhere.AppendFormat(" and FinishFlag={0}", (int)handleResult); } } List <Model.AMS_CommandList> listModel = new List <Model.AMS_CommandList>(); DataSet ds = ComDal.GetList(strWhere.ToString()); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { listModel.Add(DataRowToAMS_CammandListModel(ds.Tables[0].Rows[i])); } return(listModel); }
/// <summary> /// 根据条件获取相关记录 /// </summary> /// <param name="schoolId"></param> /// <param name="commandType"></param> /// <param name="handleResult"></param> /// <returns></returns> public static List <AdvertManage.Model.AMS_CommandListModel> GetCommandListByCondition(int schoolId, Model.Enum.CommandType commandType, Model.Enum.CommandHandleResult handleResult) { IWCFService.IAdvertManageService advertService = WcfAccessProxy.AMS_ServiceProxy.CreateChannelAdvertManageService(); bool error = false; try { return(advertService.GetCommandListByCondition(schoolId, commandType, handleResult)); } catch (Exception ex) { error = true; SeatManage.SeatManageComm.WriteLog.Write(string.Format("添加下发命令失败 ,异常来自:{0};信息:{1}", ex.Source, ex.Message)); throw ex; } finally { ICommunicationObject ICommObjectService = advertService as ICommunicationObject; try { if (ICommObjectService.State == CommunicationState.Faulted) { ICommObjectService.Abort(); } else { ICommObjectService.Close(); } } catch { ICommObjectService.Abort(); } } }
/// <summary> /// 获取命令状态 /// </summary> /// <param name="command"></param> /// <param name="schoolID"></param> /// <param name="state"></param> /// <returns></returns> public List <Model.AMS_IssureList> GetCommandState(Model.Enum.IsureCommandType command, int schoolID, Model.Enum.CommandHandleResult state) { try { List <Model.AMS_IssureList> modelList = new List <Model.AMS_IssureList>(); StringBuilder strWhere = new StringBuilder(); if (command != Model.Enum.IsureCommandType.None) { strWhere.Append(" CommandType=" + (int)command + " "); } if (schoolID > 0) { if (!string.IsNullOrEmpty(strWhere.ToString())) { strWhere.Append(" and "); } strWhere.Append("SchoolID=" + schoolID + " "); } if (state != Model.Enum.CommandHandleResult.None) { if (!string.IsNullOrEmpty(strWhere.ToString())) { strWhere.Append(" and "); } strWhere.Append(" Flag=" + (int)state + " "); } DataSet ds = dal_issureView.GetList(strWhere.ToString()); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { modelList.Add(DataRowToIssureList(ds.Tables[0].Rows[i])); } return(modelList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根据条件获取命令 /// </summary> /// <param name="schoolId"></param> /// <param name="commandType"></param> /// <param name="handleResult"></param> /// <returns></returns> public List <AdvertManage.Model.AMS_CommandListModel> GetCommandListByCondition(int schoolId, Model.Enum.CommandType commandType, Model.Enum.CommandHandleResult handleResult) { StringBuilder strWhere = new StringBuilder(); if (schoolId != -1) { strWhere.Append(" SchoolId=@SchoolId "); } if (commandType != Model.Enum.CommandType.None) { if (string.IsNullOrEmpty(strWhere.ToString())) { strWhere.Append(" Command=@Command"); } else { strWhere.Append(" and Command=@Command"); } } if (handleResult != Model.Enum.CommandHandleResult.None) { if (string.IsNullOrEmpty(strWhere.ToString())) { strWhere.Append(" FinishFlag=@FinishFlag"); } else { strWhere.Append(" and FinishFlag=@FinishFlag"); } } SqlParameter[] parameters = { new SqlParameter("@SchoolId", schoolId), new SqlParameter("@Command", commandType), new SqlParameter("@FinishFlag", handleResult), }; List <AdvertManage.Model.AMS_CommandListModel> listModel = new List <Model.AMS_CommandListModel>(); DataSet ds = commandDal.GetList(strWhere.ToString(), parameters); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { listModel.Add(DataRowToAMS_CammandListModel(ds.Tables[0].Rows[i])); } return(listModel); }