示例#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());
            }
        }
 public static void Run(clsAllComputers prDesktops)
 {
     Instance.SetDetails(prDesktops);
 }
 public static void DispatchComputerForm(clsAllComputers prComputers)
 {
     _ComputersForm[prComputers.Type].DynamicInvoke(prComputers);
 }
 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"));
 }