Ejemplo n.º 1
0
        private void populateNonComboGrids()
        {
            string approvedSelect = "SELECT purchaseorder.po as 'Order #', supplier.supplier_name as 'Supplier', purchaseorder.creation_time as 'Order Creation Time', purchaseorder.postedUser as 'Posted By' FROM purchaseorder INNER JOIN supplier ON purchaseorder.supplier_code = supplier.supplier_code WHERE purchaseorder.approval = 'Approved'";

            DatabaseHandler.populateGridViewWithBinding(approvedSelect, dataGridView2);

            string pendingSelect = "SELECT purchaseorder.po as 'Order #', supplier.supplier_name as 'Supplier', purchaseorder.creation_time as 'Order Creation Time', purchaseorder.postedUser as 'Posted By' FROM purchaseorder INNER JOIN supplier ON purchaseorder.supplier_code = supplier.supplier_code WHERE purchaseorder.approval = 'Pending'";

            DatabaseHandler.populateGridViewWithBinding(pendingSelect, dataGridView3);
        }
        private void populateGrids()
        {
            string approvedSelect = "SELECT purchaseorder.po as 'Order #', supplier.supplier_name as 'Supplier', purchaseorder.creation_time as 'Order Creation Time', purchaseorder.postedUser as 'Posted By' FROM purchaseorder INNER JOIN supplier ON purchaseorder.supplier_code = supplier.supplier_code WHERE purchaseorder.approval = 'Approved' AND purchaseorder.recieved = 'No'";

            DatabaseHandler.populateGridViewWithBinding(approvedSelect, dataGridView1);

            string finishedSelect = "SELECT purchaseorder.po as 'Order #', supplier.supplier_name as 'Supplier', purchaseorder.creation_time as 'Order Creation Time', purchaseorder.postedUser as 'Posted By' FROM purchaseorder INNER JOIN supplier ON purchaseorder.supplier_code = supplier.supplier_code WHERE purchaseorder.approval = 'Approved' AND purchaseorder.recieved = 'Yes'";

            DatabaseHandler.populateGridViewWithBinding(finishedSelect, dataGridView2);
        }
