Пример #1
0
 private void btnEditStaff_Click(object sender, EventArgs e)
 {
     if (grid.RowCount > 0)
     {
         DataRow row = grid.GetDataRow(grid.GetSelectedRows()[0]);
         EditStaff.oldInfo = row;
         EditStaff edit = new EditStaff();
         edit.ShowDialog();
         dgvListStaff.DataSource = Staff_BUS.ListStaff();
     }
     else
     {
         MessageBox.Show("Error!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
Пример #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            Staff_DTO staff = new Staff_DTO(
                idStaff.Text.ToString(),
                fName.Text.ToString(),
                lName.Text.ToString(),
                birthday.Text.ToString(),
                sex.Text.ToString(),
                placeOfBirth.Text.ToString(),
                address.Text.ToString(),
                iNumber.Text.ToString(),
                email.Text.ToString(),
                position.Text.ToString(),
                pNumber.Text.ToString());

            Staff_BUS.EditStaff(staff);
            this.Close();
        }
Пример #3
0
 private void btnDeleteStaff_Click(object sender, EventArgs e)
 {
     if (grid.RowCount > 0)
     {
         DataRow      row          = grid.GetDataRow(grid.GetSelectedRows()[0]);
         DialogResult dialogResult = MessageBox.Show("Are you sure?", "Delete staff", MessageBoxButtons.YesNo);
         if (dialogResult == DialogResult.Yes)
         {
             Staff_BUS.DeleteStaff(row["IDStaff"].ToString());
             MessageBox.Show("Staff was deleted", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         dgvListStaff.DataSource = Staff_BUS.ListStaff();
     }
     else
     {
         MessageBox.Show("Error!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
Пример #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string id             = idStaff.Text;
            string firstname      = fName.Text;
            string lastname       = lName.Text;
            string birthday1      = birthday.Text;
            string sex1           = sex.Text;
            string pOB            = placeOfBirth.Text;
            string add            = address.Text;
            string identityNumber = iNumber.Text;
            string email1         = email.Text;
            string pos            = position.Text;
            string phoneNumber    = pNumber.Text;

            Staff_DTO staff = new Staff_DTO(id, firstname, lastname, birthday1, sex1, pOB, add, identityNumber, email1, pos, phoneNumber);

            Staff_BUS.AddStaff(staff);
            MessageBox.Show("Complete!", "Add staff", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            this.Close();
        }
Пример #5
0
        private void btnSearchStaff_Click(object sender, EventArgs e)
        {
            switch (typeSearchStaff)
            {
            case 1:
            {
                dgvListStaff.DataSource = Staff_BUS.FindStaffById(keySearchStaff.Text.ToString());
                break;
            }

            case 2:
            {
                dgvListStaff.DataSource = Staff_BUS.FindStaffByName(keySearchStaff.Text.ToString());
                break;
            }

            default:
            {
                MessageBox.Show("Error!", "Search staff", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                break;
            }
            }
        }
Пример #6
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     dgvListStaff.DataSource = Staff_BUS.ListStaff();
 }
Пример #7
0
 private void ListStaff_Load(object sender, EventArgs e)
 {
     dgvListStaff.DataSource = Staff_BUS.ListStaff();
 }