protected void ButtonRegister_Click(object sender, EventArgs e) { if (TextBoxFirstName.Text.Length > 0 && TextBoxLastName.Text.Length > 0) { int newCustomerID = SQL.AddCustomer(TextBoxUserName.Text, TextBoxPassWord.Text, TextBoxFirstName.Text, TextBoxLastName.Text, TextBoxAdress.Text, TextBoxZip.Text, TextBoxCity.Text, DropDownList1.Text, TextBoxEmail.Text, TextBoxPhoneNumber.Text, false, true); } LabelSuccess.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { string fname = Request["fname"]; string lname = Request["lname"]; string mail = Request["mail"]; string passw = Request["passw"]; string phone = Request["phone"]; string address = Request["address"]; string floor = Request["floor"]; string portcode = Request["portcode"]; string city = Request["city"]; string zip = Request["zip"]; string AddOK = SQL.AddCustomer(fname, lname, mail, passw, phone, address, floor, portcode, city, zip); info.Text = AddOK; }
private void AddCustomerBtn_Click(object sender, EventArgs e) { if (CustomerCorrectInfo() == false) { MessageBox.Show("There was a problem trying to Add this customer into the system please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { int CustomerID = Convert.ToInt32(CustomerIDTxtBox.Text); string CustomerName = CustomerNameTxtBox.Text; int AddressID = SQL.AddressIDList.Count + 1; bool Active; DateTime CreateDate = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local); string Test = "test"; string CreatedBy = Test; DateTime LastUpdate = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local); string LastUpdatedBy = Test; string Address = AddressTxtBox.Text; string ZipCode = ZipCodeTxtBox.Text; string PhoneNumber = PhoneNumberTxtBox.Text; if (YesCheckBox.Checked == true) { Active = true; } else { Active = false; } SQL sql = new SQL(); sql.AddCustomer(new Customer(CustomerID, CustomerName, AddressID, Active, CreateDate, CreatedBy, LastUpdate, LastUpdatedBy, Address, ZipCode, PhoneNumber)); MainForm mf = new MainForm(); mf.Show(); this.Hide(); } catch (FormatException f) { MessageBox.Show(f.Message); } } }