Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.CheckProfile(Context);

            oS            = CommonUtility.GetUserSession(Context);
            OrderListHTML = CustomerHelper.GetCustomerOrderList(oS.sCustomer.SysNo, 0);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            IcsonSessionInfo oSession = (IcsonSessionInfo)Session["IcsonSessionInfo"];

            if (oSession == null)
            {
                oSession = new IcsonSessionInfo();
                Session["IcsonSessionInfo"] = oSession;
            }

            if (oSession.sCustomer == null || oSession.sCustomer.SysNo == AppConst.IntNull)
            {
                string url = "login.aspx";
                Response.Redirect(url);
            }

            if (Request.QueryString["Type"] != null)
            {
                this.opt = Request.QueryString["Type"].ToString();
            }

            CustomerInfo oCustomer = oSession.sCustomer;

            if (oCustomer.EmailStatus == (int)AppEnum.EmailStatus.Confirmed)
            {
                lblEmail.Visible = true;
                txtEmail.Visible = false;
            }
            else
            {
                lblEmail.Visible = false;
                txtEmail.Visible = true;
            }

            if (!Page.IsPostBack)
            {
                lbUserId.Text = oSession.sCustomer.CustomerID;
                DatePickerUtil.GetInstance().setDatePickerBox(txtBirthDay);
                scArea.BindArea();
                if (this.opt != "reg")
                {
                    txtName.Text             = oCustomer.CustomerName;
                    rblGeneder.SelectedIndex = rblGeneder.Items.IndexOf(rblGeneder.Items.FindByValue(oCustomer.Gender.ToString().Trim()));
                    txtCellPhone.Text        = oCustomer.CellPhone;
                    txtPhone.Text            = oCustomer.Phone;
                    if (oCustomer.DwellAreaSysNo != 1)//这个是new user的默认值。
                    {
                        scArea.AreaSysNo = oCustomer.DwellAreaSysNo;
                    }
                    txtDwellAddress.Text = oCustomer.DwellAddress;
                    txtZip.Text          = oCustomer.DwellZip;
                    txtFax.Text          = oCustomer.Fax;
                    lblEmail.Text        = oCustomer.Email + "(修改需要取消认证)";
                    txtBirthDay.Text     = oCustomer.BirthDay;
                    txtNickname.Text     = oCustomer.NickName;
                }
                txtEmail.Text = oCustomer.Email;
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            base.CheckProfile(Context);
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            oSession = CommonUtility.GetUserSession(Context);
            Hashtable ht = CartManager.GetInstance().GetCartHash();

            ShoppingCartHTML = CustomerHelper.GetCustomerShoppingCart(ht);
        }
Beispiel #4
0
        /// <summary>
        /// 获得用户的session
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static IcsonSessionInfo GetUserSession(HttpContext context)
        {
            IcsonSessionInfo oSession = (IcsonSessionInfo)context.Session["IcsonSessionInfo"];

            if (oSession == null)
            {
                oSession = new IcsonSessionInfo();
                context.Session["IcsonSessionInfo"] = oSession;
            }
            return(oSession);
        }
Beispiel #5
0
 protected void CheckProfile(HttpContext context)
 {
     if (!IsPostBack)
     {
         IcsonSessionInfo oSession = CommonUtility.GetUserSession(context);
         if (oSession.sCustomer == null)
         {
             string loginUrl = String.Concat(YoeJoyConfig.SiteBaseURL, "User/Login.aspx?from=", Context.Request.RawUrl.GetUrlEncodeStr());
             Response.Redirect(loginUrl);
         }
     }
 }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.CheckProfile(Context);
            oSession = CommonUtility.GetUserSession(Context);
            if (!IsPostBack)
            {
                scArea.BindArea();
                BindAddressList();

                InitGift();
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here

            this.btnCancel.Attributes.Add("onclick", "return confirm('您确认要作废订单吗?')");

            if (Request.QueryString["ID"] != null && Util.IsNaturalNumber(Request.QueryString["ID"]))
            {
                soSysNo = int.Parse(Request.QueryString["ID"]);
            }
            else
            {
                this.ShowError("此订单不存在,请重试");
            }
            oSession = CommonUtility.GetUserSession(Context);
            soInfo   = SaleManager.GetInstance().LoadSO(soSysNo);
            if (soInfo.CustomerSysNo != oSession.sCustomer.SysNo)
            {
                this.ShowError("抱歉,您无权查看他人订单");
            }

            if (Request.QueryString["action"] == "update")
            {
                PanelShow.Visible   = false;
                PanelUpdate.Visible = true;
                btnUpdate.Visible   = true;
            }
            else
            {
                PanelShow.Visible   = true;
                PanelUpdate.Visible = false;
                btnUpdate.Visible   = false;
            }
            if (soInfo.PayTypeSysNo == 13) //支付宝即时到帐付款
            {
                trSOAlipay.Visible = true;
            }
            else
            {
                trSOAlipay.Visible = false;
            }
            lblResult.Text    = "";
            lblResult.Visible = false;
            if (!Page.IsPostBack)
            {
                this.BindPage();
                BindShipTypeGrid();
                BindPayTypeGrid();
                BindAddressList();
            }
        }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         IcsonSessionInfo oSession = CommonUtility.GetUserSession(Context);
         if (oSession.sCustomer != null)
         {
             ProfilerHeadHTML = String.Format(profileHeaderTxtWithLogin, oSession.sCustomer.CustomerID);
         }
         else
         {
             ProfilerHeadHTML = String.Format(profileHeaderTxtWithoutLogin, Context.Request.RawUrl.GetUrlEncodeStr());
         }
     }
 }
