예제 #1
0
        public int Register(string username, string password, string mail)
        {
            ClientUtil rUtil = new ClientUtil();

            //if (username.Length < 8)
            //{
            //    appErr.ShowErrorMsg("Name is too short");
            //}
            //else if (password.Length < 8)
            //{
            //    return "Password is too short";
            //}
            if (rUtil.IsUsernameExist(username) == true)
            {
                appErr.ShowErrorMsg("This name is already in use. Choose different name");
            }
            else if (rUtil.IsMailExist(mail) == true)
            {
                appErr.ShowErrorMsg("This mail is already in use");
            }
            else
            {
                rUtil.CreateClient(username, password, mail);

                return(rUtil.GetId(username));
            }
            return(-1);
        }
예제 #2
0
        public int LogIn(string username, string password)
        {
            ClientUtil rUtil = new ClientUtil();

            if (rUtil.FindClient(username, password) == true)
            {
                return(rUtil.GetId(username));
            }
            else
            {
                appErr.ShowErrorMsg("Invalid username or password");
                return(-1);
            }
        }
예제 #3
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);
        }
예제 #4
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();
        }
예제 #5
0
        private List <string> GetClnFromRedis(int clnId, int flightNum)
        {
            List <string> redisData = new List <string>();

            string username = "";
            string email    = "";

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

            clnUt.GetClientInfo(clnId, out username, out email);
            redisData.Add(username);
            redisData.Add(email);
            redisData.Add(flUt.GetFlightOrderAmount(flightNum, clnId).ToString());

            return(redisData);
        }