Example #1
0
 public ActionResult AddressInfo(int addressId = -1, bool isModify = false, string viewName = "_AddressInfo")
 {
     Predicate<Maticsoft.Model.Shop.Shipping.ShippingAddress> match = null;
     Maticsoft.BLL.Shop.Shipping.ShippingAddress address = new Maticsoft.BLL.Shop.Shipping.ShippingAddress();
     ShippingAddressModel model = new ShippingAddressModel {
         ListAddress = address.GetModelList(" UserId=" + base.currentUser.UserID)
     };
     ((dynamic) base.ViewBag).IsModify = isModify;
     if ((isModify && (addressId > 0)) && ((model.ListAddress != null) && (model.ListAddress.Count > 0)))
     {
         if (match == null)
         {
             match = info => info.ShippingId == addressId;
         }
         model.CurrentAddress = model.ListAddress.Find(match);
     }
     if ((!isModify && (addressId < 0)) && (model.CurrentAddress == null))
     {
         Maticsoft.Model.Shop.Shipping.ShippingAddress address2 = new Maticsoft.Model.Shop.Shipping.ShippingAddress {
             ShippingId = addressId,
             ShipName = base.CurrentUser.TrueName,
             UserId = base.CurrentUser.UserID,
             EmailAddress = base.CurrentUser.Email,
             CelPhone = base.CurrentUser.Phone
         };
         model.CurrentAddress = address2;
     }
     if (model.CurrentAddress == null)
     {
         Maticsoft.Model.Shop.Shipping.ShippingAddress address3 = new Maticsoft.Model.Shop.Shipping.ShippingAddress {
             ShippingId = addressId
         };
         model.CurrentAddress = address3;
     }
     return base.View(viewName, model);
 }
 public ActionResult DelShippAddress(int id)
 {
     if (id < 1)
     {
         return base.Content("NOID");
     }
     Maticsoft.BLL.Shop.Shipping.ShippingAddress address = new Maticsoft.BLL.Shop.Shipping.ShippingAddress();
     Maticsoft.Model.Shop.Shipping.ShippingAddress model = address.GetModel(id);
     if ((model != null) && (base.CurrentUser.UserID == model.UserId))
     {
         return base.Content(address.Delete(id) ? "OK" : "NO");
     }
     return base.Content("ERROR");
 }
 public ActionResult SubmitShippAddress(Maticsoft.Model.Shop.Shipping.ShippingAddress model)
 {
     if ((base.CurrentUser != null) && (model != null))
     {
         Maticsoft.BLL.Shop.Shipping.ShippingAddress address = new Maticsoft.BLL.Shop.Shipping.ShippingAddress();
         if (model.ShippingId > 0)
         {
             if (address.Update(model))
             {
                 return base.Content("OK");
             }
             return base.Content("NO");
         }
         model.UserId = base.CurrentUser.UserID;
         model.ShippingId = address.Add(model);
         if (model.ShippingId > 1)
         {
             return base.Content("OK");
         }
     }
     return base.Content("NO");
 }
 public ActionResult ShippAddressList(string viewName = "ShippAddressList")
 {
     IPageSetting pageSetting = PageSetting.GetPageSetting("Home", ApplicationKeyType.Shop);
     ((dynamic) base.ViewBag).Title = "我的收货地址" + pageSetting.Title;
     ((dynamic) base.ViewBag).Keywords = pageSetting.Keywords;
     ((dynamic) base.ViewBag).Description = pageSetting.Description;
     List<Maticsoft.Model.Shop.Shipping.ShippingAddress> modelList = new Maticsoft.BLL.Shop.Shipping.ShippingAddress().GetModelList(" UserId=" + base.CurrentUser.UserID);
     return base.View(viewName, modelList);
 }
 public ActionResult ShippAddress(int id = -1, string viewName = "ShippAddress")
 {
     IPageSetting pageSetting = PageSetting.GetPageSetting("Home", ApplicationKeyType.Shop);
     ((dynamic) base.ViewBag).Title = "我的收货地址" + pageSetting.Title;
     ((dynamic) base.ViewBag).Keywords = pageSetting.Keywords;
     ((dynamic) base.ViewBag).Description = pageSetting.Description;
     Maticsoft.BLL.Shop.Shipping.ShippingAddress address = new Maticsoft.BLL.Shop.Shipping.ShippingAddress();
     Maticsoft.Model.Shop.Shipping.ShippingAddress model = new Maticsoft.Model.Shop.Shipping.ShippingAddress();
     if (id > 0)
     {
         model = address.GetModel(id);
     }
     return base.View(viewName, model);
 }