예제 #1
0
        public ActionResult BookingCreate()
        {
            // default values
            var             bookingService  = new BookingServiceClient();
            BookingContract bookingContract = bookingService.GetBookingEmpty(Logging.UserId(User.Identity, ViewBag));

            // todo, session id can't be trusted
            bookingContract.Booking.BookingId        = new Guid(Session["SessionID"].ToString());
            bookingContract.Booking.BookingSourceRcd = BookingSourceRef.InternalSystem;

            bookingContract.BookingIdentifier = new CrudeBookingIdentifierContract();
            bookingContract.BookingIdentifier.BookingIdentifierTypeRcd = BookingIdentifierTypeRef.RecordLocator;
            bookingContract.BookingIdentifier.BookingIdentifierValue   = new BookingServiceClient().LocatorCreate();

            // get user id
            ViewBag.UserId = Logging.UserId(User.Identity, ViewBag);

            // refs
            List <CrudeBookingSourceRefContract> refs =
                new BusinessLogicLayer.CrudeBookingSourceRefServiceClient().FetchAll();

            ViewBag.BookingSourceRcd =
                new SelectList(
                    refs,
                    "BookingSourceRcd",
                    "BookingSourceName",
                    bookingContract.Booking.BookingSourceRcd
                    );

            return(View(MVCHelper.Resolve(Request, "", "Booking", "BookingCreate"),
                        bookingContract
                        ));
        }
        private void Book_Button_Click(object sender, RoutedEventArgs e)
        {
            var bookingClient = new BookingServiceClient();
            var bookingDetail = new BookingDetailRequest()
            {
                BookingDetailDao = new BookingDetailDao()
                {
                    FlightId   = FlightInformation.FlightId,
                    CustomerId = UserInput.UserDao.Id,
                    Class      = SeatClass,
                    SeatRow    = (short)userSelectedRowTextbox.Text.FromAlphabetToInt(),
                    SeatCol    = (short)(userSelectedColTextbox.Text.ToIntOrDefault() - 1)
                },
                FirstName = UserInput.UserDao.FirstName,
                LastName  = UserInput.UserDao.LastName,
                Age       = UserInput.UserDao.Age
            };
            var bookingId = bookingClient.BookTicket(bookingDetail);

            if (string.IsNullOrEmpty(bookingId))
            {
                // bind text
                var vm = DataContext as SeatChartViewModel;
                vm.IsShowInvalidBookingText = true;
                vm.NotifyPropertyChanged("IsShowInvalidBookingText");
            }
            else
            {
                NavigationService.Navigate(new ThankYou(bookingId, FlightInformation, UserInput, SeatClass, userSelectedRowTextbox.Text.FromAlphabetToInt(), userSelectedColTextbox.Text.ToIntOrDefault() - 1));
            }
        }
예제 #3
0
파일: Booking.cs 프로젝트: jacov/nor-port
        public void RefreshAddress()
        {
            // fetch booking data
            var bookingService = new BookingServiceClient();

            _bookingContract =
                bookingService.GetBooking(
                    _bookingContract.Booking.BookingId,
                    _userId
                    );
            try {
                addressTypeRefCombo.Text    = _bookingContract.BookingAddress.AddressTypeRcd != null ? _bookingContract.BookingAddress.AddressTypeRcd : String.Empty;
                textBoxAddressOne.Text      = _bookingContract.BookingAddress.AddressOne;
                textBoxAddressTwo.Text      = _bookingContract.BookingAddress.AddressTwo;
                textBoxAddressThree.Text    = _bookingContract.BookingAddress.AddressThree;
                textBoxState.Text           = _bookingContract.BookingAddress.State;
                textBoxDistrict.Text        = _bookingContract.BookingAddress.District;
                textBoxProvince.Text        = _bookingContract.BookingAddress.Province;
                textBoxZipCode.Text         = _bookingContract.BookingAddress.ZipCode;
                textBoxPoBox.Text           = _bookingContract.BookingAddress.PoBox;
                textBoxComment.Text         = _bookingContract.BookingAddress.Comment;
                userPicker.SelectedValue    = _bookingContract.BookingAddress.UserId;
                dateTimePickerDateTime.Text = _bookingContract.BookingAddress.DateTime.ToString();
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            } finally {
                bookingService.Close();
            }
        }
예제 #4
0
        public ActionResult BookingCreate([Bind()] BookingContract bookingContract)
        {
            if (ModelState.IsValid)
            {
                var bookingService = new BookingServiceClient();

                bookingContract.Booking.BookingId =
                    bookingService.UpdateBooking(
                        bookingContract.Booking.BookingId,
                        bookingContract.Booking.BookingSourceRcd,
                        bookingContract.BookingIdentifier.BookingIdentifierValue,
                        bookingContract.BookingContactMethod.ContactMethodWay,
                        bookingContract.Booking.ReceivedFrom,
                        bookingContract.Booking.Comment,
                        bookingContract.Booking.FinancialCurrencyId,
                        bookingContract.Booking.FinancialCostcentreId,
                        Logging.UserId(User.Identity, ViewBag)
                        );

                return(RedirectToAction("BookingContacts",
                                        new { bookingId = bookingContract.Booking.BookingId }
                                        ));
            }

            return(View(MVCHelper.Resolve(Request, "", "Booking", "BookingCreate"),
                        bookingContract
                        ));
        }
