Ejemplo n.º 1
0
        public IEnumerable <IResult> Save()
        {
            IsBusy = true;
            yield return(new SingleResult
            {
                Action = () =>
                {
                    if (IsEditMode)
                    {
                        if (CategoryId.HasValue)
                        {
                            repository.Update(CategoryId.Value, CategoryName.Trim(),
                                              SelectedCategoryType);
                        }
                        else
                        {
                            throw new Exception(
                                "Category ID is not specified for \"Update\" operation.");
                        }
                    }
                    else
                    {
                        repository.Create(CategoryName.Trim(), SelectedCategoryType);
                    }
                }
            });

            IsBusy = false;

            Close();
        }
Ejemplo n.º 2
0
        private void CreateCategory()
        {
            AssignedCategory = new Category(CategoryName.Trim());
            App.SongDb.AddCategory(AssignedCategory);

            /*
             * TODO: Remove this after testing
             * lock (((ICollection) App.SongDb.Columns).SyncRoot)
             * {
             *  App.SongDb.Columns.Add(
             *      new GridColumn(GridColumn.ColumnTypeEnum.Category,
             *          AssignedCategory, isVisible: false));
             * }
             */
        }
Ejemplo n.º 3
0
 public CustomerCategory(DataRow row)
 {
     CategoryId   = (short)row["CCCode"];
     CategoryName = (string)row["CCDesc"];
     CategoryName = CategoryName.Trim();
 }