コード例 #1
0
        private async void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                string lcReply = new frmComputerDecision(clsAllComputers.FACTORY_PROMPT).Answer;
                if (!string.IsNullOrEmpty(lcReply))
                {
                    clsAllComputers lcComputer = clsAllComputers.NewComputer(lcReply[0]);
                    if (lcComputer != null)
                    {
                        if (txtName.Enabled)
                        {
                            pushData();
                            await ServiceClient.InsertBrandAsync(_Brand);

                            txtName.Enabled = false;
                        }
                        lcComputer.BrandName = _Brand.Name;
                        frmComputer.DispatchComputerForm(lcComputer);
                        if (!string.IsNullOrEmpty(lcComputer.Name))
                        {
                            refreshFormFromDB(_Brand.Name);
                            frmMain.Instance.UpdateDisplay();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        internal async static Task <string> DeleteComputerAsync(clsAllComputers prComputers)
        {
            using (HttpClient lcHttpClient = new HttpClient())
            {
                HttpResponseMessage lcRespMessage = await lcHttpClient.DeleteAsync
                                                        ($"http://localhost:12292/api/ComputerSales/DeleteComputer?ComputerName={prComputers.Name}&BrandName={prComputers.BrandName}");

                return(await lcRespMessage.Content.ReadAsStringAsync());
            }
        }
コード例 #3
0
 public static void Run(clsAllComputers prDesktops)
 {
     Instance.SetDetails(prDesktops);
 }
コード例 #4
0
 public static void DispatchComputerForm(clsAllComputers prComputers)
 {
     _ComputersForm[prComputers.Type].DynamicInvoke(prComputers);
 }
コード例 #5
0
 public void SetDetails(clsAllComputers prComputers)
 {
     _Computers = prComputers;
     updateForm();
     ShowDialog();
 }
コード例 #6
0
 internal async static Task <string> UpdateComputersAsync(clsAllComputers prComputers)
 {
     return(await InsertOrUpdateAsync(prComputers, "http://localhost:12292/api/ComputerSales/UpdateComputer", "PUT"));
 }