private void btnshowuserinfo_Click(object sender, EventArgs e) { //if (!pnluserinfo.Controls.Contains(ucUserInfo.Instance1)) //{ // pnluserinfo.Controls.Add(ucUserInfo.Instance1); // ucUserInfo.Instance1.Dock = DockStyle.Fill; // ucUserInfo.Instance1.BringToFront(); //} //else //{ // ucUserInfo.Instance1.BringToFront(); //} //check and show LoginInfo log = new LoginInfo(); CustomerInfoLogic show = new CustomerInfoLogic(); custregTable show2 = new custregTable(); //show.ShowUserInfo(show2.username); show2 = show.ShowUserInfo("polin"); txtusername.Text = show2.username; txtfirstName.Text = show2.firstname; txtLastname.Text = show2.lastname; txtage.Text = Convert.ToString(show2.age); txtPass.Text = show2.password; txtEmail.Text = show2.email; txtaddress.Text = show2.address; }
private void btnmainlogin_Click(object sender, EventArgs e) { LoginInfo login = new LoginInfo(); custregTable CustLoginTable = new custregTable(); //radio button. //CustomerUser Access Check. if (rbtnCustomer.Checked == true) { if (!string.IsNullOrEmpty(txtLoginUserName.Text) && !string.IsNullOrEmpty(txtLogInPassword.Text)) { if (login.CheckCustomeruser(txtLoginUserName.Text, txtLogInPassword.Text)) { CustomerControl control = new CustomerControl(); MetroMessageBox.Show(this, "Welcome " + txtLoginUserName.Text, "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Hide(); control.ShowDialog(); } else { MetroMessageBox.Show(this, "Wrong CustomerPassword!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MetroMessageBox.Show(this, "You have to fill up all fields!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } //AdminUSer Access Check else if (rbtnAdmin.Checked == true) { if (!string.IsNullOrEmpty(txtLoginUserName.Text) && !string.IsNullOrEmpty(txtLogInPassword.Text)) { if (login.CheckAdminUser(txtLoginUserName.Text, txtLogInPassword.Text)) { AdminControl objAdmin = new AdminControl(); MetroMessageBox.Show(this, "Welcome Admin " + txtLoginUserName.Text, "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Hide(); objAdmin.ShowDialog(); } else { MetroMessageBox.Show(this, "Wrong AdminPassword!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MetroMessageBox.Show(this, "You have to fill up all fields!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MetroMessageBox.Show(this, "You have to select either Admin or Customer.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public bool AddCustomer(custregTable entity) { if (entity != null) { dbcontext2.custregTables.Add(entity); dbcontext2.SaveChanges(); return(true); } else { return(false); } }
private void metroButton1_Click(object sender, EventArgs e) { CustomerInfoLogic confirm = new CustomerInfoLogic(); custregTable CustregTable = new custregTable(); if (!string.IsNullOrEmpty(txtUsername.Text) && !string.IsNullOrEmpty(txtFirstName.Text) && !string.IsNullOrEmpty(txtLastName.Text) && !string.IsNullOrEmpty(txtLastName.Text) && !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtConfirmPass.Text) && !string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtAddress.Text) && !string.IsNullOrEmpty(txtAge.Text) && !string.IsNullOrEmpty(txtPhoneNumber.Text)) { var username = txtUsername.Text.Trim(); var firstname = txtFirstName.Text.Trim(); var lastname = txtLastName.Text.Trim(); var password = txtPassword.Text.Trim(); var Confirmpass = txtConfirmPass.Text.Trim(); var email = txtEmail.Text.Trim(); var address = txtAddress.Text.Trim(); var age = txtAge.Text.Trim(); var phonenum = txtPhoneNumber.Text.Trim(); CustregTable.firstname = firstname; CustregTable.lastname = lastname; CustregTable.username = username; CustregTable.password = password; CustregTable.confirmpassword = Confirmpass; if (password == Confirmpass) { CustregTable.email = email; CustregTable.address = address; CustregTable.age = Convert.ToInt32(age); CustregTable.phonenumber = Convert.ToInt32(phonenum); confirm.AddCustomer(CustregTable); MetroMessageBox.Show(this, "Saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MetroMessageBox.Show(this, "Ooops!!!Password Missmatch!!Please Re-Check your Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MetroMessageBox.Show(this, "You Need To FillUp All Field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }