Example #1
0
        public ActionResult XacNhanLenXe(int NhaXeId, int CustomerId, int XeXuatBenId, int DatVeId, int isLenXe, string apiToken)
        {
            //kiem tra xac thuc
            string _checkauthentication = isAuthentication(NhaXeId, CustomerId, apiToken, XeXuatBenId);

            if (!String.IsNullOrEmpty(_checkauthentication))
            {
                return(ErrorOccured(_checkauthentication));
            }

            var phoive = xexuatben.DatVeHopLes().Where(c => c.Id == DatVeId).FirstOrDefault();

            if (phoive == null)
            {
                ErrorOccured("Vị trí không hợp lệ");
            }
            if (isLenXe == 1)
            {
                //khach xac nha da di
                phoive.trangthai   = ENTrangThaiDatVe.DA_DI;
                phoive.isThanhToan = true;
            }
            else
            {
                //khach huy
                phoive.trangthai  = ENTrangThaiDatVe.HUY;
                phoive.isKhachHuy = true;
            }


            _limousinebanveService.UpdateDatVe(phoive);
            return(SuccessfulSimple(phoive.Id.ToString()));
        }
Example #2
0
        public static ChuyenDiModel toModel(this ChuyenDi e, ILocalizationService localizationService)
        {
            var m = new ChuyenDiModel();

            m.Id             = e.Id;
            m.Ma             = e.Ma;
            m.LaiXeId        = e.LaiXeId;
            m.TenLaiXeRutGon = "";
            if (e.laixe != null)
            {
                m.TenLaiXe       = e.laixe.ThongTin();
                m.TenLaiXeRutGon = e.laixe.HoVaTen;
            }
            else
            {
                m.TenLaiXe = "";
            }
            //chi lay ten
            if (!string.IsNullOrEmpty(m.TenLaiXeRutGon))
            {
                string[] arrten = m.TenLaiXeRutGon.Split(' ');
                m.TenLaiXeRutGon = arrten[arrten.Length - 1].Trim();
            }
            else
            {
                m.TenLaiXeRutGon = "---";
            }
            m.NgayDi     = e.NgayDi;
            m.NgayDiThuc = e.NgayDiThuc;

            m.LichTrinhId  = e.LichTrinhId;
            m.TenLichTrinh = e.lichtrinh.toText(false);
            m.HanhTrinhId  = e.HanhTrinhId;
            m.TenHanhTrinh = e.hanhtrinh.MaHanhTrinh;
            if (e.DatVeHopLes() != null)
            {
                m.TienChuaThanhToan = e.DatVeHopLes().Where(c => !c.isThanhToan).Sum(c => c.GiaTien);
            }

            m.XeVanChuyenId = e.XeVanChuyenId;
            if (e.xevanchuyen != null)
            {
                m.BienSoXe = e.xevanchuyen.BienSo;
            }
            else
            {
                m.BienSoXe = "---------";
            }
            if (m.BienSoXe.Length >= 4)
            {
                m.BienSoXe3So = m.BienSoXe.Substring(m.BienSoXe.Length - 4);
            }
            else
            {
                m.BienSoXe3So = m.BienSoXe;
            }
            m.NgayTao       = e.NgayTao;
            m.NguoiTaoId    = e.NguoiTaoId;
            m.TenNguoiTao   = e.nguoitao.HoVaTen;
            m.trangthai     = e.trangthai;
            m.TrangThaiText = e.trangthai.ToCVEnumText(localizationService);
            m.GhiChu        = e.GhiChu;
            m.SoKhach       = e.DatVeHopLes().Count();
            m.SoGhe         = e.lichtrinh.loaixe.sodoghe.SoLuongGhe;
            m.TenLoaiXe     = e.lichtrinh.loaixe.TenLoaiXe;
            m.GiaVe         = e.lichtrinh.GiaVeToanTuyen;
            m.isEdit        = true;
            if (e.trangthai == ENTrangThaiXeXuatBen.KET_THUC)
            {
                m.isEdit = false;
            }

            return(m);
        }