예제 #5
0
        private void CheckFlightStatus()
        {
            var flightService  = new FlightServiceClient();
            var bookingService = new BookingServiceClient();

            try {
                Log("start cycles");

                flightService.CheckFlightStatuses(
                    DateTime.UtcNow.Date,
                    DateTime.UtcNow.Date.AddDays(1),
                    DefaultUserId
                    );

                Log("check flight status finished");

                bookingService.SimulateBookings(
                    DateTime.UtcNow.Date,
                    DateTime.UtcNow.Date.AddDays(1),
                    DefaultUserId
                    );

                Log("simulate bookings finished");
            } catch (Exception ex) {
                Error(ex);
            } finally {
                flightService.Close();
            }
        }
예제 #6
0
파일: Booking.cs 프로젝트: jacov/nor-port
        private void buttonBook_Click(object sender, EventArgs e)
        {
            // update / create booking
            try {
                var bookingService = new BookingServiceClient();

                Guid bookingId = bookingService.UpdateBooking(
                    _bookingContract.Booking.BookingId,
                    bookingSourceRcd: bookingSourceRefCombo.Text,
                    locator: textBoxLocator.Text,
                    email: string.Empty,
                    receivedFrom: textBoxReceivedFrom.Text,
                    comment: textBoxComment.Text,
                    financialCurrencyId: _bookingContract.Booking.FinancialCurrencyId,
                    financialCostcentreId: _bookingContract.Booking.FinancialCostcentreId,
                    userId: Singleton.Instance.UserId
                    );

                MessageBox.Show("Booking Saved");

                if (_bookingContract.Booking.BookingId == Guid.Empty)
                {
                    ShowAsEdit(bookingId, _userId);
                }
            } catch (Exception ex) {
                Singleton.Instance.Error(ex);
            }
        }
        public SeatChart(object flightInfoData) : this()
        {
            var flightInfo = (FlightInfo)flightInfoData;
            var client     = new BookingServiceClient();
            var seatInfos  = client.RetrieveOccupiedSeatsMatrixFromFlightId(flightInfo.FlightId).ToList();

            MapSeatData(seatInfos, SeatClass.FirstClass, firstClassSeatChartDataGrid);
            MapSeatData(seatInfos, SeatClass.Economy, economyClassSeatChartDataGrid);
        }
        public void TestInitialize()
        {
            _service = new BookingPersistenceService(CreateDBMock());
            _host = new ServiceHost(_service, new Uri(ServiceUrl));
            Binding binding = new NetNamedPipeBinding();

            _host.AddServiceEndpoint(typeof(IBookingPersistence).FullName, binding, ServiceUrl);
            _host.Open();

            //Create a client
            _client = new BookingServiceClient(new NetNamedPipeBinding(), ServiceUrl);
        }
예제 #9
0
        public void PopulateLookups()
        {
            using (var bs = new BookingServiceClient())
            {
                ViewData["Carriers"]            = bs.GetCarriers();
                ViewData["Containers"]          = bs.GetContainers();
                ViewData["DisposalLocations"]   = bs.GetDisposalLocations();
                ViewData["ScheduleFrequencies"] = bs.GetScheduleFrequncies();
                ViewData["EWCodes"]             = bs.GetEWCs();
            }

            ViewData["Sites"] = new SiteService.SiteServiceClient().GetSites();
        }
예제 #10
0
        public ActionResult BookingCreateWithFlightDirect(
            Guid flightId
            )
        {
            Guid bookingId =
                new BookingServiceClient().CreateBooking(
                    BookingSourceRef.InternalSystem,
                    flightId,
                    Logging.UserId(User.Identity, ViewBag)
                    );

            return(RedirectToAction("BookingPassengers",
                                    new { bookingId = bookingId }
                                    ));
        }
예제 #11
0
 public ActionResult Index(AppointmentModel appointmentModel)
 {
     if (ModelState.IsValid)
     {
         if (BookingServiceClient.RegisterNewAppointment(appointmentModel))
         {
             return(RedirectToAction("Index"));
         }
     }
     appointmentModel.AppointmentTypeDropDown1.AppointmentTypeList = CommonBookingDetail.GetAppointmentType();
     appointmentModel.AppointmentTypeDropDown2.AppointmentTypeList = CommonBookingDetail.GetAppointmentType();
     appointmentModel.AppointmentTypeDropDown3.AppointmentTypeList = CommonBookingDetail.GetAppointmentType();
     appointmentModel.DurationListDropDown.DurationList            = CommonBookingDetail.GetDuration();
     appointmentModel.TimeListDropDown.TimeList = CommonBookingDetail.GetTimeList();
     return(View(appointmentModel));
 }
