//pushes the changes to the form to the database after performing checks private async void btnSubmit_Click(object sender, EventArgs e) { if (QuanityandPricePositive() == true && inputValid() == true) { pushData(); //DialogResult = DialogResult.OK; Q10 //if (inputValid() == true) //{ //Task3 6bxviii initiate inserting or updating artworks //---------------------------------------------------------------------------------------------------------- if (tbProductName.Enabled) { MessageBox.Show(await ServiceClient.InsertProductAsync(_Products)); } else { MessageBox.Show(await ServiceClient.UpdateProductAsync(_Products)); } Close(); } else { } }
private async void btnAdd_Click(object sender, EventArgs e) { try { string lcReply = new InputBox(clsAllProducts.FACTORY_PROMPT).Answer; if (!string.IsNullOrEmpty(lcReply)) { clsAllProducts lcProduct = clsAllProducts.NewProduct(lcReply[0]); if (lcProduct != null) { if (txtName.Enabled) { pushData(); await ServiceClient.InsertProductAsync(_DeviceType); txtName.Enabled = false; } lcProduct.DeviceTypeName = _DeviceType.Name; frmProduct.DispatchProductForm(lcProduct); if (!string.IsNullOrEmpty(lcProduct.ProductName)) { refreshFormFromDB(_DeviceType.Name); frmHome.Instance.updateDisplay(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } UpdateDisplay(); frmHome.Instance.updateDisplay(); }