protected void saveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                string logOnToken   = null;
                string pswdToken    = null;
                var    temporalUser = new VLSystemUser();
                this.usersform1.GetValues(temporalUser, ref logOnToken, ref pswdToken);

                var account = SystemManager.CreateSystemAccount(temporalUser.FirstName, temporalUser.LastName, temporalUser.Role, temporalUser.Email, logOnToken, pswdToken);
                if (string.IsNullOrWhiteSpace(temporalUser.Notes) == false || account.IsActive != temporalUser.IsActive)
                {
                    account.Notes    = temporalUser.Notes;
                    account.IsActive = temporalUser.IsActive;
                    account          = SystemManager.UpdateSystemUser(account);
                }
            }
            catch (Exception ex)
            {
                this.ErrorMessage = ex.Message;
            }

            this.Response.Redirect("list.aspx", false);
            this.Context.ApplicationInstance.CompleteRequest();
        }
Example #2
0
 public void GetValues(VLSystemUser user, ref string logOnToken, ref string pswdToken)
 {
     user.FirstName = this.FirstName.Text;
     user.LastName  = this.LastName.Text;
     logOnToken     = this.LogOnToken.Text;
     pswdToken      = this.PswdToken.Text;
     user.Email     = this.Email.Text;
     user.IsActive  = this.IsActive.Checked;
     user.Role      = Convert.ToInt16(this.Role.SelectedValue);
     user.Notes     = this.Notes.Text;
 }
Example #3
0
        public void SetValues(VLSystemUser user, VLCredential credentials)
        {
            this.FirstName.Text      = user.FirstName;
            this.LastName.Text       = user.LastName;
            this.LogOnToken.Text     = credentials.LogOnToken;
            this.Email.Text          = user.Email;
            this.IsActive.Checked    = user.IsActive;
            this.IsLockedOut.Checked = credentials.IsLockedOut;
            this.Role.SelectedValue  = user.Role.ToString(CultureInfo.InvariantCulture);
            this.Notes.Text          = user.Notes;

            if (user.IsBuiltIn)
            {
                foreach (Control ctrl in this.Controls)
                {
                    if (ctrl is WebControl)
                    {
                        ((WebControl)ctrl).Enabled = false;
                    }
                }
            }
        }