private void bw_DoWork(object sender, DoWorkEventArgs e) { if (m_fmProgress.Cancel) { // Set the e.Cancel flag so that the WorkerCompleted event // knows that the process was canceled. e.Cancel = true; return; } string PhoneNumber = StringTools.TrimSpace(txtPhoneNumber.Text); string Line = StringTools.TrimSpace(txtLine.Text); string nhanVienID = StringTools.TrimSpace(txtNVID.Text); string phanLoai = string.Empty; try { phanLoai = cboPhanLoaiMay.SelectedValue.ToString(); } catch (Exception ex) { phanLoai = string.Empty; } g_dt = CuocGoiDi.GetDSCuocGoiDi(calTuNgay.Value, calDenNgay.Value, timeThoiGianDamThoai.Value, PhoneNumber, Line, nhanVienID, phanLoai); gridBaoCaoBieuMau1.DataSource = g_dt; }
//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); } }
/// <summary> /// Load phan len bieu mau /// </summary> private void btnRefresh_Click(object sender, EventArgs e) { if (TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value)) { string PhoneNumber = StringTools.TrimSpace(txtPhoneNumber.Text); string Line = StringTools.TrimSpace(txtLine.Text); string nhanVienID = StringTools.TrimSpace(txtNVID.Text); string phanLoai = string.Empty; try { phanLoai = cboPhanLoaiMay.SelectedValue.ToString(); } catch (Exception ex) { phanLoai = string.Empty; } if (phanLoai == "10") // taat cả { phanLoai = string.Empty; } g_dt = CuocGoiDi.GetDSCuocGoiDi(calTuNgay.Value, calDenNgay.Value, timeThoiGianDamThoai.Value, PhoneNumber, Line, nhanVienID, phanLoai); gridBaoCaoBieuMau1.DataSource = g_dt; SetUnActiveRefreshButton(); } else { MessageBox.MessageBox msgDialog = new Taxi.MessageBox.MessageBox(); msgDialog.Show(this, "Bạn phải nhập [Từ ngày] nhỏ hơn hoặc bằng [Đến ngày].", "Thông báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Warning); return; } }
//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); } }
private void LoadData(DateTime TuNgay, DateTime DenNgay) { g_dt = CuocGoiDi.GetDSCuocGoiDi(calTuNgay.Value, calDenNgay.Value); DataView dvData = new DataView(g_dt); gridBaoCaoBieuMau1.DataSource = dvData; }
private void LoadData(DateTime TuNgay, DateTime DenNgay) { g_dt = CuocGoiDi.GetDSCuocGoiDi(calTuNgay.Value, calDenNgay.Value); DataView dvData = new DataView(g_dt); dvData.RowFilter = "TenNhanVien = '" + txtNVID.Text + "'"; gridBaoCaoBieuMau1.DataSource = dvData; }
private void bw_DoWork(object sender, DoWorkEventArgs e) { if (g_fmProgress.Cancel) { e.Cancel = true; return; } string PhoneNumber = StringTools.TrimSpace(txtPhoneNumber.Text); string Line = StringTools.TrimSpace(txtLine.Text); if ((timeThoiGianDamThoai.Value != new DateTime(1900, 1, 1, 0, 0, 0)) || (PhoneNumber.Length > 0)) { g_dt = CuocGoiDi.GetDSCuocGoiDi(calTuNgay.Value, calDenNgay.Value, timeThoiGianDamThoai.Value, PhoneNumber, Line); gridBaoCaoBieuMau1.DataSource = g_dt; } else { LoadData(calTuNgay.Value, calDenNgay.Value); } }
/// <summary> /// hàm trả về ký tự wildcard của /// </summary> /// <param name="Item"></param> /// <param name="WidlCard"></param> /// <returns></returns> private string GetFileOfCuocGoi(CSKHChiTiet Item, out string WidlCard, out DateTime ThoiDiemGoiDiDen) { string fileName = ""; WidlCard = ""; ThoiDiemGoiDiDen = DateTime.MinValue; if (radGoiDenLan1.Checked) { fileName = Item.LAN1_FileGhiAm; WidlCard = KYTU_GOIDEN; ThoiDiemGoiDiDen = Item.LAN1_Gio; } else if (radGoiDenLan2.Checked) { fileName = Item.LAN2_FileGhiAm; WidlCard = KYTU_GOIDEN; ThoiDiemGoiDiDen = Item.LAN2_Gio; } else if (radGoiDenLan3.Checked) { fileName = Item.LAN3_FileGhiAm; WidlCard = KYTU_GOIDEN; ThoiDiemGoiDiDen = Item.LAN3_Gio; } else if (radGoiDenLan4.Checked) { fileName = Item.LAN4_FileGhiAm; WidlCard = KYTU_GOIDEN; ThoiDiemGoiDiDen = Item.LAN4_Gio; } else if (radGoiCSLan1.Checked) { fileName = CuocGoiDi.GetFileGhiAmCuocGoiDi(Item.SoDienThoai, Item.CSKH_Lan1_Gio); WidlCard = KYTU_GOIDI; ThoiDiemGoiDiDen = Item.CSKH_Lan1_Gio; } else if (radGoiCSLan2.Checked) { fileName = CuocGoiDi.GetFileGhiAmCuocGoiDi(Item.SoDienThoai, Item.CSKH_Lan2_Gio); WidlCard = KYTU_GOIDI; ThoiDiemGoiDiDen = Item.CSKH_Lan2_Gio; } else if (radGoiCSLan3.Checked) { fileName = CuocGoiDi.GetFileGhiAmCuocGoiDi(Item.SoDienThoai, Item.CSKH_Lan3_Gio); WidlCard = KYTU_GOIDI; ThoiDiemGoiDiDen = Item.CSKH_Lan3_Gio; } else if (radGoiCSLan4.Checked) { fileName = CuocGoiDi.GetFileGhiAmCuocGoiDi(Item.SoDienThoai, Item.CSKH_Lan4_Gio); WidlCard = KYTU_GOIDI; ThoiDiemGoiDiDen = Item.CSKH_Lan4_Gio; } return(fileName); }
/// <summary> /// nhan thong tin cac cuoc goi di va cap nhat vao DB /// </summary> private void CaptureCuocGoiDi() { try { DataTable dt = new DataTable(); dt = TaxiCapture.GetEarlyPhoneDialOut(g_FileVOCPath); 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.WriteLogError("Loi luu xuong DB cuoc goi di ", new Exception("[ Cuoc goi di ]")); } } } } catch (Exception ex) { LogError.WriteLogError("Loi luu xuong DB cuoc goi di ", ex); } }
private void LoadData(DateTime TuNgay, DateTime DenNgay) { g_dt = CuocGoiDi.GetDSCuocGoiDi(calTuNgay.Value, calDenNgay.Value); gridBaoCaoBieuMau1.DataSource = g_dt; }