コード例 #1
0
        private void btnShop_Click(object sender, EventArgs e)
        {
            frmShop shopForm = new frmShop();

            shopForm.Show();
            this.Hide();
        }
コード例 #2
0
ファイル: frmWine.cs プロジェクト: treymer/college-projects
        private void btnShop_Click(object sender, EventArgs e)
        {
            // send the output also even when shop is clicked
            // sends output after button click
            merlotQty     = txtMerlotQty.Text;
            cabernetQty   = txtCabernetQty.Text;
            chardonnayQty = txtChardonnayQty.Text;

            merlotPrice     = lblMerlotPrice.Text;
            cabernetPrice   = lblCabernetPrice.Text;
            chardonnayPrice = lblChardonnayPrice.Text;

            // to send only products with quantity
            if (txtMerlotQty.Text == "0")
            {
                merlotPrice = "0.0";
            }
            if (txtCabernetQty.Text == "0")
            {
                cabernetPrice = "0.0";
            }
            if (txtChardonnayQty.Text == "0")
            {
                chardonnayPrice = "0.0";
            }

            // to delete text after getting the output
            txtMerlotQty.Text     = "0";
            txtCabernetQty.Text   = "0";
            txtChardonnayQty.Text = "0";

            frmShop shopForm = new frmShop();

            shopForm.Show();
            this.Hide();
        }
コード例 #3
0
        private void btnShop_Click(object sender, EventArgs e)
        {
            // send the output also even when shop is clicked
            // sends output after button click
            domesticQty = txtDomesticQty.Text;
            importedQty = txtImportedQty.Text;
            ipaQty      = txtIpaQty.Text;

            domesticPrice = lblDomesticPrice.Text;
            importedPrice = lblImportedPrice.Text;
            ipaPrice      = lblIpaPrice.Text;

            // to send only products with quantity
            if (txtDomesticQty.Text == "0")
            {
                domesticPrice = "0.0";
            }
            if (txtImportedQty.Text == "0")
            {
                importedPrice = "0.0";
            }
            if (txtIpaQty.Text == "0")
            {
                ipaPrice = "0.0";
            }

            // to delete text after getting the output
            txtDomesticQty.Text = "0";
            txtImportedQty.Text = "0";
            txtIpaQty.Text      = "0";

            frmShop shopForm = new frmShop();

            shopForm.Show();
            this.Hide();
        }
コード例 #4
0
        private void btnShop_Click(object sender, EventArgs e)
        {
            // send the output also even when shop is clicked
            // sends output after button click
            vodkaQty   = txtVodkaQty.Text;
            tequilaQty = txtTequilaQty.Text;
            whiskeyQty = txtWhiskeyQty.Text;

            vodkaPrice   = lblVodkaPrice.Text;
            tequilaPrice = lblTequilaPrice.Text;
            whiskeyPrice = lblWhiskeyPrice.Text;

            // to send only products with quantity
            if (txtVodkaQty.Text == "0")
            {
                vodkaPrice = "0.0";
            }
            if (txtTequilaQty.Text == "0")
            {
                tequilaPrice = "0.0";
            }
            if (txtWhiskeyQty.Text == "0")
            {
                whiskeyPrice = "0.0";
            }

            // to delete text after getting the output
            txtVodkaQty.Text   = "0";
            txtTequilaQty.Text = "0";
            txtWhiskeyQty.Text = "0";

            frmShop shopForm = new frmShop();

            shopForm.Show();
            this.Hide();
        }
コード例 #5
0
        private void Loginbtn_Click(object sender, EventArgs e)
        {
            string passWord;

            userName = txtUserName.Text;
            passWord = txtPassword.Text;

            lblError1.Visible     = false;
            lblErrorStar1.Visible = false;
            lblErrorStar2.Visible = false;
            lblError1.Text        = "";

            if (userName == "" || passWord == "")
            {
                lblError1.Visible     = true;
                lblErrorStar1.Visible = true;
                lblErrorStar2.Visible = true;
                lblError1.Text        = "Must enter a Username and Password";
                txtPassword.Text      = null;
                txtUserName.Text      = null;
            }
            else if (userName == "admin" && passWord == "admin")
            {
                frmAdmin adminForm = new frmAdmin();
                adminForm.Show();
                this.Hide();
            }
            else if (userName == "driver" && passWord == "driver")
            {
                frmDriver driverForm = new frmDriver();
                driverForm.Show();
                this.Hide();
            }

            else
            {
                SqlConnection cn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Tyler Reymer\Desktop\BoozeRunProject_4_24_16\BoozeRunProject\bin\Debug\BoozeRunDB.mdf;Integrated Security=True"); //ERROR HERE

                cn.Open();

                SqlCommand    cmd = new SqlCommand("SELECT * FROM Customer WHERE Username ='******' AND Password='******'", cn);
                SqlDataReader dr;
                dr = cmd.ExecuteReader();

                int count = 0;

                while (dr.Read())
                {
                    count += 1;
                }

                if (count == 1)
                {
                    MessageBox.Show("Welcome " + userName + "!");
                    frmShop Shop = new frmShop();
                    Shop.Show();
                    this.Hide();
                }
                else if (count > 0)
                {
                    MessageBox.Show("Duplicate Username and Password");
                }
                else
                {
                    MessageBox.Show("Username or Password not correct");
                }

                cn.Close();
            }

            txtPassword.Clear();
            txtUserName.Clear();
        }