Exemplo n.º 1
0
        protected void Page_PreInit(object sender, EventArgs e)
        {
            this.oHelper = new Helper();
            this.oCustomer = new Customer();

            if (Session["CurrentCulture"] != null && Session["CurrentCulture"].ToString() == "zh-CN")
            {
                Page.Theme = "BlogChinese";
            }
            else
                Page.Theme = "Blog";
        }
Exemplo n.º 2
0
 // Methods
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     Customer customer = new Customer();
     customer.Info.UserName = ((TextBox)this.gvUsers.FooterRow.Cells[0].FindControl("txtNewUserName")).Text.Trim();
     customer.Info.Password = "******";
     customer.Info.Email = ((TextBox)this.gvUsers.FooterRow.Cells[1].FindControl("txtNewEmail")).Text.Trim();
     customer.Info.CustRole = (NRole)Enum.Parse(typeof(NRole), ((DropDownList)this.gvUsers.FooterRow.Cells[2].FindControl("ddlNewRoles")).SelectedValue);
     customer.Info.LastName = ((TextBox)this.gvUsers.FooterRow.Cells[3].FindControl("txtNewLastName")).Text.Trim();
     customer.Info.FirstName = ((TextBox)this.gvUsers.FooterRow.Cells[4].FindControl("txtNewFirstName")).Text.Trim();
     customer.Add();
     this.SetScreen();
 }
Exemplo n.º 3
0
        // Methods
        protected void btnRecover_Click(object sender, EventArgs e)
        {
            this.Page.Validate();
            if (this.Page.IsValid)
            {
                Customer customer = new Customer();
                customer.Info.Email = this.txtEmail.Text.Trim();
                customer.Info.UserName = this.txtUserName.Text.Trim();
                Email email = new Email();
                email.To = this.txtEmail.Text.Trim();

                if (email.SendPwdRecoveryEmail("12345", Request.IsLocal))
                {
                    base.BuildPopup("Your password has been retrieved and sent to your email.");
                }
            }
        }
Exemplo n.º 4
0
        // Methods
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            this.Page.Validate("vgpLogin");

            if (this.Page.IsValid)
            {
                Customer customer = new Customer();
                customer.Info.UserName = this.txtUsername.Text.Trim();
                customer.Info.Password = this.txtPassword.Text.Trim();
                customer.Info.SessionID = Guid.NewGuid().ToString();
                base.Session["token"] = customer.Info.SessionID;
                if (customer.Login())
                {
                    FormsAuthentication.SetAuthCookie(customer.Info.UserName, false);
                    string redirectUrl = FormsAuthentication.GetRedirectUrl(customer.Info.UserName, false);
                    if (string.IsNullOrEmpty(redirectUrl) || redirectUrl.ToLower().EndsWith("default.aspx"))
                    {
                        redirectUrl = base.PathBase + "Member/MyAccount.aspx";
                    }
                    if (this.chkRememberMe.Checked)
                    {
                        HttpCookie cookie = new HttpCookie("UserName", customer.Info.UserName);
                        cookie.Expires = DateTime.Now.AddDays(30.0);
                        base.Response.Cookies.Add(cookie);
                    }
                    else if (base.Request.Cookies["UserName"] != null)
                    {
                        HttpCookie cookie2 = new HttpCookie("UserName");
                        cookie2.Expires = DateTime.Now.AddDays(-1.0);
                        base.Response.Cookies.Add(cookie2);
                    }
                    base.Response.Redirect(redirectUrl);
                }
                else
                {
                    base.BuildPopup("Invalid Password & Username.");
                }
            }
        }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.oUser = new Customer();
     this.oHelper = new Helper();
     if (!this.Page.IsPostBack)
     {
         this.hidSortDirection.Value = "ASC";
         this.hidSortExpression.Value = "username";
         this.SetScreen();
     }
 }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.oUser = new Customer();
     if (!this.Page.IsPostBack)
     {
         this.Page.SetFocus(this.txtEmail);
     }
 }
Exemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         this.oCust = new Customer();
         this.oCust.Info.SessionID = base.Session["token"].ToString();
         this.oCust.Info.CurrentTask = NTaskCustomer.LoadBySessionID;
         if (this.oCust.Load())
         {
             this.txtEmail.Text = this.oCust.Info.Email;
             this.txtFirstName.Text = this.oCust.Info.FirstName;
             this.txtLastName.Text = this.oCust.Info.LastName;
             this.txtUserName.Text = this.oCust.Info.UserName;
             this.hidCustID.Value = this.oCust.Info.CustID.ToString();
         }
         this.ViewState["Customer"] = this.oCust;
     }
     else
     {
         this.oCust = (Customer)this.ViewState["Customer"];
     }
 }