Exemplo n.º 1
0
        /// <summary>
        /// The btnLogin_Click.
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>.</param>
        /// <param name="e">The e<see cref="EventArgs"/>.</param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(txtUserName.Text) && !string.IsNullOrWhiteSpace(txtPassword.Text))
                {
                    LoginDetails loginDetails = SqlHelper.Login(txtUserName.Text, txtPassword.Text, rbtnAdmin.Checked);

                    if (loginDetails != null)
                    {
                        CreateForm objCreate = new CreateForm(loginDetails.Id, loginDetails.Name, (loginDetails.IsAdminUser == true ? 1 : 0));
                        this.Hide();
                        objCreate.Show();
                    }
                    else
                    {
                        MessageBox.Show(@"Incorrect UserName or Password", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show(@"Incorrect UserName or Password", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The Create_Click.
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>.</param>
        /// <param name="e">The e<see cref="EventArgs"/>.</param>
        private void Create_Click(object sender, EventArgs e)
        {
            CreateForm obj = new CreateForm(userId, _userName, isAdmin);

            Hide();
            obj.ShowDialog();
        }