private static bool CheckAmountInput(string amount, string userName) // eos position 6
        {
            bool    isNotDecimal = false;
            decimal num          = 0.00m;

            if (!decimal.TryParse(amount, out num))
            {
                Console.Clear();
                string message = "Not valid input!";
                ConsoleLayout.Attention(message, 0);

                ConsoleLayout.Position(2);
                Console.WriteLine("To choose a correct amount please press 'Enter'");

                ConsoleLayout.Position(4);
                Console.WriteLine("To go back to menou please type 'M' and press enter");

                string message1 = "What's this?";
                ConsoleLayout.Speech(message1, -4);

                ConsoleLayout.Position(6);
                string userinput = Convert.ToString(Console.ReadLine());


                if ((userinput == "M") || (userinput == "m"))
                {
                    ShowMenus.ChooseUser(userName);
                }

                isNotDecimal = true;
                Console.Clear();
            }
            return(isNotDecimal);
        }
        private static bool CheckUsernameToTransfer(string userName, string userToTransfer)// eos position 6
        {
            string query           = "SELECT COUNT (username) FROM users WHERE username = '******'";
            int    result          = Convert.ToInt32(AddQuerryInt(query));
            bool   invalidUsername = false;

            if (result == 0.000)
            {
                Console.Clear();

                string message = "The user you are looking for does not exists.";
                ConsoleLayout.Attention(message, 0);

                ConsoleLayout.Position(2);
                Console.WriteLine("To choose an other username please press 'Enter'");

                ConsoleLayout.Position(4);
                Console.WriteLine(" To go back to menou please type 'M'");

                string message1 = "Who's that?";
                ConsoleLayout.Speech(message1, -4);

                ConsoleLayout.Position(6);
                string userinput = Convert.ToString(Console.ReadLine());

                if ((userinput == "M") || (userinput == "m"))
                {
                    ShowMenus.ChooseUser(userName);
                }
                invalidUsername = true;
            }
            return(invalidUsername);
        }
Пример #3
0
        public static void Welcome()
        {
            Console.BackgroundColor = ConsoleColor.DarkMagenta;
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.White;

            Login.EncryptPasswordOnSQL();
            string title = @"      



                                X
                                X X
                                X X X
                         XXXXXXXX X X
                           XXXXXXXX X         C#X                C#X
                             XXXXXXXX       XXXXXXX            XXXXXXXX
                                     X    XXX      XXX       XXX      XXX
                                       X XX          XXX   XXX          XX
                                        XX              XXX              XX
                                        XX               X               XX
                                        XX     WELCOME                   XX
                                         XX          TO                 XX
                                          XXX         BEAUTY-LINE     XXX
                                           XXXX                     XXXX
                                              XC#X                XC#X
                                                 XXX             XXXX
                                                    XXX        XXX    X
                                                       XX     XX        X
                                                         XXXXX            X X
                                                          C#               C#X
                                                                          XXC#X 
                                MORE HEALTH                                        );(
                                      MORE BEAUTY                .-.     .-.     .           
                                            MORE WELLNESS ... _.'   `._.'   `._.'       
                                ";



            Console.WriteLine(title);
            string message = "Hello gorgeous girl!!!\nWelcome to beauty line!";

            ConsoleLayout.Speech(message);
            Console.Clear();
        }
        public static void ExitApplication(string userName)
        {
            ConsoleLayout.Position(0);
            string title = @"
                                      _                _                
                                     | |              | |            |||
                                     | |         _    | |         _  |||
                                     |/ \_|   | |/    |/ \_|   | |/  |||
                                      \_/  \_/|/|__/   \_/  \_/|/|__/ooo
                                             /|               /|        
                                             \|               \|        ";

            Console.WriteLine(title);
            string message = "Bye bye" + userName;

            ConsoleLayout.Speech(message);
            ConsoleLayout.Position(12);
            Environment.Exit(0);
        }
Пример #5
0
        public static void CheckUser(SqlConnection sqlconn)
        {
            Welcome();
            int result = 0;
            int i      = 2;

            do
            {
                // Console.WriteLine("{0," + Console.WindowWidth / 2 + "}", " ");
                ConsoleLayout.Position(0);
                Console.WriteLine("Please enter your username");

                ConsoleLayout.Position(2);
                string userName = Convert.ToString(Console.ReadLine());

                ConsoleLayout.Position(4);
                Console.WriteLine("Please enter your password");

                ConsoleLayout.Position(6);
                string passWord = GenerateSHA256String(Hide());


                //sc.Parameters.AddWithValue("@password", GetHashedText(pass.Text));

                SqlCommand cmd = new SqlCommand("SELECT COUNT (*) FROM users WHERE username = @username AND password = @password", sqlconn);
                cmd.Parameters.AddWithValue("@username", userName);
                cmd.Parameters.AddWithValue("@password", passWord);
                result = (int)cmd.ExecuteScalar();

                if (result > 0)
                {
                    ConsoleLayout.Position(10);
                    Console.WriteLine("Successful Connection");

                    System.Threading.Thread.Sleep(1000);
                    Console.Clear();
                    ShowMenus.ChooseUser(userName);
                    break;
                }
                else if (i == 0)
                {
                    string message1 = "Where is your mind?";
                    ConsoleLayout.Speech(message1, 0);
                    string message = "Sorry, invalid user!!!";
                    ConsoleLayout.Attention(message, 10);

                    ConsoleLayout.Position(12);
                    Environment.Exit(0);
                }
                else
                {
                    i--;
                    string message = "Unsuccessfull Connection";
                    ConsoleLayout.Attention(message, 10);
                    ConsoleLayout.Position(12);
                    Console.WriteLine("Please try again, {0} tries left!!!", i + 1);

                    System.Threading.Thread.Sleep(1000);
                    Console.Clear();
                }
            }while ((result == 0) && (i >= 0));
        }