Пример #1
0
        /// <summary>
        /// get KhachDat để chèn cuộc gọi (gán thêm line)
        /// </summary>
        private KhachDatBL GetKhachDat_Row_Line(DataRow row, string line)
        {
            KhachDatBL KhachDat = new KhachDatBL();

            KhachDat.PK_KhachDatID = Convert.ToInt32(row["PK_KhachDatID"]);
            string ThoiDiemTiepNhan = row["ThoiDiemTiepNhan"].ToString();

            if (!string.IsNullOrEmpty(ThoiDiemTiepNhan))
            {
                KhachDat.ThoiDiemTiepNhan = Convert.ToDateTime(ThoiDiemTiepNhan);
            }
            KhachDat.TenKhachHang = row["TenKhachHang"].ToString();
            KhachDat.SoDienThoai  = row["SoDienThoai"].ToString();
            KhachDat.DiaChi       = row["DiaChiDon"].ToString();
            KhachDat.Line         = Convert.ToInt32(line);
            KhachDat.VungKenh     = Convert.ToInt32(row["VungKenh"]);
            KhachDat.IsLapLai     = Convert.ToBoolean(row["IsLapLai"]);
            string GioDon = row["GioDon"].ToString();

            if (!string.IsNullOrEmpty(GioDon))
            {
                KhachDat.GioDon = Convert.ToDateTime(GioDon);
            }
            string ThoiDiemBatDau = row["ThoiDiemBatDau"].ToString();

            if (!string.IsNullOrEmpty(ThoiDiemBatDau))
            {
                KhachDat.ThoiDiemBatDau = Convert.ToDateTime(ThoiDiemBatDau);
            }
            string ThoiDiemKetThuc = row["ThoiDiemKetThuc"].ToString();

            if (!string.IsNullOrEmpty(ThoiDiemKetThuc))
            {
                KhachDat.ThoiDiemKetThuc = Convert.ToDateTime(ThoiDiemKetThuc);
            }
            KhachDat.NgayTrongTuanLapLai = row["NgayTrongTuanLapLai"].ToString();
            KhachDat.SoPhutBaoTruoc      = Convert.ToInt32(row["SoPhutBaoTruoc"]);
            KhachDat.FK_CuocGoiID        = row["FK_CuocGoiID"] == DBNull.Value ? 1 : Convert.ToInt64(row["FK_CuocGoiID"]);
            KhachDat.GhiChu          = row["GhiChu"].ToString();
            KhachDat.LoaiXe          = row["LoaiXe"].ToString();
            KhachDat.SoLuongXe       = row["SoLuongXe"] == DBNull.Value ? 1 : Convert.ToInt32(row["SoLuongXe"]);
            KhachDat.DiaChiTra       = row["DiaChiTra"] == DBNull.Value ? "" : row["DiaChiTra"].ToString();
            KhachDat.SoKm            = row["SoKm"] == DBNull.Value ? 1 : float.Parse(row["SoKm"].ToString());
            KhachDat.FK_SystemBookID = row["FK_SystemBookID"] == DBNull.Value ? 1 : int.Parse(row["FK_SystemBookID"].ToString());
            if (row["UpdatedDateKD"] != DBNull.Value)
            {
                KhachDat.UpdatedDateKD = Convert.ToDateTime(row["UpdatedDateKD"].ToString());
            }
            KhachDat.StatusRow = row["StatusRow"] == DBNull.Value ? 0 : int.Parse(row["StatusRow"].ToString());
            //KhachDat.KinhDo =
            return(KhachDat);
        }
