예제 #1
0
 protected override bool OnNew()
 {
     this.CurrentOperation        = FormOperation.Adicionando;
     this.CurrentDocument         = new DocumentModel();
     CurrentDocument.FILE         = new FileModel();
     this.CurrentDocument.FILE_ID = 0;
     if (CategoryList != null && CategoryList.Count() > 0)
     {
         this.CurrentDocument.CATEGORY_ID = CategoryList.First().ID;
     }
     return(true);
 }
 public void DeleteCategory(object item)
 {
     if (CanDeleteCategory(null))
     {
         bool result = false;
         result = CategoriesClient.DeleteCategory(SelectedCategory.ProductCategoryID);
         if (result)
         {
             CategoryData categoryJustDeleted = CategoryList.First(c => c.ProductCategoryID == SelectedCategory.ProductCategoryID);
             CategoryList.Remove(categoryJustDeleted);
             MessageBox.Show("Delete successful");
         }
         else
         {
             MessageBox.Show("Delete failed");
         }
     }
 }