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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public List <TF.RunSafty.Model.TAB_MsgCallWork> GetPlaceList(List <TF.RunSafty.Model.TAB_MsgCallWork> placeList)
        {
            if (placeList != null)
            {
                List <TF.RunSafty.Model.TAB_MsgCallWork> resultList = new List <TF.RunSafty.Model.TAB_MsgCallWork>();
                foreach (TF.RunSafty.Model.TAB_MsgCallWork place in placeList)
                {
                    TF.RunSafty.Model.TAB_MsgCallWork model = new TF.RunSafty.Model.TAB_MsgCallWork();
                    model.dtCallTime = place.dtCallTime;

                    model.dtRecvTime = place.dtRecvTime;

                    model.dtSendTime        = place.dtSendTime;
                    model.nCallTimes        = place.nCallTimes;
                    model.nRecvCount        = place.nRecvCount;
                    model.nSendCount        = place.nSendCount;
                    model.eCallState        = place.eCallState;
                    model.eCallType         = place.eCallType;
                    model.strMsgGUID        = place.strMsgGUID;
                    model.strMobileNumber   = place.strMobileNumber;
                    model.strPlanGUID       = place.strPlanGUID;
                    model.strRecvMsgContent = place.strRecvMsgContent;
                    model.strRecvUser       = place.strRecvUser;
                    model.strSendMsgContent = place.strSendMsgContent;
                    model.strSendUser       = place.strSendUser;
                    model.strTrainmanGUID   = place.strTrainmanGUID;
                    model.strTrainmanName   = place.strTrainmanName;
                    model.strTrainmanNumber = place.strTrainmanNumber;
                    model.dtChuQinTime      = place.dtChuQinTime;
                    model.dtStartTime       = place.dtStartTime;
                    model.strTrainNo        = place.strTrainNo;
                    resultList.Add(model);
                }
                return(resultList);
            }
            return(null);
        }
Esempio n. 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TF.RunSafty.Model.TAB_MsgCallWork model)
 {
     return(dal.Update(model));
 }
Esempio n. 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(TF.RunSafty.Model.TAB_MsgCallWork model)
 {
     return(dal.Add(model));
 }