Пример #2
0
        private KhachDatBL GetKhachDat_Row(DataRow row)
        {
            KhachDatBL KhachDat = new KhachDatBL();

            try
            {
                KhachDat.PK_KhachDatID = Convert.ToInt32(row["PK_KhachDatID"]);
                if (row["ThoiDiemTiepNhan"] != DBNull.Value)
                {
                    KhachDat.ThoiDiemTiepNhan = Convert.ToDateTime(row["ThoiDiemTiepNhan"].ToString());
                }
                KhachDat.TenKhachHang = row["TenKhachHang"].ToString();
                KhachDat.SoDienThoai  = row["SoDienThoai"].ToString();
                KhachDat.DiaChi       = row["DiaChiDon"].ToString();
                KhachDat.VungKenh     = Convert.ToInt32(row["VungKenh"]);
                KhachDat.IsLapLai     = Convert.ToBoolean(row["IsLapLai"]);
                KhachDat.Line         = 111;
                if (row["GioDon"] != DBNull.Value)
                {
                    KhachDat.GioDon = Convert.ToDateTime(row["GioDon"].ToString());
                }
                if (row["ThoiDiemBatDau"] != DBNull.Value)
                {
                    KhachDat.ThoiDiemBatDau = Convert.ToDateTime(row["ThoiDiemBatDau"].ToString());
                }
                if (row["ThoiDiemKetThuc"] != DBNull.Value)
                {
                    KhachDat.ThoiDiemKetThuc = Convert.ToDateTime(row["ThoiDiemKetThuc"].ToString());
                }
                KhachDat.NgayTrongTuanLapLai = row["NgayTrongTuanLapLai"].ToString();
                KhachDat.SoPhutBaoTruoc      = Convert.ToInt32(row["SoPhutBaoTruoc"]);
                KhachDat.FK_CuocGoiID        = Convert.ToInt64(row["FK_CuocGoiID"]);
                KhachDat.GhiChu    = row["GhiChu"].ToString();
                KhachDat.LoaiXe    = row["LoaiXe"].ToString();
                KhachDat.SoLuongXe = Convert.ToInt32(row["SoLuongXe"]);
                KhachDat.CreatedBy = row["CreatedBy"].ToString();
                KhachDat.FULLNAME  = row["FULLNAME"].ToString();
                KhachDat.KinhDo    = row["KinhDo"] == DBNull.Value ? 0 : Convert.ToDouble(row["KinhDo"]);
                KhachDat.ViDo      = row["ViDo"] == DBNull.Value ? 0 : Convert.ToDouble(row["ViDo"]);
                KhachDat.SoTien    = row["SoTien"] == DBNull.Value ? 0 : Convert.ToDouble(row["SoTien"]);
                if (row.Table.Columns.Contains("TenLoaiXe"))
                {
                    KhachDat.TenLoaiXe = row["TenLoaiXe"].ToString();
                }
                else
                {
                    KhachDat.TenLoaiXe = CommonBL.ListStaxiLoaiXe.FirstOrDefault(a => a.StaxiType.ToString() == KhachDat.LoaiXe).Name;
                }

                if (row.Table.Columns.Contains("DiaChiTra") && row["DiaChiTra"] != DBNull.Value)
                {
                    KhachDat.DiaChiTra = row["DiaChiTra"].ToString();
                }
                else
                {
                    KhachDat.DiaChiTra = string.Empty;
                }

                if (row.Table.Columns.Contains("SoKm") && row["SoKm"] != DBNull.Value)
                {
                    KhachDat.SoKm = float.Parse(row["SoKm"].ToString());
                }
                else
                {
                    KhachDat.SoKm = 0;
                }

                if (row.Table.Columns.Contains("FK_SystemBookID") && row["FK_SystemBookID"] != DBNull.Value)
                {
                    KhachDat.FK_SystemBookID = int.Parse(row["FK_SystemBookID"].ToString());
                }
                else
                {
                    KhachDat.FK_SystemBookID = 0;
                }

                if (row["UpdatedDateKD"] != DBNull.Value)
                {
                    KhachDat.UpdatedDateKD = Convert.ToDateTime(row["UpdatedDateKD"].ToString());
                }
                KhachDat.StatusRow = row["StatusRow"] == DBNull.Value ? 0 : int.Parse(row["StatusRow"].ToString());
            }
            catch (Exception exx)
            {
                LogError.WriteLogError("GetKhachDat_Row", exx);
            }
            return(KhachDat);
        }