Example #1
0
        public IActionResult Signup(User u, string Password)
        {
            UserDb userDB = new UserDb(_connectionString);

            userDB.AddUser(u, Password);
            return(Redirect("/Home/Index"));
        }
        public IActionResult Signup(User user, string password)
        {
            var db = new UserDb(_connectionString);

            db.AddUser(user, password);
            return(Redirect("/account/login"));
        }
Example #3
0
        private async void SignupValidation_ButtonClicked(object sender, EventArgs e)
        {
            if ((string.IsNullOrWhiteSpace(userNameEntry.Text)) || (string.IsNullOrWhiteSpace(emailEntry.Text)) ||
                (string.IsNullOrWhiteSpace(passwordEntry.Text)) || (string.IsNullOrWhiteSpace(phoneEntry.Text)) ||
                (string.IsNullOrEmpty(userNameEntry.Text)) || (string.IsNullOrEmpty(emailEntry.Text)) ||
                (string.IsNullOrEmpty(passwordEntry.Text)) || (string.IsNullOrEmpty(phoneEntry.Text)))
            {
                await DisplayAlert("Enter Data", "Enter Valid Data", "OK");
            }
            else if (!string.Equals(passwordEntry.Text, confirmpasswordEntry.Text))
            {
                warningLabel.Text         = "Enter Same Password";
                passwordEntry.Text        = string.Empty;
                confirmpasswordEntry.Text = string.Empty;
                warningLabel.TextColor    = Color.IndianRed;
                warningLabel.IsVisible    = true;
            }
            else if (phoneEntry.Text.Length < 10)
            {
                phoneEntry.Text         = string.Empty;
                phoneWarLabel.Text      = "Enter 10 digit Number";
                phoneWarLabel.TextColor = Color.IndianRed;
                phoneWarLabel.IsVisible = true;
            }
            else if (IsValid(emailEntry.Text))
            {
                users.name     = emailEntry.Text;
                users.userName = userNameEntry.Text;
                users.password = passwordEntry.Text;
                users.phone    = phoneEntry.Text.ToString();
                try
                {
                    var retrunvalue = userDB.AddUser(users);
                    if (retrunvalue == "Sucessfully Added")
                    {
                        await DisplayAlert("User Add", retrunvalue, "OK");

                        await Navigation.PushAsync(new MainPage());
                    }
                    else
                    {
                        await DisplayAlert("User Add", retrunvalue, "OK");
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }
            else
            {
                emailEntry.Text         = string.Empty;
                emailWarLabel.Text      = "Enter correct email";
                emailWarLabel.TextColor = Color.IndianRed;
                emailWarLabel.IsVisible = true;
            }
        }
Example #4
0
        void MainMenuInputCatch()
        {
            string mainMenuInput = ConsoleGUI.PromptRender("Wybór: ");

            if (char.IsDigit(mainMenuInput[0]))
            {
                switch (int.Parse(mainMenuInput[0].ToString() /* co by nikt nie żartował, że wpisze 10 */))
                {
                case 1:
                    DbBrowser.Browse(ref _mainDb);
                    break;

                case 2:
                    _mainDb.AddMedicine();
                    break;

                case 3:
                    _mainDb.RemoveMedicine();
                    break;

                case 4:
                    _mainDb.SearchMedicine();
                    break;

                case 5:
                    _userDb.ShowUsers();
                    break;

                case 6:
                    _userDb.AddUser();
                    break;

                case 7:
                    _userDb.DeleteUser();
                    break;

                case 8:
                    _userDb.LogoutUser();
                    if (!LogIn())
                    {
                        Environment.Exit((int)Program.ExitCode.Success);
                    }
                    break;
                }
                RenderWelcome();
                MainMenuInputCatch();
            }
            else
            {
                ConsoleGUI.ErrorRender("Niepoprawny wybór, naciśnij Enter by spróbować ponownie");
                Console.ReadLine();
                RenderWelcome();
                MainMenuInputCatch();
            }
        }
        private void Signed_Clicked(object sender, EventArgs e)
        {
            reg    = new Registration();
            userDb = new UserDb();
            reg.Id++;
            reg.FirstName = FirstName.Text;
            reg.LastName  = LastName.Text;
            reg.Dob       = DOB.Date.ToString();
            reg.Email     = Email.Text;
            reg.Password  = Password.Text;
            reg.Address   = Address.Text;

            if (FirstName.Text == null || LastName.Text == null || Password.Text == null)
            {
                DisplayAlert("Registration", "Please Enter All the Fields!", "Ok");
            }
            DisplayAlert("Registration", "Thanks for Registration", "Ok");
            userDb.AddUser(reg);
            ClearAll();
        }
Example #6
0
        public ActionResult Register(UsersNew form)
        {
            User user = new User();

            user.SetPassword(form.Password);
            user.Type       = "user";
            user.Username   = form.Username;
            user.Country    = form.Country;
            user.City       = form.City;
            user.SchoolName = form.SchoolName;
            UserDb db = new UserDb();

            if (!db.AddUser(user))
            {
                return(View(new UsersNew
                {
                    DuplicateUserMessage = "This username already exists in database. Please choose a different one.",
                }));
            }
            Session["userName"] = form.Username;
            return(RedirectToRoute("WelcomePage"));
        }
Example #7
0
 public static bool AddUser(User user)
 {
     return(UserDb.AddUser(user.Id, user.Name, user.ContactInfo, user.JoinDateTime, user.Active, user.Username, user.Password, user.TypeName));
 }