Ejemplo n.º 1
0
		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");
		}
Ejemplo n.º 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");
		}
Ejemplo n.º 3
0
		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");
		}