private void btnLogin_Click(object sender, EventArgs e) { bool loginCase = false; foreach (Employee employee in EmployeeDataTransaction.GetEmployeeList()) { if (txtUsername.Text == employee.Username && txtPassword.Text == employee.Password) { if (employee.Title == Enums.Title.Müdür) { isManager = true; } else if (employee.Title == Enums.Title.Biletçi) { isManager = false; } this.DialogResult = System.Windows.Forms.DialogResult.Yes; loginCase = true; } } if (!loginCase) { MessageBox.Show("Hatalı kullanıcı adı ve şifre girişi!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Error); ClearForm.Clear(this); } }
public TicketForm() { InitializeComponent(); cmbSession.DataSource = SessionDataTransaction.GetAvailableSessions(); cmbSeller.DataSource = EmployeeDataTransaction.GetTicketSellers(); }
private void btnDeleteEmployee_Click(object sender, EventArgs e) { if (lstEmployees.SelectedIndex > -1) { Employee employee = (Employee)lstEmployees.SelectedItem; EmployeeDataTransaction.DeleteEmployee(employee.EmployeeID); RefreshListBox(); } }
private void label3_Click(object sender, EventArgs e) { foreach (Employee emp in EmployeeDataTransaction.GetEmployeeList()) { if (txtUsername.Text == emp.Username) { MessageBox.Show("Şifreniz: " + emp.Password, "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); } //else //{ // MessageBox.Show("Sistemde böyle bir kullanıcı adı bulunmamaktadır!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Error); //} } }
private void btnUpdateEmployee_Click(object sender, EventArgs e) { Employee employee = (Employee)lstEmployees.SelectedItem; employee.FirstName = txtFirstName.Text; employee.LastName = txtLastName.Text; employee.NationalityNumber = maskNationalityNumber.Text; employee.Gender = rdbMale.Checked == true ? Gender.Erkek : Gender.Kadın; employee.DateOfBirth = dtpDateOfBirth.Value; employee.PhoneNumber = maskPhoneNumber.Text; employee.Username = txtUsername.Text; employee.Password = txtPassword.Text; employee.Title = cmbTitle.SelectedIndex == 0 ? Title.Müdür : Title.Biletçi; EmployeeDataTransaction.UpdateEmployee(employee); EmployeeDataTransaction.GetEmployeeList(); RefreshListBox(); ClearForms(); }
private void btnAddEmployee_Click(object sender, EventArgs e) { if (txtFirstName.Text != string.Empty && txtLastName.Text != string.Empty && maskNationalityNumber.Text != string.Empty && (rdbFemale.Checked || rdbMale.Checked) && txtUsername.Text != string.Empty && txtPassword.Text != string.Empty && ((DateTime.Today.Year - dtpDateOfBirth.Value.Year) > 18)) { Employee employee = new Employee(); employee.FirstName = txtFirstName.Text; employee.LastName = txtLastName.Text; employee.NationalityNumber = maskNationalityNumber.Text; employee.Gender = rdbMale.Checked == true ? Gender.Erkek : Gender.Kadın; employee.DateOfBirth = dtpDateOfBirth.Value; employee.PhoneNumber = maskPhoneNumber.Text; employee.Username = txtUsername.Text; employee.Password = txtPassword.Text; employee.Title = cmbTitle.SelectedIndex == 0 ? Title.Müdür : Title.Biletçi; foreach (Employee emp in EmployeeDataTransaction.GetEmployeeList()) { if (emp.Username == txtUsername.Text) { MessageBox.Show("Bu kullanıcı adına sahip bir çalışan vardır.\nLütfen farklı bir kullanıcı adı giriniz...", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (emp.NationalityNumber == maskNationalityNumber.Text) { MessageBox.Show("Bu TC Kimlik numarasına sahip çalışan daha önce sisteme eklenmiştir!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } EmployeeDataTransaction.AddEmployee(employee); RefreshListBox(); MessageBox.Show("Çalışan kaydı başarıyla gerçekleştirildi", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearForms(); } else { MessageBox.Show("Lütfen çalışan kaydı için gereken bilgileri eksiksiz ve doğru bir şekilde doldurunuz!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void RefreshListBox() { lstEmployees.DataSource = null; lstEmployees.DataSource = EmployeeDataTransaction.GetEmployeeList(); }