//Get details button Form1 private void update_Click_1(object sender, EventArgs e) { int f = c.get_details(textBox1); if (f == 2 || f == 0) { MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show("Please enter a valid Booking ID", "Booking ID error", buttons, MessageBoxIcon.Exclamation); using (StreamWriter w = File.AppendText("log.txt")) { c.Log("Please Enter a valid Booking ID", w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f == 1) { ActiveForm.Hide(); Update_Details form = new Update_Details(textBox1.Text.ToLower()); form.Show(); } }
private void button1_Click(object sender, EventArgs e) { f = c.login(textBox1, textBox2); //Login Validation if (f == 1) { ActiveForm.Hide(); Admin form = new Admin(); //Admin Login form.Show(); } else if (f == 2) { ActiveForm.Hide(); Booking form = new Booking(textBox1); //Customer Login form.Show(); } else { MessageBox.Show("Invalid Username/Password", "Login Page"); if (textBox1.Text.Length != 0) { textBox2.ResetText(); textBox2.Focus(); } else { textBox1.Focus(); } using (StreamWriter w = File.AppendText("log.txt")) { c.Log("Invalid Username/Password", w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } }
private void button1_Click(object sender, EventArgs e) { f1 = c.Date1(dateTimePicker1); //Validation f2 = c.Date2(dateTimePicker1, dateTimePicker2); //Validation if (f1 == 0 && f2 == 0) { ActiveForm.Hide(); Delivery_Option f = new Delivery_Option(dateTimePicker1, dateTimePicker2); f.Show(); } if (f2 == 1) { dateTimePicker2.Focus(); label5.Text = "*Should Be less \n than present"; label5.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label4.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f2 == 2) { dateTimePicker2.Focus(); label5.Text = "Should be \n greater than\n from booking\n date"; label5.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label4.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label5.Hide(); } if (f1 == 1) { dateTimePicker1.Focus(); label4.Text = "*Invalid Date"; label4.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label4.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label4.Hide(); } }
private void button2_Click(object sender, EventArgs e) { f1 = c.addressValidate(textBox1); //Validation f2 = c.phoneValidate(textBox2); //Validation f3 = c.eDateValidate(dateTimePicker1); //Validation if (f1 == 0 && f2 == 0 && f3 == 0) { DateTime d1 = DateTime.Today; string s1 = c.writeB(textBox1, textBox2, dateTimePicker1, comboBox3, d1, custid); //Book GIft MessageBox.Show("Your Booking ID is " + s1); reset(); c.quantity_updateB(s1); //Update Quantity } if (f3 == 1) { label15.Text = "*Invalid Date"; label15.Show(); dateTimePicker1.ResetText(); dateTimePicker1.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label15.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label15.Hide(); } if (f2 == 1) { label14.Text = "*Invalid Phone No."; label14.Show(); textBox2.ResetText(); textBox2.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label14.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f2 == 2) { label14.Text = "*Too Short"; label14.Show(); textBox2.ResetText(); textBox2.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label14.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f2 == 3) { label14.Text = "*Input Required"; label14.Show(); textBox2.ResetText(); textBox2.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label14.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label14.Hide(); } if (f1 == 1) { label13.Text = "*Invalid Characters"; label13.Show(); textBox1.ResetText(); textBox1.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label13.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f1 == 2) { label13.Text = "*Too Short"; label13.Show(); textBox1.ResetText(); textBox1.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label13.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f1 == 3) { label13.Text = "*Input Required"; label13.Show(); textBox1.ResetText(); textBox1.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label13.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label13.Hide(); } }
private void button1_Click(object sender, EventArgs e) { f1 = c.name(textBox1); //Validation f2 = c.contact(textBox2); //Validation f3 = c.password(textBox3); //Validation f4 = c.retype(textBox4, textBox3); //Validation f5 = c.mail(textBox5); //Validation f6 = c.gender(comboBox1); //Validation f7 = c.date(dateTimePicker1); //Validation f8 = c.address(textBox6); //Validation if (f1 == 0 && f2 == 0 && f3 == 0 && f4 == 0 && f5 == 0 && f6 == 0 && f7 == 0 && f8 == 0) { c.write(textBox1, textBox2, textBox3, textBox5, comboBox1, dateTimePicker1, textBox6); //Add Customer ActiveForm.Hide(); Login_Page form = new Login_Page(); //Login Page form.Show(); } if (f8 == 1) { address.Text = "*Invalid Characters"; address.Show(); textBox6.ResetText(); textBox6.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(address.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f8 == 2) { address.Text = "*Too Short"; address.Show(); textBox6.ResetText(); textBox6.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(address.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f8 == 3) { address.Text = "*Input Required"; address.Show(); textBox6.ResetText(); textBox6.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(address.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { address.Hide(); } if (f7 == 1) { dateTimePicker1.ResetText(); dateTimePicker1.Focus(); date.Text = "*Invalid Date"; date.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(date.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { date.Hide(); } if (f6 == 1) { comboBox1.ResetText(); comboBox1.Focus(); gender.Text = "*Input Required"; gender.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(gender.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { gender.Hide(); } if (f5 == 1) { textBox5.ResetText(); textBox5.Focus(); mail.Text = "*Invalid Input"; mail.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(mail.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f5 == 2) { textBox5.ResetText(); textBox5.Focus(); mail.Text = "*Input Required"; mail.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(mail.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f5 == 3) { textBox5.ResetText(); textBox5.Focus(); mail.Text = "*Already Exists"; mail.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(mail.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { mail.Hide(); } if (f4 == 1) { textBox4.ResetText(); textBox4.Focus(); password2.Text = "*Not Matching"; password2.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(password2.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f4 == 2) { textBox4.ResetText(); textBox4.Focus(); password2.Text = "*Input Required"; password2.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(password2.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { password2.Hide(); } if (f3 == 1) { textBox3.ResetText(); textBox4.ResetText(); textBox3.Focus(); password.Text = " *Should Contain Alphabets,\nNumbers and Special Characters"; password.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(password.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f3 == 2) { textBox3.ResetText(); textBox4.ResetText(); textBox3.Focus(); password.Text = "*Shouldn't Start With Number\nor Special Character"; password.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(password.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f3 == 3) { textBox3.ResetText(); textBox4.ResetText(); textBox3.Focus(); password.Text = "\n*Too short"; password.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(password.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f3 == 4) { textBox3.ResetText(); textBox4.ResetText(); textBox3.Focus(); password.Text = "\n*Input Required"; password.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(password.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f3 == 5) { textBox3.ResetText(); textBox4.ResetText(); textBox3.Focus(); password.Text = "\n*Only !,@,#,$"; password.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(password.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { password.Hide(); } if (f2 == 1) { textBox2.ResetText(); textBox2.Focus(); contact.Text = "*Only Digits"; contact.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(contact.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f2 == 2) { textBox2.ResetText(); textBox2.Focus(); contact.Text = "*Too short"; contact.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(contact.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f2 == 3) { textBox2.ResetText(); textBox2.Focus(); contact.Text = "*Input Required"; contact.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(contact.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { contact.Hide(); } if (f1 == 1) { textBox1.ResetText(); textBox1.Focus(); name.Text = "*Invalid Format or Invalid Characters"; name.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(name.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f1 == 2) { textBox1.ResetText(); textBox1.Focus(); name.Text = "*Input Required"; name.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(name.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f1 == 3) { textBox1.ResetText(); textBox1.Focus(); name.Text = "*Full Name"; name.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(name.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { name.Hide(); } }
private void button1_Click(object sender, EventArgs e) { string s1 = " ", s2 = " "; f5 = 0; //Validation c1 = c.comboleave1(comboBox1); c2 = c.comboleave2(comboBox2); f2 = c.gifttype(textBox3); //Validation f4 = c.occasion(textBox4); //Validation f1 = c.costvalid(textBox1); //Validation f3 = c.quantityvalid(textBox2); //Validation if (comboBox1.Text == "") { label9.Show(); label9.Text = "Input Required"; c1 = 1; using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label9.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label9.Hide(); c1 = 0; } if (comboBox2.Text == "") { label8.Show(); label8.Text = "Input Required"; c2 = 1; using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label8.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label8.Hide(); c2 = 0; } if (f3 == 1) { label7.Text = "*Invalid Input"; label7.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label7.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f3 == 2) { label7.Text = "*Can't Be Zero"; label7.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label7.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f3 == 3) { label7.Text = "*Input Required"; label7.Show(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label9.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label7.Hide(); f3 = 0; } if (f1 == 1) { label3.Text = "*Numeric Values Only"; label3.Show(); textBox1.ResetText(); textBox1.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label3.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f1 == 2) { label3.Text = "*Input Required"; label3.Show(); textBox1.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label3.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label3.Hide(); f1 = 0; } if (comboBox1.Text.Equals("others", StringComparison.OrdinalIgnoreCase) == true) { f2 = c.gifttype(textBox3); //Validation if (f2 == 1) { label9.Text = "*Already Exists"; label9.Show(); textBox3.ResetText(); textBox3.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label9.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f2 == 2) { label9.Text = "*Input Required"; label9.Show(); textBox3.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label9.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label9.Hide(); } } if (comboBox2.Text.Equals("others", StringComparison.OrdinalIgnoreCase)) { f4 = c.occasion(textBox4); //Validation if (f4 == 1) { label8.Text = "*Already Exists"; label8.Show(); textBox4.ResetText(); textBox4.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label8.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else if (f4 == 2) { label8.Text = "*Input Required"; label8.Show(); textBox4.Focus(); using (StreamWriter w = File.AppendText("log.txt")) { c.Log(label8.Text, w); } using (StreamReader r = File.OpenText("log.txt")) { c.DumpLog(r); } } else { label8.Hide(); } } if (comboBox1.Text.Equals("Others", StringComparison.OrdinalIgnoreCase) == true && comboBox2.Text.Equals("Others", StringComparison.OrdinalIgnoreCase) == true && comboBox1.Text != null && comboBox2.Text != null) { f2 = c.gifttype(textBox3); //Validation f4 = c.occasion(textBox4); //Validation f1 = c.costvalid(textBox1); //Validation f3 = c.quantityvalid(textBox2); //Validation if (f1 == 0 && f2 == 0 && f3 == 0 && f4 == 0 && c1 == 0 && c2 == 0) { c.giftwrite(textBox3); //write Gift c.occassionwrite(textBox4); //write occassion s1 = textBox3.Text; s2 = textBox4.Text; f5 = c.finalwrite(textBox1, textBox2, s1, s2); //Add Gift } else { f5 = 0; } } if (comboBox1.Text.Equals("Others", StringComparison.OrdinalIgnoreCase) == true && comboBox2.Text.Equals("Others", StringComparison.OrdinalIgnoreCase) == false && (comboBox2.Text != null)) { f1 = c.costvalid(textBox1); //Validation f3 = c.quantityvalid(textBox2); //Validation f2 = c.gifttype(textBox3); if (f1 == 0 && f2 == 0 && f3 == 0 && c1 == 0 && c2 == 0) { c.giftwrite(textBox3); //write Gift s1 = textBox3.Text; s2 = comboBox2.Text; f5 = c.finalwrite(textBox1, textBox2, s1, s2); //Add Gift } else { f5 = 0; } } else if (comboBox1.Text.Equals("Others", StringComparison.OrdinalIgnoreCase) == false && (comboBox1.Text != null) && comboBox2.Text.Equals("Others", StringComparison.OrdinalIgnoreCase) == true) { f4 = c.occasion(textBox4); //Validation f3 = c.quantityvalid(textBox2); //Validation f1 = c.costvalid(textBox1); if (f1 == 0 && f3 == 0 && f4 == 0 && c1 == 0 && c2 == 0) { c.occassionwrite(textBox4); //write occassion s1 = comboBox1.Text; s2 = textBox4.Text; f5 = c.finalwrite(textBox1, textBox2, s1, s2); //Add Gift } else { f5 = 0; } } else if (comboBox1.Text.Equals("Others", StringComparison.OrdinalIgnoreCase) == false && comboBox2.Text.Equals("Others", StringComparison.OrdinalIgnoreCase) == false && textBox3.Text != null && textBox4.Text != null) { f3 = c.quantityvalid(textBox2); //Validation f1 = c.costvalid(textBox1); //Validation if (f1 == 0 && f3 == 0 && c1 == 0 && c2 == 0) { s1 = comboBox1.Text; s2 = comboBox2.Text; f5 = c.finalwrite(textBox1, textBox2, s1, s2); //Add Gift } } if (f5 == 1) //Display details & Reset Form. { MessageBox.Show("Gift Id " + c.labelval() + " added successfully", "Success"); textBox3.ResetText(); textBox4.ResetText(); textBox1.ResetText(); textBox2.ResetText(); comboBox1.ResetText(); comboBox2.ResetText(); c.fillgiftB(comboBox1); c.filloccassion(comboBox2); } }