Beispiel #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            //validation

            SqlConnection sqlCon = new SqlConnection(connectionString);


            sqlCon.Open();


            //insertition of data into database
            string query = " Insert into STOCK_MASTER_FILE ([Stock_Description],[Cost],[Selling_Price],[Qty_Purchased]) Values ('" + tbStockDesc.Text + "','" + Decimal.Parse(tbCost.Text) + "','" + Decimal.Parse(tbSelling.Text) + "','" + int.Parse(tbPurch.Text) + "','" + int.Parse(tbSold.Text) + "')";

            //logic for calculations
            string query1 = "SELECT Qty_Purchased*Cost AS Total_Purchases_Excl_Vat , Qty_Purchased-Qty_Sold AS Stock_On_Hand, Qty_Sold*Selling_Price AS Total_Sales_Excl_Vat  FROM STOCK_MASTER_FILE";

            SqlCommand sqlCmd = new SqlCommand(query, sqlCon);

            sqlCmd.ExecuteNonQuery();

            //open new window
            StockMaster main = new StockMaster();

            main.Show();
            this.Close();
        }
Beispiel #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            //open new window
            StockMaster main = new StockMaster();

            main.Show();
            this.Close();
        }
Beispiel #3
0
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            //validation

            SqlConnection sqlCon = new SqlConnection(connectionString);


            sqlCon.Open();


            //insertition of data into database
            string     query  = " Insert into Debtors_Master ([Name],[Address1],[Address2],[Address3]) Values ('" + tbName.Text + "','" + tbAdd1.Text + "','" + tbAdd2.Text + "','" + tbAdd3.Text + "')";
            SqlCommand sqlCmd = new SqlCommand(query, sqlCon);

            sqlCmd.ExecuteNonQuery();

            //open new window
            StockMaster main = new StockMaster();

            main.Show();
            this.Close();
        }