public frmLogin()
        {
            InitializeComponent();
            rfmAdminDashboard ad = new rfmAdminDashboard();

            ad.lg = this;
        }
Ejemplo n.º 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            l.username  = txtUserName.Text.Trim();
            l.password  = txtPasword.Text.Trim();
            l.user_type = cmbUserType.selectedValue.Trim();

            bool success = dal.loginCheck(l);

            if (success == true)
            {
                loggedIn = l.username;
                switch (l.user_type)
                {
                case "Admin":
                {
                    rfmAdminDashboard admin = new rfmAdminDashboard();
                    admin.adlg = this;
                    admin.Show();
                    this.Hide();
                }
                break;

                case "Cashier":
                {
                    frmUserDashboard user = new frmUserDashboard();
                    user.uslg = this;
                    user.Show();
                    this.Hide();
                }
                break;

                case "StoreKeeper":
                {
                    frmStKeeperDashboard stk = new frmStKeeperDashboard();
                    stk.stlg = this;
                    stk.Show();
                    this.Hide();
                }
                break;

                default:
                {
                    MassageBox mb = new MassageBox("Invalid User Type", MsgType.clear);
                    mb.Show();
                    //MessageBox.Show("Invalid User Type!!!");
                }
                break;
                }
            }
            else
            {
                MassageBox mb = new MassageBox("Login Failed\nRetry", MsgType.retry);
                mb.Show();
                //MessageBox.Show("Login Fail !!!....Try Again");
            }
        }
Ejemplo n.º 3
0
        private void frmPurchaseAndSales_Load(object sender, EventArgs e)
        {
            rfmAdminDashboard ad = new rfmAdminDashboard();

            // adminDash ad = new adminDash();
            frmUserDashboard us = new frmUserDashboard();

            if (frmLogin.loggedIn == "admin")
            {
                type        = rfmAdminDashboard.transactionType;
                lblTop.Text = type;
            }
            else if (frmLogin.loggedIn == "cashier")
            {
                type        = frmUserDashboard.transactionType;
                lblTop.Text = type;
            }
            else if (frmLogin.loggedIn == "stkeeper")
            {
                type        = frmStKeeperDashboard.transactionType;
                lblTop.Text = type;
            }

            transactionDT.Columns.Add("Product Name");
            transactionDT.Columns.Add("Rate");
            transactionDT.Columns.Add("Quantity");
            transactionDT.Columns.Add("Total");


            SqlConnection conn = new SqlConnection(myconnstring);

            conn.Open();
            SqlCommand cmdCate = new SqlCommand("SELECT * FROM tbl_categories", conn);

            SqlDataReader dr = cmdCate.ExecuteReader();

            while (dr.Read())
            {
                cmbCat.Items.Add(dr["title"]);
                categori.Add(new categoriesBLL()
                {
                    Id    = ((int)dr["Id"]),
                    title = dr["title"] as string
                });
            }
            conn.Close();
            conn.Open();
            SqlCommand    cmdProd = new SqlCommand("SELECT * FROM tbl_products", conn);
            SqlDataReader dr1     = cmdProd.ExecuteReader();

            while (dr1.Read())
            {
                producti.Add(new productsBLL()
                {
                    Id       = ((int)dr1["Id"]),
                    name     = dr1["name"] as string,
                    category = dr1["category"] as string
                });
            }
            conn.Close();
        }