/// <summary> ///Pre-Condition: A cell is selected ///Post-Condition: A form is opened filled with the data of the selected row ///Description: Opens a form associated with the selected cell and information in the data grid view /// </summary> /// <param name="pkID"></param> private void openSelected(long pkID) { switch (SearchCategory) { case "Customer": frm_Customers frmCustomers; if (pkID <= -1) frmCustomers = new frm_Customers(blnCanWrite); else frmCustomers = new frm_Customers(pkID, blnCanWrite); frmCustomers.MdiParent = this.MdiParent; frmCustomers.Show(); break; case "Supplier": frm_Suppliers frmSuppliers; if (pkID <= -1) frmSuppliers = new frm_Suppliers(blnCanWrite); else frmSuppliers = new frm_Suppliers(pkID, blnCanWrite); frmSuppliers.MdiParent = this.MdiParent; frmSuppliers.Show(); break; case "Employee": frm_Employee frmEmployee; if (pkID == -1) frmEmployee = new frm_Employee(blnCanWrite); else frmEmployee = new frm_Employee(pkID, blnCanWrite); frmEmployee.MdiParent = this.MdiParent; frmEmployee.Show(); break; case "Product": frm_Product frmProduct; if (pkID == -1) frmProduct = new frm_Product(blnCanWrite); else frmProduct = new frm_Product(pkID, blnCanWrite); frmProduct.MdiParent = this.MdiParent; frmProduct.Show(); break; case "RawIngredient": frm_RawIngredients frmRawIngredients; if (pkID == -1) frmRawIngredients = new frm_RawIngredients(blnCanWrite); else frmRawIngredients = new frm_RawIngredients(pkID, blnCanWrite); frmRawIngredients.MdiParent = this.MdiParent; frmRawIngredients.Show(); break; case "Sale": frm_Sale frmSale; if (pkID <= 0) frmSale = new frm_Sale(blnCanWrite); else frmSale = new frm_Sale(pkID, blnCanWrite); frmSale.MdiParent = this.MdiParent; frmSale.Show(); break; case "Order": frm_Order frmOrder; if (pkID <= 0) frmOrder = new frm_Order(blnCanWrite); else frmOrder = new frm_Order(pkID, blnCanWrite); frmOrder.MdiParent = this.MdiParent; frmOrder.Show(); break; } }
private void vts_Order_New_Click(object sender, EventArgs e) { if (!isDenied("frm_Order")) { frm_Order frmOrder = new frm_Order(canWrite("frm_Order")); frmOrder.MdiParent = this; frmOrder.Show(); } else MessageBox.Show("Access denied. Contact network administrator to gain access"); }