private void checkEdit_Loi_CheckedChanged(object sender, EventArgs e) { try { grid_SearchAndEdit.Refresh(); KtraCheckLoi(); dt = new DataTable(); dt = con.SearchAndEdit(User_Login.Id, LocLoi, dtfrom, dtto, MonitorSetting.ChooseLane); grid_SearchAndEdit.DataSource = dt; } catch (Exception ex) { logger.Error(ex); } }
public void LoadDb() { // CheckConnectionDb(); try { ConnectDb con = new ConnectDb(); if (con.CheckConnectDb() == true) { Cursor.Current = Cursors.WaitCursor; GridView view = (GridView)grid_SearchAndEdit.MainView; int index = view.FocusedRowHandle; int topVisibleIndex = view.TopRowIndex; KtraCheckLoi(); DataTable dt = new DataTable(); dt = con.SearchAndEdit(User_Login.Id, LocLoi, dtfrom, dtto, MonitorSetting.ChooseLane); grd_HistoryGs.BeginDataUpdate(); grid_SearchAndEdit.DataSource = dt; if (view != null) { view.FocusedRowHandle = index; view.TopRowIndex = topVisibleIndex; } grd_HistoryGs.EndDataUpdate(); //NotChangeRowAfterReLoadDb(); LoadInfo(); Cursor.Current = Cursors.Default; } else { XtraMessageBox.Show(Properties.Resources.CheckConnection, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.Error("Connect Db Failed"); } } catch (Exception ex) { logger.Error(ex); } }