예제 #12
0
        public void SimulateBookings()
        {
            FlightServiceClient  flightService  = new FlightServiceClient();
            BookingServiceClient bookingService = new BookingServiceClient();

            try {
                bookingService.SimulateBookings(
                    DateTime.UtcNow.Date,
                    DateTime.UtcNow.Date.AddDays(1),
                    DefaultUserId
                    );
            } catch (Exception ex) {
                Assert.Fail(message: $"Failed to Simulate Bookings, message: {ex.Message}");
            } finally {
                bookingService.Close();
            }
        }
예제 #13
0
        public BookingGeneralContract(
            Guid bookingId,
            Guid userId
            )
        {
            // fetch booking data
            BookingContract =
                new BookingServiceClient().GetBooking(
                    bookingId,
                    userId
                    );

            BookingId        = BookingContract.Booking.BookingId;
            Locator          = BookingContract.BookingIdentifier.BookingIdentifierValue;
            BookingSourceRcd = BookingContract.Booking.BookingSourceRcd;
            ReceivedFrom     = BookingContract.Booking.ReceivedFrom;
            Comment          = BookingContract.Booking.Comment;
        }
예제 #14
0
파일: Booking.cs 프로젝트: jacov/nor-port
        public void ShowAsAdd(
            Guid userId
            )
        {
            _userId = userId;

            var bookingService = new BookingServiceClient();

            _bookingContract = bookingService.GetBookingEmpty(userId);
            _bookingContract.BookingIdentifier = new CrudeBookingIdentifierContract();
            _bookingContract.BookingIdentifier.BookingIdentifierValue = new BookingServiceClient().LocatorCreate();
            _bookingContract.Booking.BookingSourceRcd = BookingSourceRef.InternalSystem;
            _bookingContract.BookingPassengers        = new List <BookingPassengersContract>();

            RefreshBooking();

            Show();
        }
예제 #15
0
        public SeatChart(object flightInfoData, User user, SeatClass seatClass) : this()
        {
            var flightInfo = (FlightInfo)flightInfoData;

            FlightInformation = flightInfo;
            UserInput         = user;
            SeatClass         = seatClass;

            var client    = new BookingServiceClient();
            var seatInfos = client.RetrieveOccupiedSeatsMatrixFromFlightId(flightInfo.FlightId).ToList();

            var dataGrid = seatClass == SeatClass.FirstClass ? firstClassSeatChartDataGrid : economyClassSeatChartDataGrid;

            //// implement the seat selection
            MapSeatData(seatInfos, seatClass, dataGrid);
            var vm = new SeatChartViewModel(true);

            DataContext = vm;
        }
예제 #16
0
파일: Booking.cs 프로젝트: jacov/nor-port
        public void ShowAsEdit(
            Guid bookingId,
            Guid userId
            )
        {
            _userId = userId;

            // get booking with new booking contract
            var bookingService = new BookingServiceClient();

            _bookingContract =
                bookingService.GetBooking(
                    bookingId,
                    _userId
                    );

            RefreshBooking();

            Show();
        }
예제 #17
0
        private void CashCalc()
        {
            CrudeFinancialCurrencyContract currency =
                new BookingServiceClient().PaymentGetCurrency(
                    financialCurrencyPickerPayment.SelectedValue,
                    financialCurrencyPickerBookingBalance.SelectedValue,
                    _financialPaymentContract.DateTime
                    );

            if (currency.FinancialCurrencyId == Guid.Empty)
            {
                _paymentAmount = 0;
                _paymentAmountInBookingCurrency  = 0;
                _roundingAmountInBookingCurrency = _balanceAmount - 0;

                maskedTextBoxAmountInBookingCurrency.Text = string.Empty;
                maskedTextBoxRoundingAmount.Text          = string.Empty;
                maskedTextBoxNewBalance.Text = maskedTextBoxBalance.Text;

                labelCurrencyNotFound.Visible = true;
            }
            else
            {
                // set correct currency exchange
                financialCurrencyPickerPayment.SelectedValue = currency.FinancialCurrencyId;

                decimal.TryParse(maskedTextBoxPaymentAmount.Text, out _paymentAmount);
                _paymentAmountInBookingCurrency  = _paymentAmount / currency.Amount;
                _roundingAmountInBookingCurrency = _balanceAmount - Math.Round(_balanceAmount, currency.DecimalCount);

                maskedTextBoxAmountInBookingCurrency.Text = _paymentAmountInBookingCurrency.ToString();
                maskedTextBoxRoundingAmount.Text          = _roundingAmountInBookingCurrency.ToString();
                maskedTextBoxNewBalance.Text = (_balanceAmount - _paymentAmountInBookingCurrency).ToString("F" + currency.DecimalCount.ToString());

                labelCurrencyNotFound.Visible = false;
            }
        }
예제 #18
0
        public ActionResult Index()
        {
            var appointmentModel = BookingServiceClient.GetNewBookingModel();

            return(View(appointmentModel));
        }
예제 #19
0
 /// <summary>
 /// Controller constructor the WCF client is initialized here.
 /// </summary>
 public HomeController()
 {
     _serviceClient = new BookingServiceClient();
 }
예제 #20
0
        public JsonResult GetServices([DataSourceRequest] DataSourceRequest request)
        {
            var services = new BookingServiceClient().GetServices();

            return(Json(services.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }