Exemplo n.º 1
0
 public SaveReleaseNoteCommand(ReleaseNoteViewModel viewModel, IReleaseNoteRepositories repo, IUserNotify notify, ISecurityContext ctx)
 {
     this.viewModel = viewModel;
     this.repos = repo;
     this.notify = notify;
     this.ctx = ctx;
 }
Exemplo n.º 2
0
        public ReleaseNoteViewModel(IReleaseNoteRepositories repos, Guid id, IUserNotify notify, ISecurityContext ctx)
        {
            this.repos  = repos;
            this.notify = notify;
            this.ctx    = ctx;

            saveCommand   = ViewModelSource.Create(() => new SaveReleaseNoteCommand(this, repos, notify, ctx));
            shipCommand   = ViewModelSource.Create(() => new ShipReleaseNoteCommand(this, repos, notify, ctx));
            unshipCommand = ViewModelSource.Create(() => new UnshipReleaseNoteCommand(this, repos, notify, ctx));

            ReleaseNotePipes = new PlainPipeBindingList();
            if (id == Guid.Empty)
            {
                NewRailcar();
            }
            else
            {
                ReleaseNote = repos.ReleaseNoteRepo.Get(id);
                if (ReleaseNote == null)
                {
                    log.Error(string.Format("Release Note (id:{0}) does not exist.", id));
                    // TODO: user message? close document?
                }
                else
                {
                    IList <Pipe> pipes = repos.ReleaseNoteRepo.GetReleasedNotePipe(id);
                    foreach (var p in pipes)
                    {
                        ReleaseNotePipes.Add(new PlainPipe(p));
                    }
                }
            }
        }
Exemplo n.º 3
0
 public ShipReleaseNoteCommand(ReleaseNoteViewModel viewModel, IReleaseNoteRepositories repo, IUserNotify notify, ISecurityContext ctx)
 {
     this.viewModel = viewModel;
     this.repos     = repo;
     this.notify    = notify;
     this.ctx       = ctx;
 }
Exemplo n.º 4
0
        public ReleaseNoteViewModel(IReleaseNoteRepositories repos, Guid id, IUserNotify notify, ISecurityContext ctx)
        {
            try
            {
                this.repos  = repos;
                this.notify = notify;
                this.ctx    = ctx;

                saveCommand   = ViewModelSource.Create(() => new SaveReleaseNoteCommand(this, repos, notify, ctx));
                shipCommand   = ViewModelSource.Create(() => new ShipReleaseNoteCommand(this, repos, notify, ctx));
                unshipCommand = ViewModelSource.Create(() => new UnshipReleaseNoteCommand(this, repos, notify, ctx));

                ReleaseNotePipes = new PlainPipeBindingList();
                if (id == Guid.Empty)
                {
                    NewRailcar();
                }
                else
                {
                    ReleaseNote = repos.SimpleNoteRepo.Get(id);
                    if (ReleaseNote == null)
                    {
                        log.Error(string.Format("Release Note (id:{0}) does not exist.", id));
                        // TODO: user message? close document?
                    }
                    else
                    {
                        IList <SimplePipe> pipes = repos.SimpleNoteRepo.GetReleasedNotePipe(id);
                        foreach (var p in pipes)
                        {
                            ReleaseNotePipes.Add(new PlainPipe(p));
                        }
                    }
                }
            }
            catch (RepositoryException ex)
            {
                log.Warn(this.GetType().Name + " | " + ex.ToString());
                notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message),
                                   Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header));
            }
        }