/// <summary>
 /// This method invokes a method for showing a window for editing product.
 /// </summary>
 public void EditProductExecute()
 {
     try
     {
         EditProductView editProductView = new EditProductView(Product);
         editProductView.ShowDialog();
         ProductList = products.ViewAllProduct();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 2
0
 private void ItemEditProduct_Click(object sender, EventArgs e)
 {
     if (dv.SelectedRows.Count == 1)
     {
         long id      = (long)dv.SelectedRows[0].Cells["MSP"].Value;
         var  Product = result.Where(p => p.product_id == id).FirstOrDefault();
         if (Product != null)
         {
             using (EditProductView view = new EditProductView(getParent().controller, Product))
             {
                 view.ShowDialog();
                 if (view.IsChange)
                 {
                     Product = view.product;
                 }
             }
         }
     }
     else
     {
         if (dv.SelectedCells.Count == 1)
         {
             long id      = (long)dv.Rows[dv.SelectedCells[0].RowIndex].Cells["MSP"].Value;
             var  Product = result.Where(p => p.product_id == id).FirstOrDefault();
             if (Product != null)
             {
                 using (EditProductView view = new EditProductView(getParent().controller, Product))
                 {
                     view.ShowDialog();
                     if (view.IsChange)
                     {
                         Product = view.product;
                     }
                 }
             }
         }
         else
         {
             Functions.ShowMessgeError("Chưa chọn dữ liệu để đổi");
         }
     }
 }
Exemplo n.º 3
0
 private void AddExecute()
 {
     if (this.ProductViewModels.Count < _limitCount)
     {
         EditProductView view = new EditProductView();
         List <Product>  list = new List <Product>();
         foreach (var item in ProductViewModels)
         {
             list.Add(new Product {
                 Url = item.Url
             });
         }
         EditProductViewModel viewModel = new EditProductViewModel(list);
         viewModel.SaveCompleted += viewModel_SaveCompleted;
         view.DataContext         = viewModel;
         view.ShowDialog();
     }
     else
     {
         string message = string.Format("最多只能同时监控{0}个商品", _limitCount);
         MessageBox.Show(message);
     }
 }