예제 #1
0
        public UManage(Guid currentUser, List <User> GetUsers)
        {
            InitializeComponent();
            CultureInfo   culture   = Thread.CurrentThread.CurrentCulture;
            TextInfo      textInfo  = culture.TextInfo;
            List <string> stateList = new List <string>();

            users = GetUsers;
            CCErrorProvider.Clear();
            UserLoginErrorProv.Clear();
            UserMaintErrorProv.Clear();
            if (currentUser != Guid.Empty)
            {
                UserIndexNo  = users.FindIndex(a => a.guid == currentUser);
                LoggedInUser = users[UserIndexNo];
            }
            stateList.Add(string.Empty);
            stateList.AddRange(Enum.GetNames(typeof(User.StateEnum)));
            for (int counter = 0; counter < stateList.Count(); counter++)
            {
                stateList[counter] = textInfo.ToTitleCase(stateList[counter].Replace("_", " "));
            }
            StateBox.Items.AddRange(stateList.ToArray());
            StateBox.SelectedIndex = 0;
        }
예제 #2
0
 private void ChangePassWdButton_Click(object sender, EventArgs e)
 {
     UserMaintErrorProv.Clear();
     CCErrorProvider.Clear();
     if (string.IsNullOrEmpty(Passwordbox.Text))
     {
         UserMaintErrorProv.SetError(Passwordbox, "You must first enter your old password.");
     }
     else if (!LoggedInUser.PassWdMatch(sHA.ComputeHash(ue.GetBytes(Passwordbox.Text))))
     {
         UserMaintErrorProv.SetError(Passwordbox, InvalPass);
     }
     else if (string.IsNullOrEmpty(CreatePasswordBox.Text))
     {
         UserMaintErrorProv.SetError(CreatePasswordBox, "You must enter a new password!");
     }
     else
     {
         LoggedInUser.ChangePass(sHA.ComputeHash(ue.GetBytes(Passwordbox.Text)), sHA.ComputeHash(ue.GetBytes(CreatePasswordBox.Text)));
         UserMaintErrorProv.Clear();
         users.RemoveAt(UserIndexNo);
         users.Add(LoggedInUser);
         UserIndexNo = users.FindIndex(a => a.guid == LoggedInUser.guid);
         MessageBox.Show("Your password has been successfully changed!", "Password changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #3
0
        private void Zipbox_Validated(object sender, EventArgs e)
        {
            int MaybeZip;

            if (!int.TryParse(Zipbox.Text, out MaybeZip) || (MaybeZip < 10000) || (MaybeZip > 999999999))
            {
                UserMaintErrorProv.SetError(Zipbox, "The zip is not valid.");
                NewUserButton.Enabled = false;
                return;
            }
            UserMaintErrorProv.Clear();
        }