/// <summary> /// Hàm xử lý xe chuẩn (Thêm + Update) /// </summary> /// <param name="verNum"></param> public void VehicleStandardProcess(string verNum) { ConnectDb cn = new ConnectDb(); try { if (grd_HistoryGs.RowCount == 0) { return; } if (string.IsNullOrEmpty(verNum)) { return; } int typeId = -1; if (cn.CheckVerhicleNunberInTransaction(verNum, out typeId)) { if (typeId != -1) { cn.CheckStandardVerhicleInfo(verNum, typeId); } } } catch (Exception ex) { logger.Error(ex); } finally { cn.CloseConnection(); } }
private void btn_Loi1_Click(object sender, EventArgs e) { string id = grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "MaGs").ToString(); try { ConnectDb cn = new ConnectDb(); cn.UpdateError(id, 1); if (!grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "MaLoi").ToString().Trim().Equals("1")) { string BienSo = grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "BienSo").ToString(); string LinkAnh = grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "HinhAnh").ToString(); string ThuPhiVien = grd_HistoryGs.GetRowCellDisplayText(grd_HistoryGs.FocusedRowHandle, "ThuPhiVien").ToString(); logDb.Save(string.Format("User {0} thay đổi {1} thành lỗi loại 1 lượt xe có mã {2} \n Biển số: {3} \n Link ảnh: {4} \n Thu phí viên: {5}", User_Login.Name, OldErr, id, BienSo, LinkAnh, ThuPhiVien), (int)eReview01.CommonUI.Enumeration.FormAction.tích_lỗi); int VehType = grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "LoaiXe").ConvertToInt(); if (!string.IsNullOrEmpty(BienSo) && VehType > 0) { RemoveVehicleStandard(BienSo, VehType); } } LoadDb(); } catch (Exception ex) { XtraMessageBox.Show(Properties.Resources.CheckConnection, "Thất bại!", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.Error("User: "******" try tick 'Loi loai 1' for record '" + id + "' and Failure! by error " + ex, false); } }
private void btn_Loi0_Click(object sender, EventArgs e) { string id = grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "MaGs").ToString(); try { ConnectDb cn = new ConnectDb(); string BienSo = grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "BienSo").ToString(); string LinkAnh = grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "HinhAnh").ToString(); string ThuPhiVien = grd_HistoryGs.GetRowCellDisplayText(grd_HistoryGs.FocusedRowHandle, "ThuPhiVien").ToString(); if (!string.IsNullOrEmpty(BienSo) && !string.IsNullOrWhiteSpace(BienSo)) { cn.UpdateError(id, 0); VehicleStandardProcess(BienSo); if (!grd_HistoryGs.GetRowCellValue(grd_HistoryGs.FocusedRowHandle, "MaLoi").ToString().Trim().Equals("0")) { logDb.Save(string.Format("User {0} thay đổi {1} thành không lỗi lượt xe có mã {2} \n Biển số: {3} \n Link ảnh: {4} \n Thu phí viên: {5}", User_Login.Name, OldErr, id, BienSo, LinkAnh, ThuPhiVien), (int)eReview01.CommonUI.Enumeration.FormAction.tích_lỗi); } LoadDb(); } else { XtraMessageBox.Show("Đây là trường hợp hệ thống không trả về biển số (Lỗi loại 3) bạn không thể tick không lỗi", "Cảnh báo!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { XtraMessageBox.Show(Properties.Resources.CheckConnection, "Thất bại!"); logger.Error("User: "******" try tick 'Khong loi' for record '" + id + "' and Failure! by error " + ex, false); } }
private void Frm_ConfigLane_Load(object sender, EventArgs e) { ConnectDb con = new ConnectDb(); DataTable dt = con.DoDuLieuProcedure("proc_Monitor_ConfigChooseLane"); gridControl1.DataSource = dt; CreateUnboundColumn(); ritem = new RepositoryItemCheckEdit(); ritem.AllowGrayed = false; }
private void btn_ok_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txt_password.Text) || string.IsNullOrEmpty(txt_user.Text)) { XtraMessageBox.Show(Properties.Resources.EnterFullInfo, "Chú ý!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ConnectDb con = new ConnectDb(); int str = int.Parse(con.HienThi1ThongTin("Select Count(*) from user_info where USER_INFO_ID=N'" + txt_user.Text + "' and USER_INFO_PASS=N'" + Util.Sha256Encrypt(txt_password.Text) + "'")); if (str >= 1) { Frm_Main frm = new Frm_Main(); User_Login.Id = con.HienThi1ThongTin("Select USER_INFO_ID from user_info where USER_INFO_ID=N'" + txt_user.Text + "'"); User_Login.Name = con.HienThi1ThongTin("Select USER_INFO_FULL from user_info where USER_INFO_ID=N'" + txt_user.Text + "'"); int CheckQuyen = int.Parse(con.HienThi1ThongTin("select count(*) from membership where MEM_USER =N'" + txt_user.Text + "' AND MEM_ROLE=1")); //User_Login.GroupRole = int.Parse(con.HienThi1ThongTin("SELECT MEM_GRP FROM membership WHERE MEM_USER =N'" +txt_user.Text +"'")); User_Login.LoginDateTime = DateTime.Now; if (CheckQuyen >= 1) // đối chiếu quyền giám sát =1 nhóm là nhóm giám sát =2 { User_Login.Role = 1; User_Login.ChucVu = con.HienThi1ThongTin("Select MEM_DESC FROM membership where MEM_USER = N'" + txt_user.Text + "'"); logger.Info("User " + User_Login.Name + "tried login and success | Role correct"); frm.Show(); this.Hide(); } else // đối vs những quyền khác { logger.Info("User " + User_Login.Name + "tried login but failure | Role incorrect"); DialogResult dr = XtraMessageBox.Show(Properties.Resources.RoleIncorrect, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop); if (dr == DialogResult.OK) { txt_user.Text = null; txt_password.Text = null; txt_user.Focus(); } } } else { XtraMessageBox.Show(Properties.Resources.IncorrectInfoReEnter, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_user.Focus(); } } } catch (Exception ex) { logger.Error("Loi Dang nhap: " + ex); } }
private void frm_login_Load(object sender, EventArgs e) { logger.Info(User_Login.Name + "Run Login"); txt_user.Focus(); try { ConnectDb Connect = new ConnectDb(); MySqlConnection con = Connect.GetCon(); con.Open(); con.Close(); logger.Info("Db correct"); } catch (Exception ex) { Frm_Config frm = new Frm_Config(); frm.ShowDialog(); logger.Error("Error Db incorrect: " + ex); } }
/// <summary> /// Hàm remove xe khỏi danh sách dữ liệu chuẩn /// So sánh loại xe có khớp vs xe trong dữ liệu chuẩn không, nếu khớp mới remove /// </summary> /// <param name="verNum"></param> public void RemoveVehicleStandard(string vehNum, int Vehtype) { ConnectDb cn = new ConnectDb(); try { if (Vehtype == cn.SelectStandardVehicleInfo(vehNum)) { cn.DeleteStandardVehicleInfo(vehNum); } } catch (Exception ex) { logDb.Error(string.Format("Không thể xóa xe '{0}' khỏi dữ liệu xe chuẩn, lỗi \n{1}", vehNum, ex.ToString())); } finally { cn.CloseConnection(); } }
private void CheckConnectionDb() { ConnectDb con = new ConnectDb(); MySqlConnection mycon = con.GetCon(); try { mycon.Open(); } catch { XtraMessageBox.Show(Properties.Resources.DisconnectDb, "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { if (mycon.State == ConnectionState.Open) { mycon.Close(); mycon.Dispose(); } } }
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); } }
private void Frm_Setting_Load(object sender, EventArgs e) { try { ConnectDb con = new ConnectDb(); DataTable dt = con.DoDuLieuProcedure("proc_Monitor_ConfigChooseLane"); dt.Columns.Add("IsMonitor", typeof(bool)); gridControl1.DataSource = dt; CreateUnboundColumn(); ritem = new RepositoryItemCheckEdit(); ritem.AllowGrayed = false; checkTuDongPhatHienNghiNgo.AutoSizeInLayoutControl = true; // doc file setting.xml] set_TimeRunSlideShow.Value = 1; set_TimeLoadData.Value = 1; GetInfoSetting(); } catch (Exception ex) { logger.Error("Error load setting by: " + ex); } }
private void button2_Click(object sender, EventArgs e) { ConnectDb con = new ConnectDb(); }
private void btn_Ok_Click(object sender, EventArgs e) { ConnectDb.WriteFile(txt_Server.Text, cbo_LoadData.Text, txt_Port.Text, txt_Username.Text, txt_Password.Text); this.Close(); }