Execute() private method

private Execute ( ) : void
return void
        public void NewPipe()
        {
            currentType = new PipeMillSizeType();
            extractPurchaseOrderCommand.Execute();
            extractHeatsCommand.Execute();
            extractPipeTypeCommand.Execute();

            this.Pipe = new Pipe();
            this.PipePurchaseOrder = null;
            this.Heat                    = null;
            this.PlateNumber             = string.Empty;
            this.Pipe.IsActive           = true;
            this.Pipe.IsAvailableToJoint = true;
            this.Pipe.Status             = PipeMillStatus.Produced;
            this.Pipe.ConstructionStatus = Domain.Entity.Construction.PartConstructionStatus.Pending;
            this.Pipe.InspectionStatus   = Domain.Entity.Construction.PartInspectionStatus.Pending;
            this.Pipe.Project            = repoMill.RepoProject.GetSingle();

            this.Number = string.Empty;
            this.Mill   = string.Empty;

            this.WallThickness   = 0;
            this.Weight          = 0;
            this.Length          = 0;
            this.Diameter        = 0;
            this.PipeTestResults = new BindingList <PipeTestResult>();
            if (this.FilesFormViewModel != null)
            {
                this.FilesFormViewModel.RefreshFiles(this.Pipe.Id);
            }
            this.Pipe.Mill     = mill;
            this.Pipe.ToExport = false;
        }
        public void NewPipe()
        {
            try
            {
                currentType = new PipeMillSizeType()
                {
                    IsNative = true, Project = this.Project
                };
                extractPurchaseOrderCommand.Execute();
                extractHeatsCommand.Execute();
                extractPipeTypeCommand.Execute();

                this.Pipe = new Pipe();
                this.PipePurchaseOrder = null;
                this.Heat                    = null;
                this.PlateNumber             = string.Empty;
                this.Pipe.IsActive           = true;
                this.Pipe.IsAvailableToJoint = true;
                this.Pipe.Status             = PipeMillStatus.Produced;
                this.Pipe.ConstructionStatus = Domain.Entity.Construction.PartConstructionStatus.Pending;
                this.Pipe.InspectionStatus   = Domain.Entity.Construction.PartInspectionStatus.Pending;
                this.Pipe.Project            = repoMill.RepoProject.GetSingle();

                this.Number = string.Empty;
                this.Mill   = string.Empty;

                this.WallThickness   = 0;
                this.Weight          = 0;
                this.Length          = 0;
                this.Diameter        = 0;
                this.PipeTestResults = new BindingList <PipeTestResult>();
                if (this.FilesFormViewModel != null)
                {
                    this.FilesFormViewModel.Files = null;
                }
                this.Pipe.Mill     = mill;
                this.Pipe.ToExport = false;

                PipeNotifier = NotificationService.Instance.NotRequiredOperationManager.CreateNotifier(Pipe);
                SelectiveOperationPipeNotifier = NotificationService.Instance.SelectiveOperationManager.CreateNotifier(Pipe);
            }
            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();
        }
        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();
        }