private void AddAddress(HttpContext context) { string address1 = context.Request["address1"]; string address2 = context.Request["address2"]; string name = context.Request["name"]; string mobile = context.Request["mobile"]; bool res = false; try { if (mobile != null && mobile != "") { AddressBll bll = new AddressBll(); res = bll.InsertAddress(address1, address2, name, mobile); } if (res) { context.Response.Write("sucess"); } else { context.Response.Write("fail"); } } catch { context.Response.Write("false"); } }
private void BindList() { int userid = Convert.ToInt32(Request["id"]); List <T_Address> user = new List <T_Address>(); AddressBll bll = new AddressBll(); user = bll.GetAddressListByUserId(userid); this.addressdata.DataSource = user; this.addressdata.DataBind(); }
public AddressModel GetSelectedAddressInfo(string userId) { AddressBll bll = new AddressBll(); AddressModel model = null; int addrId = String.IsNullOrEmpty(Request.Form["addrId"]) ? 0 : int.Parse(Request.Form["addrId"]); if (addrId == 0) { model = this.AddAddressInfo(userId); } else { model = bll.GetModel(addrId); } return(model); }
private void GetAddress(HttpContext context) { AddressBll bll = new AddressBll(); T_Address address = new T_Address(); address = bll.GetAddressByUserId(); string straddress = ""; if (address != null) { straddress = address.Adress + address.Area + address.Name + address.Mobile; context.Response.Write(straddress); } else { context.Response.Write("fail"); } }
public void ShowAddressList(string userId) { AddressBll bll = new AddressBll(); List <AddressModel> list = bll.GetModelList(userId); if (list.Count == 0) { panAddrList.Visible = false; panNewAddr.Style.Add(HtmlTextWriterStyle.Display, "block"); this.Page.ClientScript.RegisterStartupScript(this.GetType(), "shownewaddress", "showNewAddr();", true); } else { panAddrList.Visible = true; panNewAddr.Style.Add(HtmlTextWriterStyle.Display, "none"); this.rpAddrList.DataSource = list; rpAddrList.DataBind(); } }
private void AddOrder(HttpContext context) { OrderBll bll = new OrderBll(); string card_birthday = context.Request["card_birthday"]; string paytype = context.Request["paytype"]; string remark = context.Request["remark"]; string bastdate = context.Request["bastdate"]; string ordercode = DateTime.Now.ToString("yyyyMMddffffff"); AddressBll addressbll = new AddressBll(); CartBll carbll = new CartBll(); UserBll userbll = new UserBll(); int userid = userbll.GetUserIdByToken(); if (carbll.GetCartListByUserId(userid).Count() > 0) { if (addressbll.GetAddressByUserId() != null) { if (bll.AddOrderByUserId(card_birthday, bastdate, paytype, remark, ordercode)) { context.Response.Write(ordercode); } else { context.Response.Write("fail"); } } else { context.Response.Write("addressfail"); } } else { context.Response.Write("cartisnull"); } }
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); }
public AddressController(DBApiContext context, IConfiguration configuration) : base(configuration) { this.addressBll = new AddressBll(context); }