Exemple #1
0
        public User(string username, string bankId, double balance, string fullname, long birthday, string phone, int gender, string userId, string email, int status)
        {
            this.Username = username;
            this.BankId   = bankId;
            this.Balance  = balance;
            this.Fullname = fullname;
            this.Birthday = birthday;
            this.Phone    = phone;
            this.Gender   = gender;
            this.UserId   = userId;
            this.Email    = email;
            this.Status   = status;
            LongTime longtime = new LongTime();

            this.CreateAt = longtime.CurrentTimeMillis();
            this.UpdateAt = longtime.CurrentTimeMillis();
        }
Exemple #2
0
        public History(string tradingCode, string sendBankId, string receiveBankId, double amount, string content)
        {
            this.TradingCode   = tradingCode;
            this.SendBankId    = sendBankId;
            this.ReceiveBankId = receiveBankId;
            this.Amount        = amount;
            this.Content       = content;
            LongTime longtime = new LongTime();

            this.DateTransaction = longtime.CurrentTimeMillis();
        }
Exemple #3
0
        // Tạo form Signup .
        public void Signup()
        {
            Console.WriteLine("====================== SIGN UP =======================");
            Account account = new Account();
            User    user    = new User();

            while (true)
            {
                Console.WriteLine("Please Enter Username: "******"Please Enter Password: "******"Please Enter Fullname: ");
                string fullName          = Console.ReadLine();
                string validatedFullName = validate.ValidateFullname(fullName);
                if (validatedFullName == null)
                {
                    user.Fullname = fullName;
                    break;
                }
                else
                {
                    Console.WriteLine(validatedFullName);
                }
            }

            while (true)
            {
                Console.WriteLine("Please Enter BirthDay(dd/mm/yyyy): ");
                string DoB = Console.ReadLine();
                string validatedBirthday = validate.ValidateBirthday(DoB);
                if (validatedBirthday == null)
                {
                    user.Birthday = DoB;
                    break;
                }
                else
                {
                    Console.WriteLine(validatedBirthday);
                }
            }

            while (true)
            {
                Console.WriteLine("Please Enter Phone Number: ");
                string phoneNumber    = Console.ReadLine();
                string validatedPhone = validate.ValidatePhone(phoneNumber);
                if (validatedPhone == null)
                {
                    user.Phone = phoneNumber;
                    break;
                }
                else
                {
                    Console.WriteLine(validatedPhone);
                }
            }

            while (true)
            {
                Console.WriteLine("Please Enter Identity Card: ");
                string userId          = Console.ReadLine();
                string validatedUserId = validate.ValidateUserId(userId);
                if (validatedUserId == null)
                {
                    user.UserId = userId;
                    break;
                }
                else
                {
                    Console.WriteLine(validatedUserId);
                }
            }

            while (true)
            {
                Console.WriteLine("Please Enter Email: ");
                string email          = Console.ReadLine();
                string validatedEmail = validate.ValidateEmail(email);
                if (validatedEmail == null)
                {
                    user.Email = email;
                    break;
                }
                else
                {
                    Console.WriteLine(validatedEmail);
                }
            }

            while (true)
            {
                Console.WriteLine("Please Enter Gender (F(female)/M(male)/O(other)): ");
                string inputGender = Console.ReadLine();
                inputGender = inputGender.ToLower();
                Console.WriteLine("===" + inputGender);
                string validateGender = validate.ValidateGender(inputGender);
                int    gender         = 0;
                if (validateGender == null)
                {
                    switch (inputGender)
                    {
                    case "f":
                        gender = 0;
                        break;

                    case "m":
                        gender = 1;
                        break;

                    case "o":
                        gender = 2;
                        break;

                    default:
                        Console.WriteLine("Gender incorrect. Please re-enter gender.");
                        break;
                    }

                    user.Gender = gender;
                    break;
                }
                else
                {
                    Console.WriteLine(validateGender);
                }
            }

            user.BankId   = StringGenerator.NumberGen(6);
            user.CreateAt = longTime.CurrentTimeMillis();
            user.Balance  = 5000000;

            Console.WriteLine("Processing ......");

            if (controller.HandleSignup(account, user))
            {
                Console.WriteLine("Sign Up Success");
            }
            else
            {
                Console.WriteLine("Sign Up Failed. Please try again.");
            }

            Console.WriteLine("=========================================================");
        }