예제 #1
0
		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.";
				}
			}
		}
예제 #2
0
		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");
		}