Exemplo n.º 1
0
        public void GetFlightInfoFromRedis(int flightNum, ref string from, ref string to, ref string date, ref string cost, ref string leftTickets)
        {
            FlightUtil flUt = new FlightUtil();

            from        = flUt.GetFlightFromAirport(flightNum);
            to          = flUt.GetFlightToAirport(flightNum);
            date        = flUt.GetFlightDate(flightNum);
            cost        = flUt.GetFlightCost(flightNum).ToString();
            leftTickets = flUt.GetLeftTicketsAmount(flightNum).ToString();
        }
Exemplo n.º 2
0
        private List <string> GetFlightFromRedis(int clnId, int flightNum)
        {
            List <string> redisData = new List <string>();

            ClientUtil clnUt = new ClientUtil();
            FlightUtil flUt  = new FlightUtil();

            redisData.Add(flUt.GetFlightFromAirport(flightNum));
            redisData.Add(flUt.GetFlightToAirport(flightNum));
            redisData.Add(flUt.GetFlightCost(flightNum).ToString());
            redisData.Add(flUt.GetFlightOrderAmount(flightNum, clnId).ToString());

            return(redisData);
        }
Exemplo n.º 3
0
        public void DeleteOrder(int flightId, int orderAmount)
        {
            BankUtil   bankUt = new BankUtil();
            FlightUtil flUtil = new FlightUtil();

            if (bankUt.MoneyTransfer(companyAcountId, clnId, flUtil.GetFlightCost(flightId) * orderAmount))
            {
                flUtil.UnBookFlight(flightId, clnId, orderAmount);
                clnTrack.Set_Result(-orderAmount);
                appErr.ShowMsg("Order deleted successfully");
            }
            else
            {
                appErr.ShowErrorMsg("Bank error");
            }
        }
Exemplo n.º 4
0
        public void MakeOrder(int flightId, int orderAmount)
        {
            BankUtil   bankUt = new BankUtil();
            FlightUtil flUtil = new FlightUtil();

            if (flUtil.IsEnoughTicket(flightId, orderAmount))
            {
                if (bankUt.MoneyTransfer(clnId, companyAcountId, flUtil.GetFlightCost(flightId) * orderAmount))
                {
                    flUtil.BookFlight(flightId, clnId, orderAmount);
                    clnTrack.Set_Result(orderAmount);
                    appErr.ShowMsg("Order completed successfully");
                }
                else
                {
                    appErr.ShowErrorMsg("Bank error");
                }
            }
            else
            {
                appErr.ShowErrorMsg("Zero tickets left");
            }
        }
Exemplo n.º 5
0
        public decimal GetTicketsCost(int flightId)
        {
            FlightUtil flUtil = new FlightUtil();

            return(flUtil.GetFlightCost(flightId));
        }