/// <summary> /// hàm trả về một đối tượng CSKHChiTiet /// /// ID Line PhoneNumber ThoiDiemGoi DiaChiDonKhach KieuKhachHangGoiDen Vung MaNhanVienDienThoai MaNhanVienTongDai /// XeNhan XeDon DiaChiTraKhach ThoiGianDieuXe ThoiGianDonKhach KieuCuocGoi TrangThaiCuocGoi CuocGoiLaiIDs MaDoiTac /// MOIKHACH_NhungThoiDiemMoi MOIKHACH_NhungNhanVienMoi FileVoicePath DonDuoc TruotHoan KhongXe ChiTietGoiLai /// ///19438 1 0905111111 2011-02-26 11:20:48.800 khong xe 1 1 dienthoai tongdai 0 0 1 4 /// ;2011-02-26 11:24:05;2011-02-26 11:24:05 ;tongdai NULL 0 0 1 /// 19439,2011-02-26 11:21:05,dienthoai,|19440,2011-02-26 11:22:14,dienthoai,|19441,2011-02-26 11:22:24,dienthoai,| /// /// </summary> /// <param name="dataRow"></param> /// <returns></returns> public static CSKHChiTiet GetCSKHChiTietByRow(DataRow dataRow) { try{ CSKHChiTiet objChiTiet = new CSKHChiTiet(); objChiTiet.ID = Convert.ToInt64(dataRow["ID"].ToString()); objChiTiet.Line = dataRow["Line"].ToString(); objChiTiet.SoDienThoai = dataRow["PhoneNumber"].ToString(); objChiTiet.DiaChi = dataRow["DiaChiDonKhach"].ToString(); objChiTiet.Vung = Convert.ToInt32(dataRow["Vung"].ToString()); objChiTiet.PhanLoai = GetPhanLoaiCuocGoi(Convert.ToInt32(dataRow["KieuCuocGoi"].ToString()), Convert.ToInt32(dataRow["Vung"].ToString())); objChiTiet.LAN1_Gio = Convert.ToDateTime(dataRow["ThoiDiemGoi"].ToString()); objChiTiet.LAN1_NVDT = dataRow["MaNhanVienDienThoai"].ToString(); objChiTiet.LAN1_FileGhiAm = dataRow["FileVoicePath"] == null ? "" : dataRow["FileVoicePath"].ToString(); //DateTime LAN2_Gio = DateTime.MinValue; //string LAN2_NVDT =""; //string LAN2_FileGhiAm = ""; //DateTime LAN3_Gio = DateTime.MinValue; //string LAN3_NVDT = ""; //string LAN3_FileGhiAm = ""; //DateTime LAN4_Gio = DateTime.MinValue; //string LAN4_NVDT = ""; //string LAN4_FileGhiAm = ""; //string strChiTietGoiLai = ""; //strChiTietGoiLai = dataRow["ChiTietGoiLai"] == null ? "" : dataRow["ChiTietGoiLai"].ToString(); //if (strChiTietGoiLai != null && strChiTietGoiLai.Length > 0) //{ // if (strChiTietGoiLai.EndsWith("|")) // strChiTietGoiLai = strChiTietGoiLai.Substring(0, strChiTietGoiLai.Length - 1); //} //if (strChiTietGoiLai.Length > 0) //{ // CSKHChiTiet.GetChiTietGoiLai(strChiTietGoiLai, out LAN2_Gio, out LAN2_NVDT, out LAN2_FileGhiAm, // out LAN3_Gio, out LAN3_NVDT, out LAN3_FileGhiAm, // out LAN4_Gio, out LAN4_NVDT, out LAN4_FileGhiAm); //} //objChiTiet.LAN2_Gio = LAN2_Gio; //objChiTiet.LAN2_NVDT = LAN2_NVDT; //objChiTiet.LAN2_FileGhiAm = LAN2_FileGhiAm; //objChiTiet.LAN3_Gio = LAN3_Gio; //objChiTiet.LAN3_NVDT = LAN3_NVDT; //objChiTiet.LAN3_FileGhiAm = LAN3_FileGhiAm; //objChiTiet.LAN4_Gio = LAN4_Gio; //objChiTiet.LAN4_NVDT = LAN4_NVDT; //objChiTiet.LAN4_FileGhiAm = LAN4_FileGhiAm; string strNhungThoiDiemMoi = dataRow["MOIKHACH_NhungThoiDiemMoi"] == null ? "" : dataRow["MOIKHACH_NhungThoiDiemMoi"].ToString(); string strNhungNhanVienMoi = dataRow["MOIKHACH_NhungNhanVienMoi"] == null ? null : dataRow["MOIKHACH_NhungNhanVienMoi"].ToString(); DateTime CSKH_Lan1_Gio = DateTime.MinValue; string CSKH_Lan1_MaNhanVien = ""; DateTime CSKH_Lan2_Gio = DateTime.MinValue; string CSKH_Lan2_MaNhanVien = ""; DateTime CSKH_Lan3_Gio = DateTime.MinValue; string CSKH_Lan3_MaNhanVien = ""; DateTime CSKH_Lan4_Gio = DateTime.MinValue; string CSKH_Lan4_MaNhanVien = ""; if (strNhungNhanVienMoi.Length > 0 && strNhungThoiDiemMoi.Length > 0) { CSKHChiTiet.GetChiTietLanCSKH(strNhungThoiDiemMoi, strNhungNhanVienMoi, out CSKH_Lan1_Gio, out CSKH_Lan1_MaNhanVien , out CSKH_Lan2_Gio, out CSKH_Lan2_MaNhanVien , out CSKH_Lan3_Gio, out CSKH_Lan3_MaNhanVien , out CSKH_Lan4_Gio, out CSKH_Lan4_MaNhanVien); } objChiTiet.CSKH_Lan1_Gio = CSKH_Lan1_Gio; objChiTiet.CSKH_Lan1_MaNhanVien = CSKH_Lan1_MaNhanVien; objChiTiet.CSKH_Lan2_Gio = CSKH_Lan2_Gio; objChiTiet.CSKH_Lan2_MaNhanVien = CSKH_Lan2_MaNhanVien; objChiTiet.CSKH_Lan3_Gio = CSKH_Lan3_Gio; objChiTiet.CSKH_Lan3_MaNhanVien = CSKH_Lan3_MaNhanVien; objChiTiet.CSKH_Lan4_Gio = CSKH_Lan4_Gio; objChiTiet.CSKH_Lan4_MaNhanVien = CSKH_Lan4_MaNhanVien; //DonDuoc TruotHoan KhongXe objChiTiet.DonDuoc = false; if (dataRow["DonDuoc"] != DBNull.Value && dataRow["DonDuoc"].ToString() == "1") { objChiTiet.DonDuoc = true; } objChiTiet.TruotHoan = false; if (dataRow["TruotHoan"] != DBNull.Value && dataRow["TruotHoan"].ToString() == "1") { objChiTiet.TruotHoan = true; } objChiTiet.KhongXe = false; if (dataRow["KhongXe"] != DBNull.Value && dataRow["KhongXe"].ToString() == "1") { objChiTiet.KhongXe = true; } objChiTiet.Khac = false; if (dataRow["Khac"] != DBNull.Value && dataRow["Khac"].ToString() == "1") { objChiTiet.Khac = true; } objChiTiet.MaNVTongDai = dataRow["MaNhanVienTongDai"].ToString(); objChiTiet.MaNhanVienDienThoai = dataRow["MaNhanVienDienThoai"].ToString(); return(objChiTiet); } catch (Exception ex) { return(null); } }
/// <summary> /// hàm trả về dữ liệu báo cáo chi tiết cskh /// khi isGoiTaxi = true thì /// isDOnDuoc, isDonDuoc888, isTruotHoan,isKhongXe, isKhongXe888 mới được kiểm tra /// ngươc lại thì bỏ qua /// </summary> public static List <CSKHChiTiet> GetBCCSKHChiTiet(DateTime TuNgay, DateTime DenNgay, string Vung, int SoLanGoiLai, bool isDonDuoc, bool isDonDuoc888, bool isTruotHoan, bool isKhongXe, bool isKhongXe999, string idTongDai, string idCS, string idDienThoai, bool isGoiTaxi, bool isGoiLai, string pSoDienThoai = "") { List <CSKHChiTiet> lstCSKHChiTiet = new List <CSKHChiTiet> (); DataTable dt = new DataTable(); dt = new Data.CSKHChiTiet().GetBCCSKHChiTiet(TuNgay, DenNgay, Vung, SoLanGoiLai, isDonDuoc, isDonDuoc888, isTruotHoan, isKhongXe, isKhongXe999, idTongDai, idCS, idDienThoai, isGoiTaxi, isGoiLai, pSoDienThoai); if (dt != null && dt.Rows.Count > 0) { bool bThemMoi = true; int iLanGoi = 0; string sSoDienThoai = ""; DateTime thoiDiemGoi = DateTime.MinValue; CSKHChiTiet objCSKHChiTiet = null; DateTime LAN2_Gio = DateTime.MinValue; string LAN2_NVDT = ""; string LAN2_FileGhiAm = ""; DateTime LAN3_Gio = DateTime.MinValue; string LAN3_NVDT = ""; string LAN3_FileGhiAm = ""; DateTime LAN4_Gio = DateTime.MinValue; string LAN4_NVDT = ""; string LAN4_FileGhiAm = ""; string[] NhanVienMoiKhach; bool quaGio = true; // kiểm soát giới hạn quá giờ lớn hơn 45 phút. for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; if (!bThemMoi) { if (sSoDienThoai == dr["PhoneNumber"].ToString() && (!quaGio)) // gọi lại { TimeSpan timeSpan = Convert.ToDateTime(dr["ThoiDiemGoi"].ToString()) - thoiDiemGoi; if (timeSpan.TotalMinutes > 45) { quaGio = true; } if (!quaGio) { if (iLanGoi == 1) // gọi lại lần 1 { iLanGoi++; LAN2_Gio = Convert.ToDateTime(dr["ThoiDiemGoi"].ToString()); LAN2_NVDT = dr["MaNhanVienDienThoai"].ToString();; LAN2_FileGhiAm = dr["FileVoicePath"] == null ? "" : dr["FileVoicePath"].ToString(); } else if (iLanGoi == 2) { iLanGoi++; LAN3_Gio = Convert.ToDateTime(dr["ThoiDiemGoi"].ToString());; LAN3_NVDT = dr["MaNhanVienDienThoai"].ToString();; LAN3_FileGhiAm = dr["FileVoicePath"] == null ? "" : dr["FileVoicePath"].ToString(); } else if (iLanGoi == 3) { iLanGoi++; LAN4_Gio = Convert.ToDateTime(dr["ThoiDiemGoi"].ToString());; LAN4_NVDT = dr["MaNhanVienDienThoai"].ToString();; LAN4_FileGhiAm = dr["FileVoicePath"] == null ? "" : dr["FileVoicePath"].ToString(); } } } else // cuoc goi khac { bThemMoi = true; iLanGoi = 0; sSoDienThoai = ""; objCSKHChiTiet.LAN2_Gio = LAN2_Gio; objCSKHChiTiet.LAN2_NVDT = LAN2_NVDT; objCSKHChiTiet.LAN2_FileGhiAm = LAN2_FileGhiAm; objCSKHChiTiet.LAN3_Gio = LAN3_Gio; objCSKHChiTiet.LAN3_NVDT = LAN3_NVDT; objCSKHChiTiet.LAN3_FileGhiAm = LAN3_FileGhiAm; objCSKHChiTiet.LAN4_Gio = LAN4_Gio; objCSKHChiTiet.LAN4_NVDT = LAN4_NVDT; objCSKHChiTiet.LAN4_FileGhiAm = LAN4_FileGhiAm; lstCSKHChiTiet.Add(objCSKHChiTiet); // them vao // dat la thong so lan LAN2_Gio = DateTime.MinValue; LAN2_NVDT = ""; LAN2_FileGhiAm = ""; LAN3_Gio = DateTime.MinValue; LAN3_NVDT = ""; LAN3_FileGhiAm = ""; LAN4_Gio = DateTime.MinValue; LAN4_NVDT = ""; LAN4_FileGhiAm = ""; } } if (bThemMoi) { objCSKHChiTiet = new CSKHChiTiet(); // Them moi objCSKHChiTiet = CSKHChiTiet.GetCSKHChiTietByRow(dr); iLanGoi = 1; // lần gọi đầu sSoDienThoai = objCSKHChiTiet.SoDienThoai; // luu lại số điện thoại để so sánh thoiDiemGoi = objCSKHChiTiet.LAN1_Gio; bThemMoi = false; quaGio = false; } } } return(lstCSKHChiTiet); }