Esempio n. 1
0
        private void categoriesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (LoginCodeClass.IsLogged == false)
                {
                    throw new Exception("Login first.");
                }
                else
                {
                    if (LoginCodeClass.isAdmin == true)
                    {
                        var cat = new CATEGORIES();

                        MainClass.ShowWindow(cat, MDI.ActiveForm);
                    }
                    else
                    {
                        MainClass.ShowMsg("You do not have permission to view categories.", "Error");
                    }
                }
            }
            catch (Exception ex)
            {
                MainClass.ShowMsg(ex.Message, "Error");
            }
        }
Esempio n. 2
0
        private void login_button_Click(object sender, EventArgs e)
        {
            try
            {
                if (username_textBox.Text != "" && password_textBox.Text != "")
                {
                    Hashtable ht = new Hashtable();

                    ht.Add("@email", username_textBox.Text);

                    ht.Add("@password", password_textBox.Text);

                    if (other_radioButton.Checked == true)
                    {
                        if (LoginCodeClass.getlogindetails("st_getAuthenticationDetails", ht, false))
                        {
                            LoginCodeClass.isAdmin = false; //not admin, common user

                            LoginCodeClass.IsLogged = true;

                            var sal = new SALES();

                            MainClass.ShowWindow(sal, MDI.ActiveForm);
                        }
                    }
                    else if (admin_radioButton.Checked == true)
                    {
                        if (LoginCodeClass.getlogindetails("st_getAuthenticationDetailsFromAUTH", ht, true))
                        {
                            LoginCodeClass.isAdmin = true; //Admin,not common user

                            LoginCodeClass.IsLogged = true;

                            var cat = new CATEGORIES();

                            MainClass.ShowWindow(cat, MDI.ActiveForm);
                        }
                    }
                    else
                    {
                        MainClass.ShowMsg("Please select if you are admin or any other person.", "Error");

                        LoginCodeClass.IsLogged = false;
                    }
                }
                else
                {
                    MainClass.ShowMsg("Please fill all fields.", "Error"); LoginCodeClass.IsLogged = false;
                }
            }
            catch (Exception ex)
            {
                MainClass.ShowMsg(ex.Message, "Error");

                LoginCodeClass.IsLogged = false;
            }
        }