コード例 #1
0
        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();
                    }
                }
            }
        }
コード例 #2
0
        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());
            }
        }
コード例 #3
0
 public static void Run(clsAllProduct prProduct)
 {
     Getinstance.SetDetails(prProduct);
 }
コード例 #4
0
 public static void DispatchWorkForm(clsAllProduct prProduct)
 {
     _ProductsForm[prProduct.Category].DynamicInvoke(prProduct);
     //_ProductsForm["2"].DynamicInvoke(prProduct);
 }
コード例 #5
0
 public void SetDetails(clsAllProduct prProduct)
 {
     _Product = prProduct;
     updateForm();
     ShowDialog();
 }
コード例 #6
0
 internal static async Task <string> InsertProductAsync(clsAllProduct prProduct)
 {
     return(await InsertOrUpdateAsync(prProduct, "http://localhost:60064/api/product/PostProduct", "POST"));
 }
コード例 #7
0
 internal static async Task <string> UpdateProductAsync(clsAllProduct prProduct)
 {
     //throw new NotImplementedException();
     return(await InsertOrUpdateAsync(prProduct, "http://localhost:60064/api/product/PutProduct", "PUT"));
 }