public NewSavePipeCommand(
     MillPipeNewEditViewModel viewModel,
     IMillRepository repo,
     IUserNotify notify,
     ISecurityContext ctx)
 {
     this.viewModel = viewModel;
     this.repo = repo;
     this.notify = notify;
     this.ctx = ctx;
 }
Example #2
0
 public NewSavePipeCommand(
     MillPipeNewEditViewModel viewModel,
     IMillRepository repo,
     IUserNotify notify,
     ISecurityContext ctx)
 {
     this.viewModel = viewModel;
     this.repo      = repo;
     this.notify    = notify;
     this.ctx       = ctx;
 }
Example #3
0
        public MillPipeSearchViewModel(
            IMillRepository repoMill,
            IUserNotify notify)
        {
            this.repoMill = repoMill;
            this.notify   = notify;

            searchCommand = ViewModelSource.Create <MillPipeSearchCommand>(
                () => new MillPipeSearchCommand(this, repoMill.RepoPipe, notify));

            pipeTypes        = repoMill.RepoPipeType.GetAll();
            checkedPipeTypes = repoMill.RepoPipeType.GetAll();

            LoadStatuses();
        }
Example #4
0
        public MillPipeSearchViewModel(
            IMillRepository repoMill,
            IUserNotify notify)
        {
            try
            {
                this.repoMill = repoMill;
                this.notify   = notify;

                searchCommand = ViewModelSource.Create <MillPipeSearchCommand>(
                    () => new MillPipeSearchCommand(this, repoMill.RepoPipe, notify));

                pipeTypes        = repoMill.RepoPipeType.GetAll();
                checkedPipeTypes = repoMill.RepoPipeType.GetAll();

                LoadStatuses();
            }
            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));
            }
        }
        public MillPipeSearchViewModel(
            IMillRepository repoMill,
            IUserNotify notify)
        {
            try
            {
                this.repoMill = repoMill;
                this.notify = notify;

                searchCommand = ViewModelSource.Create<MillPipeSearchCommand>(
                    () => new MillPipeSearchCommand(this, repoMill.RepoPipe, notify));

                pipeTypes = repoMill.RepoPipeType.GetAll();
                checkedPipeTypes = repoMill.RepoPipeType.GetAll();

                LoadStatuses();
            }
            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));
            }
        }
        public MillPipeNewEditViewModel(IMillRepository repoMill, Guid id, IUserNotify notify, ISecurityContext ctx)
        {
            this.repoMill = repoMill;
            this.notify   = notify;
            this.PipeId   = id;
            this.ctx      = ctx;

            #region Commands creation
            pipeDeactivationCommand =
                ViewModelSource.Create(() => new PipeDeactivationCommand(this, repoMill, notify, ctx));

            newSavePipeCommand =
                ViewModelSource.Create(() => new NewSavePipeCommand(this, repoMill, notify, ctx));

            savePipeCommand =
                ViewModelSource.Create(() => new SavePipeCommand(this, repoMill, notify, ctx));

            extractHeatsCommand =
                ViewModelSource.Create(() => new ExtractHeatsCommand(this, repoMill.RepoHeat, notify));

            extractPurchaseOrderCommand =
                ViewModelSource.Create(() => new ExtractPurchaseOrderCommand(this, repoMill.RepoPurchaseOrder));

            extractPipeTypeCommand =
                ViewModelSource.Create(() => new ExtractPipeTypeCommand(this, repoMill.RepoPipeType));

            getPipeCommand =
                ViewModelSource.Create(() => new GetPipeCommand(this, repoMill));

            getProjectCommand =
                ViewModelSource.Create(() => new GetProjectCommand(this, repoMill.RepoProject));
            #endregion

            this.GetProjectCommand.Execute();
            this.mill = Project.MillName;

            if (id == Guid.Empty)
            {
                NewPipe();
            }
            else
            {
                extractPurchaseOrderCommand.Execute();
                extractHeatsCommand.Execute();
                extractPipeTypeCommand.Execute();
                getPipeCommand.Execute();
                GetAllPipeTestResults();
                PipeNotifier = NotificationService.Instance.NotRequiredOperationManager.CreateNotifier(Pipe);
                SelectiveOperationPipeNotifier = NotificationService.Instance.SelectiveOperationManager.CreateNotifier(Pipe);
            }

            Welders = repoMill.WelderRepo.GetAll();
            if (this.Welders == null || this.Welders.Count <= 0)
            {
                log.Warn(string.Format("Pipe (id:{0}) creation: List of Welders is NULL or empty", id));
            }

            Inspectors = repoMill.RepoInspector.GetAll();
            if (this.Inspectors == null || this.Inspectors.Count <= 0)
            {
                log.Warn(string.Format("Pipe (id:{0}) creation: List of Inspectors is NULL or empty", id));
            }

            GetAvailableTests();

            foreach (string controlTypeName in Enum.GetNames(typeof(PipeTestResultStatus)))
            {
                if (controlTypeName != Enum.GetName(typeof(PipeTestResultStatus), PipeTestResultStatus.Undefined))
                {
                    TestResultStatuses.Add(new EnumWrapper <PipeTestResultStatus>()
                    {
                        Value = (PipeTestResultStatus)Enum.Parse(typeof(PipeTestResultStatus), controlTypeName)
                    }
                                           );
                }
            }

            LoadPipeMillStatuses();
        }
