Example #1
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txt_UserName.Text) && !string.IsNullOrEmpty(txtPassword.Text))
            {
                userService userService = new userService();
                user        userControl = userService.userControl(txt_UserName.Text, txtPassword.Text);

                if (userControl != null)
                {
                    Form     mainForm     = Application.OpenForms["Form1"];
                    Panel    leftPanel    = (Panel)mainForm.Controls["pnlIslemList"];
                    GroupBox grpIslemList = (GroupBox)leftPanel.Controls["grpOperationList"];
                    foreach (Control item in grpIslemList.Controls)
                    {
                        if (item is Button)
                        {
                            item.Enabled = true;
                        }
                    }
                    MessageBox.Show("Welcome to TO DO...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Wrong username or password", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Enter your user name or password.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }