/// <summary> /// /// </summary> private void GetDepartments() { context = new EducationSkillsDbContext(); var departments = context.Database.SqlQuery <Department>("EXEC [dbo].[sp_Get_All_Departments]").ToList(); txtDept.Properties.DataSource = departments; }
/// <summary> /// Xóa KTV mắt /// </summary> /// <param name="staffCode"></param> public static void DeleteEye(string staffCode) { object[] param = { new SqlParameter() { ParameterName = "@StaffCode", Value = staffCode, SqlDbType = SqlDbType.VarChar }, new SqlParameter("@Out_Parameter", SqlDbType.Int) { Direction = ParameterDirection.Output } }; try { using (var context = new EducationSkillsDbContext()) { context.Database.ExecuteSqlCommand("EXEC [dbo].[DeleteMat] @StaffCode", param); } } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); return; } }
/// <summary> /// /// </summary> /// <param name="key"></param> private void LoadReportsSolder(string key) { splashScreenManager1.ShowWaitForm(); context = new EducationSkillsDbContext(); SqlParameter parmDept = new SqlParameter() { ParameterName = "@deptCode", Value = key, SqlDbType = SqlDbType.VarChar }; if (key == null) { parmDept.Value = DBNull.Value; } try { var reports = context.Database.SqlQuery <ReportsSolder>("EXEC [dbo].[sp_Get_All_Check Solders] @deptCode", parmDept).ToList(); gridControl1.DataSource = reports; } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); } if (gridControl1.DataSource != null) { btnExportToExel.Enabled = true; } splashScreenManager1.CloseWaitForm(); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="name"></param> public static void InsertSubject(string id, string name, string type, string dept) { var subject = new PR_Bomon() { MaBoMon = id, TenBoMon = name, CreateBy = type, CreateDate = DateTime.Now, ModifyDate = DateTime.Now, }; if (dept != null) { subject.Dept = dept; } try { using (var context = new EducationSkillsDbContext()) { context.PR_Bomon.Add(subject); context.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="key"></param> private void LoadSubjects() { splashScreenManager1.ShowWaitForm(); context = new EducationSkillsDbContext(); string type = "Đào tạo toàn công ty"; object[] param = { new SqlParameter() { ParameterName = "@type", Value = type, SqlDbType = SqlDbType.NVarChar }, new SqlParameter() { ParameterName = "@dept", Value = DBNull.Value, SqlDbType = SqlDbType.NVarChar }, new SqlParameter("@Out_Parameter", SqlDbType.Int) { Direction = ParameterDirection.Output } }; try { var subjects = context.Database.SqlQuery <PR_Bomon>("EXEC [dbo].[ShowBoMon] @type, @dept", param).ToList(); gridControl1.DataSource = subjects; } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); } splashScreenManager1.CloseWaitForm(); }
/// <summary> /// /// </summary> private void GetCertificates() { context = new EducationSkillsDbContext(); List <EDU_Certificates> certificates = new List <EDU_Certificates>(); if (checkEditEye.Checked == false && checkEditSolder.Checked == false) { certificates = context.EDU_Certificates.OrderBy(c => c.DisplayMember).ToList(); } if (checkEditEye.Checked == true && checkEditSolder.Checked == false) { certificates = context.EDU_Certificates.Where(m => m.Type == "Eye").OrderBy(c => c.DisplayMember).ToList(); } if (checkEditEye.Checked == false && checkEditSolder.Checked == true) { certificates = context.EDU_Certificates.Where(m => m.Type == "Solder").OrderBy(c => c.DisplayMember).ToList(); } if (checkEditEye.Checked == true && checkEditSolder.Checked == true) { certificates = context.EDU_Certificates.OrderBy(c => c.DisplayMember).ToList(); } txtCertificate.Properties.DisplayMember = "DisplayMember"; txtCertificate.Properties.ValueMember = "ValueMember"; txtCertificate.Properties.DataSource = certificates; }
/// <summary> /// /// </summary> private void GetCertificates() { context = new EducationSkillsDbContext(); var certificates = context.EDU_Certificates.ToList(); gridControl1.DataSource = certificates; }
private void btnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtValue.Text)) { var item = new EDU_Certificates { DisplayMember = txtValue.Text }; context = new EducationSkillsDbContext(); try { context.EDU_Certificates.Add(item); context.SaveChanges(); GetCertificates(); txtValue.ResetText(); } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); } } else { MessageHelper.ErrorMessageBox("Vui lòng nhập vào đầy đủ thông tin!"); return; } }
/// <summary> /// /// </summary> /// <param name="staffCode"></param> /// <param name="levelI"></param> /// <param name="dateLevelI"></param> /// <param name="levelII"></param> /// <param name="dateLevelII"></param> /// <param name="levelIII"></param> /// <param name="dateLevelIII"></param> /// <param name="dateConfirm"></param> public static void UpdateEye(string staffCode, string levelI, string dateLevelI, string levelII, string dateLevelII, string levelIII, string dateLevelIII, string dateConfirm, string dateTestActual) { var eye = GetEyeByID(staffCode); if (eye != null) { if (Ultils.IsNull(levelI)) { eye.CapDo = levelI; } if (Ultils.IsNull(levelII)) { eye.NangCap = levelII; } ; if (Ultils.IsNull(levelIII)) { eye.CNNguoiDaoTao = levelIII; } ; if (Ultils.IsNull(dateLevelI)) { eye.NgayCap = DateTime.Parse(dateLevelI); } if (Ultils.IsNull(dateLevelII)) { eye.NgayNangCap = DateTime.Parse(dateLevelII); } if (Ultils.IsNull(dateLevelIII)) { eye.NgayCNNguoiDaoTao = DateTime.Parse(dateLevelIII); } if (Ultils.IsNull(dateConfirm)) { eye.NgayThi = DateTime.Parse(dateConfirm); } if (Ultils.IsNull(dateTestActual)) { eye.NgayThiThucTe = DateTime.Parse(dateTestActual); } try { using (var context = new EducationSkillsDbContext()) { context.PR_Mat.Attach(eye); context.Entry(eye).State = EntityState.Modified; context.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } } }
private void btnSave_Click(object sender, EventArgs e) { context = new EducationSkillsDbContext(); if (!ValidationHelper.IsNullOrEmptyControl(cboLevel)) { MessageHelper.ErrorMessageBox("Vui lòng chọn cấp độ!"); } else if (checkEditEye.Checked == false && checkEditSolder.Checked == false) { MessageHelper.ErrorMessageBox("Vui lòng nhập đầy đủ thông tin!"); } else if (!ValidationHelper.IsNullOrEmptyControl(txtCertificate)) { MessageHelper.ErrorMessageBox("Vui lòng chọn một chứng chỉ!"); } else if (!ValidationHelper.IsNullOrEmptyControl(dateEditTestDate)) { MessageHelper.ErrorMessageBox("Vui lòng nhập vào Ngày cấp!"); } else if (!ValidationHelper.IsNullOrEmptyControl(dateEditDateConfirmed)) { MessageHelper.ErrorMessageBox("Vui lòng nhập vào Ngày xác thực!"); } else { foreach (var item in items) { // Hàn = check // Mắt = no check if (checkEditSolder.CheckState == CheckState.Checked && checkEditEye.CheckState == CheckState.Unchecked) { EducationSkillDataProviders.InsertSolder(cboLevel.SelectedIndex, item, txtCertificate.Text, (DateTime)dateEditTestDate.EditValue, (DateTime)dateEditDateConfirmed.EditValue, 1); } // Hàn = no check // Mắt = check else if (checkEditSolder.CheckState == CheckState.Unchecked && checkEditEye.CheckState == CheckState.Checked) { EducationSkillDataProviders.InsertEye(cboLevel.SelectedIndex, item, txtCertificate.Text, (DateTime)dateEditTestDate.EditValue, (DateTime)dateEditDateConfirmed.EditValue, 1); } // Cả hai cùng Check else if (checkEditSolder.CheckState == CheckState.Checked && checkEditEye.CheckState == CheckState.Checked) { // Hàn EducationSkillDataProviders.InsertSolder(cboLevel.SelectedIndex, item, txtCertificate.Text, (DateTime)dateEditTestDate.EditValue, (DateTime)dateEditDateConfirmed.EditValue, 1); // Mắt EducationSkillDataProviders.InsertEye(cboLevel.SelectedIndex, item, txtCertificate.Text, (DateTime)dateEditTestDate.EditValue, (DateTime)dateEditDateConfirmed.EditValue, 1); } } MessageHelper.SuccessMessageBox("Lưu thành công!"); this.Close(); } }
/// <summary> /// /// </summary> /// <param name="staffCode"></param> /// <param name="levelI"></param> /// <param name="dateLevelI"></param> /// <param name="levelII"></param> /// <param name="dateLevelII"></param> /// <param name="levelIII"></param> /// <param name="dateLevelIII"></param> /// <param name="dateConfirm"></param> /// <param name="dateTestActual"></param> public static void UpdateSolder(string staffCode, string levelI, string dateLevelI, string levelII, string dateLevelII, string levelIII, string dateLevelIII, string dateConfirm, string dateTestActual) { var solder = GetSolderByID(staffCode); if (solder != null) { if (Ultils.IsNull(levelI)) { solder.CapDoHan = levelI; } if (Ultils.IsNull(levelII)) { solder.NangCapDo = levelII; } if (Ultils.IsNull(levelIII)) { solder.CNNguoiDaoTao = levelIII; } if (Ultils.IsNull(dateLevelI)) { solder.NgayCap = DateTime.Parse(dateLevelI); } if (Ultils.IsNull(dateLevelII)) { solder.NgayNangCap = DateTime.Parse(dateLevelII); } if (Ultils.IsNull(dateLevelIII)) { solder.NgayCNNguoiDaoTao = DateTime.Parse(dateLevelIII); } if (Ultils.IsNull(dateConfirm)) { solder.NgayThiXacNhan = DateTime.Parse(dateConfirm); } if (Ultils.IsNull(dateTestActual)) { solder.NgayThiThucTe = DateTime.Parse(dateTestActual); } try { using (var context = new EducationSkillsDbContext()) { context.PR_Han.Attach(solder); context.Entry(solder).State = EntityState.Modified; context.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } } }
/// <summary> /// Xóa chứng chỉ /// </summary> /// <param name="id"></param> public static void DeleteManagerCertificates(string id) { try { using (var context = new EducationSkillsDbContext()) { context.Database.ExecuteSqlCommand($"DELETE FROM [GA_UMC].[dbo].[EDU_ManageCertificates] WHERE ID={id}"); } } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); return; } }
/// <summary> /// /// </summary> private void GetDepartments() { context = new EducationSkillsDbContext(); var dept = new Department { DeptCode = "Tất cả" }; List <Department> departments = null; departments = context.Database.SqlQuery <Department>("EXEC [dbo].[sp_Get_All_Departments]").ToList(); departments.Add(dept); txtDept.Properties.DataSource = departments; txtDept.Properties.DisplayMember = "DeptCode"; txtDept.Properties.ValueMember = "DeptCode"; }
/// <summary> /// /// </summary> /// <param name="staffCode"></param> /// <param name="level"></param> /// <param name="testDate"></param> /// <param name="dateConfirmed"></param> /// <param name="solanthi"></param> public static void InsertEye(int index, string staffCode, string level, DateTime testDate, DateTime dateConfirmed, int solanthi) { object[] param = { new SqlParameter() { ParameterName = "@Level", Value = index, SqlDbType = SqlDbType.Int }, new SqlParameter() { ParameterName = "@StaffCode", Value = staffCode, SqlDbType = SqlDbType.VarChar }, new SqlParameter() { ParameterName = "@CapDo", Value = level, SqlDbType = SqlDbType.NVarChar }, new SqlParameter() { ParameterName = "@NgayCap", Value = testDate, SqlDbType = SqlDbType.DateTime }, new SqlParameter() { ParameterName = "@NgayThiXacNhan", Value = dateConfirmed, SqlDbType = SqlDbType.DateTime }, new SqlParameter() { ParameterName = "@Solanthi", Value = solanthi, SqlDbType = SqlDbType.Int }, new SqlParameter("@Out_Parameter", SqlDbType.Int) { Direction = ParameterDirection.Output } }; try { using (var context = new EducationSkillsDbContext()) { context.Database.ExecuteSqlCommand("EXEC [dbo].[InSertKTMat] @Level, @StaffCode, @CapDo, @NgayCap, @NgayThiXacNhan, @Solanthi", param); } } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); return; } }
/// <summary> /// /// </summary> /// <param name="key"></param> private void LoadEmployees(string key) { splashScreenManager1.ShowWaitForm(); context = new EducationSkillsDbContext(); object deptCode; if (key == null) { deptCode = DBNull.Value; } else { deptCode = key; } object[] param = { new SqlParameter() { ParameterName = "@deptCode", Value = deptCode, SqlDbType = SqlDbType.NVarChar }, new SqlParameter("@Out_Parameter", SqlDbType.Int) { Direction = ParameterDirection.Output } }; try { var reports = context.Database.SqlQuery <Employees>("EXEC [dbo].[sp_Get_All_Staff] @deptCode", param).ToList(); gridControl1.DataSource = reports; } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); } if (gridControl1.DataSource != null) { btnTranfers.Enabled = true; } splashScreenManager1.CloseWaitForm(); }
public FormAddSubject(string id) { InitializeComponent(); context = new EducationSkillsDbContext(); if (id != "") { lblTitle.Text = "Sửa môn học"; _subject = SubjectDataProvider.GetSubjectById(id); txtSubjectID.Text = _subject.MaBoMon; txtSubjectName.Text = _subject.TenBoMon; txtSubjectID.Enabled = false; } else { lblTitle.Text = "Thêm môn học"; btnDel.Visible = false; } GetDepartments(); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="name"></param> public static void UpdateSubject(string id, string name) { var subject = GetSubjectById(id); if (subject != null) { subject.TenBoMon = name; try { using (var context = new EducationSkillsDbContext()) { context.PR_Bomon.Attach(subject); context.Entry(subject).State = EntityState.Modified; context.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } } }
private void btnSaveChanges_Click(object sender, EventArgs e) { int record = 0; for (int i = 0; i < gridView1.DataRowCount; i++) { string strDate = null; if (gridView1.GetRowCellValue(i, "NgayThamGia") != null) { strDate = gridView1.GetRowCellValue(i, "NgayThamGia").ToString(); } string note = (string)gridView1.GetRowCellValue(i, "GhiChu"); string subjectId = (string)gridView1.GetRowCellValue(i, "MaBoMon"); // Mã bộ môn SqlParameter mabomon = new SqlParameter() { ParameterName = "@MaBoMon", Value = subjectId, SqlDbType = SqlDbType.NChar }; if (subjectId == null) { mabomon.Value = DBNull.Value; } // StaffCode SqlParameter parmstaffCode = new SqlParameter() { ParameterName = "@StaffCode", Value = lblCode.Text, SqlDbType = SqlDbType.NChar }; if (lblCode.Text == null) { parmstaffCode.Value = DBNull.Value; } // Ngày tham gia SqlParameter parmNgayThamGia = new SqlParameter { ParameterName = "@NgayThamGia", SqlDbType = SqlDbType.DateTime }; if (gridView1.GetRowCellValue(i, "NgayThamGia") != null) { parmNgayThamGia.Value = DateTime.Parse(strDate); parmNgayThamGia.SqlDbType = SqlDbType.DateTime; } else { parmNgayThamGia.Value = DBNull.Value; } SqlParameter parmNote = new SqlParameter() { ParameterName = "@GhiChu", Value = note, SqlDbType = SqlDbType.NVarChar }; if (note == null) { parmNote.Value = DBNull.Value; } try { if (gridView1.GetRowCellValue(i, "NgayThamGia") != null) { if (DateTime.Parse(strDate) > DateTime.Now) { MessageHelper.ErrorMessageBox("Ngày tham gia không được lớn hơn ngày hiện tại. Vui lòng kiểm tra lại!"); return; } if (DateTime.Parse(strDate) < DateTime.Parse(lblEntryDate.Text)) { MessageHelper.ErrorMessageBox("Ngày tham gia không được nhỏ hơn ngày vào làm. Vui lòng kiểm tra lại!"); return; } } using (var dbcontext = new EducationSkillsDbContext()) { dbcontext.Database.ExecuteSqlCommand("EXEC [dbo].[UpdateSkillMap] @StaffCode,@MaBoMon,@NgayThamGia,@GhiChu", parmstaffCode, mabomon, parmNgayThamGia, parmNote); } record++; } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); } //} } MessageHelper.SuccessMessageBox($"Lưu thành công {record}!"); }
public UserControlReportsEye() { InitializeComponent(); context = new EducationSkillsDbContext(); InitializeMenuItems(); }
public FormLogin() { InitializeComponent(); context = new EducationSkillsDbContext(); }
/// <summary> /// /// </summary> /// <param name="staffCode"></param> private void LoadData(string staffCode) { splashScreenManager1.ShowWaitForm(); context = new EducationSkillsDbContext(); SqlParameter parmstaffCode = new SqlParameter() { ParameterName = "@staffCode", SqlDbType = SqlDbType.VarChar }; if (staffCode == null) { parmstaffCode.Value = DBNull.Value; } else { parmstaffCode.Value = staffCode; } try { var employees = context.Database.SqlQuery <Employees>("EXEC [dbo].[sp_GetStaffByCode] @staffCode", parmstaffCode).SingleOrDefault(); if (employees != null) { lblCode.Text = employees.StaffCode; lblFullName.Text = employees.FullName; lblBirthDate.Text = string.Format("{0:dd-MM-yyyy}", employees.BirthDate); lblSex.Text = employees.Sex; lblDeptCode.Text = employees.DeptCode; lblEntryDate.Text = string.Format("{0:MM/dd/yyyy}", employees.EntryDate); lblPosName.Text = employees.PosName; string type = "Đào tạo toàn công ty"; object[] paramSubjects = { new SqlParameter() { ParameterName = "@type", Value = type, SqlDbType = SqlDbType.NVarChar }, new SqlParameter() { ParameterName = "@dept", Value = DBNull.Value, SqlDbType = SqlDbType.NVarChar }, new SqlParameter("@Out_Parameter", SqlDbType.Int) { Direction = ParameterDirection.Output } }; var subjects = context.Database.SqlQuery <PR_Bomon>("EXEC [dbo].[ShowBoMon] @type, @dept", paramSubjects).Where(c => c.MaBoMon.Contains("EDU-")).ToList(); foreach (var sub in subjects) { object[] param = { new SqlParameter() { ParameterName = "@staffCode", Value = staffCode, SqlDbType = SqlDbType.VarChar }, new SqlParameter() { ParameterName = "@MaBoMon", Value = sub.MaBoMon, SqlDbType = SqlDbType.VarChar }, new SqlParameter("@Out_Parameter", SqlDbType.Int) { Direction = ParameterDirection.Output } }; var checkExits = context.Database.SqlQuery <SkillMap>("EXEC [dbo].[CheckStaffCodeExitsSkillMap] @staffCode,@MaBoMon", param).SingleOrDefault(); if (checkExits == null) { object[] param2 = { new SqlParameter() { ParameterName = "@StaffCode", Value = staffCode, SqlDbType = SqlDbType.VarChar }, new SqlParameter() { ParameterName = "@MaMon", Value = sub.MaBoMon, SqlDbType = SqlDbType.VarChar }, new SqlParameter("@Out_Parameter", SqlDbType.Int) { Direction = ParameterDirection.Output } }; try { context.Database.ExecuteSqlCommand("EXEC [dbo].[InsertSkillMap] @StaffCode,@MaMon", param2); } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); } } } object[] paramOffStaffCode = { new SqlParameter() { ParameterName = "@staffCode", Value = staffCode, SqlDbType = SqlDbType.VarChar }, new SqlParameter("@Out_Parameter", SqlDbType.Int) { Direction = ParameterDirection.Output } }; try { var reports = context.Database.SqlQuery <SkillMap>("EXEC [dbo].[sp_Get_Subjects_Of_StaffCode] @staffCode", paramOffStaffCode).Where(c => c.MaBoMon.Contains("EDU-")).ToList(); gridControl1.DataSource = reports; } catch (Exception ex) { MessageHelper.ErrorMessageBox(ex.Message); } splashScreenManager1.CloseWaitForm(); } else { splashScreenManager1.CloseWaitForm(); MessageHelper.ErrorMessageBox($"Không tìm thấy nhân viên với code: [{staffCode}]. Vui lòng kiểm tra lại!"); } } catch (Exception ex) { splashScreenManager1.CloseWaitForm(); MessageHelper.ErrorMessageBox(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="staffCode"></param> private void LoadData(string staffCode) { splashScreenManager1.ShowWaitForm(); context = new EducationSkillsDbContext(); SqlParameter parmstaffCode = new SqlParameter() { ParameterName = "@staffCode", SqlDbType = SqlDbType.VarChar }; if (staffCode == null) { parmstaffCode.Value = DBNull.Value; } else { parmstaffCode.Value = staffCode; } try { var employees = context.Database.SqlQuery <Employees>("EXEC [dbo].[sp_GetStaffByCode] @staffCode", parmstaffCode).SingleOrDefault(); if (employees != null) { lblCode.Text = employees.StaffCode; lblFullName.Text = employees.FullName; lblBirthDate.Text = string.Format("{0:dd-MM-yyyy}", employees.BirthDate); lblSex.Text = employees.Sex; lblDeptCode.Text = employees.DeptCode; lblEntryDate.Text = string.Format("{0:MM/dd/yyyy}", employees.EntryDate); lblPosName.Text = employees.PosName; //var olympic = context.EDU_Olympics.SingleOrDefault(m => m.StaffCode == staffCode); //if (olympic != null) //{ // txtTestContent.EditValue = olympic.TestContent; // txtTestNumber.Text = olympic.TestNumber.ToString(); // txtTestDate.DateTime = olympic.TestDate; // txtTestResults.EditValue = olympic.TestResults; //} //else //{ //txtTestContent.EditValue = null; //txtTestContent.ResetText(); //txtTestNumber.ResetText(); //txtTestDate.ResetText(); //txtTestResults.EditValue = null; //txtTestResults.ResetText(); //} splashScreenManager1.CloseWaitForm(); } else { splashScreenManager1.CloseWaitForm(); MessageHelper.ErrorMessageBox($"Không tìm thấy nhân viên với code: [{staffCode}]. Vui lòng kiểm tra lại!"); } } catch (Exception ex) { splashScreenManager1.CloseWaitForm(); MessageHelper.ErrorMessageBox(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="date"></param> /// <param name="dept"></param> private void GetReportSkillsMap(string dept) { splashScreenManager1.ShowWaitForm(); context = new EducationSkillsDbContext(); SqlParameter parmDept = new SqlParameter() { ParameterName = "@deptCode", Value = dept, SqlDbType = SqlDbType.VarChar }; if (dept == null) { parmDept.Value = DBNull.Value; } try { List <Staff> staffs = context.Database.SqlQuery <Staff>("EXEC [dbo].[sp_GetStaffs] @deptCode", parmDept).ToList(); List <PivotSkillMap> queryResults = (from iso in staffs orderby iso.StaffCode ascending, iso.MaBoMon ascending group iso by iso.StaffCode into isoGroup select new PivotSkillMap() { StaffCode = isoGroup.Key, FullName = isoGroup.Select(d => d.FullName).FirstOrDefault(), DeptCode = isoGroup.Select(d => d.DeptCode).FirstOrDefault(), MaBoMon = isoGroup.Select(y => y.MaBoMon), NgayThamGia = isoGroup.Select(v => v.NgayThamGia) }).ToList(); PopulateGrid(queryResults); gridView1.Columns[0].Width = 70; gridView1.Columns[1].Width = 150; gridView1.Columns[2].Width = 70; gridView1.Columns[0].Fixed = FixedStyle.Left; gridView1.Columns[1].Fixed = FixedStyle.Left; gridView1.Columns[2].Fixed = FixedStyle.Left; // Tooltip Column Title foreach (var item in gridView1.Columns) { string columnName = item.ToString(); if (columnName.StartsWith("EDU-")) { var SubjectName = context.PR_Bomon.SingleOrDefault(m => m.MaBoMon == columnName).TenBoMon; gridView1.Columns[columnName].ToolTip = SubjectName; //gridView1.Columns[columnName].Summary.Add(DevExpress.Data.SummaryItemType.Count, columnName, "{0}"); gridView1.Columns[columnName].SummaryItem.SetSummary(SummaryItemType.Count, "{0}"); //gridView1.Columns[columnName].SummaryItem.SummaryType = SummaryItemType.Count; gridView1.Columns[columnName].AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; gridView1.Columns[columnName].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Far; } if (columnName.StartsWith("TOTAL")) { gridView1.Columns[columnName].AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; gridView1.Columns[columnName].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } if (gridControl1.DataSource != null) { btnExportToExel.Enabled = true; } splashScreenManager1.CloseWaitForm(); }