Beispiel #9
0
        private void BindAddressList()
        {
            IcsonSessionInfo oSession = CommonUtility.GetUserSession(Context);

            if (oSession.sCustomer == null || oSession.sCustomer.SysNo == AppConst.IntNull)
            {
                Response.Redirect("login.aspx");
            }

            int customerSysNo = oSession.sCustomer.SysNo;

            lblCustomerSysNo.Text = customerSysNo.ToString();
            DataSet ds = CustomerManager.GetInstance().GetCustomerAddressDs(customerSysNo);

            DataList1.DataSource = ds;
            DataList1.DataBind();
        }
Beispiel #10
0
        protected void btnSubmit_Click(object sender, ImageClickEventArgs e)
        {
            if (txtOld.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入旧密码!";
                return;
            }
            if (txtNew0.Text.Trim() == "" || txtNew1.Text.Trim() == "")
            {
                lblErrMsg.Text = "新的密码不能为空!";
                return;
            }
            if (txtNew0.Text.Trim() != txtNew1.Text.Trim())
            {
                lblErrMsg.Text = "密码输入不一致!";
                return;
            }

            IcsonSessionInfo oSession = CommonUtility.GetUserSession(Context);

            if (oSession.sCustomer == null || oSession.sCustomer.SysNo == AppConst.IntNull)
            {
                Response.Redirect("Login.aspx");
            }

            if (txtOld.Text.Trim() != DESProvider.DecryptString(oSession.sCustomer.Pwd))
            {
                lblErrMsg.Text = "您输入的旧密码与您的旧密码不一致,不能修改。";
            }
            else
            {
                //更新数据库中的用户密码
                Hashtable ht = new Hashtable(2);
                ht.Add("SysNo", oSession.sCustomer.SysNo);
                ht.Add("Pwd", DESProvider.EncryptString(txtNew0.Text.Trim()));
                CustomerManager.GetInstance().Update(ht);

                //更新session中的密码
                oSession.sCustomer.Pwd = txtNew0.Text.Trim();

                lblErrMsg.Text = "修改成功!";
            }
        }
