public int AddOrUpdateMemberAddress(AddMemberAddressDTO addMemberAddress, string operatorName) { if (addMemberAddress == null) { throw new ArgumentNullException("对象不能为空"); } if (string.IsNullOrWhiteSpace(operatorName)) { throw new ArgumentNullException("操作者不能为空"); } CMemberAddressPO spo1 = new CMemberAddressPO { Address = addMemberAddress.Address, CityId = addMemberAddress.CityId, HouseNumber = addMemberAddress.HouseNumber, Label = addMemberAddress.Label, Latitude = addMemberAddress.Latitude, Longitude = addMemberAddress.Longitude, MemberUUID = addMemberAddress.MemberUUID, Name = addMemberAddress.Name, Telephone = addMemberAddress.Telephone, Id = addMemberAddress.Id, Sex = addMemberAddress.Sex }; CMemberAddressPO cMemberAddressPO = spo1; if (addMemberAddress.Id > 0) { CMemberAddressPO memberAddressPO = this.GetById(addMemberAddress.Id); if (memberAddressPO == null) { throw new BusinessException("此用户地址不存在"); } cMemberAddressPO.MemberAddressUUID = memberAddressPO.MemberAddressUUID; return(this.Update(cMemberAddressPO, operatorName)); } return(this.Add(cMemberAddressPO, operatorName)); }
private string SubmitAddress() { MessageInfo info = new MessageInfo { Status = 1 }; if (base.CurrentMemberWeiXinDTO == null) { info.Message = "未获取到微信用户信息"; WCFClient.LoggerService.Error(string.Format("未获取到微信用户信息", new object[0])); return(JsonSerializer.Serialize(info)); } try { string str = base.Request["name"]; int num = 0; try { num = int.Parse(base.Request["id"]); } catch { num = 0; } string str2 = base.Request["sex"]; string str3 = base.Request["telephone"]; string str4 = base.Request["addres"]; decimal num2 = decimal.Parse(base.Request["latitude"]); decimal num3 = decimal.Parse(base.Request["longitude"]); string str5 = base.Request["houseNumber"]; string str6 = base.Request["label"]; AddMemberAddressDTO dto = new AddMemberAddressDTO { address = str4, cityId = "上海", houseNumber = str5, label = str6, latitude = new decimal?(num2), longitude = new decimal?(num3), memberUUID = base.CurrentMemberWeiXinDTO.MemberUUID, name = str, telephone = str3, id = num, sex = str2 }; ReturnValue <int> value2 = WCFClient.CoffeeService.AddOrUpdateMemberAddress(dto, "MemberUUID"); if (((value2 == null) || (value2.Code != 200)) || (value2.Value <= 0)) { info.Message = "添加客户地址错误"; WCFClient.LoggerService.Error(string.Format("添加客户地址错误,详细情况:{0}", value2.RawMessage)); return(JsonSerializer.Serialize(info)); } return(this.GetAddressList()); } catch (Exception exception) { info.Status = 1; info.Message = "网络异常,稍后重试"; WCFClient.LoggerService.Error(string.Format("添加客户地址错误,详细情况:{0}", exception.Message)); } return(JsonSerializer.Serialize(info)); }
/// <summary> /// 添加用户地址 /// </summary> /// <returns></returns> public ReturnValue <int> AddOrUpdateMemberAddress(AddMemberAddressDTO dto, string operatorName) { return(ReturnValue <int> .Get200OK(CMemberAddressManager.Instance.AddOrUpdateMemberAddress(dto, operatorName))); }