private async void btnAdd_ClickAsync(object sender, EventArgs e) { if ((txtPlaceName.Text == "") || (txtCode.Text == "")) { MessageBox.Show("Please enter any value"); return; } string lcReply = new InputBox(clsAllProduct.FACTORY_PROMPT).Answer; if (!string.IsNullOrEmpty(lcReply)) { clsAllProduct lcProduct = clsAllProduct.NewProduct(lcReply); if (lcProduct != null) { if (txtPlaceName.Enabled) { pushData(); await ServiceClient.InsertPlaceAsync(_Place); txtPlaceName.Enabled = false; } lcProduct.PlaceName = _Place.PlaceName; frmProduct.DispatchWorkForm(lcProduct); if (!string.IsNullOrEmpty(lcProduct.ProductName)) { await refreshFormFromDBAsync(_Place.PlaceName); frmMain.Instance.UpdateDisplayAsync(); } } } }
internal static async Task <string> DeleteProductAsync(clsAllProduct prProduct) { using (HttpClient lcHttpClient = new HttpClient()) { HttpResponseMessage lcRespMessage = await lcHttpClient.DeleteAsync($"http://localhost:60064/api/product/DeleteProduct?ProductName={prProduct.ProductName}&PlaceName={prProduct.PlaceName}"); return(await lcRespMessage.Content.ReadAsStringAsync()); } }
public static void Run(clsAllProduct prProduct) { Getinstance.SetDetails(prProduct); }
public static void DispatchWorkForm(clsAllProduct prProduct) { _ProductsForm[prProduct.Category].DynamicInvoke(prProduct); //_ProductsForm["2"].DynamicInvoke(prProduct); }
public void SetDetails(clsAllProduct prProduct) { _Product = prProduct; updateForm(); ShowDialog(); }
internal static async Task <string> InsertProductAsync(clsAllProduct prProduct) { return(await InsertOrUpdateAsync(prProduct, "http://localhost:60064/api/product/PostProduct", "POST")); }
internal static async Task <string> UpdateProductAsync(clsAllProduct prProduct) { //throw new NotImplementedException(); return(await InsertOrUpdateAsync(prProduct, "http://localhost:60064/api/product/PutProduct", "PUT")); }