Example #7
0
 public GetPipeCommand(MillPipeNewEditViewModel viewModel, IMillRepository repo)
 {
     this.viewModel = viewModel;
     this.repo      = repo;
 }
        public MillPipeNewEditViewModel(IMillRepository repoMill, Guid id, IUserNotify notify, ISecurityContext ctx)
        {
            this.repoMill = repoMill;
            this.notify = notify;
            this.PipeId = id;
            this.ctx = ctx;

            #region Commands creation
            pipeDeactivationCommand =
                ViewModelSource.Create(() => new PipeDeactivationCommand(this, repoMill, notify, ctx));

            newSavePipeCommand =
                ViewModelSource.Create(() => new NewSavePipeCommand(this, repoMill, notify, ctx));

            savePipeCommand =
                ViewModelSource.Create(() => new SavePipeCommand(this, repoMill, notify, ctx));

            extractHeatsCommand =
                ViewModelSource.Create(() => new ExtractHeatsCommand(this, repoMill.RepoHeat, notify));

            extractPurchaseOrderCommand =
                ViewModelSource.Create(() => new ExtractPurchaseOrderCommand(this, repoMill.RepoPurchaseOrder));

            extractPipeTypeCommand =
                ViewModelSource.Create(() => new ExtractPipeTypeCommand(this, repoMill.RepoPipeType));

            getPipeCommand =
                ViewModelSource.Create(() => new GetPipeCommand(this, repoMill));

            getProjectCommand =
                ViewModelSource.Create(() => new GetProjectCommand(this, repoMill.RepoProject));
            #endregion

            this.GetProjectCommand.Execute();
            this.mill = Project.MillName;

            if(id == Guid.Empty)
            {
                NewPipe();
            }
            else
            {
                extractPurchaseOrderCommand.Execute();
                extractHeatsCommand.Execute();
                extractPipeTypeCommand.Execute();
                getPipeCommand.Execute();
                GetAllPipeTestResults();
                PipeNotifier = NotificationService.Instance.NotRequiredOperationManager.CreateNotifier(Pipe);
                SelectiveOperationPipeNotifier = NotificationService.Instance.SelectiveOperationManager.CreateNotifier(Pipe);
            }

            Welders = repoMill.WelderRepo.GetAll();
            if(this.Welders == null || this.Welders.Count <= 0)
                log.Warn(string.Format("Pipe (id:{0}) creation: List of Welders is NULL or empty", id));

            Inspectors = repoMill.RepoInspector.GetAll();
            if(this.Inspectors == null || this.Inspectors.Count <= 0)
                log.Warn(string.Format("Pipe (id:{0}) creation: List of Inspectors is NULL or empty", id));

            GetAvailableTests();

            foreach(string controlTypeName in Enum.GetNames(typeof(PipeTestResultStatus)))
            {
                if(controlTypeName != Enum.GetName(typeof(PipeTestResultStatus), PipeTestResultStatus.Undefined))
                    TestResultStatuses.Add(new EnumWrapper<PipeTestResultStatus>()
                    {
                        Value = (PipeTestResultStatus)Enum.Parse(typeof(PipeTestResultStatus), controlTypeName)
                    }
                    );
            }

            LoadPipeMillStatuses();
        }
Example #9
0
 public GetPipeCommand(MillPipeNewEditViewModel viewModel, IMillRepository repo)
 {
     this.viewModel = viewModel;
     this.repo = repo;
 }