Esempio n. 1
0
        private void cmbPorderNo_SelectedIndexChanged(object sender, EventArgs e)
        {
            int pordrNo = Convert.ToInt32(cmbPorderNo.SelectedItem);
            DBPurchase_Item_reference i = new DBPurchase_Item_reference();

            DR = i.getItemNo(pordrNo);
            while (DR.Read())
            {
                metroComboBox1.Items.Add(DR[0].ToString());
            }
        }
        private void cmbporder_SelectedIndexChanged(object sender, EventArgs e)
        {
            /////editable add the validations
            DBPurchase_Item_reference p = new DBPurchase_Item_reference();
            int porder = Convert.ToInt32(cmbporder.SelectedItem);

            da = p.select(porder);
            DataTable dt = new DataTable();

            da.Fill(dt);
            dataGridView2.DataSource = dt;
        }
Esempio n. 3
0
        private void mtadd_Click(object sender, EventArgs e)
        {
            int error = 0;

            if (txtprice.Text.Length == 0 && txtstatus.Text.Length == 0 && txtqty.Text.Length == 0)
            {
                error = 1;
                MessageBox.Show("Please fill out all the fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            if (cmbitemname.SelectedIndex == 0)
            {
                error = 1;
                MessageBox.Show("Please select an Item Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (cmbsupname.SelectedIndex == 0)
            {
                error = 1;
                MessageBox.Show("Please select a Supplier Name", "Ërror", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (txtprice.Text.Any(Char.IsLetter))
            {
                error = 1;
                MessageBox.Show("Price cannot contain letters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (txtqty.Text.Any(Char.IsLetter))
            {
                error = 1;
                MessageBox.Show("Quantity cannot contain letters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (error != 1)
            {
                String      date    = txtdate.Text;
                String      status  = txtstatus.Text;
                String      supname = cmbsupname.SelectedItem.ToString();
                DBSupplier  sup     = new DBSupplier();
                int         sup_no  = sup.getSupNo(supname);
                DBPurchases dp      = new DBPurchases();
                int         po_no   = dp.setPurchaseOrder(date, status, count_tot, count_qty, Users_ID, sup_no);
                DBPurchase_Item_reference P_I_ref = new DBPurchase_Item_reference();
                foreach (DataGridViewRow Datarow in dataGridView1.Rows)
                {
                    if (Datarow.Cells[0].Value != null && Datarow.Cells[1].Value != null && Datarow.Cells[2].Value != null)
                    {
                        String itemName = dataGridView1.CurrentRow.Cells["Item_Name"].Value.ToString();
                        int    itemqty  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Item_Qty"].Value);
                        int    itemtot  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Sub_Total"].Value);
                        DBItem di       = new DBItem();
                        int    itemno   = di.getItemNo(itemName);
                        P_I_ref.setReference(po_no, itemno, itemqty, itemtot);
                    }
                }
            }
        }