示例#1
0
        private async void add_Click(object sender, EventArgs e)
        {
            try
            {
                string lcReply = new InputBox(clsBag.FACTORY_PROMPT).Answer;
                if (!string.IsNullOrEmpty(lcReply)) // not cancelled?
                {
                    clsBag lcBag = clsBag.NewWork(lcReply[0]);
                    if (lcBag != null)        // valid bag created?
                    {
                        if (textBox1.Enabled) // new bag not saved?
                        {
                            pushData();
                            await ServiceClient.InsertBrandAsync(_brand);

                            textBox1.Enabled = false;
                        }
                        lcBag.bag_brand_id = _brand.brand_name;
                        frmBag.DispatchWorkForm(lcBag);
                        if (!string.IsNullOrEmpty(lcBag.bag_name)) // not cancelled?
                        {
                            _Instance.UpdateDisplay();
                            frmMain.Instance.UpdateDisplay();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
示例#2
0
        internal async static Task <string> DeleteBagAsync(clsBag prBag)
        {
            using (HttpClient lcHttpClient = new HttpClient())
            {
                HttpResponseMessage lcRespMessage = await lcHttpClient.DeleteAsync
                                                        ($"http://localhost:60064/api/Bag/DeleteBag?Name={prBag.bag_name}");

                return(await lcRespMessage.Content.ReadAsStringAsync());
            }
        }
示例#3
0
 public void SetDetails(clsBag prBag)
 {
     _Bag = prBag;
     updateForm();
     ShowDialog();
 }
示例#4
0
 internal async static Task <string> InsertBagAsync(clsBag _Bag)
 {
     return(await InsertOrUpdateAsync(_Bag, "http://localhost:60064/api/Bag/PostBag", "POST"));
 }
示例#5
0
 public static void DispatchWorkForm(clsBag prBag)
 {
     _BagsForm[prBag.bag_catergory].DynamicInvoke(prBag);
 }