Ejemplo n.º 3
0
        private void dataGridView3_Click(object sender, EventArgs e)
        {
            try
            {
                string val = dataGridView3.SelectedRows[0].Cells["Order #"].Value.ToString();

                string select = "SELECT po_item.po as 'Order #', po_item.item_code as 'Item Code', STORE.item_name as 'Item', po_item.qty as 'Qty' FROM po_item INNER JOIN STORE ON po_item.item_code = STORE.item_code WHERE po_item.po = '" + val + "'";
                DatabaseHandler.populateGridViewWithBinding(select, dataGridView5);
            }catch (Exception err)
            {
                Console.WriteLine(err);
            }
        }
 private void poNumTxt_TextChanged(object sender, EventArgs e)
 {
     if (System.Text.RegularExpressions.Regex.IsMatch(poNumTxt.Text, "[^0-9]"))
     {
         MessageBox.Show("Please enter only numbers.");
         poNumTxt.Text = poNumTxt.Text.Remove(poNumTxt.Text.Length - 1);
     }
     if (poNumTxt.Text == "")
     {
         string selectedPo = "SELECT purchaseorder.po as 'Order #', supplier.supplier_name as 'Supplier', purchaseorder.creation_time as 'Order Creation Time', purchaseorder.postedUser as 'Posted By' FROM purchaseorder INNER JOIN supplier ON purchaseorder.supplier_code = supplier.supplier_code WHERE purchaseorder.approval = 'Approved' AND purchaseorder.recieved='No'";
         DatabaseHandler.populateGridViewWithBinding(selectedPo, dataGridView1);
     }
 }
        private void populateItemGrid(DataGridView dataGridView)
        {
            try
            {
                string val = dataGridView.SelectedRows[0].Cells["Order #"].Value.ToString();

                string select = "SELECT ro_item.ro as 'Order #', ro_item.item_code as 'Item Code', STORE.item_name as 'Item', ro_item.qty as 'Qty' FROM ro_item INNER JOIN STORE ON ro_item.item_code = STORE.item_code WHERE ro_item.ro = '" + val + "'";
                DatabaseHandler.populateGridViewWithBinding(select, dataGridView6);
            }
            catch (Exception err)
            {
                Console.WriteLine(err);
            }
        }
        private void populateDataGrid()
        {
            string selectStatement = "SELECT STORE.item_code as 'Item Code', STORE.item_name as 'Item Name', STORE.description as 'Item Description', STORE.qty as 'Available Quantity', SUPPLIER.supplier_name as 'Supplier' FROM STORE INNER JOIN SUPPLIER ON STORE.supplier_code = SUPPLIER.supplier_code";

            DatabaseHandler.populateGridViewWithBinding(selectStatement, dataGridView5);

            string selectStatement1 = "SELECT requestorder.ro as 'Order #', client.hospital as 'Client Name', requestorder.creation_time as 'Posted Time', requestorder.postedUser as 'User' FROM requestorder inner join client on requestorder.client_code = client.identifier_code WHERE requestorder.approval = 'Pending' AND requestorder.released='No'";

            DatabaseHandler.populateGridViewWithBinding(selectStatement1, dataGridView1);

            string selectStatement2 = "SELECT requestorder.ro as 'Order #', client.hospital as 'Client Name', requestorder.creation_time as 'Posted Time', requestorder.postedUser as 'User' FROM requestorder inner join client on requestorder.client_code = client.identifier_code WHERE requestorder.approval = 'Approved' AND requestorder.released='No'";

            DatabaseHandler.populateGridViewWithBinding(selectStatement2, dataGridView2);

            string selectStatement3 = "SELECT requestorder.ro as 'Order #', client.hospital as 'Client Name', requestorder.creation_time as 'Posted Time', requestorder.postedUser as 'User' FROM requestorder inner join client on requestorder.client_code = client.identifier_code WHERE requestorder.approval = 'Approved' AND requestorder.released='Yes'";

            DatabaseHandler.populateGridViewWithBinding(selectStatement3, dataGridView3);
        }
        private void applyBtn_Click(object sender, EventArgs e)
        {
            string poNum = poNumTxt.Text;
            List <MySqlParameter> paramList = new List <MySqlParameter>();

            paramList.Add(new MySqlParameter("@poNum", poNum));
            paramList.Add(new MySqlParameter("@recieved", "No"));
            paramList.Add(new MySqlParameter("@approval", "Approved"));

            int returnedRowCount = DatabaseHandler.returnRowCount("SELECT*FROM purchaseorder WHERE po = @poNum AND recieved=@recieved AND approval=@approval", paramList);

            if (returnedRowCount == 1)
            {
                poNumTxt.Enabled = false;
                string select = "select supplier.supplier_name from purchaseorder inner join supplier on purchaseorder.supplier_code = supplier.supplier_code where purchaseorder.po ='" + poNum + "'";
                string returnedSupplierName = DatabaseHandler.returnOneValueWithoutParams(select, "supplier_name");
                supplierNameLbl.Text = returnedSupplierName;

                string query = "SELECT po_item.item_code as 'Item Code', STORE.item_name as 'Item', po_item.qty as 'Qty' FROM po_item INNER JOIN STORE ON po_item.item_code = STORE.item_code WHERE po_item.po = '" + poNum + "'";
                DatabaseHandler.populateGridViewWithBinding(query, dataGridView3);

                string selectedPo = "SELECT purchaseorder.po as 'Order #', supplier.supplier_name as 'Supplier', purchaseorder.creation_time as 'Order Creation Time', purchaseorder.postedUser as 'Posted By' FROM purchaseorder INNER JOIN supplier ON purchaseorder.supplier_code = supplier.supplier_code WHERE purchaseorder.approval = 'Approved' AND purchaseorder.po='" + poNum + "'";
                DatabaseHandler.populateGridViewWithBinding(selectedPo, dataGridView1);

                commitBtn.Enabled = true;
            }
            else
            {
                poNumTxt.Enabled = true;
                MessageBox.Show("No such uncommited Purchase Order or the Order may not be approved. Please Try again..");
                poNumTxt.Clear();
                dataGridView3.DataSource = null;
                dataGridView3.Refresh();

                supplierNameLbl.Text = "";
            }
        }
        private void itemName_TextChanged(object sender, EventArgs e)
        {
            string selectStatement = "SELECT STORE.item_code as 'Item Code', STORE.item_name as 'Item Name', STORE.description as 'Item Description', STORE.qty as 'Available Quantity', SUPPLIER.supplier_name as 'Supplier' FROM STORE INNER JOIN SUPPLIER ON STORE.supplier_code = SUPPLIER.supplier_code WHERE STORE.item_name like '%" + itemNameTxt.Text + "%'";

            DatabaseHandler.populateGridViewWithBinding(selectStatement, dataGridView5);
        }
        private void manualProductId_TextChanged(object sender, EventArgs e)
        {
            string query = "SELECT item_code as 'Item Code', item_name as 'Item Name', qty as 'Available Quantity', description as 'Description' FROM STORE WHERE item_code like '%" + findProductId.Text + "%'";

            DatabaseHandler.populateGridViewWithBinding(query, dataGridView1);
        }
        private void populateGrid()
        {
            string query = "SELECT item_code as 'Item Code', item_name as 'Item Name', qty as 'Available Quantity', description as 'Description'FROM STORE";

            DatabaseHandler.populateGridViewWithBinding(query, dataGridView1);
        }