protected void BindCustomersList() { BPCustomers bpcat = new BPCustomers(); DSCustomers = bpcat.SelectAll(); DSCustomers.tbl_Customers.DefaultView.Sort = "CustomerLastName"; dgCustomers.DataBind(); }
private void btnSend_ServerClick(object sender, EventArgs e) { if (txtFrom.Text == string.Empty) { lblErr.Visible = true; lblErr.Text = "Error: Please enter your email address."; } else { BECustomers ds = new BECustomers(); BPCustomers bp = new BPCustomers(); ds = bp.SelectByCustomerEmail(txtFrom.Text); if (ds.tbl_Customers.Count > 0) { BESetup setupInfo = new BESetup(); BPSetup bpSetup = new BPSetup(); setupInfo = bpSetup.SelectAll(); SmtpMail.SmtpServer = setupInfo.tbl_Setup[0].SetupEmailServer; BECustomers.tbl_CustomersRow customer = ds.tbl_Customers[0]; MailMessage mm = new MailMessage(); mm.To = (txtFrom.Text.Replace(",", ";")).Trim(); mm.From = setupInfo.tbl_Setup[0].SetupEmailAddress1; //mm.Subject = txtSubj.Text; mm.Subject = "Carrie'l Salon and Spa Administration"; mm.Body += "Thank you for using Carrie'l Salon and Spa's Password Retrieval System."; mm.Body += "\r\n\r\nHere is your information:"; mm.Body += "\r\n\r\nEmail:\t" + customer.CustomerEmail; mm.Body += "\r\nPassword:\t" + customer.CustomerPassword; mm.Body += "\r\n\r\nhttp://www.Carriel.ca"; try { SmtpMail.Send(mm); } catch{} lblErr.Visible = true; lblErr.Text = "Your password has been sent."; pnlEmail.Visible = false; btnCont.Visible = true; } else { lblErr.Visible = true; lblErr.Text = "Error: Sorry, we could not find that email address."; } } }
public bool Login (string CustomerEmail, string CustomerPassword) { BPCustomers bp = new BPCustomers(); string[] s = bp.AuthenticateCustomer (CustomerEmail, CustomerPassword); if (s != null) { FormsAuthentication.Initialize (); FormsAuthenticationTicket t = new FormsAuthenticationTicket (1, s[0], DateTime.Now, DateTime.Now.AddMinutes (20), false, s[1]); string hash = FormsAuthentication.Encrypt (t); HttpCookie c = new HttpCookie (FormsAuthentication.FormsCookieName, hash); c.Expires = t.Expiration; Response.Cookies.Add (c); CustomerID = Convert.ToInt32 (s[0]); // if (this.TempCart != 0) // { // BPShoppingCartDetail.MigrateTempCart (Convert.ToInt32 (s[0]), this.TempCart); // } return true; } return false; }
private void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string PageName = Request.ServerVariables["SCRIPT_NAME"]; PageName = PageName.ToLower().Replace("/Carriel-web/", ""); PageName = PageName.ToLower(); if (Request.Cookies["CustomerID"] == null) { viewLoggedOutStatus(); } else if (Request.Cookies["CustomerID"].Value != "0") { BECustomers.tbl_CustomersRow customer; BPCustomers bp = new BPCustomers(); customer = bp.SelectCustomersByID(Convert.ToInt32(Request.Cookies["CustomerID"].Value)).tbl_Customers[0]; LoginUser(customer.CustomerEmail); } } //string PageTitle = ""; //object strID; // switch (PageName) // { // case "productcategories.aspx": // // strID = Request.QueryString["ProductCategoryID"]; // if (strID != null) // { // PageTitle = GetProductCategoryTitle(Convert.ToInt32(strID)); // if (PageTitle.Length > 0) // { // lblTitle.Text = PageTitle + " - Carriel"; // } // } // break; // // case "products.aspx": // strID = Request.QueryString["ProductID"]; // if (strID != null) // { // PageTitle = GetProductTitle(Convert.ToInt32(strID)); // if (PageTitle.Length > 0) // { // lblTitle.Text = PageTitle + " - Carriel"; // } // } // break; // // case "servicecategories.aspx": // // strID = Request.QueryString["ServiceCategoryID"]; // if (strID != null) // { // //PageTitle = GetServiceCategoryTitle(Convert.ToInt32(strID)); // if (PageTitle.Length > 0) // { // lblTitle.Text = PageTitle + " - Carriel"; // } // } // break; // // case "services.aspx": // strID = Request.QueryString["ServiceID"]; // if (strID != null) // { // //PageTitle = GetServiceTitle(Convert.ToInt32(strID)); // if (PageTitle.Length > 0) // { // lblTitle.Text = PageTitle + " - Carriel"; // } // } // break; // // case "applicationcategories.aspx": // // strID = Request.QueryString["ApplicationCategoryID"]; // if (strID != null) // { // //PageTitle = GetApplicationCategoryTitle(Convert.ToInt32(strID)); // if (PageTitle.Length > 0) // { // lblTitle.Text = PageTitle + " - Carriel"; // } // } // break; // // case "applications.aspx": // strID = Request.QueryString["ApplicationID"]; // if (strID != null) // { // //PageTitle = GetApplicationTitle(Convert.ToInt32(strID)); // if (PageTitle.Length > 0) // { // lblTitle.Text = PageTitle + " - Carriel"; // } // } // break; // } GetPositionPostBack _GetPositionPostBack = new GetPositionPostBack(); FormMain.Controls.Add(_GetPositionPostBack); }
private void btnCreate_Click(object sender, EventArgs e) { string firstName = txtCreateFirstName.Text.Trim(); string lastName = txtCreateLastName.Text.Trim(); string email = txtCreateEmail.Text.Trim(); string password = txtCreatePassword.Text.Trim(); string passwordConfirm = txtCreateConfirm.Text.Trim(); // if (txtCreatePassword.Text != txtCreateConfirm.Text) // { if(firstName == "" || lastName == "" || email == "" || password == "" || passwordConfirm == "") { lblLoginError.Visible = false; lblCreateError.Visible = true; lblCreateError.Text = "Error: First Name, Last Name, Email Address, Password, and Password Confirmation are all required."; return; } if (password != passwordConfirm) { lblLoginError.Visible = false; lblCreateError.Visible = true; lblCreateError.Text = "Error: Your password and password confirmation do not match."; return; } else { lblCreateError.Visible = false; } // if (Login(email, password)) // { // Session["LoggedIn"] = true; // //ExtendSession = true; // if (CartID != 0) // { // ConvertTempCart(CartID,CustomerID); // } // Response.Redirect("CustomerInformation.aspx"); // } BPCustomers bp = new BPCustomers(); DSCustomers = bp.SelectByCustomerEmail(email); if(DSCustomers.tbl_Customers.Count > 0) { lblLoginError.Visible = false; lblCreateError.Visible = true; lblCreateError.Text = "Error: This Email Address is already in use."; return; } BECustomers.tbl_CustomersRow customer; DSCustomers = new BECustomers(); if (CustomerID == 0) { // Add a Customer Category customer = DSCustomers.tbl_Customers.Newtbl_CustomersRow(); } else { // Edit a Customer Category DSCustomers = bp.SelectCustomersByID(CustomerID); customer = DSCustomers.tbl_Customers.FindByCustomerID(CustomerID); } //all content to be updated/inserted between here customer.CustomerFirstName = firstName; customer.CustomerLastName = lastName; customer.CustomerEmail = email; customer.CustomerPassword = password; //customer.CustomerNewsletter = chkCustomerNewsletter.Checked; customer.CustomerNewsletter = false; customer.CustomerActive = true; customer.DateModified = DateTime.Now; customer.ModifiedByAdminID = Convert.ToInt32(base.CustomerID); if (CustomerID == 0) { //Add new CustomerRow to table customer.DateCreated = DateTime.Now; DSCustomers.tbl_Customers.Addtbl_CustomersRow(customer); } bp.Update(DSCustomers); CustomerID = customer.CustomerID; AddAddress(0, firstName, lastName, email); //billing AddAddress(1, null, null, null); //shipping if (CartID != 0) { ConvertTempCart(CartID,CustomerID); } Response.Redirect("CustomerInformation.aspx"); }
private void btnDelete_Click(object sender, EventArgs e) { BPCustomers bp = new BPCustomers(); //bp.DeleteCustomerCountriesByCustomerID(CustomerID); BECustomers.tbl_CustomersRow Customer; DSCustomers = bp.SelectCustomersByID(CustomerID); Customer = DSCustomers.tbl_Customers.FindByCustomerID(CustomerID); Customer.Delete(); bp.Update(DSCustomers); Response.Redirect("BrowseCustomers.aspx"); }
private void btnSubmit_Click(object sender, EventArgs e) { BPCustomers bp = new BPCustomers(); BECustomers.tbl_CustomersRow customer; DSCustomers = new BECustomers(); if (CustomerID == 0) { // Add a Customer Category customer = DSCustomers.tbl_Customers.Newtbl_CustomersRow(); } else { // Edit a Customer Category DSCustomers = bp.SelectCustomersByID(CustomerID); customer = DSCustomers.tbl_Customers.FindByCustomerID(CustomerID); } //all content to be updated/inserted between here customer.CustomerFirstName = txtCustomerFirstName.Text; customer.CustomerLastName = txtCustomerLastName.Text; customer.CustomerEmail = txtCustomerEmail.Text; customer.CustomerPassword = txtCustomerPassword.Text; //customer.CustomerNewsletter = chkCustomerNewsletter.Checked; customer.CustomerNewsletter = false; customer.CustomerActive = chkCustomerActive.Checked; customer.DateModified = DateTime.Now; customer.ModifiedByAdminID = Convert.ToInt32(CarrielUser.CarrielIdentity.MemberID); //all content to be updated/inserted between here if (CustomerID == 0) { //Add new Customer Category customer.DateCreated = DateTime.Now; DSCustomers.tbl_Customers.Addtbl_CustomersRow(customer); } bp.Update(DSCustomers); _CustomerID = customer.CustomerID; UpdateAddress(BillingAddressID, 0); UpdateAddress(ShippingAddressID, 1); Response.Redirect("BrowseCustomers.aspx"); }
protected bool GetCustomerActiveStatus(int CustomerID) { BPCustomers bp = new BPCustomers(); DSCustomers = bp.SelectCustomersByID(CustomerID); BECustomers.tbl_CustomersRow customer = DSCustomers.tbl_Customers[0]; customer = DSCustomers.tbl_Customers[0]; return customer.CustomerActive; }
private void GetCustomerInfo() { BPCustomers bpCat = new BPCustomers(); BECustomers ds = bpCat.SelectCustomersByID(CustomerID); BECustomers.tbl_CustomersRow customer = ds.tbl_Customers.FindByCustomerID(CustomerID); lblTitle.Text = "Edit Customer - " + customer.CustomerLastName + ", " + customer.CustomerFirstName; txtCustomerFirstName.Text = customer.CustomerFirstName; txtCustomerLastName.Text = customer.CustomerLastName; if (!customer.IsCustomerEmailNull()) { txtCustomerEmail.Text = customer.CustomerEmail; } if (!customer.IsCustomerPasswordNull()) { txtCustomerPassword.Text = customer.CustomerPassword; } chkCustomerNewsletter.Checked = customer.CustomerNewsletter; chkCustomerActive.Checked = customer.CustomerActive; }
private void BindCustomers () { BPCustomers bpCustomer = new BPCustomers(); DSCustomers = bpCustomer.SelectAll(); DSCustomers.tbl_Customers.DefaultView.Sort = "CustomerFullName"; ddlCustomers.DataSource = DSCustomers.tbl_Customers.DefaultView; ddlCustomers.DataTextField = "CustomerFullName"; ddlCustomers.DataValueField = "CustomerID"; ddlCustomers.DataBind(); ddlCustomers.Items.Insert(0, new ListItem("(All Customers)", "-1")); }