Exemplo n.º 1
0
		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);
		}
Exemplo 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");
		}
Exemplo n.º 3
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");
		}
Exemplo n.º 4
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");
		}
Exemplo n.º 5
0
		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;
		}
Exemplo n.º 6
0
		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;
		}