private void DataGridView2Config(ViewSapXepLichTrinh viewSapXepLichTrinh) { //dataGridView2.Refresh(); ATINChamCongEntities context = new ATINChamCongEntities(); var lstSapXepLTT = context.spGetSapXepLichTrinhTamByNguoi(viewSapXepLichTrinh.MaNguoi).ToList(); var lstLichTrinh = context.spGetAllLichTrinh().ToList(); dataGridView2.DataSource = lstSapXepLTT; if (lstSapXepLTT.Count < 1) { return; } dataGridView2.Columns["TuNgay"].DisplayIndex = 0; dataGridView2.Columns["DenNgay"].DisplayIndex = 1; dataGridView2.Columns["TenLichTrinh"].DisplayIndex = 2; foreach (DataGridViewRow row in dataGridView2.Rows) { foreach (var lichtrinh in lstLichTrinh) { if ((row.DataBoundItem as SapXepLichTrinhTam).MaLichTrinh == lichtrinh.MaLichTrinh) { row.Cells["TenLichTrinh"].Value = lichtrinh.TenLichTrinh; } } } dataGridView2.Columns["LichTrinh"].Visible = false; dataGridView2.Columns["Nguoi"].Visible = false; dataGridView2.Columns["MaNguoi"].Visible = false; dataGridView2.Columns["MaLichTrinh"].Visible = false; dataGridView2.Columns["MaLichTrinhTam"].Visible = false; }
private void Set() { ATINChamCongEntities context = new ATINChamCongEntities(); var lstkyhieu = context.spGetAllKyHieuChamCong().OrderBy(x => (x.MaKyHieu)).ToList(); textEdit1.Text = lstkyhieu[0].TenKyHieu; checkBox1.Checked = lstkyhieu[0].SuDung; textEdit1.Tag = lstkyhieu[0]; textEdit2.Text = lstkyhieu[1].TenKyHieu; checkBox2.Checked = lstkyhieu[1].SuDung; textEdit2.Tag = lstkyhieu[1]; textEdit3.Text = lstkyhieu[2].TenKyHieu; checkBox3.Checked = lstkyhieu[2].SuDung; textEdit3.Tag = lstkyhieu[2]; textEdit4.Text = lstkyhieu[3].TenKyHieu; checkBox4.Checked = lstkyhieu[3].SuDung; textEdit4.Tag = lstkyhieu[3]; textEdit5.Text = lstkyhieu[4].TenKyHieu; checkBox5.Checked = lstkyhieu[4].SuDung; textEdit5.Tag = lstkyhieu[4]; textEdit6.Text = lstkyhieu[5].TenKyHieu; checkBox6.Checked = lstkyhieu[5].SuDung; textEdit6.Tag = lstkyhieu[5]; textEdit7.Text = lstkyhieu[6].TenKyHieu; checkBox7.Checked = lstkyhieu[6].SuDung; textEdit7.Tag = lstkyhieu[6]; textEdit8.Text = lstkyhieu[7].TenKyHieu; checkBox8.Checked = lstkyhieu[7].SuDung; textEdit8.Tag = lstkyhieu[7]; textEdit9.Text = lstkyhieu[8].TenKyHieu; checkBox9.Checked = lstkyhieu[8].SuDung; textEdit9.Tag = lstkyhieu[8]; }
//delete selected private void button2_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; button2.Enabled = false; ATINChamCongEntities context = new ATINChamCongEntities(); foreach (TreeNode node in treeView1.Nodes) { foreach (TreeNode childNode in node.Nodes) { if (childNode.Checked) { switch (WorkCalendarShowType) { case "week": context.spDeleteLichTrinhTuan(lichTrinh.MaLichTrinh, (childNode.Tag as LichTrinhTuan).MaCaLamViec, node.Tag as int?); break; case "month": context.spDeleteLichTrinhThang(lichTrinh.MaLichTrinh, (childNode.Tag as LichTrinhThang).MaCaLamViec, node.Tag as int?); break; case "year": context.spDeleteLichTrinhNam(lichTrinh.MaLichTrinh, (childNode.Tag as LichTrinhNam).MaCaLamViec, node.Tag as int?, comboBox1.SelectedIndex + 1); break; } } } } TreeView1Config(listView2); Cursor.Current = Cursors.Default; button2.Enabled = true; }
private void Set() { ATINChamCongEntities context = new ATINChamCongEntities(); var lstKyHieuVang = context.spGetAllKyHieuCacLoaiVang(); dataGridView1.DataSource = lstKyHieuVang; }
private void button1_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; button1.Enabled = false; button2.Enabled = false; ATINChamCongEntities context = new ATINChamCongEntities(); if (dataGridView1.Rows.Count < 1) { return; } try { foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value == null) { continue; } if ((bool)row.Cells[0].Value == true) { context.spDeleteChamCongChiTietByNguoi((row.DataBoundItem as Nguoi).MaNguoi, dateEdit1.DateTime, dateEdit2.DateTime, checkBox1.Checked); } } MessageBox.Show("Xóa dữ liệu chấm công thành công!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } Cursor.Current = Cursors.Default; button1.Enabled = true; button2.Enabled = true; }
private void barButtonItemActive_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ATINChamCongEntities context = new ATINChamCongEntities(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells.Count > 0) { if (row.Cells[0].Value == null) { continue; } if ((bool)row.Cells[0].Value == true) { var viewsapxeplichtrinh = row.DataBoundItem as ViewSapXepLichTrinh; if (comboBox1.SelectedValue == null) { context.spDeleteSapXepLichTrinh(viewsapxeplichtrinh.MaSapXep); } else { context.spDeleteSapXepLichTrinh(viewsapxeplichtrinh.MaSapXep); context.spInsertSapXepLichTrinh(viewsapxeplichtrinh.MaNguoi, comboBox1.SelectedValue.ToString().Trim()); } } } } DataGridView1Config(treeView1.SelectedNode); }
private void DataGridView2Config(Nguoi nguoi) { ATINChamCongEntities context = new ATINChamCongEntities(); dataGridView2.DataSource = context.spGetViewDanhSachVangByNguoi(nguoi.MaNguoi); dataGridView2.Columns["NgayChamCong"].DefaultCellStyle.Format = "dd/MM/yyyy"; dataGridView2.Columns["MaNhanVien"].Visible = false; dataGridView2.Columns["MaChamCong"].Visible = false; }
private void DataGridView2Config(Nguoi nguoi) { ATINChamCongEntities context = new ATINChamCongEntities(); var views = context.spGetViewSuaGioChamCongByNguoiByTime(nguoi.MaNguoi, (DateTime)barEditItem4.EditValue).ToList(); dataGridView2.DataSource = views; dataGridView2.Columns["MaNhanVien"].Visible = false; dataGridView2.Columns["MaChamCongChiTiet"].Visible = false; }
private void button2_Click(object sender, EventArgs e) { ATINChamCongEntities context = new ATINChamCongEntities(); if (dataGridView2.SelectedRows.Count > 0) { context.spDeleteChamCongLoaiVang((int)dataGridView2.SelectedRows[0].Cells["MaChamCong"].Value, dataGridView2.SelectedRows[0].Cells["MaCaLamViec"].Value.ToString()); } DataGridView2Config(dataGridView1.SelectedRows[0].DataBoundItem as Nguoi); }
private void DeleteLichTrinh(string MaLichTrinh) { try { var context = new ATINChamCongEntities(); context.spDeleteLichTrinh(MaLichTrinh); } catch (Exception e) { MessageBox.Show(e.Message); } }
private void DeleteCaLamViec(string MaCaLamViec) { try { var context = new ATINChamCongEntities(); context.spDeleteCaLamViec(MaCaLamViec); } catch (Exception e) { MessageBox.Show(e.Message); } }
private void buttonDeleteSapXepTam_Click(object sender, EventArgs e) { ATINChamCongEntities context = new ATINChamCongEntities(); if (dataGridView2.SelectedRows.Count > 0) { context.spDeleteSapXepLichTrinhTam((dataGridView2.SelectedRows[0].DataBoundItem as SapXepLichTrinhTam).MaLichTrinhTam); } var viewSapXepLichTrinh = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].DataBoundItem as ViewSapXepLichTrinh; DataGridView2Config(viewSapXepLichTrinh); }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox2.SelectedIndex < 0) { return; } ATINChamCongEntities context = new ATINChamCongEntities(); var calamviec = context.spGetCaLamViec((comboBox2.SelectedItem as CaLamViec).MaCaLamViec).FirstOrDefault(); textBox10.Text = calamviec.TongGio.ToString(); textBox11.Text = calamviec.DiemCong.ToString(); }
private void barButtonItemDeleeAll_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ATINChamCongEntities context = new ATINChamCongEntities(); foreach (DataGridViewRow row in dataGridView2.Rows) { context.spDeleteSapXepLichTrinhTam((row.DataBoundItem as SapXepLichTrinhTam).MaLichTrinhTam); } var viewSapXepLichTrinh = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].DataBoundItem as ViewSapXepLichTrinh; DataGridView2Config(viewSapXepLichTrinh); }
private void Save() { ATINChamCongEntities context = new ATINChamCongEntities(); context.spUpdateKyHeuChamCong((textEdit1.Tag as KyHieuChamCong).MaKyHieu, (textEdit1.Tag as KyHieuChamCong).TenKyHieu, checkBox1.Checked); context.spUpdateKyHeuChamCong((textEdit2.Tag as KyHieuChamCong).MaKyHieu, (textEdit2.Tag as KyHieuChamCong).TenKyHieu, checkBox2.Checked); context.spUpdateKyHeuChamCong((textEdit3.Tag as KyHieuChamCong).MaKyHieu, (textEdit3.Tag as KyHieuChamCong).TenKyHieu, checkBox3.Checked); context.spUpdateKyHeuChamCong((textEdit4.Tag as KyHieuChamCong).MaKyHieu, (textEdit4.Tag as KyHieuChamCong).TenKyHieu, checkBox4.Checked); context.spUpdateKyHeuChamCong((textEdit5.Tag as KyHieuChamCong).MaKyHieu, (textEdit5.Tag as KyHieuChamCong).TenKyHieu, checkBox5.Checked); context.spUpdateKyHeuChamCong((textEdit6.Tag as KyHieuChamCong).MaKyHieu, (textEdit6.Tag as KyHieuChamCong).TenKyHieu, checkBox6.Checked); context.spUpdateKyHeuChamCong((textEdit7.Tag as KyHieuChamCong).MaKyHieu, (textEdit7.Tag as KyHieuChamCong).TenKyHieu, checkBox7.Checked); context.spUpdateKyHeuChamCong((textEdit8.Tag as KyHieuChamCong).MaKyHieu, (textEdit8.Tag as KyHieuChamCong).TenKyHieu, checkBox8.Checked); context.spUpdateKyHeuChamCong((textEdit9.Tag as KyHieuChamCong).MaKyHieu, (textEdit9.Tag as KyHieuChamCong).TenKyHieu, checkBox9.Checked); }
private void SetCombobox_Datetime_Default() { ATINChamCongEntities context = new ATINChamCongEntities(); var lstMayChamCong = context.MayNhanDangs.ToList(); comboBox1.DataSource = lstMayChamCong; comboBox1.DisplayMember = "TenMay"; comboBox1.ValueMember = "MaMay"; if (lstMayChamCong.Count > 0) { comboBox1.SelectedIndex = 0; } dateEdit1.DateTime = DateTime.Now; }
private void SetListView() { imageList1.Images.Clear(); listView1.Items.Clear(); ATINChamCongEntities context = new ATINChamCongEntities(); List <ViewXemHinhChamCong> lstViewXemHinhChamCong = new List <ViewXemHinhChamCong>(); if (comboBox1.DataSource == null) { return; } if (radioButton1.Checked == true) { lstViewXemHinhChamCong = context.spGetViewXemHinhChamCongByTimeByMachine(dateEdit1.DateTime, (int)comboBox1.SelectedValue, "year").ToList(); } else if (radioButton2.Checked == true) { lstViewXemHinhChamCong = context.spGetViewXemHinhChamCongByTimeByMachine(dateEdit1.DateTime, (int)comboBox1.SelectedValue, "month").ToList(); } else if (radioButton3.Checked == true) { lstViewXemHinhChamCong = context.spGetViewXemHinhChamCongByTimeByMachine(dateEdit1.DateTime, (int)comboBox1.SelectedValue, "date").ToList(); } else if (radioButton4.Checked == true) { lstViewXemHinhChamCong = context.spGetViewXemHinhChamCongByTimeByMachine(dateEdit1.DateTime, (int)comboBox1.SelectedValue, "hour").ToList(); } List <ListViewItem> lstLv = new List <ListViewItem>(); foreach (var view in lstViewXemHinhChamCong) { if (view.HinhChamCong == null) { imageList1.Images.Add(Properties.Resources.bouser_32x32); } else { imageList1.Images.Add(byteArrayToImage(view.HinhChamCong)); } } imageList1.ImageSize = new Size(100, 100); listView1.View = View.LargeIcon; for (int j = 0; j < this.imageList1.Images.Count; j++) { ListViewItem item = new ListViewItem(lstViewXemHinhChamCong[j].HoTen + " " + lstViewXemHinhChamCong[j].GioChamCong.ToString()); item.ImageIndex = j; this.listView1.Items.Add(item); } listView1.LargeImageList = imageList1; }
//Save private void button1_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; button1.Enabled = false; ATINChamCongEntities context = new ATINChamCongEntities(); //date switch (WorkCalendarShowType) { case "week": foreach (ListViewItem Dateitem in listView2.CheckedItems) { int?x = Dateitem.Tag as int?; foreach (ListViewItem caItem in listView1.CheckedItems) { CaLamViec ca = caItem.Tag as CaLamViec; context.spInsertLichTrinhTuan(lichTrinh.MaLichTrinh, ca.MaCaLamViec, x); } } break; case "month": foreach (ListViewItem Dateitem in listView2.CheckedItems) { int?x = Dateitem.Tag as int?; foreach (ListViewItem caItem in listView1.CheckedItems) { CaLamViec ca = caItem.Tag as CaLamViec; context.spInsertLichTrinhThang(lichTrinh.MaLichTrinh, ca.MaCaLamViec, x); } } break; case "year": foreach (ListViewItem Dateitem in listView2.CheckedItems) { int?x = Dateitem.Tag as int?; foreach (ListViewItem caItem in listView1.CheckedItems) { CaLamViec ca = caItem.Tag as CaLamViec; context.spInsertLichTrinhNam(lichTrinh.MaLichTrinh, ca.MaCaLamViec, x, comboBox1.SelectedIndex + 1); } } break; } TreeView1Config(listView2); Cursor.Current = Cursors.Default; button1.Enabled = true; }
public static List <CaLamViec> LoadAllCaLamViec() { List <CaLamViec> caLamViecs = new List <CaLamViec>(); try { ATINChamCongEntities context = new ATINChamCongEntities(); caLamViecs = context.spGetAllCaLamViec().ToList(); return(caLamViecs); } catch (Exception e) { MessageBox.Show(e.Message); return(null); } }
public static List <LichTrinh> LoadAllLichTrinhs() { List <LichTrinh> lichTrinhs = new List <LichTrinh>(); try { ATINChamCongEntities context = new ATINChamCongEntities(); lichTrinhs = context.spGetAllLichTrinh().ToList(); return(lichTrinhs); } catch (Exception e) { MessageBox.Show(e.Message); return(null); } }
private void SetLichTrinh(LichTrinh lichTrinh) { ATINChamCongEntities context = new ATINChamCongEntities(); var lstMap = context.spGetMapLichTrinhNangCaoByLichTrinh(lichTrinh.MaLichTrinh).ToList(); textEdit1.Text = lichTrinh.MaLichTrinh; textEdit2.Text = lichTrinh.TenLichTrinh; checkBox1.Checked = false; checkBox2.Checked = false; checkBox3.Checked = false; checkBox4.Checked = false; checkBox5.Checked = false; foreach (var map in lstMap) { switch (map.MaLichTrinhNangCao) { case "NC1": checkBox1.Checked = true; break; case "NC2": checkBox2.Checked = true; break; case "NC3": checkBox3.Checked = true; break; case "NC4": checkBox4.Checked = true; break; case "NC5": checkBox5.Checked = true; break; } } switch (lichTrinh.LoaiChuKy) { case "week": radioButton1.Checked = true; WorkCalendarShowType = "week"; break; case "month": radioButton2.Checked = true; WorkCalendarShowType = "monh"; break; case "year": radioButton3.Checked = true; WorkCalendarShowType = "year"; break; } RefreshGrid2(lichTrinh.MaLichTrinh); }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { ATINChamCongEntities context = new ATINChamCongEntities(); if (dataGridView1.CurrentCell != null) { var kyHieuVang = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].DataBoundItem as KyHieuCacLoaiVang; if (dataGridView1.CurrentCell.ColumnIndex == 3) { context.spUpdateKyHieuCacLoaiVang(kyHieuVang.MaKyHieu, (bool)dataGridView1.CurrentCell.Value, (bool)dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[4].Value); } if (dataGridView1.CurrentCell.ColumnIndex == 4) { context.spUpdateKyHieuCacLoaiVang(kyHieuVang.MaKyHieu, (bool)dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[3].Value, (bool)dataGridView1.CurrentCell.Value); } } }
private void TreeView1Config() { treeView1.Nodes[1].Nodes[0].Nodes.Clear(); ATINChamCongEntities context = new ATINChamCongEntities(); var phongBans = context.spGetAllPhongBan().ToList(); treeView1.Nodes[0].Tag = new PhongBan(); treeView1.Nodes[1].Tag = new PhongBan(); treeView1.Nodes[1].Nodes[0].Tag = new PhongBan(); foreach (var phong in phongBans) { TreeNode node = new TreeNode(phong.TenPhongBan); node.Tag = phong; treeView1.Nodes[1].Nodes[0].Nodes.Add(node); } treeView1.ExpandAll(); }
private void button1_Click(object sender, EventArgs e) { ATINChamCongEntities context = new ATINChamCongEntities(); if (checkBox2.Checked == false && checkBox1.Checked == false) { return; } if (checkBox1.Checked == true) { context.spInsertChamCongChiTiet(MaNhanVien, dateEdit1.DateTime, "IN", 3); } if (checkBox2.Checked == true) { context.spInsertChamCongChiTiet(MaNhanVien, dateEdit2.DateTime, "OUT", 3); } this.Close(); }
private void button1_Click(object sender, EventArgs e) { ATINChamCongEntities context = new ATINChamCongEntities(); if (dateEdit1.DateTime.Year != dateEdit2.DateTime.Year && dateEdit1.DateTime.Month != dateEdit2.DateTime.Month && dateEdit1.DateTime.Day != dateEdit2.DateTime.Day) { MessageBox.Show("Không được phép đổi ngày"); dateEdit2.DateTime = dateEdit1.DateTime; } else { context.spUpdateChamCongChiTiet(MaChamCongCHiTiet, dateEdit2.DateTime); this.Close(); } }
private void Set() { ATINChamCongEntities context = new ATINChamCongEntities(); var lstLichTrinh = context.spGetAllLichTrinh().ToList(); LichTrinh lichTrinhNuLL = new LichTrinh { MaLichTrinh = null, TenLichTrinh = "Chưa Xếp" }; lstLichTrinh.Add(lichTrinhNuLL); List <LichTrinh> lstLichTrinh2 = new List <LichTrinh>(lstLichTrinh); comboBox1.DataSource = lstLichTrinh; comboBox2.DataSource = lstLichTrinh2; comboBox1.DisplayMember = "TenLichTrinh"; comboBox2.DisplayMember = "TenLichTrinh"; comboBox1.ValueMember = "MaLichTrinh"; comboBox2.ValueMember = "MaLichTrinh"; dateEditFromDate.DateTime = DateTime.Now; dateEditToDate.DateTime = DateTime.Now; }
//Insert & update SapXepLichTrinh when changed combobox value private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.CurrentCell != null) { ATINChamCongEntities context = new ATINChamCongEntities(); if (dataGridView1.CurrentCell.GetType() == typeof(DataGridViewComboBoxCell)) { var viewsapxeplichtrinh = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].DataBoundItem as ViewSapXepLichTrinh; if (dataGridView1.CurrentCell.Value == null) { context.spDeleteSapXepLichTrinh(viewsapxeplichtrinh.MaSapXep); } else { context.spDeleteSapXepLichTrinh(viewsapxeplichtrinh.MaSapXep); context.spInsertSapXepLichTrinh(viewsapxeplichtrinh.MaNguoi, viewsapxeplichtrinh.MaLichTrinh); } } } }
private void Set() { ATINChamCongEntities context = new ATINChamCongEntities(); var lstLoaiVang = context.spGetAllKyHieuCacLoaiVang().ToList(); var lstCaLamViec = context.spGetAllCaLamViec().ToList(); comboBox1.DataSource = lstLoaiVang; comboBox2.DataSource = lstCaLamViec; comboBox1.DisplayMember = "MoTa"; comboBox1.ValueMember = "MaKyHieu"; comboBox2.DisplayMember = "MaCaLamViec"; comboBox2.ValueMember = "MaCaLamViec"; if (lstLoaiVang.Count > 0) { comboBox1.SelectedIndex = 0; } if (lstCaLamViec.Count > 0) { comboBox2.SelectedIndex = 0; } }
//using Singleton to create only one Instance of form private PrepareEmployeeCalenda() { InitializeComponent(); this.Dock = DockStyle.Fill; SetDoubleBuffer(dataGridView1, true); SetDoubleBuffer(dataGridView2, true); TreeView1Config(); ATINChamCongEntities context = new ATINChamCongEntities(); var lstLichTrinh = context.spGetAllLichTrinh().ToList(); LichTrinh lichTrinhEmpty = new LichTrinh { MaLichTrinh = null, TenLichTrinh = "Chưa Xếp", LoaiChuKy = null }; lstLichTrinh.Add(lichTrinhEmpty); DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); col.DataSource = lstLichTrinh; col.Name = "col"; col.DisplayMember = "TenLichTrinh"; col.DataPropertyName = "MaLichTrinh"; col.ValueMember = "MaLichTrinh"; col.HeaderText = "Lịch trình"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; col.DefaultCellStyle.NullValue = lichTrinhEmpty.TenLichTrinh; col.DefaultCellStyle.DataSourceNullValue = lichTrinhEmpty.MaLichTrinh; dataGridView1.Columns.Add(col); DataGridViewCheckBoxColumn checkCol = new DataGridViewCheckBoxColumn(); checkCol.Name = "Checkbox"; checkCol.DataPropertyName = "Checkbox"; checkCol.HeaderText = ""; checkCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; checkCol.Width = 120; checkCol.DefaultCellStyle.NullValue = false; checkCol.DefaultCellStyle.DataSourceNullValue = false; dataGridView1.Columns.Add(checkCol); Set(); }
private void buttonAddSapXepTam_Click(object sender, EventArgs e) { ATINChamCongEntities context = new ATINChamCongEntities(); if (checkBoxUpdateBySelectedEmployee.Checked) { foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value == null) { continue; } if ((bool)row.Cells[0].Value == true) { context.spInsertSapxepLichTrinhTam( dateEditFromDate.DateTime, dateEditToDate.DateTime, (string)comboBox2.SelectedValue, (row.DataBoundItem as ViewSapXepLichTrinh).MaNguoi ); } } } else { if (dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].DataBoundItem != null) { context.spInsertSapxepLichTrinhTam( dateEditFromDate.DateTime, dateEditToDate.DateTime, (string)comboBox2.SelectedValue, (dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].DataBoundItem as ViewSapXepLichTrinh).MaNguoi ); } } var viewSapXepLichTrinh = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].DataBoundItem as ViewSapXepLichTrinh; DataGridView2Config(viewSapXepLichTrinh); }