/// <summary> /// Khoi tao du lieu luc dau /// </summary> private void Init() { // Lay thong tin he thong ThongTinCauHinh.LayThongTinCauHinh(); g_ConnecString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]; // check connection if (!DieuHanhTaxi.CheckConnection()) { MessageBox.Show("Không kết nối được với cơ sở dữ liệu.Cần liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); return; } /// end check connection timerCapture = new System.Timers.Timer(5000); // nửa giây quét một lần. 15 giay timerCapture.Elapsed += new System.Timers.ElapsedEventHandler(timerCapture_Elapsed); timerCapture.Enabled = true; // Thong tin status bar statusLblKhoiDongLuc.Text = " Khởi động : " + string.Format("{0:HH:mm dd/MM}", DateTime.Now); statusLblSoCuocChoXuLy.Text = " Cuộc chờ xử lý : 0"; statusLblServer.Text = " Server: " + GetServerName(g_ConnecString); statusLblDatabase.Text = " DB: " + GetDatabaseName(g_ConnecString); this.Text = Configuration.GetCompanyName() + " - " + this.Text; }
/// <summary> /// Khoi tao du lieu luc dau /// </summary> private void Init() { timerCapture = new System.Timers.Timer(1000); // nửa giây quét một lần. timerCapture.Elapsed += new System.Timers.ElapsedEventHandler(timerCapture_Elapsed); timerCapture.Enabled = true; g_ConnecString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]; // Lay thong tin he thong ThongTinCauHinh.LayThongTinCauHinh(); g_ThoiDiemLayTruocVOC = DateTime.Now; if (ThongTinCauHinh.SoDauCuaTongDai.Length > 0) { g_HasSoDauTongDai = true; } else { g_HasSoDauTongDai = false; } g_SoCuocGoiGiuLai = Configuration.GetSoCuocGoiGiuLai(); g_FileVOCPath = Configuration.VocFilePath(); if ((!FileTools.IsExsitFile(g_FileVOCPath))) { MessageBox.Show("Không tồn tại file thông tin cuộc gọi.Liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); return; } else { TaxiCapture.DeletePhoneCallVocFile(DateTime.Now, g_FileVOCPath); } // check connection if (!DieuHanhTaxi.CheckConnection()) { MessageBox.Show("Không kết nối được với cơ sở dữ liệu.Cần liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); return; } /// end check connection // Thong tin status bar statusLblKhoiDongLuc.Text = " Khởi động : " + string.Format("{0:HH:mm dd/MM}", DateTime.Now); statusLblSoCuocChoXuLy.Text = " Cuộc chờ xử lý : 0"; statusLblServer.Text = " Server: " + GetServerName(g_ConnecString); statusLblDatabase.Text = " DB: " + GetDatabaseName(g_ConnecString); this.Text = Configuration.GetCompanyName() + " - " + this.Text; g_ListLines = TaxiCapture.GetLineDialOutCS(g_ConnecString); // lấy line của CS g_TimeSecondOnDay = (int)DateTime.Now.TimeOfDay.TotalSeconds; }
/// <summary> /// Khoi tao du lieu luc dau /// </summary> private void Init() { // Lay thong tin he thong ThongTinCauHinh.LayThongTinCauHinh(); if (ThongTinCauHinh.SoDauCuaTongDai.Length > 0) { g_HasSoDauTongDai = true; } else { g_HasSoDauTongDai = false; } g_ConnecString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]; g_FileLogIncomingPath = Configuration.LogIncomingPath(); g_FileInComPath = Configuration.InComFilenamePath(); g_FileVOCPath = Configuration.VocFilePath(); if ((!FileTools.IsExsitFile(g_FileLogIncomingPath)) || (!FileTools.IsExsitFile(g_FileInComPath)) || (!FileTools.IsExsitFile(g_FileVOCPath))) { MessageBox.Show("Không tồn tại file thông tin cuộc gọi.Liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); return; } // check connection if (!DieuHanhTaxi.CheckConnection()) { MessageBox.Show("Không kết nối được với cơ sở dữ liệu.Cần liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); return; } /// end check connection timerCapture = new System.Timers.Timer(500); // nửa giây quét một lần. timerCapture.Elapsed += new System.Timers.ElapsedEventHandler(timerCapture_Elapsed); timerCapture.Enabled = true; try { // Xoa toan bo du lieu hien tai cua he thong phan cung TaxiCapture.DeletePhoneCallInCom(DateTime.Now, g_FileInComPath); TaxiCapture.DeletePhoneCallLogIncomming(DateTime.Now, g_FileLogIncomingPath); TaxiCapture.DeletePhoneCallVocFile(DateTime.Now, g_FileVOCPath); } catch (Exception ex) { MessageBox.Show("Có lỗi thiết lập (reset) các cuộc gọi.Cần liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } CaptureCuocGoiDi(); TaxiCapture.DeletePhoneCallVocFile_CuocGoiDi(g_FileVOCPath); g_bKetThucBackgroundWork = true; g_bTimerHoanThanh = true; g_iKhoiDongLai = 0; }
void frmDMKhachAo_Load(object sender, EventArgs e) { if (DieuHanhTaxi.CheckConnection()) { // Lay thong tin he thong ThongTinCauHinh.LayThongTinCauHinh(); LoadListKhachQuen(); //CheckIn(); LoadListKhachQuen_Type(); LoadListKhachQuen_Rank(); } }
private void frmThongTinKhachHangPhanAnh_Load(object sender, EventArgs e) { if (DieuHanhTaxi.CheckConnection()) {// Lay thong tin he thong ThongTinCauHinh.LayThongTinCauHinh(); g_TimeServer = DieuHanhTaxi.GetTimeServer(); } LoadPhanAnh_ChuaGiaiQuyet(0); CheckIn(); grdGiaiQuyetPA.Focus(); // Khoi tao cong COM KhoiTaoCOMPort(); // khoi dong kiem tra COM, lay cong co the mo duoc }
private void frmMain_Load(object sender, EventArgs e) { try { if (DieuHanhTaxi.CheckConnection()) { // Lay thong tin he thong ThongTinCauHinh.LayThongTinCauHinh(); //---------------------------------------------------- HeThong_DangNhap frmDangNhap = new HeThong_DangNhap(); DialogResult dlgResult = frmDangNhap.ShowDialog(); if (dlgResult == DialogResult.Cancel) { Application.Exit(); } strUser_Id = ThongTinDangNhap.USER_ID; this.Text = Configuration.GetCompanyName() + " - " + this.Text; G_IsActive = true; LoadData(); g_TimeServer = DieuHanhTaxi.GetTimeServer(); InitTimerCapturePhone(); } else { new MessageBox.MessageBox().Show(this, "Có lỗi kết nối máy chủ, cần liên lạc với quản trị.", "Thông báo lỗi", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error); Application.Exit(); } statusBar.Panels["TenDangNhap"].Text = ThongTinDangNhap.FULLNAME; if (ThongTinDangNhap.USER_ID != "admin") { //thực hiện phân quyền trên menu PhanQuyenMenu(EF02_mnuMain, ThongTinDangNhap.PermissionsFull); } } catch (Exception ex) { new MessageBox.MessageBox().Show(this, ex.Message, "Thông báo lỗi", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error); } }
private void FormMainRibbon_Load(object sender, EventArgs e) { if (DieuHanhTaxi.CheckConnection()) { // Lưu ý:Làm hàm Load tối giản lại càng tốt RealTimeEnvironment.IniRealTime(); PingApp = new BackgroundWorker(); PingApp.DoWork += PingApp_DoWork; using (var PingWcf = new BackgroundWorker()) { PingWcf.DoWork += (sender1, e1) => Service_Common.PingWcf(); PingWcf.RunWorkerAsync(); } if (Config_Common.DienThoai_KhungDiaChi == KhungDiaChi.Duoi) { PanelThongTinDiaChi.Dock = DockStyle.Bottom; } else { PanelThongTinDiaChi.Dock = DockStyle.Top; } if (Config_Common.GridConfig != 1) { btnAnHien.PerformClick(); btnAnHien.Visible = false; } #region ==== GridControl ==== // RealTimeEnvironment.LineVung = "124;179"; // Lấy cấu hình. #region === Ini Data === grvChoGiaiQuyet.FuncGetTimerServer = () => RealTimeEnvironment.TimeServer; grvChoGiaiQuyet.FuncGetAll = CuocGoi.G5_DIENTHOAI_LayAllCuocGoi; grvChoGiaiQuyet.FuncGetNew = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiMoi_FT; grvChoGiaiQuyet.FuncGetUpdate = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiThayDoiByTongDai; grvChoGiaiQuyet.FuncGetDelete = (Line, LsKeys) => CuocGoi.G5_DIENTHOAI_LayCacIDCuocGoiKetThucByTongDai(LsKeys, Line); grvChoGiaiQuyet.ActionPopUp += grvChoGiaiQuyet_ActionPopUp; grvChoGiaiQuyet.EventActionStep += grvChoGiaiQuyet_EventActionStep; grvCuocKhachLineKhac.FuncGetTimerServer = () => RealTimeEnvironment.TimeServer; grvCuocKhachLineKhac.FuncGetAll = CuocGoi.DIENTHOAI_LayAllCuocGoi_Khac; grvCuocKhachLineKhac.FuncGetNew = CuocGoi.DIENTHOAI_LayDSCuocGoiMoi_V3_Khac; grvCuocKhachLineKhac.FuncGetUpdate = CuocGoi.DIENTHOAI_LayDSCuocGoiThayDoiByTongDai_V3_Khac; grvCuocKhachLineKhac.FuncGetDelete = (Line, LsKeys) => CuocGoi.DIENTHOAI_LayCacIDCuocGoiKetThuc_Khac(LsKeys, Line); #endregion grvCuocKhachLineKhac.LoadAll(); grvChoGiaiQuyet.LoadAll(); grvChoGiaiQuyet.StartRealTime(); #endregion #region === Form Input === formInput = new frmDienThoaiInputDataNew_V3(RealTimeEnvironment.ListDataAutoComplete, false, RealTimeEnvironment.DMVung_GPS); formInput.OKCloseFormEvent += SaveData_Click; formInput.HienThiCuocMoiEvent += g_frmInput_HienThiCuocMoiEvent; formInput.GetTimeServerEvent += g_frmInput_GetTimeServerEvent; formInput.EventCallOut += g_frmInput_EventCallOut; #endregion IsShowCommandHelp = GetHelpCommand(); panelTopHelp.Visible = IsShowCommandHelp; if (!CheckIn()) { Application.Exit(); } } else { MessageBox.Show(this, "Có lỗi kết nối máy chủ, cần liên lạc với quản trị.", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }