Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Clear();
            Response.StatusCode = 200;
            string name = Request.QueryString["name"];

            try
            {
                bool ret = BLL_Customer.QueryCustomerExits(name);
                if (ret)
                {
                    Response.Write("True");
                }
                else
                {
                    Response.Write("False");
                }
            }
            catch
            {
                Response.StatusCode = 500;
                Response.Write("True");
            }
            finally
            {
                Response.End();
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["name"] == null)
            {
                return;
            }

            string name     = Request.Form["consignee_name"].ToString();
            string address  = Request.Form["consignee_address"].ToString();
            string mobile   = Request.Form["consignee_mobile"].ToString();
            string postcode = Request.Form["consignee_postcode"].ToString();
            string email    = Request.Form["consignee_email"].ToString();

            Customer cus = new Customer();

            cus.TrueName = name;
            cus.Address  = address;
            cus.Phone    = mobile;
            cus.PostCode = postcode;
            cus.Email    = email;
            cus.Name     = Session["name"].ToString();

            // 听知乎的话,不要乱catch
            if (BLL_Customer.ModifyPostInfo(cus.Name, cus.TrueName, cus.Address, cus.PostCode) &&
                BLL_Customer.ModifyPersonalInfo(cus.Name, "", cus.Phone, cus.Email))
            {
                Server.Transfer("/updatePostInfo.aspx");
            }
            else
            {
                Server.Transfer("/updatePostInfo.aspx?error=1");
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["name"] == null)
            {
                Response.Write("<script>location.href='/login.aspx';</script>");
                return;
            }

            var cus  = BLL_Customer.QueryCustomerPostInfo(Session["name"].ToString());
            var cus2 = BLL_Customer.QueryCustomerPersonalInfo(Session["name"].ToString());

            cus.Email = cus2.Email; cus.Phone = cus2.Phone;
            if (isNullOrEmpty(cus.TrueName) || isNullOrEmpty(cus.Address) || isNullOrEmpty(cus.PostCode) || isNullOrEmpty(cus.Phone))
            {
                fd.InnerHtml = "<script>$('.J_consignee_global').click();</script>";
            }
            else
            {
                trueName.InnerText   = cus.TrueName;
                addr_name.InnerText  = cus.Address;
                addr_tel.InnerText   = cus.Phone.Substring(0, 3) + "****" + cus.Phone.Substring(7);
                sendAddr.InnerText   = "寄送至: " + cus.Address;
                sendMobile.InnerText = "收货人:" + cus.TrueName + " " + cus.Phone.Substring(0, 3) + "****" + cus.Phone.Substring(7);
            }

            var selected_goods = Request.Form["str"];

            string[] goods       = selected_goods.Split(',');
            string   list        = "";
            decimal  price_count = 0.0M;

            foreach (var item in goods)
            {
                var id   = item.Split(':')[0];
                var cnt  = item.Split(':')[1];
                var good = Business_Logic_Layer.BLL_Goods.QueryGood(id);
                price_count += good.UnitPrice * Int32.Parse(cnt);
                list        += "<div class=\"goods-list\">";
                list        += "<div class=\"goods-items\">";
                list        += "<div class=\"goods-suit goods-last\">";
                list        += "<div class=\"goods-item goods-item-extra\" goods-id=\"" + good.Id + "\" sx-type=\"0\">";
                list        += "<div class=\"p-img\">";
                list        += "<a target=\"_blank\" href=\"/detail.aspx?id=" + id.ToString() + "\">";
                list        += "<img src=\"" + good.ImageName + "\" alt=\"" + good.Name + "\" /></a>";
                list        += "</div>";
                list        += "<div class=\"goods-msg\">";
                list        += "<div class=\"goods-msg-gel\">";
                list        += "<div class=\"p-name\">";
                list        += "<a href=\"/detail.aspx?id=" + id.ToString() + "\" target=\"_blank\">" + good.Name + "";
                list        += "</a></div>";
                list        += "<div class=\"p-price\">";
                list        += "<strong class=\"jd-price\">¥ " + Math.Round(good.UnitPrice * Int32.Parse(cnt), 2) + "</strong>";
                list        += "<span class=\"p-num\">x" + cnt.ToString() + "</span></div></div></div></div></div></div></div>";
            }
            shopping_list.InnerHtml = list + shopping_list.InnerHtml;
            goods_count.InnerText   = goods.Length.ToString();
            warePriceId.InnerText   = "¥" + Math.Round(price_count, 2).ToString();
            cardId.InnerText        = "¥-" + Math.Round(price_count, 2).ToString();
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string name      = Request.Form["loginname"];
            string pwd       = Request.Form["nloginpwd"];
            string returnUrl = Request.QueryString["returnUrl"];

            pwd = BLL_Safety.DecodeBase64(pwd);
            int result = 0;

            try
            {
                if (BLL_Customer.Login(name, pwd))
                {
                    Session["name"] = name;
                    result          = 1;
                }
                else
                {
                    result = 2;
                }
            }
            catch
            {
                result = 3;
            }
            finally
            {
                if (result == 1)
                {
                    if (returnUrl != null && returnUrl != "")
                    {
                        Response.Redirect(returnUrl);
                    }
                    else
                    {
                        Response.Redirect("index.aspx");
                    }
                }
                else if (result == 2)
                {
                    Response.Redirect("login.aspx?name=" + name + "&errorID=entry&errorMsg=账户名与密码不匹配,请重新输入");
                }
                else if (result == 3)
                {
                    Response.Redirect("login.aspx?name=" + name + "&errorID=entry&errorMsg=服务器错误");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Clear();
            Response.StatusCode = 200;

            var cus  = BLL_Customer.QueryCustomerPostInfo(Session["name"].ToString());
            var cus2 = BLL_Customer.QueryCustomerPersonalInfo(Session["name"].ToString());

            cus.Email = cus2.Email; cus.Phone = cus2.Phone;
            if (isNullOrEmpty(cus.TrueName) || isNullOrEmpty(cus.Address) || isNullOrEmpty(cus.PostCode) || isNullOrEmpty(cus.Phone))
            {
                Response.StatusCode = 500;
            }

            Response.End();
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string name              = Request.Form["regName"];
            string pwd               = Request.Form["pwd"].Substring(1);
            string pwdRe             = Request.Form["pwdRepeat"].Substring(1);
            string authCode          = Request.Form["authCode"];
            string checkcode_correct = Session["CheckCode"].ToString();

            if (name.Length < 4 || name.Length > 20)
            {
                Response.Redirect("reg.aspx"); return;
            }
            if (pwd.Length < 6 || pwd.Length > 20)
            {
                Response.Redirect("reg.aspx"); return;
            }
            //Regex reg = new Regex("^[\\w\\d-_]{ 4, 20 }$");
            //if (!reg.IsMatch(name)) { Response.Redirect("reg.aspx"); return; }

            if (!pwd.Equals(pwdRe))
            {
                Response.Redirect("reg.aspx?name=" + name +
                                  "&errorID=authCode&errorMsg=两次密码输入不一致");
                return;
            }
            if (!checkcode_correct.Equals(authCode))
            {
                Response.Redirect("reg.aspx?name=" + name +
                                  "&errorID=authCode&errorMsg=验证码错误");
                return;
            }

            Customer customer = new Customer();

            customer.Name     = name;
            customer.Pass     = pwd;
            customer.Question = customer.Answer = "";
            if (BLL_Customer.Register(customer))
            {
                string regSuccessname = name;
                Response.Redirect("login.aspx?name=" + name);
            }
            else
            {
                Response.Redirect("reg.aspx?name=" + name + "&errorMsg=服务器错误");
            }
        }