public AddressModel AddAddressInfo(string userId)
        {
            AddressModel info = new AddressModel();
             info.AddressId = 0;
             info.UserId = userId;
             info.RecieverName = Request.Form["ucaddress_username"].Trim();
             info.Postalcode =Request.Form["ucaddress_postalcode"].Trim();
             info.Email = Request.Form["ucaddress_email"].Trim();
             info.AddressDetail =  Request.Form["ucaddress_address"].Trim();

             RegionInfo regionInfo = ucRegion.GetSelectedRegionInfo();
             info.RegionPath = regionInfo.RegionPath;
             info.Country = regionInfo.Country;
             info.Province = regionInfo.Province;
             info.City = regionInfo.City;
             info.County = regionInfo.County;

             info.Telephone = Request.Form["ucaddress_phone"].Trim();
             info.Mobile = Request.Form["ucaddress_mobile"].Trim();

             if (String.IsNullOrEmpty(info.AddressDetail) || String.IsNullOrEmpty(info.RecieverName)
                 || String.IsNullOrEmpty(info.Country) || String.IsNullOrEmpty(info.Province) || String.IsNullOrEmpty(info.City)
                 || String.IsNullOrEmpty(info.Postalcode) || String.IsNullOrEmpty(info.UserId) || String.IsNullOrEmpty(info.Email) ||
                 (String.IsNullOrEmpty(info.Telephone) && String.IsNullOrEmpty(info.Mobile)))
             {
                 // throw new Exception("地址信息不全");
                 return null;
             }

             AddressBll bll = new AddressBll();
             bll.Save(info);
             return info;
        }
예제 #2
0
 public void Save(NoName.NetShop.Member.Model.AddressModel model)
 {
     if (model.AddressId == 0)
     {
         model.AddressId = Common.CommDataHelper.GetNewSerialNum(AppType.Address);
     }
     if (dal.Exists(model.AddressId))
     {
         dal.Update(model);
     }
     else
     {
         dal.Add(model);
     }
 }