Esempio n. 1
0
 /// <summary>
 /// Handles the Click event of the tsRegister control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void tsRegister_Click(object sender, EventArgs e)
 {
     bool isCurrentUserAdmin = this.CurrentUserType.HasValue && this.CurrentUserType.Value == UserTypes.Admininstrator;
     LoginForm frmLogin = new LoginForm(LoginForm.LoginType.CreateNewUser, isCurrentUserAdmin);
     if (frmLogin.ShowDialog(this) == DialogResult.OK)
     {
         /*Creating user*/
         string message;
         this.CurrentUser =
             this._logicsService.CreateCustomer(frmLogin.UserName, frmLogin.Password, UserTypes.User,frmLogin.UserId, out message);
         this.ShowUserChangedMessage(this.CurrentUser, message);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Handles the Click event of the tsLogin control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void tsLogin_Click(object sender, EventArgs e)
 {
     bool isCurrentUserAdmin = this.CurrentUserType.HasValue && this.CurrentUserType.Value == UserTypes.Admininstrator;
     LoginForm frmLogin = new LoginForm(LoginForm.LoginType.Login, isCurrentUserAdmin);
     if (frmLogin.ShowDialog(this) == DialogResult.OK)
     {
         /*Getting user by user name / password */
         this.CurrentUser = this._logicsService.AuthenticateUser(frmLogin.UserName, frmLogin.Password);
         this.ShowUserChangedMessage(this.CurrentUser,String.Empty);
     }
 }