//nút tạo thêm ngày nghỉ cho nhân viên private void button9_Click(object sender, EventArgs e) { /* * Form formBackground = new Form(); * try * { * using (CREATEOFFDAY frmOffDay = new CREATEOFFDAY()) * { * formBackground.StartPosition = FormStartPosition.CenterScreen; * formBackground.FormBorderStyle = FormBorderStyle.None; * formBackground.Size = new Size(1484, 811); * formBackground.Opacity = .80d; * formBackground.BackColor = Color.Black; * formBackground.WindowState = FormWindowState.Normal; * formBackground.TopMost = true; * formBackground.Location = this.Location; * formBackground.ShowInTaskbar = false; * formBackground.Show(); * * frmOffDay.Owner = formBackground; * * frmOffDay.ShowDialog(); * formBackground.Dispose(); * } * } * catch(Exception ex) * { * MessageBox.Show(ex.Message); * }*/ CREATE_OFF_DAY frmOffDay = new CREATE_OFF_DAY(); frmOffDay.Show(); LoadData(); }
//Click double để mở màn hình chỉnh sửa thông tin private void bunifuCustomDataGrid1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { Form formBackground = new Form(); List <int> temp = new List <int>(); for (int i = 0; i < this.bunifuCustomDataGrid1.SelectedRows.Count; i++) { temp.Add(this.listOFFStaff[(int)this.bunifuCustomDataGrid1.CurrentRow.Cells[0].Value - 1].ID); } try { using (CREATE_OFF_DAY frmOffDay = new CREATE_OFF_DAY(temp)) { formBackground.StartPosition = FormStartPosition.CenterScreen; formBackground.FormBorderStyle = FormBorderStyle.None; formBackground.Size = new Size(1484, 811); formBackground.Opacity = .80d; formBackground.BackColor = Color.Black; formBackground.WindowState = FormWindowState.Normal; formBackground.TopMost = true; formBackground.Location = this.Location; formBackground.ShowInTaskbar = false; formBackground.Show(); frmOffDay.Owner = formBackground; frmOffDay.ShowDialog(); formBackground.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } LoadData(); }
//nút cập nhật cho 1 (hoặc 1 số ) nhân viên private void button1_Click(object sender, EventArgs e) { //Form formBackground = new Form(); List <int> temp = new List <int> (); //Kiểm tra các dòng selected có cùng nhau hay không bool checkDuplicate = false; for (int i = 0; i < this.bunifuCustomDataGrid1.SelectedRows.Count - 1; i++) { if (this.listOFFStaff[(int)this.bunifuCustomDataGrid1.SelectedRows[i].Cells[0].Value - 1].ID_LoaiNgayNghi != this.listOFFStaff[(int)this.bunifuCustomDataGrid1.SelectedRows[i + 1].Cells[0].Value - 1].ID_LoaiNgayNghi) { checkDuplicate = true; } } for (int i = 0; i < this.bunifuCustomDataGrid1.SelectedRows.Count - 1; i++) { if (this.listOFFStaff[(int)this.bunifuCustomDataGrid1.SelectedRows[i].Cells[0].Value - 1].NgayBatDau != this.listOFFStaff[(int)this.bunifuCustomDataGrid1.SelectedRows[i + 1].Cells[0].Value - 1].NgayBatDau) { checkDuplicate = true; } } for (int i = 0; i < this.bunifuCustomDataGrid1.SelectedRows.Count - 1; i++) { if (this.listOFFStaff[(int)this.bunifuCustomDataGrid1.SelectedRows[i].Cells[0].Value - 1].NgayKetThuc != this.listOFFStaff[(int)this.bunifuCustomDataGrid1.SelectedRows[i + 1].Cells[0].Value - 1].NgayKetThuc) { checkDuplicate = true; } } if (checkDuplicate == false) { for (int i = 0; i < this.bunifuCustomDataGrid1.SelectedRows.Count; i++) { temp.Add(this.listOFFStaff[this.bunifuCustomDataGrid1.SelectedRows[i].Index].ID); } try { using (CREATE_OFF_DAY frmOffDay = new CREATE_OFF_DAY(temp)) { /* * formBackground.StartPosition = FormStartPosition.CenterScreen; * formBackground.FormBorderStyle = FormBorderStyle.None; * formBackground.Size = new Size(1484, 811); * formBackground.Opacity = .80d; * formBackground.BackColor = Color.Black; * formBackground.WindowState = FormWindowState.Normal; * formBackground.TopMost = true; * formBackground.Location = this.Location; * formBackground.ShowInTaskbar = false; * formBackground.Show(); * * frmOffDay.Owner = formBackground; * * frmOffDay.ShowDialog(); * formBackground.Dispose(); */ frmOffDay.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Các ngày lựa chọn không hợp lệ !!! Xin nhập lại "); } LoadData(); }