Example #1
0
        private void BrandAdd_Click(object sender, EventArgs e)
        {
            BrandAdd brandAddForm = new BrandAdd();

            brandAddForm.Show();
            brandAddForm.FormClosed += childClose;
            this.Tag = tag_insert;
        }
Example #2
0
 public async Task PostBrand(BrandAdd brand)
 {
     using (HttpResponseMessage responseMessage = await _aPIHelper.ApiClient.PostAsJsonAsync("api/Brands", brand))
     {
         if (responseMessage.StatusCode == System.Net.HttpStatusCode.OK)
         {
             //ActivateItem(IoC.Get<Car2ViewModel>());
         }
         else
         {
             throw new Exception();
         }
     }
 }
Example #3
0
        private void updateBrand(object sender, EventArgs e)
        {
            Brand brand = (Brand)dataGridView1.CurrentRow.Tag;

            if (brand == null)
            {
                Tool.show("请选择一行");
                return;
            }

            BrandAdd brandAddForm = new BrandAdd();

            brandAddForm.Tag = brand;
            brandAddForm.update(brand);
            brandAddForm.Show();
            brandAddForm.FormClosed += childClose;
            this.Tag = tag_update;
        }
Example #4
0
        private void childClose(object sender, EventArgs e)
        {
            BrandAdd ba    = (BrandAdd)sender;
            Brand    brand = ba.brand;

            string tag = (string)this.Tag;

            if (tag.Equals(tag_insert))
            {
                dao.addBrand(brand);
            }
            else
            {
                dao.updateBrand(brand);
            }

            initData();
        }
Example #5
0
        public async Task AddBrand()
        {
            BrandAdd brand = new BrandAdd()
            {
                Name        = this.Name2,
                Country     = this.Country,
                Owner       = this.Owner,
                DateCreated = this.DateCreated
            };

            //
            try
            {
                await _brandEndPoint.PostBrand(brand);

                _addedViewModel.UpdateMessage("Komunikat", "Dodano rekord");
                _windowManager.ShowWindow(_addedViewModel);
            }
            catch
            {
                _addedViewModel.UpdateMessage("Ostrzeżenie", "Nie dodano rekord");
                _windowManager.ShowWindow(_addedViewModel);
            }
        }