示例#1
0
        public string BookingTaxi(string tenKhachHang, string soDienThoai, string diaChiDon, string diaChiTra, float soKm, int soTien,
                                  string loaiXe, int soLuongXe, DateTime gioDon, int soPhutBaoTruoc, string ghiChu, int systemBookID)
        {
            if (!isAuthentication)
            {
                if (maLoi != "E3")
                {
                    maLoi = "E4";// lỗi không qua xác thực
                }
            }
            if (maLoi == "E3" || maLoi == "E4")
            {
                return(maLoi);
            }
            KhachDat model = new KhachDat();

            if (string.IsNullOrEmpty(tenKhachHang) || string.IsNullOrEmpty(diaChiDon) ||
                string.IsNullOrEmpty(diaChiTra) || string.IsNullOrEmpty(soDienThoai) ||
                string.IsNullOrEmpty(systemBookID.ToString()))
            {
                return("E1");
            }
            if (gioDon == null || soLuongXe <= 0 || soPhutBaoTruoc < 0 || systemBookID < 0 || soTien <= 0 || soKm <= 0)
            {
                return("E2");
            }
            DateTime timeServer = model.GetTimerServer();

            model.TenKhachHang    = tenKhachHang;
            model.SoDienThoai     = soDienThoai;
            model.DiaChiDon       = diaChiDon;
            model.DiaChiTra       = diaChiTra;
            model.SoKm            = soKm;
            model.SoTien          = soTien;
            model.LoaiXe          = loaiXe;
            model.SoLuongXe       = soLuongXe;
            model.GioDon          = gioDon;
            model.SoPhutBaoTruoc  = soPhutBaoTruoc;
            model.GhiChu          = ghiChu;
            model.FK_SystemBookID = systemBookID;

            model.ThoiDiemBatDau      = timeServer.Date;                           //đầu ngày
            model.ThoiDiemKetThuc     = timeServer.AddDays(1).Date.AddSeconds(-1); //cuối ngày
            model.ThoiDiemTiepNhan    = timeServer;
            model.NgayTrongTuanLapLai = "";
            model.CreatedDate         = timeServer;
            model.UpdatedDate         = timeServer;
            model.UpdatedDateKD       = timeServer;
            try
            {
                return(model.Insert().ToString());
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("[BookingTaxi_Insert]", ex);
                return("F");
            }
        }
示例#2
0
        public string BookingTaxi_V2(KhachDat khachDat)
        {
            if (!isAuthentication)
            {
                maLoi = "E4";// lỗi không qua xác thực
            }
            if (maLoi == "E3" || maLoi == "E4")
            {
                return(maLoi);
            }
            KhachDat model      = new KhachDat();
            DateTime timeServer = model.GetTimerServer();

            if (string.IsNullOrEmpty(khachDat.TenKhachHang) || string.IsNullOrEmpty(khachDat.DiaChiDon) ||
                string.IsNullOrEmpty(khachDat.DiaChiTra) || string.IsNullOrEmpty(khachDat.SoDienThoai) ||
                string.IsNullOrEmpty(khachDat.FK_SystemBookID.ToString()))
            {
                return("E1");
            }
            if (khachDat.GioDon < timeServer || khachDat.SoLuongXe <= 0 || khachDat.FK_SystemBookID < 0 || khachDat.SoTien <= 0)
            {
                return("E2");
            }

            model.TenKhachHang        = khachDat.TenKhachHang;
            model.DiaChiDon           = khachDat.DiaChiDon;
            model.DiaChiTra           = khachDat.DiaChiTra;
            model.SoDienThoai         = khachDat.SoDienThoai;
            model.GioDon              = khachDat.GioDon;
            model.GhiChu              = khachDat.GhiChu;
            model.LoaiXe              = khachDat.LoaiXe;
            model.SoLuongXe           = khachDat.SoLuongXe;
            model.SoPhutBaoTruoc      = khachDat.SoPhutBaoTruoc;
            model.SoTien              = khachDat.SoTien;
            model.FK_SystemBookID     = khachDat.FK_SystemBookID;
            model.SoKm                = khachDat.SoKm;
            model.ThoiDiemBatDau      = timeServer.Date;                           //đầu ngày
            model.ThoiDiemKetThuc     = timeServer.AddDays(1).Date.AddSeconds(-1); //cuối ngày
            model.ThoiDiemTiepNhan    = timeServer;
            model.NgayTrongTuanLapLai = "";
            model.CreatedDate         = timeServer;
            model.UpdatedDate         = timeServer;
            model.UpdatedDateKD       = timeServer;

            try
            {
                return(model.Insert().ToString());
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("[BookingTaxi_V2]", ex);
                return("F");
            }
        }