private void textBoxSnoDefective_Leave(object sender, EventArgs e) { SqlDataReader dr = dbConnection.query("select sales.billno,billdetails.billdate,sales.productID,billdetails.custID from sales,billdetails where sales.billno=billdetails.billno and sales.serialno='" + textBoxSnoDefective.Text + "'"); if (dr.Read()) { textBoxBillNo.Text = dr[0].ToString(); textBoxBillDate.Text = dr[1].ToString(); prodid=dr[2].ToString(); int stockcount =Convert.ToInt32( dbConnection.executescalar("select count(product.productID) from product where productID='" + dr[2].ToString() + "' and salestatus='INSTOCK'")); customerid = dr[3].ToString(); if (stockcount == 0) { insufficientstock=true; DialogResult rs = MessageBox.Show("The Product is currently out of stock.\nDo you want to place an order?", "Out of stock", MessageBoxButtons.YesNo); if (rs == DialogResult.Yes) { OrderProducts ordprod = new OrderProducts(prodid, "1", customerid); ordprod.Show(); } } } else { MessageBox.Show("Product Not found in sold products. Please try again."); textBoxSnoDefective.Text = ""; textBoxSnoDefective.Focus(); } }
private void placeOrderToolStripMenuItem_Click(object sender, EventArgs e) { OrderProducts ordprods = new OrderProducts(); ordprods.MdiParent= MDImainwnd.ActiveForm; ordprods.Show(); }