/************************************Inventory************************************************************/ public void Load(object sender, EventArgs e) { _view = (InventoryForm)((InventoryForm)sender).FindForm(); servicesTable = franchisee_inventory.getServices(user.getFranchiseeId(_view.getUser())); productsTable = franchisee_inventory.getProducts(user.getFranchiseeId(_view.getUser())); DataTable categoryTable = category.get(); DataTable supplierTable = supplier.get(); _view.getCategory().DataSource = categoryTable; _view.getCategory().DisplayMember = "type"; _view.getCategory().ValueMember = "id"; _view.getSupplier().DataSource = supplierTable; _view.getSupplier().DisplayMember = "name"; _view.getSupplier().ValueMember = "service_id"; fillProductcombo(); fillServicecombo(); try { _view.SetProductsTable(productsTable); _view.SetServicesTable(servicesTable); } catch (InvalidCastException ef) { MessageBox.Show("Incorrect data was loaded in this form."); } }
public void addService_btn_Click(object sender, EventArgs e) { _view = (InventoryForm)((Button)sender).FindForm(); franchisee_inventory.insertService(user.getFranchiseeId(_view.getUser()), _view.getServiceName(), _view.getServiceDescription(), _view.getServicePrice()); servicesTable = franchisee_inventory.getServices(user.getFranchiseeId(_view.getUser())); _view.SetServicesTable(servicesTable); fillServicecombo(); }