/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); userAddressList = UserAddressBLL.ReadList(base.UserId); singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); string action = RequestHelper.GetQueryString <string>("Action"); switch (action) { case "Update": int id = RequestHelper.GetQueryString <int>("ID"); userAddress = UserAddressBLL.Read(id, base.UserId); singleUnlimitClass.ClassID = userAddress.RegionId; break; case "Delete": string deleteID = RequestHelper.GetQueryString <string>("ID"); UserAddressBLL.Delete(deleteID, base.UserId); ResponseHelper.Write("ok"); ResponseHelper.End(); break; default: break; } }
protected override void PageLoad() { base.PageLoad(); string action = RequestHelper.GetQueryString <string>("Action"); switch (action) { case "Add": Add(); break; case "Delete": Delete(); break; case "Read": Read(); break; } int id = RequestHelper.GetQueryString <int>("id"); userAddress = UserAddressBLL.Read(id, base.UserId); singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); singleUnlimitClass.ClassID = userAddress.RegionId; userAddressList = UserAddressBLL.ReadList(base.UserId); }
protected void btn_modify_Click(object sender, EventArgs e) { //地址 string addpre = ddl_counties.SelectedValue + "," + ddl_streets.SelectedValue + "," + ddl_district.SelectedValue; addpre += "|" + ddl_counties.SelectedItem.Text + ddl_streets.SelectedItem.Text + ddl_district.SelectedItem.Text; UserInfo item = Session["cudoUser"] as UserInfo; List <UserAddress> addresslist = new UserAddressBLL().GetList(item.Id); UserAddress additem = addresslist[0]; additem.UserName = txtusername.Value; additem.Address = addpre; UserInfo uinfo = new UsersBLL().GetUserByID(item.Id); uinfo.NickName = txtusername.Value; uinfo.Address = addpre; if (new UserAddressBLL().UpdateAddress(additem) > 0) { new UsersBLL().UpdateUser(uinfo); Response.Write("<script>window.parent.self.location = \"shoplist.aspx?aid=" + ddl_counties.SelectedValue + "&sid=" + ddl_streets.SelectedValue + "&did=" + ddl_district.SelectedValue + "\";</script>"); //L_msg.Text = "<font color='green'>修改成功!</font>"; } else { L_msg.Text = "<font color='red'>修改失败!</font>"; } }
/// <summary> /// 提交数据 /// </summary> protected override void PostBack() { UserAddressInfo userAddress = new UserAddressInfo(); userAddress.Id = RequestHelper.GetForm <int>("ID"); userAddress.Consignee = StringHelper.AddSafe(RequestHelper.GetForm <string>("Consignee")); userAddress.RegionId = singleUnlimitClass.ClassID; userAddress.Address = StringHelper.AddSafe(RequestHelper.GetForm <string>("Address")); userAddress.ZipCode = StringHelper.AddSafe(RequestHelper.GetForm <string>("ZipCode")); userAddress.Tel = StringHelper.AddSafe(RequestHelper.GetForm <string>("Tel")); userAddress.Mobile = StringHelper.AddSafe(RequestHelper.GetForm <string>("Mobile")); userAddress.IsDefault = RequestHelper.GetForm <int>("IsDefault"); userAddress.UserId = base.UserId; userAddress.UserName = base.UserName; string alertMessage = "添加成功"; if (userAddress.Id <= 0) { UserAddressBLL.Add(userAddress); } else { UserAddressBLL.Update(userAddress); alertMessage = "修改成功"; } ScriptHelper.AlertFront(alertMessage, RequestHelper.RawUrl); }
protected override void PostBack() { UserAddressInfo userAddress = new UserAddressInfo(); userAddress.ID = RequestHelper.GetForm <int>("ID"); userAddress.Consignee = StringHelper.AddSafe(RequestHelper.GetForm <string>("Consignee")); userAddress.RegionID = this.singleUnlimitClass.ClassID; userAddress.Address = StringHelper.AddSafe(RequestHelper.GetForm <string>("Address")); userAddress.ZipCode = StringHelper.AddSafe(RequestHelper.GetForm <string>("ZipCode")); userAddress.Tel = StringHelper.AddSafe(RequestHelper.GetForm <string>("Tel")); userAddress.Mobile = StringHelper.AddSafe(RequestHelper.GetForm <string>("Mobile")); userAddress.IsDefault = RequestHelper.GetForm <int>("IsDefault"); userAddress.UserID = base.UserID; userAddress.UserName = base.UserName; if (userAddress.IsDefault == 1) { UserAddressBLL.UpdateUserAddressIsDefault(0, base.UserID); } string message = "添加成功"; if (userAddress.ID == 0) { UserAddressBLL.AddUserAddress(userAddress); } else { UserAddressBLL.UpdateUserAddress(userAddress); message = "修改成功"; } ScriptHelper.Alert(message, RequestHelper.RawUrl); }
protected override void PageLoad() { base.PageLoad(); this.userAddressList = UserAddressBLL.ReadUserAddressByUser(base.UserID); this.singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); string queryString = RequestHelper.GetQueryString <string>("Action"); if (queryString != null) { if (!(queryString == "Update")) { if (queryString == "Delete") { UserAddressBLL.DeleteUserAddress(RequestHelper.GetQueryString <string>("ID"), base.UserID); ResponseHelper.Write("ok"); ResponseHelper.End(); } } else { int id = RequestHelper.GetQueryString <int>("ID"); this.userAddress = UserAddressBLL.ReadUserAddress(id, base.UserID); this.singleUnlimitClass.ClassID = this.userAddress.RegionID; } } }
protected override void PageLoad() { base.PageLoad(); string action = RequestHelper.GetQueryString <string>("Action"); if (action == "SelectShipping") { this.SelectShipping(); } int id = RequestHelper.GetQueryString <int>("id"); var address = UserAddressBLL.Read(id, base.UserId); if (string.IsNullOrEmpty(address.RegionId)) { return; } //取出所有配送方式Id List <ShippingInfo> tempShippingList = ShippingBLL.ReadList(); tempShippingList = tempShippingList.Where(k => k.IsEnabled == (int)BoolType.True).ToList(); var shippingIds = new List <int>(); tempShippingList.ForEach(k => shippingIds.Add(k.Id)); //读取配送区域列表 List <ShippingRegionInfo> shippingRegionList = ShippingRegionBLL.ReadList(shippingIds.ToArray()); //查找符合条件的配送方式 foreach (ShippingInfo shipping in tempShippingList) { string tempRegionId = address.RegionId; while (tempRegionId.Length >= 1) { bool isFind = false; foreach (ShippingRegionInfo temp in shippingRegionList) { if (("|" + temp.RegionId + "|").IndexOf("|" + tempRegionId + "|") > -1 && temp.ShippingId == shipping.Id) { isFind = true; shippingList.Add(shipping); break; } } if (isFind) { break; } else { tempRegionId = tempRegionId.Substring(0, tempRegionId.Length - 1); tempRegionId = tempRegionId.Substring(0, tempRegionId.LastIndexOf('|') + 1); } } } }
public void updateDefaultAddress(int id) { UserAddressBLL bll = new UserAddressBLL(); UserAddress item = bll.GetAddressByID(id); item.IsDefault = 1; bll.UpdateAddress(item); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { base.CheckAdminPower("ReadUserAddress", PowerCheckType.Single); int queryString = RequestHelper.GetQueryString <int>("UserID"); base.BindControl(UserAddressBLL.ReadUserAddressByUser(queryString), this.RecordList); } }
private void SelectShipping() { int shippingId = RequestHelper.GetQueryString <int>("shippingId"); int addressId = RequestHelper.GetQueryString <int>("addressId"); string checkCart = HttpUtility.UrlDecode(CookiesHelper.ReadCookieValue("CheckCart")); int[] cartIds = Array.ConvertAll <string, int>(checkCart.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); if (string.IsNullOrEmpty(checkCart) || cartIds.Length < 1) { ResponseHelper.Write("error|请选择需要购买的商品"); ResponseHelper.End(); } var address = UserAddressBLL.Read(addressId, base.UserId); //计算配送费用 List <CartInfo> cartList = CartBLL.ReadList(base.UserId).Where(k => cartIds.Contains(k.Id)).ToList(); if (cartList.Count < 1) { ResponseHelper.Write("error|请选择需要购买的商品"); ResponseHelper.End(); } int count = 0; int[] ids = cartList.Select(k => k.ProductId).ToArray(); var productList = ProductBLL.SearchList(1, ids.Length, new ProductSearchInfo { InProductId = string.Join(",", ids) }, ref count); cartList.ForEach(k => k.Product = productList.FirstOrDefault(k2 => k2.Id == k.ProductId) ?? new ProductInfo()); decimal shippingMoney = 0; //首先根据ShopId分组,根据供应商的不同来分别计算运费 //然后将分拆后的供应商商品,按单个商品独立计算运费(相同商品购买多个则叠加计算) ShippingInfo shipping = ShippingBLL.Read(shippingId); ShippingRegionInfo shippingRegion = ShippingRegionBLL.SearchShippingRegion(shippingId, address.RegionId); var shopIds = cartList.GroupBy(k => k.Product.ShopId).Select(k => k.Key).ToList(); foreach (var shopId in shopIds) { var shopCartList = cartList.Where(k => k.Product.ShopId == shopId).ToList(); foreach (var shopCartSplit in shopCartList) { shippingMoney += ShippingRegionBLL.ReadShippingMoney(shipping, shippingRegion, shopCartSplit); } } //decimal shippingMoney = ShippingRegionBLL.ReadShippingMoney(shippingId, address.RegionId, cartList); ResponseHelper.Write("ok|" + Math.Round(shippingMoney, 2).ToString()); ResponseHelper.End(); }
protected void DeleteButton_Click(object sender, EventArgs e) { base.CheckAdminPower("DeleteUserAddress", PowerCheckType.Single); string intsForm = RequestHelper.GetIntsForm("SelectID"); if (intsForm != string.Empty) { UserAddressBLL.DeleteUserAddress(intsForm, 0); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("UserAddress"), intsForm); ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl); } }
protected override void PageLoad() { base.PageLoad(); int id = RequestHelper.GetQueryString <int>("id"); userAddress = UserAddressBLL.Read(id, base.UserId); singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); singleUnlimitClass.ClassID = userAddress.RegionId; Title = "收货地址"; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserInfo uinfo = Session["cudoUser"] as UserInfo; List <UserAddress> addresslist = new UserAddressBLL().GetList(uinfo.Id); if (addresslist[0].Address.Split('|')[1] != "") { string[] addlist = addresslist[0].Address.Split('|')[0].Split(','); goshopurl = "shoplist.aspx?aid=" + addlist[0] + "&sid=" + addlist[1] + "&did=" + addlist[2]; } } }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); singleUnlimitClass.FunctionName = "readShippingList()"; int id = RequestHelper.GetQueryString <int>("ID"); if (id > 0) { userAddress = UserAddressBLL.Read(id, base.UserId); singleUnlimitClass.ClassID = userAddress.RegionId; } }
protected override void PageLoad() { base.PageLoad(); this.singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); this.singleUnlimitClass.FunctionName = "readShippingList()"; int queryString = RequestHelper.GetQueryString <int>("ID"); if (queryString > 0) { this.userAddress = UserAddressBLL.ReadUserAddress(queryString, base.UserID); this.singleUnlimitClass.ClassID = this.userAddress.RegionID; } }
private void Delete() { int id = RequestHelper.GetQueryString <int>("id"); if (id < 1) { ResponseHelper.Write("error|无效的收货地址"); ResponseHelper.End(); } UserAddressBLL.Delete(id, base.UserId); ResponseHelper.Write("ok|"); ResponseHelper.End(); }
public ActionResult GetAddressById(int id) { var item = UserAddressBLL.Read(id, uid); VirtualAddress newaddress = new VirtualAddress(); newaddress.id = item.Id; newaddress.name = item.Consignee; newaddress.address = item.Address; newaddress.mobile = item.Mobile; newaddress.isdefault = Convert.ToBoolean(item.IsDefault); newaddress.regionnames = string.Join(",", RegionBLL.RegionNameList(item.RegionId).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Skip(1)); return(Json(new { address = newaddress }, JsonRequestBehavior.AllowGet)); }
protected override void PageLoad() { base.PageLoad(); if ((ShopConfig.ReadConfigInfo().AllowAnonymousAddCart == 0) && (base.UserID == 0)) { ResponseHelper.Redirect("/User/Login.aspx?RedirectUrl=/CheckOut.aspx"); ResponseHelper.End(); } if ((Sessions.ProductBuyCount == 0) || (Sessions.ProductTotalPrice == 0M)) { ResponseHelper.Redirect("/Cart.aspx"); ResponseHelper.End(); } if (base.UserID > 0) { this.userAddressList = UserAddressBLL.ReadUserAddressByUser(base.UserID); List <UserCouponInfo> list = UserCouponBLL.ReadUserCouponCanUse(base.UserID); foreach (UserCouponInfo info in list) { if (info.Coupon.UseMinAmount <= Sessions.ProductTotalPrice) { this.userCouponList.Add(info); } } this.moneyLeft = UserBLL.ReadUserMore(base.UserID).MoneyLeft; } this.payPluginsList = PayPlugins.ReadProductBuyPayPluginsList(); this.favorableActivity = FavorableActivityBLL.ReadFavorableActivity(DateTime.Now, DateTime.Now, 0); if (this.favorableActivity.ID > 0) { if ((("," + this.favorableActivity.UserGrade + ",").IndexOf("," + this.GradeID.ToString() + ",") > -1) && (Sessions.ProductTotalPrice >= this.favorableActivity.OrderProductMoney)) { if (this.favorableActivity.GiftID != string.Empty) { GiftSearchInfo gift = new GiftSearchInfo(); gift.InGiftID = this.favorableActivity.GiftID; this.giftList = GiftBLL.SearchGiftList(gift); } } else { this.favorableActivity = new FavorableActivityInfo(); } } base.Title = "结算中心"; }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); userAddressList = UserAddressBLL.ReadList(base.UserId); singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); singleUnlimitClass.ClassID = (!string.IsNullOrEmpty(userAddress.RegionId)) ? userAddress.RegionId : "|1|"; string action = RequestHelper.GetQueryString <string>("Action"); switch (action) { case "Update": int id = RequestHelper.GetQueryString <int>("ID"); userAddress = UserAddressBLL.Read(id, base.UserId); singleUnlimitClass.ClassID = userAddress.RegionId; break; case "Delete": string deleteID = RequestHelper.GetQueryString <string>("ID"); UserAddressBLL.Delete(deleteID, base.UserId); ResponseHelper.Write("ok"); ResponseHelper.End(); break; case "Add": Add(); break; case "Read": Read(); break; case "SetDefaultAddress": int addressId = RequestHelper.GetQueryString <int>("addressId"); SetDefaultAddress(addressId); break; case "ReadAddressList": ReadAddressList(); break; default: break; } }
public ActionResult GetAddress() { var address = UserAddressBLL.ReadList(uid); List <VirtualAddress> addresslist = new List <VirtualAddress>(); foreach (var item in address) { VirtualAddress newaddress = new VirtualAddress(); newaddress.id = item.Id; newaddress.name = item.Consignee; newaddress.address = RegionBLL.RegionNameList(item.RegionId) + " " + item.Address; newaddress.mobile = item.Mobile; newaddress.isdefault = Convert.ToBoolean(item.IsDefault); addresslist.Add(newaddress); } return(Json(new { address = addresslist }, JsonRequestBehavior.AllowGet)); }
public string addNewAddress(string addressMessage) { JObject addressObject = JObject.Parse(addressMessage); UserAddress item = new UserAddress(); UserAddressBLL bll = new UserAddressBLL(); item.UserId = Convert.ToInt32(addressObject["userid"].ToString()); item.UserName = addressObject["username"].ToString().Replace("\"", ""); item.Mobile = addressObject["mobile"].ToString().Replace("\"", ""); item.Address = addressObject["address"].ToString().Replace("\"", ""); item.IsDefault = Convert.ToInt32(addressObject["isdefault"].ToString()); if (bll.AddAddress(item) > 0) { return("ok"); } return("fail"); }
private void Read() { int id = RequestHelper.GetQueryString <int>("id"); if (id < 1) { ResponseHelper.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { result = "error", msg = "无效的收货地址" })); ResponseHelper.End(); } var entity = UserAddressBLL.Read(id, base.UserId); SingleUnlimitClass unlimitClass = new SingleUnlimitClass(); unlimitClass.ClassID = entity.RegionId; unlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); ResponseHelper.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { result = "ok", consignee = entity.Consignee, address = entity.Address, mobile = entity.Mobile, tel = entity.Tel, regionId = unlimitClass.ShowContent() })); ResponseHelper.End(); }
/// <summary> /// 设为默认 /// </summary> protected void SetDefaultAddress(int addressId) { if (addressId < 1) { Response.Clear(); ResponseHelper.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { flag = "error", msg = "无效的收货地址" })); ResponseHelper.End(); } if (base.UserId <= 0) { Response.Clear(); ResponseHelper.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { flag = "error", msg = "无效的操作,请重新登录" })); ResponseHelper.End(); } UserAddressBLL.SetDefault(addressId, base.UserId); Response.Clear(); ResponseHelper.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { flag = "ok", msg = "操作成功" })); ResponseHelper.End(); }
private void addrssListInit() { UserInfo user = Session["cudoUser"] as UserInfo; UserAddressBLL bll = new UserAddressBLL(); List <UserAddress> list = bll.GetList(user.Id); List <string> addressList = new List <string>(); int i = 0; foreach (UserAddress u in list) { addressList.Add(u.Address.Split('|')[1]); if (i++ == 0) { Session["selectAddress"] = u; } } defaultIndex = addressList.IndexOf(abll.GetAreaName(aid) + abll.GetAreaName(sid) + abll.GetAreaName(did)); address_list.DataSource = addressList; address_list.DataBind(); }
/// <summary> /// 获取地址列表 /// </summary> protected void ReadAddressList() { try { List <UserAddressInfo> tmpuserAddressList = UserAddressBLL.ReadList(base.UserId); List <UserAddressInfo> resultList = new List <UserAddressInfo>(); foreach (var item in tmpuserAddressList) { item.RegionId = RegionBLL.RegionNameList(item.RegionId); resultList.Add(item); } Response.Clear(); Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { flag = "ok", dataList = resultList, msg = "" })); } catch (Exception ex) { Response.Clear(); Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { flag = "error", dataList = "", msg = "系统忙,请稍后重试" })); } finally { Response.End(); } }
protected string CheckUserAddress(HttpContext context, int shopid) { string strResult = string.Empty; UserInfo item = context.Session["cudoUser"] as UserInfo; List <UserAddress> addresslist = new UserAddressBLL().GetList(item.Id); string[] addlist = addresslist[0].Address.Split('|'); if (addresslist[0].UserName.Trim() == "" || addlist[1].Trim() == "") { strResult = "{\"types\":\"0\",\"adtype\":\"0\",\"msg\":\"请先完善您的地址!\"}"; } else { UserInfo uinfo = new UsersBLL().GetUserByID(item.Id); int result = 0; int uaid = Convert.ToInt32(addlist[0].Split(',')[2]); //用户所在楼宇的id(默认) int uaid2 = Convert.ToInt32(uinfo.Address.Split('|')[0].Split(',')[2]); //现在 List <Area> list = new AreaBLL().GetListByShopId(shopid); foreach (Area temp in list) { if (temp.Id == uaid || temp.Id == uaid2) { result = 1; break; } } if (result == 0) { strResult = "{\"types\":\"0\",\"adtype\":\"1\",\"msg\":\"默认地址不在该餐厅服务范围内,请重选本次送餐地址!\"}"; } else { strResult = "{\"types\":\"1\",\"msg\":\"\"}"; } } return(strResult); }
protected void addresbtn_Click(object sender, EventArgs e) { string address = address_list.SelectedValue; if (AreaName != string.Empty && address != string.Empty && !AreaName.Equals(address)) { UserInfo user = Session["cudoUser"] as UserInfo; UserAddressBLL bll = new UserAddressBLL(); List <UserAddress> list = bll.GetList(user.Id); foreach (UserAddress u in list) { if (u.Address.Split('|')[1].Equals(address)) { Session["selectAddress"] = u; string[] id = u.Address.Split('|')[0].Split(','); Response.Redirect("/shoplist.aspx?aid=" + id[0] + "&sid=" + id[1] + "&did=" + id[2]); } } } else { PageInit(); } }
protected override void PageLoad() { base.PageLoad(); //登录验证 if (base.UserId <= 0) { string redirectUrl = "/Mobile/login.html?RedirectUrl=/mobile/CheckOut.html"; ResponseHelper.Redirect(redirectUrl); ResponseHelper.End(); } //购物车验证 checkCart = HttpUtility.UrlDecode(CookiesHelper.ReadCookieValue("CheckCart")); int[] cartIds = Array.ConvertAll <string, int>(checkCart.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); if (string.IsNullOrEmpty(checkCart) || cartIds.Length < 1) { ResponseHelper.Redirect("/Mobile/cart.html"); ResponseHelper.End(); } //cart list #region cart list //商品清单 cartList = CartBLL.ReadList(base.UserId); cartList = cartList.Where(k => cartIds.Contains(k.Id)).ToList(); if (cartList.Count < 1) { ResponseHelper.Redirect("/Mobile/cart.html"); ResponseHelper.End(); } //关联的商品 int count = 0; int[] ids = cartList.Select(k => k.ProductId).ToArray(); var products = ProductBLL.SearchList(1, ids.Length, new ProductSearchInfo { InProductId = string.Join(",", ids) }, ref count); //规格 foreach (var cart in cartList) { cart.Product = products.FirstOrDefault(k => k.Id == cart.ProductId) ?? new ProductInfo(); if (cart.Product.StandardType == 1) { //使用规格的价格和库存 var standardRecord = ProductTypeStandardRecordBLL.Read(cart.ProductId, cart.StandardValueList); cart.Price = standardRecord.SalePrice; cart.LeftStorageCount = standardRecord.Storage - OrderDetailBLL.GetOrderCount(cart.ProductId, cart.StandardValueList); //规格集合 cart.Standards = ProductTypeStandardBLL.ReadList(Array.ConvertAll <string, int>(standardRecord.StandardIdList.Split(';'), k => Convert.ToInt32(k))); } else { cart.Price = cart.Product.SalePrice; cart.LeftStorageCount = cart.Product.TotalStorageCount - OrderDetailBLL.GetOrderCount(cart.ProductId, cart.StandardValueList); } if (cart.LeftStorageCount <= 0) { ScriptHelper.AlertFront("您购物车中 " + cart.Product.Name + " 库存不足,请重新选择", "/Mobile/Cart.html"); } } #endregion //收货地址 addressList = UserAddressBLL.ReadList(base.UserId); addressList = addressList.OrderByDescending(k => k.IsDefault).ToList(); singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); totalProductMoney = cartList.Sum(k => k.BuyCount * k.Price); //用户信息 var user = UserBLL.Read(base.UserId); if (user.Id > 0) { //读取优惠券 List <UserCouponInfo> tempUserCouponList = UserCouponBLL.ReadCanUse(base.UserId); foreach (UserCouponInfo userCoupon in tempUserCouponList) { CouponInfo tempCoupon = CouponBLL.Read(userCoupon.CouponId); if (tempCoupon.UseMinAmount <= totalProductMoney) { userCouponList.Add(userCoupon); } } moneyLeft = UserBLL.ReadUserMore(base.UserId).MoneyLeft; } //读取优惠活动 favorableActivity = FavorableActivityBLL.Read(DateTime.Now, DateTime.Now, 0); if (favorableActivity.Id > 0) { if (("," + favorableActivity.UserGrade + ",").IndexOf("," + base.GradeID.ToString() + ",") > -1 && Sessions.ProductTotalPrice >= favorableActivity.OrderProductMoney) { if (favorableActivity.GiftId != string.Empty) { FavorableActivityGiftSearchInfo giftSearch = new FavorableActivityGiftSearchInfo(); giftSearch.InGiftIds = Array.ConvertAll <string, int>(favorableActivity.GiftId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); giftList = FavorableActivityGiftBLL.SearchList(giftSearch); } } else { favorableActivity = new FavorableActivityInfo(); } } //支付方式列表 payPluginsList = PayPlugins.ReadProductBuyPayPluginsList(); Title = "结算中心"; }
public ActionResult DelAddress(int id) { UserAddressBLL.Delete(id, uid); return(Json(new { flag = true, msg = "删除成功" }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddAddress() { var entity = new UserAddressInfo(); int updateId = RequestHelper.GetForm <int>("updateId"); entity.Consignee = StringHelper.AddSafe(RequestHelper.GetForm <string>("consignee")); entity.Address = StringHelper.AddSafe(RequestHelper.GetForm <string>("address")); entity.Mobile = StringHelper.AddSafe(RequestHelper.GetForm <string>("mobile")); entity.Tel = StringHelper.AddSafe(RequestHelper.GetForm <string>("tel")); entity.Email = StringHelper.AddSafe(RequestHelper.GetForm <string>("email")); entity.IsDefault = Convert.ToInt32(RequestHelper.GetForm <bool>("isdefault")); if (entity.IsDefault > 0) { UserAddressBLL.SetDefault(entity.Id, uid); } SingleUnlimitClass unlimitClass = new SingleUnlimitClass(); entity.RegionId = unlimitClass.ClassID; if (string.IsNullOrEmpty(entity.Consignee)) { return(Content("请填写收货人")); } var region = StringHelper.AddSafe(RequestHelper.GetForm <string>("region")); if (!string.IsNullOrEmpty(region)) { string[] regarr = region.Split(','); if (regarr.Length < 3) { return(Content("请填写完整的地区信息")); } else { string province = regarr[0]; string city = regarr[1]; string town = regarr[2]; if (!string.IsNullOrEmpty(town)) { entity.RegionId = RegionBLL.ReadRegionIdList(province, city, town); } else { entity.RegionId = RegionBLL.ReadRegionIdList(city); } } } else { return(Content("请填写完整的地区信息")); } if (string.IsNullOrEmpty(entity.Address)) { return(Content("请填写详细地址")); } if (string.IsNullOrEmpty(entity.Mobile)) { return(Content("手机号码不能为空")); } entity.UserId = user.Id; entity.UserName = user.UserName; string msg = "添加成功"; if (updateId > 0) { entity.Id = updateId; UserAddressBLL.Update(entity); msg = "修改成功"; } else { updateId = UserAddressBLL.Add(entity); } return(Json(new { flag = true, msg = msg, id = updateId })); }