//private void LoadDuLieuCuocGoiDiTuPhanCung() //{ // // Create a background thread // BackgroundWorker bw = new BackgroundWorker(); // bw.DoWork += new DoWorkEventHandler(bw_DoWork); // bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); // // Create a progress form on the UI thread // m_fmProgress = new fmProgress(); // // Kick off the Async thread // bw.RunWorkerAsync(); // // Lock up the UI with this modal progress form. // try // { // m_fmProgress.ShowDialog(this); // m_fmProgress = null; // } // catch (Exception ex) // { // } //} //private void bw_DoWork(object sender, DoWorkEventArgs e) //{ // m_fmProgress.lblDescription.Invoke( // (MethodInvoker)delegate() // { // m_fmProgress.lblDescription.Text = "Loading ... cuộc gọi đi"; // m_fmProgress.progressBar1.Value = 50; // } // ); // CaptureCuocGoiDi(); // if (m_fmProgress.Cancel) // { // // Set the e.Cancel flag so that the WorkerCompleted event // // knows that the process was canceled. // e.Cancel = true; // return; // } //} //private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) //{ // // The background process is complete. First we should hide the // // modal Progress Form to unlock the UI. The we need to inspect our // // response to see if an error occured, a cancel was requested or // // if we completed succesfully. // // Hide the Progress Form // if (m_fmProgress != null) // { // m_fmProgress.Hide(); // m_fmProgress = null; // } // // Check to see if an error occured in the // // background process. // if (e.Error != null) // { // new MessageBox.MessageBox().Show(this, "Có lỗi trong quá trình xử lý dữ liệu. [" + e.Error.Message + "]"); // return; // } // // Check to see if the background process was cancelled. // if (e.Cancelled) // { // // new Taxi.MessageBox.MessageBox().Show("Processing cancelled."); // return; // } //} /// <summary> /// nhan thong tin cac cuoc goi di va cap nhat vao DB /// </summary> private void CaptureCuocGoiDi() { try { // lay du lieu DateTime timeServer = DieuHanhTaxi.GetTimeServer(); string VOCFileName = ProcessVocFile.GetVOCFileFullPath(timeServer); DataTable dt = new DataTable(); dt = ProcessVocFile.GetEarlyPhoneDialOut(VOCFileName); if ((dt != null) && (dt.Rows.Count > 0)) { foreach (DataRow dr in dt.Rows) { CuocGoiDi objGoiDi = new CuocGoiDi(dr["Line"].ToString(), dr["PhoneNumber"].ToString(), (DateTime)dr["ThoiDiemGoi"], (DateTime)dr["DoDaiCuocGoi"], dr["VoiceFilePath"].ToString()); if (!objGoiDi.Insert()) { // LogError.WriteLog("Loi luu xuong DB cuoc goi di ", new Exception("[ Cuoc goi di ]")); } } } } catch (Exception ex) { // LogError.WriteLog("Loi luu xuong DB cuoc goi di ", ex); } }
//private void LoadDuLieuCuocGoiDiTuPhanCung() //{ // // Create a background thread // BackgroundWorker bw = new BackgroundWorker(); // bw.DoWork += new DoWorkEventHandler(bw_DoWork); // bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); // // Create a progress form on the UI thread // m_fmProgress = new fmProgress(); // // Kick off the Async thread // bw.RunWorkerAsync(); // // Lock up the UI with this modal progress form. // try // { // m_fmProgress.ShowDialog(this); // m_fmProgress = null; // } // catch (Exception ex) // { // } //} //private void bw_DoWork(object sender, DoWorkEventArgs e) //{ // m_fmProgress.lblDescription.Invoke( // (MethodInvoker)delegate() // { // m_fmProgress.lblDescription.Text = "Loading ... cuộc gọi đi"; // m_fmProgress.progressBar1.Value = 50; // } // ); // CaptureCuocGoiDi(); // if (m_fmProgress.Cancel) // { // // Set the e.Cancel flag so that the WorkerCompleted event // // knows that the process was canceled. // e.Cancel = true; // return; // } //} //private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) //{ // // The background process is complete. First we should hide the // // modal Progress Form to unlock the UI. The we need to inspect our // // response to see if an error occured, a cancel was requested or // // if we completed succesfully. // // Hide the Progress Form // if (m_fmProgress != null) // { // m_fmProgress.Hide(); // m_fmProgress = null; // } // // Check to see if an error occured in the // // background process. // if (e.Error != null) // { // new MessageBox.MessageBox().Show(this, "Có lỗi trong quá trình xử lý dữ liệu. [" + e.Error.Message + "]"); // return; // } // // Check to see if the background process was cancelled. // if (e.Cancelled) // { // // new Taxi.MessageBox.MessageBox().Show("Processing cancelled."); // return; // } //} /// <summary> /// nhan thong tin cac cuoc goi di va cap nhat vao DB /// </summary> private void CaptureCuocGoiDi() { try { DateTime timeServer = DieuHanhTaxi.GetTimeServer(); string VOCFileName = ProcessVocFile.GetVOCFileFullPath(timeServer); DataTable dt = new DataTable(); dt = ProcessVocFile.GetEarlyPhoneDialOut(VOCFileName); if ((dt != null) && (dt.Rows.Count > 0)) { foreach (DataRow dr in dt.Rows) { CuocGoiDi objGoiDi = new CuocGoiDi(dr["Line"].ToString(), dr["PhoneNumber"].ToString(), (DateTime)dr["ThoiDiemGoi"], (DateTime)dr["DoDaiCuocGoi"], dr["VoiceFilePath"].ToString()); if (!objGoiDi.Insert()) { new MessageBoxBA().Show("Lỗi khi thêm mới dữ liệu!"); } } } } catch (Exception ex) { LogError.WriteLogError("CaptureCuocGoiDi: ", ex); } }