コード例 #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            //Take the information from the Textboxes and put them into the DVG, (THIS WAS HARD SINCE IT HAS NO DATABASE)
            int    n     = 0;
            double total = Convert.ToDouble(ProdPriceTb1.Text) * Convert.ToInt32(ProdQtyTb1.Text);

            if (ProdNameTb1.Text == "" || ProdQtyTb1.Text == "" || ProdPriceTb1.Text == "")
            {
                MessageBox.Show("Need to put in more data");
            }
            else
            {
                DataGridViewRow dataGridViewRow = new DataGridViewRow();
                dataGridViewRow.CreateCells(OrderDVG);

                dataGridViewRow.Cells[0].Value = ProdNameTb1.Text.ToString();
                dataGridViewRow.Cells[1].Value = ProdPriceTb1.Text.ToString();
                dataGridViewRow.Cells[2].Value = ProdQtyTb1.Text.ToString();
                dataGridViewRow.Cells[3].Value = Convert.ToDouble(ProdPriceTb1.Text) * Convert.ToInt32(ProdQtyTb1.Text);
                OrderDVG.Rows.Add(dataGridViewRow);
                FinalTotal        += total;
                FinalTotallbl.Text = "" + FinalTotal;
                BillIdTb.Text      = "";
                ProdNameTb1.Text   = "";
                ProdPriceTb1.Text  = "";
                ProdQtyTb1.Text    = "";
                BillIdTb.Focus();
            }
        }
コード例 #2
0
        private void button9_Click(object sender, EventArgs e)
        {
            //Adding into the total sales

            Con.Open();
            string     query = "insert into TotalSales values(" + BillIdTb.Text + ", '" + SellerNamelbl.Text + "', '" + FinalTotallbl.Text + "')";
            SqlCommand cmd   = new SqlCommand(query, Con);

            cmd.ExecuteNonQuery();
            MessageBox.Show("Category Added Successfully");
            Con.Close();
            populate();
            BillIdTb.Text     = "";
            ProdNameTb1.Text  = "";
            ProdPriceTb1.Text = "";
            ProdQtyTb1.Text   = "";
            BillIdTb.Focus();
        }