public void GetAllClientInfo(out string username, out string mail, out decimal money)
        {
            BankUtil bankUt = new BankUtil();

            clnUtil.GetClientInfo(clnId, out username, out mail);
            money = bankUt.GetClientsAmount(clnId);
        }
Exemple #2
0
        public void GetClientInfoFromRedis(int clnId, ref string name, ref string email, ref string money, ref string booked)
        {
            ClientTracker clnTrack = new ClientTracker();

            clnTrack.Start_Tracking();

            ClientUtil clnUt = new ClientUtil();
            BankUtil   bnkUt = new BankUtil();

            clnUt.GetClientInfo(clnId, out name, out email);
            money = bnkUt.GetClientsAmount(clnId).ToString();

            var row = clnTrack.GetClientBookedTotal(clnId).First();

            booked = row.GetValue <int>("system.sum(action)").ToString();
        }
        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");
            }
        }
        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");
            }
        }