Beispiel #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     base.CheckProfile(Context);
     // Put user code to initialize the page here
     oSession = CommonUtility.GetUserSession(Context);
     if (oSession.sCustomer.DwellAreaSysNo == AppConst.IntNull && oSession.sCustomer.ReceiveAreaSysNo == AppConst.IntNull)
     {
         tabInfo.Visible     = true;
         lnkInfo.NavigateUrl = "../User/MyAddress.aspx";
     }
     else
     {
         tabInfo.Visible = false;
         //this.soInfo = oSession.sSO;
         //soInfo.VATEMSFee = 0;
         //soInfo.VatInfo.VATEMSFee = 0;
         //oSession.sSO = this.soInfo;
         //Response.Redirect("CheckOut.aspx");
         Response.Redirect("Comfirm.aspx");
     }
 }
        protected void btnSave_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入您的姓名!";
                return;
            }

            if (txtNickname.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入您的昵称!";
                return;
            }

            if (txtDwellAddress.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入联系地址!";
                return;
            }

            if (txtPhone.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入联系电话!";
                return;
            }

            if (scArea.DistrictSysNo == AppConst.IntNull)
            {
                lblErrMsg.Text = "请选择地区(包括省、市、区县)";
                return;
            }

            if (txtCellPhone.Text.Trim() != "")
            {
                if (!Util.IsCellNumber(txtCellPhone.Text.Trim()))
                {
                    lblErrMsg.Text = "手机号码格式不正确,您可以不输入";
                    return;
                }
            }

            if (txtZip.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入邮政编码!";
                return;
            }

            if (txtZip.Text.Trim() != "")
            {
                if (!Util.IsZipCode(txtZip.Text.Trim()))
                {
                    lblErrMsg.Text = "邮政编码格式不正确!";
                    return;
                }
            }

            if (String.IsNullOrEmpty(txtBirthDay.Text.ToString()))
            {
                lblErrMsg.Text = "生日不能为空";
                return;
            }

            if (!Util.IsEmailAddress(txtEmail.Text.Trim()))
            {
                lblErrMsg.Text = "Email地址格式不正确";
                return;
            }

            IcsonSessionInfo oSession = (IcsonSessionInfo)Session["IcsonSessionInfo"];

            if (oSession == null)
            {
                oSession = new IcsonSessionInfo();
                Session["IcsonSessionInfo"] = oSession;
            }

            if (oSession.sCustomer == null || oSession.sCustomer.SysNo == AppConst.IntNull)
            {
                string url = "../CustomError.aspx?msg=" + Server.UrlEncode("缺少注册信息,不能更新或继续注册,请登录");
                Response.Redirect(url);
            }

            bool         isOK      = false;
            CustomerInfo oCustomer = oSession.sCustomer;

            try
            {
                oCustomer.CustomerName   = txtName.Text.Trim();
                oCustomer.NickName       = txtNickname.Text.Trim();
                oCustomer.Gender         = int.Parse(rblGeneder.SelectedItem.Value.Trim());
                oCustomer.Phone          = txtPhone.Text.Trim();
                oCustomer.CellPhone      = txtCellPhone.Text.Trim();
                oCustomer.Fax            = txtFax.Text.Trim();
                oCustomer.DwellAreaSysNo = scArea.AreaSysNo;
                oCustomer.DwellZip       = txtZip.Text.Trim();
                oCustomer.DwellAddress   = txtDwellAddress.Text.Trim();
                oCustomer.Email          = txtEmail.Text.Trim();
                oCustomer.BirthDay       = txtBirthDay.Text.Trim();

                Hashtable ht = new Hashtable(20);

                ht.Add("SysNo", oCustomer.SysNo);
                ht.Add("CustomerName", oCustomer.CustomerName);
                ht.Add("Nickname", oCustomer.NickName);
                ht.Add("Gender", oCustomer.Gender);
                ht.Add("Phone", oCustomer.Phone);
                ht.Add("CellPhone", oCustomer.CellPhone);
                ht.Add("Fax", oCustomer.Fax);
                ht.Add("DwellAreaSysNo", oCustomer.DwellAreaSysNo);
                ht.Add("DwellZip", oCustomer.DwellZip);
                ht.Add("DwellAddress", oCustomer.DwellAddress);
                ht.Add("Email", oCustomer.Email);
                ht.Add("Birthday", oCustomer.BirthDay);
                CustomerManager.GetInstance().Update(ht);

                isOK           = true;
                lblErrMsg.Text = "更新个人信息成功";
            }
            catch (BizException exp)
            {
                lblErrMsg.Text = exp.Message;
            }
            catch (Exception exp)
            {
                ErrorLog.GetInstance().Write(exp.ToString());
                string url = "../CustomError.aspx?msg=" + Server.UrlEncode("更新用户信息失败");
                Response.Redirect(url);
            }

            if (this.opt == "New" && isOK)
            {
                //新注册用户,联系人资料作为默认的收货地址添加到收货地址表中
                CustomerAddressInfo caInfo = new CustomerAddressInfo();
                caInfo.CustomerSysNo = oCustomer.SysNo;
                caInfo.Brief         = "收货地址1";
                caInfo.Contact       = txtName.Text.Trim();
                caInfo.Name          = txtName.Text.Trim();
                caInfo.Phone         = txtPhone.Text.Trim();
                caInfo.CellPhone     = txtCellPhone.Text.Trim();
                caInfo.Fax           = txtFax.Text.Trim();
                caInfo.AreaSysNo     = scArea.AreaSysNo;
                caInfo.Zip           = txtZip.Text.Trim();
                caInfo.Address       = txtDwellAddress.Text.Trim();
                caInfo.IsDefault     = (int)AppEnum.BiStatus.Valid;
                caInfo.UpdateTime    = DateTime.Now;
                CustomerManager.GetInstance().InsertCustomerAddress(caInfo);

                Response.Redirect("../Account/AddressManagement.html");
                //Response.Redirect("Register2.aspx?opt=reg");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            IcsonSessionInfo oSessionInfo = CommonUtility.GetUserSession(Context);

            CustomerInfo cInfo  = oSessionInfo.sCustomer;
            int          cSysNo = cInfo.SysNo;

            bool   result = false;
            string msg    = String.Empty;

            try
            {
                switch (Cmd)
                {
                //添加商品到收藏
                case "add":
                {
                    WishListInfo wInfo = new WishListInfo();
                    wInfo.CustomerSysNo = cSysNo;
                    wInfo.ProductSysNo  = productSysNo;
                    WishListManager.GetInstance().Insert(wInfo);
                    result = true;
                    msg    = "成功添加";
                    Response.Write(JsonContentTransfomer <object> .GetJsonContent(new { IsSuccess = result, Msg = msg }));
                    break;
                }

                //删除单个收藏商品
                case "delete":
                {
                    foreach (string pid in productSysNos)
                    {
                        WishListManager.GetInstance().Delete(cSysNo, int.Parse(pid));
                    }
                    msg = "删除成功";
                    Response.Write(JsonContentTransfomer <object> .GetJsonContent(new { IsSuccess = result, Msg = msg }));
                    break;
                }

                //清空收藏商品
                case "empty":
                {
                    WishListManager.GetInstance().Clear(cSysNo);
                    msg = "清空收藏夹成功";
                    Response.Write(JsonContentTransfomer <object> .GetJsonContent(new { IsSuccess = result, Msg = msg }));
                    break;
                }

                //获得分页的收藏列表
                default:
                {
                    Response.Write(CustomerHelper.GetCustomerWishListProducts(cSysNo, StartIndex));
                    break;
                }
                }
            }
            catch
            {
                msg = "用户请求的操作失败";
                Response.Write(JsonContentTransfomer <object> .GetJsonContent(new { IsSuccess = result, Msg = msg }));
            }
        }
