Ejemplo n.º 1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            PrintArea printArea = new PrintArea();
            //Transfering content of dgvInvoice and txtGTotal to PrintArea.dgvPrint and PrintArea.txtPrintTotal
            String dateNow = DateTime.Now.ToString(), tDate = DateTime.Now.ToShortDateString();
            String tTime = DateTime.Now.ToShortTimeString();



            String transactionId = "TTc" + dateNow;

            foreach (DataGridViewRow dr in this.dgvInvoice.SelectedRows)
            {
                String insertQuery = "INSERT INTO business_transaction(TRANSACTION_ID, TRANSACTION_DATE, TRANSACTION_TIME, ITEM_SOLD, QUANTITY_SOLD) VALUES ('" + transactionId + "','" + tDate + "','" + tTime + "','" + dr.Cells[0].Value + "', '" + dr.Cells[2].Value + "') ";

                dbConnect connect = new dbConnect();
                connect.Insert(insertQuery);


                //printArea.dgvPrintF.Rows.Add(dr.Cells[0].Value, dr.Cells[1].Value, dr.Cells[2].Value, dr.Cells[3].Value);
            }


            //printArea.txtPrintTotal.Text = this.txtGTotal.Text;
            dgvInvoice.Rows.Clear();
            txtGTotal.Text = "";
            MessageBox.Show("Transaction Completed Successfully");
            //printArea.Show();
            //this.Hide();
        }
Ejemplo n.º 2
0
 //Add employee Data
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         String    insertQuery = "INSERT INTO employee(STAFF_ID, FIRST_NAME, LAST_NAME, GENDER, DATE_OF_BIRTH, USER_TYPE, USER_PASSWORD, SECURITY_QUESTION, ANSWER) VALUES ('" + txtStaff_id.Text + "','" + txtFName.Text + "','" + txtLName.Text + "','" + cmbGender.Text + "','" + dtpDod.Text + "','" + cmbUserType.Text + "','" + txtPassword.Text + "','" + cmbSQ.Text + "','" + txtAnswer.Text + "') ";
         dbConnect connect     = new dbConnect();
         connect.Insert(insertQuery);
         MessageBox.Show("Data Inserted Successfully");
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     }
     loadEmployee();
 }
Ejemplo n.º 3
0
        //Add Product
        private void btnInsertP_Click(object sender, EventArgs e)
        {
            String    insertQuery = "INSERT INTO products(PRODUCT_ID, PRODUCT_NAME, QUANTITY, PRICE ) VALUES ('" + txtPID.Text + "','" + txtPName.Text + "','" + txtQty.Text + "','" + txtPrice.Text + "') ";
            dbConnect connect     = new dbConnect();

            if (txtPID.Text != "" && txtPName.Text != "" && txtQty.Text != "" && txtPrice.Text != "")
            {
                connect.Insert(insertQuery);

                MessageBox.Show("Product Inserted Successfully");
            }
            else
            {
                MessageBox.Show("Invalid Entry");
            }
            loadProduct();
        }