private void btnXoa_Click(object sender, EventArgs e) { if (fg.Row < fg.Rows.Fixed || fg.Rows[fg.Row].IsNode) { BaseMessages.ShowInformationMessage("Chọn dòng để sửa!"); return; } if (BaseMessages.ShowDeleteQuestionMessage() == DialogResult.No) { return; } var cls = new clsPhanCapNhanVien(); cls.ID_NguoiQuanLy = Convert.ToInt32(cmbNguoiQuanLy.EditValue); var items = cmbNhanVien.Properties.GetItems().GetCheckedValues(); foreach (var item in items) { cls.ID_NhanVien = Convert.ToInt32(item); } cls.Delete(); BaseMessages.ShowInformationMessage("Xóa thành công!"); LockEdit(true); Loadfg(); ResetComboboxs(); }
private void Loadfg() { fg.Tag = 0; fg.BeginUpdate(); var cls = new clsPhanCapNhanVien(); var dt = cls.SelectAll_With_Ten(GlobalVariables.uID_DonVi); fg.ClearRows(); fg.SetDataSource(dt); LoadTree(); var iSTT = 0; for (var i = fg.Rows.Fixed; i < fg.Rows.Count; i++) { if (fg.Rows[i].IsNode) { iSTT = 0; } else { fg[i, "STT"] = iSTT; } iSTT++; } fg.Row = -1; fg.AutoSizeRows(); fg.EndUpdate(); fg.Tag = 1; }
private void SaveData() { var cls = new clsPhanCapNhanVien(); if (m_bFlag) { cls.ID_DonVi = GlobalVariables.uID_DonVi; cls.ID_NguoiQuanLy = Convert.ToInt32(cmbNguoiQuanLy.EditValue); var items = cmbNhanVien.Properties.GetItems().GetCheckedValues(); foreach (var item in items) { cls.ID_NhanVien = Convert.ToInt32(item); cls.Insert(); } } else { cls.ID_DonVi = GlobalVariables.uID_DonVi; cls.ID_NguoiQuanLy = Convert.ToInt32(fg[fg.Row, "ID_NguoiQuanLy"]); cls.ID_NhanVien = Convert.ToInt32(fg[fg.Row, "ID_NhanVien"]); cls.Delete(); cls.ID_NguoiQuanLy = Convert.ToInt32(cmbNguoiQuanLy.EditValue); cls.ID_NhanVien = Convert.ToInt32(cmbNhanVien.EditValue); cls.Insert(); } }