Beispiel #14
0
        /// <summary>
        /// 注册新用户
        /// </summary>
        public static bool RegisterNewCustomer(HttpContext context, NewRegisterCustomerModel customer, out string msg)
        {
            bool isSuccess = false;

            msg = String.Empty;

            string customerID    = customer.CustomerID.Trim();
            string password1     = customer.PassWordInput1.Trim();
            string password2     = customer.PassWordInput2.Trim();
            string customerEmail = customer.CustomerEmail.Trim();

            if (customerID == "")
            {
                msg += "请输入用户名!<br />";
            }
            else if (!CommonUtility.IsValidNum(customerID, "^[\u4e00-\u9fa5a-zA-Z]+$"))//原需求只允许中英文
            {
                msg += "用户名只能包含中英文字符!<br />";
            }
            else if (customerID.Length < 3 || customerID.Length > 20)
            {
                msg += "用户名长度必须大于等于3个字符!<br />";
            }
            if (password1 == "")
            {
                msg += "请输入密码!<br />";
            }
            else if (!CommonUtility.IsValidNum(password1, "[a-zA-Z0-9]+$"))//原需求只允许英文数字组合
            {
                msg += "密码只能是英文数字组合!<br />";
            }
            else if (password1.Length < 6 || password1.Length > 20)
            {
                msg += "密码长度必须大于等于6个字符!<br />";
            }
            else if (password2 == "")
            {
                msg += "请输入确认密码!<br />";
            }
            else if (password2 != password1)
            {
                msg += "请确保两次输入的密码一致!<br />";
            }

            if (customerEmail == "")
            {
                msg += "请输入电子邮箱!<br />";
            }
            else if (!Util.IsEmailAddress(customerEmail))
            {
                msg += "请正确输入电子邮箱地址!";
            }

            try
            {
                //定义一个用户对象并赋值
                CustomerInfo oCustomer = new CustomerInfo();
                //-----基础的三个信息,用户名,密码,邮箱---//
                oCustomer.CustomerID = customerID;
                //DESC加密用户密码
                oCustomer.Pwd   = DESProvider.EncryptString(password1, YoeJoyConfig.DESCEncryptKey);
                oCustomer.Email = customerEmail;

                //---其他信息---//
                oCustomer.EmailStatus      = (int)AppEnum.EmailStatus.Origin;
                oCustomer.Status           = (int)AppEnum.BiStatus.Valid;
                oCustomer.DwellAreaSysNo   = AppConst.IntNull;
                oCustomer.ReceiveAreaSysNo = AppConst.IntNull;

                oCustomer.CustomerRank = (int)AppEnum.CustomerRank.Ordinary;
                oCustomer.IsManualRank = (int)AppEnum.YNStatus.No;
                oCustomer.CustomerType = (int)AppEnum.CustomerType.Personal;

                oCustomer.RegisterTime  = DateTime.Now;
                oCustomer.LastLoginTime = DateTime.Now;
                oCustomer.LastLoginIP   = context.Request.UserHostAddress;

                oCustomer.ValidScore       = 0;
                oCustomer.TotalScore       = 0;
                oCustomer.ValidFreeShipFee = 0;
                oCustomer.TotalFreeShipFee = 0;


                //注册操作
                CustomerManager.GetInstance().Insert(oCustomer);

                IcsonSessionInfo oSession = (IcsonSessionInfo)context.Session["IcsonSessionInfo"];
                if (oSession == null)
                {
                    oSession = new IcsonSessionInfo();
                    context.Session["IcsonSessionInfo"] = oSession;
                }
                //指定当前用户为注册的用户
                oSession.sCustomer = oCustomer;

                isSuccess = true;
            }
            catch (BizException exp)
            {
                msg = exp.Message;
            }
            catch (Exception ex)
            {
                ErrorLog.GetInstance().Write(ex.ToString());
                string url = "../CustomError.aspx?msg=" + context.Server.UrlEncode("用户注册失败!");
                context.Response.Redirect(url);
            }

            if (isSuccess)
            {
                //Response.Redirect("../Customer/NewCustomer.aspx?Type=success");
                msg += "注册成功";
                //lblErrmsg.Text = "恭喜您,注册成功!<br/>";
                //lblErrmsg.Text += "<a href='../Account/AccountCenter.aspx'><span style='color:#FF298F'>请点击进入用户中心!</ span></ a>";

                //Response.Redirect("../Account/AccountCenter.aspx");
            }
            return(isSuccess);
        }
