public List <EpidemicInfo> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); TitleNumResponse titleNumResponse = server.findEpideInfoCount(strWhere[CommonText.TITLE_COLOMUN].ToString(), DateTime.Parse("0001-01-01"), DateTime.Parse("9999-12-30")); if (titleNumResponse.error_code != 0) { throw new Exception("连接服务器错误:" + titleNumResponse.error_msg); } TotalNum = titleNumResponse.titlenum; Title_Response title_Response = server.findEpideInfoTitleList(strWhere[CommonText.TITLE_COLOMUN].ToString(), DateTime.Parse("0001-01-01"), DateTime.Parse("9999-12-30"), startIndex, endIndex); TitleInfo[] titlelist = title_Response.titlelist; List <EpidemicInfo> es = new List <EpidemicInfo>(); for (int i = 0; i < titlelist.Length; i++) { es.Add(new EpidemicInfo(titlelist[i].id, titlelist[i].title, titlelist[i].authod)); } return(es); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public List <ShenboContent> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); TitleNumResponse titleNumResponse = server.findReportContenCount(strWhere[ShenboContent.CONTENT_COLOMUN].ToString()); if (titleNumResponse.error_code != 0) { throw new Exception("连接服务器错误:" + titleNumResponse.error_msg); } TotalNum = titleNumResponse.titlenum; ReportContent_Response response = server.findReportContentList(strWhere[ShenboContent.CONTENT_COLOMUN].ToString(), startIndex, endIndex); ReportContent[] titlelist = response.reportcontentlist; List <ShenboContent> wrs = new List <ShenboContent>(); for (int i = 0; i < titlelist.Length; i++) { wrs.Add(new ShenboContent(titlelist[i].id, titlelist[i].logicid, titlelist[i].content, titlelist[i].content_en)); } reportContentArray = response.reportcontentlist; return(wrs); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean updateHxswqhThreshold(double biology, double chem) { SysTask task = new SysTask(); task.type = (int)TaskType.bio_port; task.target_gates = new int[] { AppConfig.hxswqhnum }; task.bio_port = biology; try { ICustomsCMS server = XmlRpcInstance.getInstance(); RPCResponse response = server.publishTask(AppConfig.hxswqhsensor, task); task.type = (int)TaskType.chem_port; task.chem_port = chem; response = server.publishTask(AppConfig.hxswqhsensor, task); if (response.error_code == 0) { return(true); } else { throw new Exception("修改口岸阀值错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误" + ex.Message); } }
/// <summary> /// 根据id和用户名查询符合条件的记录 /// </summary> /// <param name="id">id</param> /// <param name="name">用户名</param> /// <returns></returns> public Boolean findRowByIdAndName(int id, string userName) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); UsercheckRPCResponse usercheckRPCResponse = server.findUser(userName); if (usercheckRPCResponse.id != 0 && usercheckRPCResponse.id != id) { return(true); } return(false); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } try { ICustomsCMS server = XmlRpcInstance.getInstance(); UsercheckListRPCResponse response = server.findAllUserByUserid(userName, 1, 1); Usercheck[] titlelist = response.listmodule; } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public List <SystemManage> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); NumResponse numResponse = server.findAllUserCount(strWhere[SystemManage.USERNAME_COLUMN].ToString()); if (numResponse.error_code != 0) { throw new Exception("连接服务器错误:" + numResponse.error_msg); } TotalNum = numResponse.all_num; UsercheckListRPCResponse response = server.findAllUserByUserid(strWhere[SystemManage.USERNAME_COLUMN].ToString(), startIndex, endIndex); Usercheck[] titlelist = response.listmodule; List <SystemManage> wrs = new List <SystemManage>(); for (int i = 0; i < titlelist.Length; i++) { string rolename = getRoleName(Int32.Parse(titlelist[i].rolename)); wrs.Add(new SystemManage(titlelist[i].id, titlelist[i].username, titlelist[i].password, Int32.Parse(titlelist[i].rolename), rolename, titlelist[i].realname, titlelist[i].idcard)); } return(wrs); } catch (Exception ex) { Console.WriteLine("错误:" + ex.Message); return(null); } }
/// <summary> /// 更新闸机的通行模式 /// </summary> /// <param name="mode">通行模式</param> /// <param name="gateNos">闸机编号</param> /// <returns></returns> public Boolean updateGateMode(int mode, int[] gateNos) { ICustomsCMS server = XmlRpcInstance.getInstance(); SysTask task = new SysTask(); task.type = (int)TaskType.ChangeMode; task.mode = mode; task.target_gates = gateNos; task.created_by = SystemManageService.currentUser.UserName; try { RPCResponse response = server.publishTask(AppConfig.gateSensor, task); if (response.error_code == 0) { return(true); } else { throw new Exception("更改闸机运行模式错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 更新闸机的状态 /// </summary> /// <param name="state">状态</param> /// <param name="gateNos">闸机编号</param> /// <returns></returns> public Boolean updateGateState(int state, int[] gateNos) { ICustomsCMS server = XmlRpcInstance.getInstance(); SysOrder sysOrder = new SysOrder(); sysOrder.type = state; sysOrder.target_gates = gateNos; sysOrder.created_by = SystemManageService.currentUser.UserName; try { OrderRPCResponse response = server.publishSensorOrder(AppConfig.gateSensor, sysOrder); if (response.error_code == 0) { return(true); } else { throw new Exception("更改闸机状态错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public List <LogRecord> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); NumResponse num = server.getLogCount((DateTime)strWhere[LogColumn.para_begin_column], (DateTime)strWhere[LogColumn.para_end_column], strWhere[LogColumn.operatePeople_column].ToString(), "", "");; TotalNum = num.all_num; LogListRPCResponse logListRPCResponse = server.getLog((DateTime)strWhere[LogColumn.para_begin_column], (DateTime)strWhere[LogColumn.para_end_column], strWhere[LogColumn.operatePeople_column].ToString(), "", "", startIndex, endIndex); LogRecord[] list = logListRPCResponse.loglists; List <LogRecord> logs = new List <LogRecord>(); for (int i = 0; i < list.Length; i++) { logs.Add(list[i]); } return(logs); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 温度和核素阈值误差更新 /// </summary> /// <param name="temperature_error"></param> /// <param name="nuclear"></param> /// <param name="gates"></param> /// <returns></returns> public Boolean updateGateThresholdError(double temperature_error, double nuclear_error, int[] gates) { ICustomsCMS server = XmlRpcInstance.getInstance(); SysTask task = new SysTask(); task.type = (int)TaskType.gateThresholdErrorUpdate; task.target_gates = gates; task.tiny_temperature = temperature_error; task.tiny_nuclear = nuclear_error; try { RPCResponse response = server.publishTask(AppConfig.gateSensor, task); if (response.error_code == 0) { return(true); } else { throw new Exception("修改闸机阀值误差错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean publishTask(string mesage, int[] gates) { ICustomsCMS server = XmlRpcInstance.getInstance(); SysTask task = new SysTask(); task.type = (int)TaskType.PublishNotice; task.notice = mesage.Trim(); task.target_gates = gates; try { RPCResponse response = server.publishTask(AppConfig.gateSensor, task); if (response.error_code == 0) { return(true); } else { throw new Exception("发布消息错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 验证用户名和密码 /// </summary> /// <param name="username">用户名</param> /// <param name="password">密码</param> /// <returns>验证是否正确</returns> public Boolean validateUserNameAndPassword(string username, string password) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); Usercheck usercheck = new Usercheck(); usercheck.username = username; usercheck.password = password; UsercheckRPCResponse usercheckRPCResponse = server.checkUser(usercheck); if (usercheckRPCResponse.username != "") { currentUser.UserName = usercheckRPCResponse.username; currentUser.Rolename = usercheckRPCResponse.rolename; return(true); } else { return(false); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public List <GateRecord> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { //实现分页查询的方法, 使用strWhere,startIndex,endIndex, 同时需要返回Pager //记录总数量 ICustomsCMS server = XmlRpcInstance.getInstance(); try { NumResponse numResponse = server.searchPassengerCount(strWhere[ClearanceRecord.NAME_COLUMN].ToString(), DictionaryToXmlRpcStruct.dictionaryToXmlRpcStruct(strWhere));; strWhere.Add("start", startIndex); strWhere.Add("limit", endIndex); GateRecordsResponse res = server.searchPassenger(strWhere[ClearanceRecord.NAME_COLUMN].ToString(), DictionaryToXmlRpcStruct.dictionaryToXmlRpcStruct(strWhere)); TotalNum = numResponse.all_num; List <GateRecord> gateRecords = new List <GateRecord>(res.records); for (int i = 0; i < gateRecords.Count; i++) { gateRecords[i].unnormal_type_name = zhuhai.util.AbnormalType.getAllAbnormalTypeNames()[gateRecords[i].unnormal_type + 1]; gateRecords[i].gate_mode_name = zhuhai.util.GateWorkState.getAllGateWorkStateNames()[gateRecords[i].gate_mode]; } return(gateRecords); } catch (Exception ex) { Console.WriteLine("ClearanceRecordService - InitDt" + ex.Message); } return(null); }
public Boolean addRow(CommonText commonText) { ////以下删掉 ////实例化一个文件流--->与写入文件相关联 //FileStream fo = new FileStream("D:/tmp/tmp.rtf", FileMode.Create); ////实例化BinaryWriter //BinaryWriter bw = new BinaryWriter(fo); //bw.Write(commonText.Bytes); ////清空缓冲区 //bw.Flush(); ////关闭流 //bw.Close(); //fo.Close(); try { ICustomsCMS server = XmlRpcInstance.getInstance(); ImageTextInfo imageTextInfo = new ImageTextInfo(); imageTextInfo.title = commonText.Title; imageTextInfo.content = commonText.Bytes; imageTextInfo.authod = SystemManageService.currentUser.UserName; DBRPCResponse dBRPCResponse = server.putWorkRule(imageTextInfo); return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public CommonText getRow(int id, string title) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); ImageTextInfo imageTextInfo = server.findEpideInfobytitle(title); CommonText commonText = new CommonText(imageTextInfo.id, imageTextInfo.title); commonText.Bytes = imageTextInfo.content; return(commonText); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean setTitle(string titleName) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); RPCResponse rPCResponse = server.setTitle("100", titleName); if (rPCResponse.error_code != 0) { throw new Exception("连接服务器错误:" + rPCResponse.error_msg); } return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public string getTitle() { try { ICustomsCMS server = XmlRpcInstance.getInstance(); TitleNameRPCResponse r = server.getTitle("100"); if (r.error_code != 0) { throw new Exception("连接服务器错误:" + r.error_msg); } return(r.value); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public int getGateTotal() { try { ICustomsCMS server = XmlRpcInstance.getInstance(); GatesNumResponse gatesNumResponse = server.getGatesNumber(AppConfig.gateSensor); if (gatesNumResponse.error_code != 0) { throw new Exception("连接服务器错误:" + gatesNumResponse.error_msg); } return(gatesNumResponse.all_num); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean deleteRow(int id) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); DBRPCResponse dBRPCResponse = server.deleteReportContent(id); if (dBRPCResponse.error_code != 0) { throw new Exception("连接服务器错误:" + dBRPCResponse.error_msg); } return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean addRow(CommonText commonText) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); ImageTextInfo imageTextInfo = new ImageTextInfo(); imageTextInfo.title = commonText.Title; imageTextInfo.content = commonText.Bytes; imageTextInfo.authod = SystemManageService.currentUser.UserName; DBRPCResponse dBRPCResponse = server.putEpideInfo(imageTextInfo); return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean addRow(string content, string content_en, int logicid) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); ReportContent reportContent = new ReportContent(); reportContent.content = content; reportContent.logicid = logicid; reportContent.content_en = content_en; reportContent.operatePeople = SystemManageService.currentUser.UserName; DBRPCResponse dBRPCResponse = server.addReportContent(reportContent); return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 根据id和标题查询符合条件的记录 /// </summary> /// <param name="id">id</param> /// <param name="title">标题</param> /// <returns></returns> public Boolean findRowByIdAndTitle(int id, string title) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); ImageTextInfo imageTextInfo = server.findEpideInfobytitle(title); //查询出结果,同时id不和本身相同 if (imageTextInfo.id != 0 && imageTextInfo.id != id) { return(true); } return(false); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean addRow(SystemManage systemManage) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); Usercheck usercheck = new Usercheck(); usercheck.idcard = systemManage.IdCard; usercheck.password = systemManage.Password; usercheck.realname = systemManage.Name; usercheck.username = systemManage.UserName; usercheck.rolename = systemManage.Type.ToString(); DBRPCResponse dBRPCResponse = server.AddUser(usercheck); return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 根据Id获取照片 /// </summary> /// <param name="photo_id">照片id</param> /// <returns></returns> public byte[] getPassengerPhoto(int photo_id) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); IDPhotoResponse photoResponse = server.getPassengerPhoto(AppConfig.gateSensor, photo_id); if (photoResponse.error_code == 0) { return(photoResponse.content); } else { throw new Exception("错误:" + photoResponse.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 记录日志 /// </summary> /// <param name="operateContent">操作内容</param> /// <param name="operateModule">操作模块</param> public void log(string operateContent, string operateModule) { string operatePeople = SystemManageService.currentUser.UserName; try { ICustomsCMS server = XmlRpcInstance.getInstance(); Log log = new Log(); log.operateContent = operateContent; log.operateModule = operateModule; log.operatePeople = operatePeople; RPCResponse rPCResponse = server.log(log); if (rPCResponse.error_code != 0) { Console.WriteLine("连接服务器错误:" + rPCResponse.error_msg); } } catch (Exception ex) { Console.WriteLine("错误:" + ex.Message); } }
/// <summary> /// 根据条件查询通关记录人数 /// </summary> /// <param name="name">姓名</param> /// <returns></returns> public string getGateRecordsNum(string name, IDictionary <string, object> strWhere) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); GateRecordsNumResponse gateRecordsNumResponse = server.getGateRecordsNum(name, DictionaryToXmlRpcStruct.dictionaryToXmlRpcStruct(strWhere)); if (gateRecordsNumResponse.error_code == 0) { return("过关总人数:" + gateRecordsNumResponse.all_num + "!正常过关人数:" + gateRecordsNumResponse.healthy_num + "!异常过关人数:" + gateRecordsNumResponse.unhealthy_num); } else { throw new Exception("错误:" + gateRecordsNumResponse.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 获取闸机的阈值 /// </summary> /// <param name="gateNo">闸机号</param> /// <returns></returns> public GateThresholdValue getGateThreshold(int gateNo) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); TaskRPCResponse taskRPCResponse = server.getCurrentThreshold(gateNo); if (taskRPCResponse.error_code == 0) { return(new GateThresholdValue(taskRPCResponse.task.thr_temperature, taskRPCResponse.task.thr_nuclear)); } else { Console.WriteLine("连接服务器错误:" + taskRPCResponse.error_msg); return(null); } } catch (Exception ex) { Console.WriteLine("错误:" + ex.Message); return(null); } }
public HxswqhThresholdValue getHxswqhThreshold() { //以下是获取原来的阈值,并显示出来 try { ICustomsCMS server = XmlRpcInstance.getInstance(); TaskRPCResponse taskRPCResponse = server.getCurrentThreshold(AppConfig.hxswqhnum); if (taskRPCResponse.error_code == 0) { return(new HxswqhThresholdValue(taskRPCResponse.task.bio_port, taskRPCResponse.task.chem_port)); } else { Console.WriteLine("连接服务器错误:" + taskRPCResponse.error_msg); return(null); } } catch (Exception ex) { Console.WriteLine("错误:" + ex.Message); return(null); } }