Пример #1
0
        /// <summary>
        /// Update Trip Request
        /// </summary>
        /// <param name="Trip Request"></param>
        /// <returns></returns>
        public bool UpdatePayChequeRequest(PayChequeRequestViewModel paychequeRequestViewModel)
        {
            bool status = false;

            try
            {
                BookingRequestsHistory bookingRequestsHistory = new BookingRequestsHistory();
                var _bookingDetails = _Context.BookingRequests.FirstOrDefault(x => x.Id == paychequeRequestViewModel.Id);

                if (_bookingDetails != null)
                {
                    _bookingDetails.ActualDistance = paychequeRequestViewModel.TotalMiles;
                    _bookingDetails.WaitTime       = paychequeRequestViewModel.WaitTime;
                    //_bookingDetails.Status = (int)Utility.Enums.BookingRequestStatus.PayChequeRequest;

                    _bookingDetails.CreatedBy          = paychequeRequestViewModel.CreatedBy;
                    _bookingDetails.BeginMile          = paychequeRequestViewModel.BeginMiles;
                    _bookingDetails.EndMile            = paychequeRequestViewModel.EndMiles;
                    _bookingDetails.ModifiedOn         = DateTime.Now;
                    _bookingDetails.PickUp             = paychequeRequestViewModel.PickUp;
                    _bookingDetails.DropOff            = paychequeRequestViewModel.DropOff;
                    _bookingDetails.IsPayChequeRequest = true;
                    _bookingDetails.PaychequeCreated   = DateTime.Now;
                    ////_bookingDetails.WaitTimeStart = paychequeRequestViewModel.WaitTimeStart;
                    ////_bookingDetails.WaitTimeEnd = paychequeRequestViewModel.WaitTimeEnd;
                    _Context.Configuration.ValidateOnSaveEnabled = false;
                    Mapper.Map(_bookingDetails, bookingRequestsHistory);
                    bookingRequestsHistory.RequestId        = paychequeRequestViewModel.Id;
                    bookingRequestsHistory.CreatedOn        = DateTime.Now;
                    bookingRequestsHistory.ActualDistance   = paychequeRequestViewModel.TotalMiles;
                    bookingRequestsHistory.WaitTime         = paychequeRequestViewModel.WaitTime;
                    bookingRequestsHistory.Status           = (int)Utility.Enums.BookingRequestStatus.PayChequeRequest;
                    bookingRequestsHistory.BeginMile        = paychequeRequestViewModel.BeginMiles;
                    bookingRequestsHistory.EndMile          = paychequeRequestViewModel.EndMiles;
                    bookingRequestsHistory.ModifiedOn       = DateTime.Now;
                    bookingRequestsHistory.PickUp           = paychequeRequestViewModel.PickUp;
                    bookingRequestsHistory.DropOff          = paychequeRequestViewModel.DropOff;
                    bookingRequestsHistory.PaychequeCreated = DateTime.Now;
                    //bookingRequestsHistory.WaitTimeStart = paychequeRequestViewModel.WaitTimeStart;
                    //bookingRequestsHistory.WaitTimeEnd = paychequeRequestViewModel.WaitTimeEnd;
                    _Context.BookingRequestsHistory.Add(bookingRequestsHistory);
                    _Context.SaveChanges();

                    status = true;
                }
            }

            catch (Exception ex)
            {
            }
            return(status);
        }
Пример #2
0
        /// <summary>
        ///  Save Trip Request
        /// </summary>
        /// <param name="TripRequest"></param>
        /// <param name="logId"></param>
        /// <param name="validateOnSaveEnabled"></param>
        /// <param name="mailBodyTemplate"></param>
        /// <returns></returns>
        public bool SavePayChequeRequest(PayChequeRequestViewModel paychequeRequestViewModel, long logId = 0, bool validateOnSaveEnabled = true, string mailBodyTemplate = "")
        {
            bool status = false;

            BookingRequests bookingRequests = new BookingRequests();

            Mapper.Map(paychequeRequestViewModel, bookingRequests);
            bookingRequests.IsActive  = true;
            bookingRequests.CreatedOn = DateTime.Now;
            //bookingRequests.Status = (int)Utility.Enums.BookingRequestStatus.PayChequeRequest;
            bookingRequests.IsPayChequeRequest = true;
            bookingRequests.IsDeleted          = false;
            bookingRequests.BeginMile          = paychequeRequestViewModel.BeginMiles;
            bookingRequests.EndMile            = paychequeRequestViewModel.EndMiles;
            bookingRequests.PickUp             = paychequeRequestViewModel.PickUp;
            bookingRequests.DropOff            = paychequeRequestViewModel.DropOff;
            bookingRequests.BackupVendorId     = 123;
            bookingRequests.PaychequeCreated   = DateTime.Now;
            //bookingRequests.WaitTimeStart = paychequeRequestViewModel.WaitTimeStart;
            //bookingRequests.WaitTimeEnd = paychequeRequestViewModel.WaitTimeEnd;
            BookingRequestsHistory bookingRequestsHistory = new BookingRequestsHistory();

            Mapper.Map(paychequeRequestViewModel, bookingRequestsHistory);
            _Context.BookingRequests.Add(bookingRequests);
            _Context.Configuration.ValidateOnSaveEnabled = validateOnSaveEnabled;
            _Context.SaveChanges();
            bookingRequestsHistory.RequestId        = bookingRequests.Id;
            bookingRequestsHistory.RailRoadId       = bookingRequests.RailRoadId;
            bookingRequestsHistory.BeginMile        = bookingRequests.BeginMile;
            bookingRequestsHistory.EndMile          = bookingRequests.EndMile;
            bookingRequestsHistory.CreatedOn        = DateTime.Now;
            bookingRequestsHistory.PickUp           = paychequeRequestViewModel.PickUp;
            bookingRequestsHistory.DropOff          = paychequeRequestViewModel.DropOff;
            bookingRequestsHistory.PaychequeCreated = DateTime.Now;
            //bookingRequestsHistory.WaitTimeStart = paychequeRequestViewModel.WaitTimeStart; ;
            //bookingRequestsHistory.WaitTimeEnd = paychequeRequestViewModel.WaitTimeEnd;
            _Context.BookingRequestsHistory.Add(bookingRequestsHistory);
            _Context.SaveChanges();
            status = true;


            return(status);
        }