public static GreyFoxUser NewUser(string username) { GreyFoxUser user = new GreyFoxUser(); user.UserName = username; user.LoginPassword = GreyFoxPassword.CreateRandomPassword(15); user.Contact = new Amns.GreyFox.People.GreyFoxContact(GreyFoxUserManager.ContactTable); user.Encrypt(); return(user); }
protected void ok_Click(object sender, EventArgs e) { bool reset = false; if (greyFoxUserID == 0) { editGreyFoxUser = new GreyFoxUser(); reset = resetOnAdd; } else { editGreyFoxUser = new GreyFoxUser(greyFoxUserID); } if (editGreyFoxUser.Contact == null) { editGreyFoxUser.Contact = new GreyFoxContact("sysGlobal_Contacts"); } editGreyFoxUser.Contact.ParseName(tbName.Text); editGreyFoxUser.Contact.Address1 = tbAddress1.Text; editGreyFoxUser.Contact.IsBadAddress = cbBadAddress.Checked; editGreyFoxUser.Contact.Address2 = tbAddress2.Text; editGreyFoxUser.Contact.City = tbCity.Text; editGreyFoxUser.Contact.StateProvince = tbStateProvince.Text; editGreyFoxUser.Contact.PostalCode = tbPostalCode.Text; editGreyFoxUser.Contact.Country = tbCountry.Text; editGreyFoxUser.Contact.HomePhone = tbHomePhone.Text; editGreyFoxUser.Contact.IsBadHomePhone = cbBadHomePhone.Checked; editGreyFoxUser.Contact.WorkPhone = tbWorkPhone.Text; editGreyFoxUser.Contact.IsBadWorkPhone = cbBadWorkPhone.Checked; editGreyFoxUser.Contact.MobilePhone = tbMobilePhone.Text; editGreyFoxUser.Contact.Pager = tbPager.Text; editGreyFoxUser.Contact.IsBadMobilePhone = cbBadMobilePhone.Checked; editGreyFoxUser.Contact.Email1 = tbEmail1.Text; editGreyFoxUser.Contact.IsBadEmail = cbBadEmail.Checked; editGreyFoxUser.Contact.Email2 = tbEmail2.Text; editGreyFoxUser.Contact.Url = tbUrl.Text; editGreyFoxUser.Contact.IsBadUrl = cbBadUrl.Checked; editGreyFoxUser.Contact.BirthDate = DateTime.Parse(tbBirthDate.Text); editGreyFoxUser.Contact.MemoText = tbMemoText.Text; editGreyFoxUser.UserName = tbUserName.Text; editGreyFoxUser.IsDisabled = cbIsDisabled.Checked; if (tbLoginPassword.Text != "") { editGreyFoxUser.LoginPassword = GreyFoxPassword.EncodePassword(tbLoginPassword.Text); } GreyFoxRoleManager roleManager = new GreyFoxRoleManager(); editGreyFoxUser.Roles = roleManager.DecodeString(tbRoles.Text, "\r\n"); if (editOnAdd) { greyFoxUserID = editGreyFoxUser.Save(); } else { editGreyFoxUser.Save(); } if (reset) { tbUserName.Text = string.Empty; cbIsDisabled.Checked = false; tbLoginPassword.Text = string.Empty; tbName.Text = string.Empty; tbAddress1.Text = string.Empty; tbAddress2.Text = string.Empty; tbCity.Text = string.Empty; tbStateProvince.Text = string.Empty; tbPostalCode.Text = string.Empty; tbCountry.Text = string.Empty; tbHomePhone.Text = string.Empty; tbWorkPhone.Text = string.Empty; tbMobilePhone.Text = string.Empty; tbPager.Text = string.Empty; tbEmail1.Text = string.Empty; tbEmail2.Text = string.Empty; tbUrl.Text = string.Empty; tbBirthDate.Text = string.Empty; tbMemoText.Text = string.Empty; } OnUpdated(EventArgs.Empty); }