private void button1_Click(object sender, EventArgs e) { UserHome uh = new UserHome(ui); uh.Show(); this.Visible = false; }
private void button2_Click(object sender, EventArgs e) { if (textBox2.Text.Length <= 3) { MessageBox.Show("Password is too short !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBox2.Text = ""; textBox3.Text = ""; textBox2.Select(); } if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0) { MessageBox.Show("Fillup All Text Boxs", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (textBox2.Text != textBox3.Text) { MessageBox.Show("Enter Valid password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { UpdateDBlink ul = new UpdateDBlink(); string x = ul.UpdateUserPassword(textBox1.Text, textBox2.Text, textBox3.Text); MessageBox.Show(x); UserHome uh = new UserHome(ui); uh.Show(); this.Visible = false; } } }
private void button1_Click(object sender, EventArgs e) { UpdateDBlink ul = new UpdateDBlink(); ai = ul.getAdmin(textBox1.Text); string pass; if (textBox1.Text == ai.UName && ai.UStatus == "Admin") { if (textBox2.Text == ai.Pword) { /* HomeAdmin h = new HomeAdmin(ai); * h.Show(); * this.Visible = false; */ AdminHome h = new AdminHome(ai); h.Show(); this.Visible = false; } else { MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { ui = ul.getUser(textBox1.Text); pass = ul.getPassword(textBox1.Text); if (textBox2.Text == pass) { UserHome h = new UserHome(ui); h.Show(); this.Visible = false; } else { MessageBox.Show("Wrong Password or Username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button2_Click(object sender, EventArgs e) { u.Name = textBox1.Text; u.FirstName = textBox2.Text; u.LastName = textBox8.Text; u.Password = textBox3.Text; u.MobileNo = textBox5.Text; u.Email = textBox6.Text; bool isChecked = radioButton1.Checked; if (isChecked) { u.Gender = radioButton1.Text; } else { u.Gender = radioButton2.Text; } u.Address = textBox7.Text; if (textBox3.Text.Length <= 3) { MessageBox.Show("Password is too short !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBox3.Text = ""; textBox4.Text = ""; } if (textBox5.Text.Length == 11 && (textBox5.Text.StartsWith("016") || textBox5.Text.StartsWith("017") || textBox5.Text.StartsWith("018") || textBox5.Text.StartsWith("019") || textBox5.Text.StartsWith("015"))) { } else { MessageBox.Show("Wrong Mobile Number !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); textBox5.Text = ""; } if ((textBox6.Text.Contains("@") && textBox6.Text.Contains(".com")) && (!textBox6.Text.StartsWith("@") || !textBox6.Text.StartsWith(" "))) { } else { MessageBox.Show("Use Valid Email ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (textBox3.Text == textBox4.Text) { if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0 || textBox4.Text.Length == 0 || textBox5.Text.Length == 0 || textBox6.Text.Length == 0 || textBox7.Text.Length == 0 || textBox8.Text.Length == 0) { MessageBox.Show("Please filled all the field properly", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { //////////////////////// try { SmtpClient client = new SmtpClient("smtp.gmail.com", 587); client.EnableSsl = true; client.Timeout = 10000; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false; client.Credentials = new NetworkCredential("*****@*****.**", "zigatola1234"); MailMessage msg = new MailMessage(); msg.To.Add(textBox6.Text); msg.From = new MailAddress("*****@*****.**"); msg.Subject = "Email Validaton . Login accepted for Inventory management"; msg.Body = "WELCOME TO INVENTORY MANAGEMENT SYSTEM \n\n\n Your mail address is validet \n\n\n Thank you"; client.Send(msg); MessageBox.Show("Email Validation Complete"); } catch (Exception ex) { MessageBox.Show(ex.Message); } /////////////////////// CustomerInfo c = new CustomerInfo { user_name = u.Name, First_name = u.FirstName, Last_name = u.LastName, password = u.Password, mobile = u.MobileNo, address = u.Address, gender = u.Gender, email = u.Email, Status = status }; pd.CustomerInfos.InsertOnSubmit(c); pd.SubmitChanges(); UserHome h = new UserHome(u); h.Show(); this.Visible = false; } } else { MessageBox.Show("Wrong Password ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }