public Response <CRMInfo> AddPod(AddOrUpdateCRMInfoRequest request) { Response <CRMInfo> response = new Response <CRMInfo>(); if (request == null || request.CRMInfo == null) { ArgumentNullException ex = new ArgumentNullException("AddPod request"); LogError(ex); response.ErrorCode = ErrorCode.Argument; response.Exception = ex; return(response); } if (string.IsNullOrEmpty(request.CRMInfo.CustomerName) || string.IsNullOrEmpty(request.CRMInfo.Age) || string.IsNullOrEmpty(request.CRMInfo.City) || string.IsNullOrEmpty(request.CRMInfo.CreateTime) || string.IsNullOrEmpty(request.CRMInfo.Phone) || string.IsNullOrEmpty(request.CRMInfo.ProjectName)) { ArgumentException ex = new ArgumentException("Add CRMInfo, CustomerName or Age or City or CreateTime or Phone or ProjectName can't be null"); LogError(ex); response.ErrorCode = ErrorCode.Argument; response.Exception = ex; return(response); } try { CRMInfoAccessor accessor = new CRMInfoAccessor(); response.Result = accessor.AddCrm(request.CRMInfo); if (response.Result.ID > 0) { response.IsSuccess = true; } else { response.IsSuccess = false; response.ErrorCode = ErrorCode.Technical; } } catch (Exception ex) { LogError(ex); response.IsSuccess = false; response.ErrorCode = ErrorCode.Technical; } return(response); }
public Response <IEnumerable <CRMInfo> > AddPods(AddOrUpdateCRMInfoRequest request) { throw new NotImplementedException(); //Response<IEnumerable<CRMInfo>> response = new Response<IEnumerable<CRMInfo>>(); //if (request == null || request.CRMInfos == null || !request.CRMInfos.Any()) //{ // ArgumentNullException ex = new ArgumentNullException("AddCrms request"); // LogError(ex); // response.ErrorCode = ErrorCode.Argument; // response.Exception = ex; // return response; //} //try //{ // CRMInfoAccessor accessor = new CRMInfoAccessor(); // response.Result = accessor.AddCrms(request.CRMInfos); // if (response.Result.Count() == 0) // { // response.IsSuccess = false; // response.ErrorCode = ErrorCode.Technical; // } // else // { // response.IsSuccess = true; // } //} //catch (Exception ex) //{ // LogError(ex); // response.IsSuccess = false; // response.ErrorCode = ErrorCode.Technical; //} //return response; }
/// <summary> /// 添加crm信息和更改crm信息方法 /// </summary> /// <param name="crminfo"></param> /// <returns></returns> public Response <CRMInfo> OperateCRMInfo(AddOrUpdateCRMInfoRequest request) { Response <CRMInfo> response = new Response <CRMInfo>(); if (request == null || request.CRMInfo == null) { ArgumentNullException ex = new ArgumentNullException("OperateCRMInfo request"); LogError(ex); response.ErrorCode = ErrorCode.Argument; response.Exception = ex; return(response); } try { CRMInfoAccessor CRMAccessor = new CRMInfoAccessor(); response.Result = CRMAccessor.OperateCRMInfo(request.CRMInfo); if (response.Result.ID > 0) { response.IsSuccess = true; } else { response.IsSuccess = false; response.ErrorCode = ErrorCode.Technical; } } catch (Exception ex) { LogError(ex); response.IsSuccess = false; response.Exception = ex; response.ErrorCode = ErrorCode.Technical; } return(response); }