Esempio n. 1
0
        private void homeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form frm = new frm_homeuser();

            frm.Show();
            this.Hide();
        }
        public void login(string username, string password)
        {
            try
            {
                if (tbl_user_detailsTableAdapter1.GetDataForLogin(username, password).Rows.Count == 1)
                {
                    string role = tbl_user_detailsTableAdapter1.GetDataForLogin(username, password).Rows[0]["User_role"].ToString();

                    switch (role)
                    {
                    case "Admin":
                        frm_homeadmin frm = new frm_homeadmin();
                        frm.Show();
                        this.Hide();
                        notifyIcon1.ShowBalloonTip(100000, "Login Success!", "You are Logged In as an Admin User!", ToolTipIcon.Info);


                        break;

                    case "Economy":
                        frm_homeuser frme = new frm_homeuser();
                        frme.Show();
                        this.Hide();

                        notifyIcon1.ShowBalloonTip(100000, "Login Success!", "You are Logged In as an Economy User!", ToolTipIcon.Info);

                        break;

                    case "Premium":
                        frm_homeuser frmp = new frm_homeuser();
                        frmp.Show();
                        this.Hide();

                        notifyIcon1.ShowBalloonTip(100000, "Login Success!", "You are Logged In as a Premium User!", ToolTipIcon.Info);

                        break;

                    case "VIP":
                        frm_homeuser frmv = new frm_homeuser();
                        frmv.Show();
                        this.Hide();

                        notifyIcon1.ShowBalloonTip(100000, "Login Success!", "You are Logged In as a VIP User!", ToolTipIcon.Info);

                        break;

                    default:
                        this.lbl_invalidrole.Show();
                        txt_username.Clear();
                        txt_password.Clear();
                        break;
                    }
                }
                else
                {
                    this.lbl_loginerror.Show();
                    txt_username.Clear();
                    txt_password.Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

                throw;
            }
            finally
            {
                notifyIcon1.Icon = null;
            }
        }