コード例 #1
0
 public BasicResponse EndBcallDbByBcallInfoList(EndBcallDbByBcallInfoListRequest request)
 {
     TransactionsManager.BeginTransaction(() =>
     {
         foreach (var item in request.Info)
         {
             if (item.CallType == 1)
             {
                 item.CallType = 2;
                 var req       = new B_CallUpdateRequest()
                 {
                     CallInfo = item
                 };
                 var _call = ObjectConverter.Copy <B_CallInfo, B_CallModel>(item);
                 _Repository.UpdateCall(_call);
             }
         }
     });
     return(new BasicResponse());
 }
コード例 #2
0
        public BasicResponse <B_CallInfo> UpdateCall(B_CallUpdateRequest callRequest)
        {
            //var _call = ObjectConverter.Copy<B_CallInfo, B_CallModel>(callRequest.CallInfo);
            //_Repository.UpdateCall(_call);
            //var callresponse = new BasicResponse<B_CallInfo>();
            //callresponse.Data = ObjectConverter.Copy<B_CallModel, B_CallInfo>(_call);
            //return callresponse;

            var callresponse = new BasicResponse <B_CallInfo>();

            //判断缓存中是否存在
            B_CallInfo oldB_CallInfo = null;
            BCallCacheGetByKeyRequest BCallCacheRequest = new BCallCacheGetByKeyRequest();

            BCallCacheRequest.Id = callRequest.CallInfo.Id;
            oldB_CallInfo        = _BCallCacheService.GetByKeyBCallCache(BCallCacheRequest).Data;
            if (oldB_CallInfo == null)
            {
                //缓存中存在此测点
                callresponse.Code    = 1;
                callresponse.Message = "当前更新的呼叫控制记录不存在!";
                return(callresponse);
            }

            var _call = ObjectConverter.Copy <B_CallInfo, B_CallModel>(callRequest.CallInfo);

            _Repository.UpdateCall(_call);

            //更新缓存
            BCallCacheUpdateRequest BCallCacheUpdateRequest = new BCallCacheUpdateRequest();

            BCallCacheUpdateRequest.BCallInfo = callRequest.CallInfo;
            _BCallCacheService.UpdateBCallCache(BCallCacheUpdateRequest);

            callresponse.Data = ObjectConverter.Copy <B_CallModel, B_CallInfo>(_call);
            return(callresponse);
        }