public void SaveAsNew(IDialogBoxPresenter result)
        {
            if (result.IsCancel == true)
            {
                return;
            }

            var selectedType = AssignmentTypeCategories.CurrentItem.As <Type>();
            var source       = CurrentEntity;

            if (_assignmentTypeModel.DuplicationChecking(source, result.Text))
            {
                result.ConfrimCallback(new Exception("duplication of name"));
            }
            else
            {
                var newEntity    = _assignmentTypeModel.SaveAsNew(result.Text, selectedType, ref source);
                var newPresenter = _entityFactory.Create <IAssignmentTypeDetailPresenter>(new Dictionary <string, object> {
                    { "Entity", newEntity }
                });
                Cancel();
                AddToPresenters(newPresenter);
                Save();

                result.Close();
            }
        }
        public void CreateNew(IDialogBoxPresenter result)
        {
            if (result.IsCancel == true)
            {
                return;
            }

            var newEntity = _entityFactory.Create <TermStyle>((Type)AssignmentTypeCategories.CurrentItem);

            if (_assignmentTypeModel.DuplicationChecking(newEntity, result.Text))
            {
                result.ConfrimCallback(new Exception("duplication of name"));
            }
            else
            {
                newEntity.Name = result.Text;
                newEntity.Type = (Type)ImplementationTypes.CurrentItem;
                newEntity.SaftyInvoke <AssignmentType>(o =>
                {
                    o.TimeZone = TimeZoneInfo.Local;
                    o.Country  = Country.Local;
                });
                var newPresenter = _entityFactory.Create <IAssignmentTypeDetailPresenter>(new Dictionary <string, object> {
                    { "Entity", newEntity }
                });

                AddToPresenters(newPresenter);
                Save();
                result.Close();
            }
        }
示例#3
0
        public void Delete(IDialogBoxPresenter result)
        {
            if (result.IsCancel == true)
            {
                return;
            }

            CollectionViewSource.GetDefaultView(SelectedDayItemEventList).CurrentItem.SaftyInvoke <CalendarEvent>(x =>
            {
                _model.Delete(x);
                RemoveFromGroup(x);
                result.Close();
            });
        }
        public void Rename(IDialogBoxPresenter result)
        {
            if (result.IsCancel == true)
            {
                return;
            }

            if (_assignmentTypeModel.DuplicationChecking(CurrentEntity, result.Text))
            {
                result.ConfrimCallback(new Exception("duplication of name"));
            }
            else
            {
                CurrentEntity.Name = result.Text;
                Save();
                result.Close();
            }
        }
示例#5
0
        public void Delete(IDialogBoxPresenter result)
        {
            if (result.IsCancel == true) return;

            CollectionViewSource.GetDefaultView(SelectedDayItemEventList).CurrentItem.SaftyInvoke<CalendarEvent>(x =>
            {
                _model.Delete(x);
                RemoveFromGroup(x);
                result.Close();
            });
        }