Beispiel #15
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="context"></param>
        /// <param name="name"></param>
        /// <param name="password"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool CustomerLogin(HttpContext context, string name, string password, out string msg)
        {
            bool isSuccess = false;

            msg = String.Empty;

            if (name == "")
            {
                msg = "请输入用户名!";
                return(isSuccess);
            }

            if (password == "")
            {
                msg = "密码不能为空!";
                return(isSuccess);
            }

            CustomerInfo oCustomer = null;

            oCustomer = CustomerManager.GetInstance().Load(name);
            string encryptPassword = DESProvider.EncryptString(password, YoeJoyConfig.DESCEncryptKey);

            //string encryptPassword1 = DESProvider.DecryptString(oCustomer.Pwd, YoeJoyConfig.DESCEncryptKey);
            if (oCustomer == null)
            {
                msg = "用户不存在";
                return(isSuccess);
            }

            if (oCustomer.Pwd != encryptPassword)
            {
                msg = "密码不正确";
                return(isSuccess);
            }
            else if (oCustomer.Status != (int)AppEnum.BiStatus.Valid)
            {
                msg = "用户名已经作废";
                return(isSuccess);
            }
            else
            {
                //初始化会员级别,删除过期会员级别
                //NewPointManager.GetInstance().DelOverDueRank(oCustomer.SysNo);
                //oCustomer = CustomerManager.GetInstance().Load(name);
                //NewPointManager.GetInstance().InitRank(oCustomer.SysNo, oCustomer.CustomerRank);
                //NewPointManager.GetInstance().DelOverDueRank(oCustomer.SysNo);
                oCustomer = CustomerManager.GetInstance().Load(name);

                System.Web.HttpCookie mycookie = new System.Web.HttpCookie("LoginInfo");        //申明新的COOKIE变量
                mycookie.Domain  = YoeJoyConfig.SiteBaseURL;
                mycookie.Expires = DateTime.Now.AddYears(1);
                mycookie.Value   = name + "," + DateTime.Now.ToString(AppConst.DateFormatLong);
                context.Response.Cookies.Add(mycookie);

                IcsonSessionInfo oSession = CommonUtility.GetUserSession(context);
                oSession.sCustomer = oCustomer;

                Hashtable ht = new Hashtable(5);
                ht.Add("SysNo", oCustomer.SysNo);
                ht.Add("LastLoginIP", context.Request.UserHostAddress);
                ht.Add("LastLoginTime", DateTime.Now);
                CustomerManager.GetInstance().Update(ht);

                //if (oCustomer.IsManualRank != (int)AppEnum.YNStatus.Yes)
                //{
                //    int customerRank = CustomerManager.GetInstance().SetRank(oCustomer.SysNo);
                //    oSession.sCustomer.CustomerRank = customerRank;
                //}

                isSuccess = true;
            }

            return(isSuccess);
        }