public FrmChangePassword(Form close, Msemployee emp) { InitializeComponent(); this.close = close; this.emp = emp; emp = new Msemployee(); }
private void tbxOld_TextChanged(object sender, EventArgs e) { using (DataClassesDataContext db = new DataClassesDataContext()) { Msemployee employee = db.Msemployees.Where(s => s.EmployeeID == emp.EmployeeID).FirstOrDefault(); if (tbxOld.Text == employee.Password) { tbxNew.Enabled = true; } else { tbxNew.Enabled = false; } } }
private void button1_Click(object sender, EventArgs e) { try { if (textBox1.Text == "" || textBox2.Text == "") { MessageBox.Show("Data Cant Be Empty", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error); bersih(); } else { using (DataClassesDataContext db = new DataClassesDataContext()) { Msemployee emp = db.Msemployees.Where(s => s.Email == textBox1.Text && s.Password == textBox2.Text).FirstOrDefault(); if (emp != null) { if (emp.Position == "Admin") { (new FrmAdminNavigation(this, emp)).Show(); this.Hide(); bersih(); } else if (emp.Position == "Chef") { (new FrmChefNavigation(this, emp)).Show(); this.Hide(); bersih(); } else if (emp.Position == "Cashier") { (new FrmCashierNavigation(this, emp)).Show(); this.Hide(); bersih(); } } else { MessageBox.Show("No Such User", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); bersih(); } } } } catch (Exception ex) { MessageBox.Show("Try Again, Please Contact Admin", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void autonumber() { using (DataClassesDataContext db = new DataClassesDataContext()) { Msemployee emp = db.Msemployees.OrderByDescending(s => s.EmployeeID).FirstOrDefault(); if (emp != null) { string a = emp.EmployeeID.ToString(); int n = Convert.ToInt32(a) + 1; tbxID.Text = n.ToString("d1"); } else { tbxID.Text = "1"; } } }
private void btnDelete_Click(object sender, EventArgs e) { using (DataClassesDataContext db = new DataClassesDataContext()) { if (tbxID.Text == "" || tbxName.Text == "" || tbxEmail.Text == "" || tbxHandphone.Text == "" || cbxPosition.SelectedItem == null) { MessageBox.Show("Data Cant Be Empty", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error); bersih(); } else { Msemployee emp = db.Msemployees.Where(s => s.EmployeeID == tbxID.Text).FirstOrDefault(); db.Msemployees.DeleteOnSubmit(emp); db.SubmitChanges(); awal(); MessageBox.Show("Successfully Deleted Data", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void button1_Click(object sender, EventArgs e) { using (DataClassesDataContext db = new DataClassesDataContext()) { Msemployee employee = db.Msemployees.Where(s => s.EmployeeID == emp.EmployeeID).FirstOrDefault(); if (tbxOld.Text == "" || tbxNew.Text == "" || tbxConfirm.Text == "") { MessageBox.Show("Data Cant Be Empty", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error); awal(); } else { employee.Password = tbxConfirm.Text; db.SubmitChanges(); MessageBox.Show("Successfully Change Password", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); awal(); } } }
public FrmCashierNavigation(Form close, Msemployee emp) { InitializeComponent(); this.close = close; this.emp = emp; }
partial void DeleteMsemployee(Msemployee instance);
partial void UpdateMsemployee(Msemployee instance);
partial void InsertMsemployee(Msemployee instance);
public FrmOrder(Form close, Msemployee emp) { InitializeComponent(); this.close = close; this.emp = emp; }