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();
            }
        }
        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();
            }
        }
Ejemplo n.º 4
0
        public void CreateNew(IDialogBoxPresenter result)
        {
            if (result.IsCancel == true)
            {
                return;
            }
            NewCalendarEvent.EventName = result.Text;

            var exception = _model.Save(NewCalendarEvent);

            result.ConfrimCallback(exception);

            if (exception == null)
            {
                AddToGroup(new[] { NewCalendarEvent });
                NotifyOfPropertyChange(() => ActiveTime);
            }
        }
Ejemplo n.º 5
0
        public void CreateNew(IDialogBoxPresenter result)
        {
            if (result.IsCancel == true) return;
            NewCalendarEvent.EventName = result.Text;

            var exception = _model.Save(NewCalendarEvent);

            result.ConfrimCallback(exception);

            if (exception == null)
            {
                AddToGroup(new[] { NewCalendarEvent });
                NotifyOfPropertyChange(() => ActiveTime);
            }
        }