public override string QueryResult() { JsonModel jsonModel = new JsonModel(); TF.RunSafty.BLL.TAB_MsgCallWork bllCallWork = new TF.RunSafty.BLL.TAB_MsgCallWork(); TF.RunSafty.BLL.TAB_MsgCallWork_Record bllRecord = new TF.RunSafty.BLL.TAB_MsgCallWork_Record(); TF.Api.Utilities.Validation validater = new TF.Api.Utilities.Validation(); try { pCallWork paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <pCallWork>(this.Data); //验证数据正确性,非空字段不能为空 if (validater.IsNotNullPropertiesValidated(paramModel.data)) { foreach (pMsg msg in paramModel.data) { TF.RunSafty.Model.TAB_MsgCallWork_Record record = bllRecord.GetModelByGUID(msg.strGUID); if (record != null) { record.strReceiverPhone = msg.strReceiverPhone; record.strSenderPhone = msg.strSenderPhone; record.dtTime = DateTime.Parse(msg.dtSendTime); record.nResult = int.Parse(msg.nResult); bllRecord.Update(record); } else { record.strReceiverPhone = msg.strReceiverPhone; record.strSenderPhone = msg.strSenderPhone; record.dtTime = DateTime.Parse(msg.dtSendTime); record.nResult = int.Parse(msg.nResult); bllRecord.Add(record); } //更新叫班次数 TF.RunSafty.Model.TAB_MsgCallWork work = bllCallWork.GetModelByGUID(msg.strGUID); if (work != null) { work.dtCallTime = DateTime.Parse(msg.dtSendTime); work.nCallTimes = work.nCallTimes + 1; bllCallWork.Update(work); } } jsonModel.result = 0; jsonModel.resultStr = "提交成功"; } } catch (Exception ex) { TF.CommonUtility.LogClass.logex(ex, ""); jsonModel.result = 1; jsonModel.resultStr = "提交失败" + ex.Message; } string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel); return(result); }
public override string QueryResult() { //根据电话号码找到乘务员的guid,然后根据trainmanguid和receivetime匹配TAB_MsgCallWork 最近的一次记录 JsonModel jsonModel = new JsonModel(); TF.RunSafty.BLL.TAB_MsgCallWork bllCallWork = new TF.RunSafty.BLL.TAB_MsgCallWork(); TF.RunSafty.BLL.TAB_MsgCallWork_Record bllRecord = new TF.RunSafty.BLL.TAB_MsgCallWork_Record(); TF.Api.Utilities.Validation validater = new TF.Api.Utilities.Validation(); try { pCallWork paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <pCallWork>(this.Data); //验证数据正确性,非空字段不能为空 if (validater.IsNotNullPropertiesValidated(paramModel.data)) { foreach (pMsg msg in paramModel.data) { TF.RunSafty.Model.TAB_MsgCallWork work = bllCallWork.GetModelByTelephone(msg.strSenderPhone, msg.dtRecvTime); if (work != null) { TF.RunSafty.Model.TAB_MsgCallWork_Record record = new TAB_MsgCallWork_Record(); record.strGUID = Guid.NewGuid().ToString(); record.strMsgContent = msg.strContent; record.strSenderPhone = msg.strSenderPhone; record.strReceiverPhone = msg.strReceiverPhone; record.strCallWorkGUID = work.strMsgGUID; record.dtTime = DateTime.Parse(msg.dtRecvTime); record.nType = 0; record.nResult = 1; bllRecord.Add(record); //更新叫班表的叫班状态、接收时间、接收次数 work.dtRecvTime = msg.dtRecvTime; work.nRecvCount = work.nRecvCount + 1; work.eCallState = (int)TRsCallWorkState.cwsRecv; bllCallWork.Update(work); } } jsonModel.result = 0; jsonModel.resultStr = "提交成功"; } } catch (Exception ex) { TF.CommonUtility.LogClass.logex(ex, ""); jsonModel.result = 1; jsonModel.resultStr = "提交失败" + ex.Message; } string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel); return(result); }
public override string QueryResult() { JsonModel jsonModel = new JsonModel(); TF.RunSafty.BLL.TAB_MsgCallWork bllCallWork = new TF.RunSafty.BLL.TAB_MsgCallWork(); TF.Api.Utilities.Validation validater = new TF.Api.Utilities.Validation(); try { pCallWork paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <pCallWork>(this.Data); //验证数据正确性,非空字段不能为空 if (validater.IsNotNullPropertiesValidated(paramModel.data)) { TF.RunSafty.Model.TAB_MsgCallWork work = new TAB_MsgCallWork(); work.strTrainmanGUID = paramModel.data.strTrainmanGUID; work.strPlanGUID = paramModel.data.strPlanGUID; work.strSendMsgContent = paramModel.data.strMsgContent; work.dtCallTime = DateTime.Parse(paramModel.data.dtCreateTime); work.strMsgGUID = paramModel.data.strMsgGUID; work.eCallType = paramModel.data.eCallType; work.strRecvUser = paramModel.data.strRecvUser; work.dtRecvTime = paramModel.data.dtRecvTime; work.strSendUser = paramModel.data.strSendUser; work.dtSendTime = paramModel.data.dtSendTime; work.nCallTimes = 0; work.nRecvCount = 0; work.nSendCount = 0; work.eCallState = 1; bllCallWork.Add(work); jsonModel.result = 0; jsonModel.resultStr = "提交成功"; } } catch (Exception ex) { TF.CommonUtility.LogClass.logex(ex, ""); jsonModel.result = 1; jsonModel.resultStr = "提交失败" + ex.Message; } string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel); return(result); }