Example #1
0
        public ValidateViewModel(JCHVRF.Model.Project project, ref AddFlow addFlow)
        {
            this.ProjectLegacy = project;
            this.addFlowPiping = addFlow;
            if (ProjectLegacy.SystemListNextGen[0] == null)
            {
                return;
            }
            if (curSystemItem == null && ProjectLegacy.SystemListNextGen[0] != null)
            {
                if (ProjectLegacy.SystemListNextGen.Count == 0)
                {
                    return;
                }
                curSystemItem = ProjectLegacy.SystemListNextGen[0];
            }

            utilPiping     = new UtilPiping();
            ut_length      = SystemSetting.UserSetting.unitsSetting.settingLENGTH;
            ut_power       = SystemSetting.UserSetting.unitsSetting.settingPOWER;
            ut_temperature = SystemSetting.UserSetting.unitsSetting.settingTEMPERATURE;
            ut_airflow     = SystemSetting.UserSetting.unitsSetting.settingAIRFLOW;
            ut_weight      = SystemSetting.UserSetting.unitsSetting.settingWEIGHT;

            DoPipingFinalVerification();
            addFlow = this.addFlowPiping;
        }
Example #2
0
 public WL.AddFlow Validate(JCHVRF.Model.NextGen.SystemVRF CurrentSystem, WL.AddFlow AddFlowAutoPiping)
 {
     if (CurrentSystem == null)
     {
         return(AddFlowAutoPiping);
     }
     utilPiping        = new NextGenBLL.UtilPiping();
     ut_length         = SystemSetting.UserSetting.unitsSetting.settingLENGTH;
     ut_power          = SystemSetting.UserSetting.unitsSetting.settingPOWER;
     ut_temperature    = SystemSetting.UserSetting.unitsSetting.settingTEMPERATURE;
     ut_airflow        = SystemSetting.UserSetting.unitsSetting.settingAIRFLOW;
     ut_weight         = SystemSetting.UserSetting.unitsSetting.settingWEIGHT;
     AddFlowAutoPiping = DoPipingFinalVerification(CurrentSystem, AddFlowAutoPiping);
     return(AddFlowAutoPiping);
 }
Example #3
0
        private void InitAndRemovePipingNodes(ref WL.AddFlow AddFlowAutoPiping)
        {
            var Nodes    = Enumerable.OfType <WL.Node>(AddFlowAutoPiping.Items).ToList();
            var Captions = Enumerable.OfType <WL.Caption>(AddFlowAutoPiping.Items).ToList();
            var Links    = Enumerable.OfType <WL.Link>(AddFlowAutoPiping.Items).ToList();

            foreach (var item in Nodes)
            {
                AddFlowAutoPiping.RemoveNode(item);
            }
            foreach (var item in Captions)
            {
                AddFlowAutoPiping.RemoveCaption(item);
            }
            foreach (var item in Links)
            {
                AddFlowAutoPiping.RemoveLink(item);
            }
        }
Example #4
0
        public WL.AddFlow DoDrawingPiping(bool reset, JCHVRF.Model.NextGen.SystemVRF CurrentSystem, WL.AddFlow AddFlowAutoPiping)
        {
            try
            {
                AddFlowAutoPiping.Clear();
                if (CurrentSystem.MyPipingNodeOut.AddFlow != null)
                {
                    AddFlowAutoPiping = CurrentSystem.MyPipingNodeOut.AddFlow;
                }
                NextGenBLL.UtilPiping utilPiping = new NextGenBLL.UtilPiping();

                NextGenBLL.PipingBLL pipBll = GetPipingBLLInstance();
                //pipBll.SaveAllPipingStructure();
                //pipBll.CreatePipingNodeStructure(CurrentSystem);
                bool isHitachi = projectLegacy.BrandCode == "H";
                bool isHR      = NextGenBLL.PipingBLL.IsHeatRecovery(CurrentSystem);
                //string dir = GetBinDirectoryPath(ConfigurationManager.AppSettings["PipingNodeImageDirectory"].ToString());
                //TO DO Pick VRF system in case of multi system
                string dir = GetImagePathPiping();
                NextGenModel.MyNodeOut pipingNodeOut = CurrentSystem.MyPipingNodeOut;
                if (pipingNodeOut == null || CurrentSystem.OutdoorItem == null)
                {
                    return(AddFlowAutoPiping);
                }
                if (pipingNodeOut.ChildNode == null)
                {
                    return(AddFlowAutoPiping);
                }
                if (isHR)
                {
                    //SetAllNodesIsCoolingonlyFrom();
                    pipBll.SetIsCoolingOnly(CurrentSystem.MyPipingNodeOut);
                }
                if (!reset)
                {
                    utilPiping.ResetColors();
                    InitAndRemovePipingNodes(ref AddFlowAutoPiping);
                    pipBll.DrawPipingNodes(CurrentSystem, dir, ref AddFlowAutoPiping);
                    pipBll.DrawPipingLinks(CurrentSystem, ref AddFlowAutoPiping);
                    pipBll.DrawLegendText(CurrentSystem, ref AddFlowAutoPiping);
                    pipBll.LoadPipingPlottingScaleNode(CurrentSystem, ref AddFlowAutoPiping);
                    CurrentSystem.MyPipingOrphanNodes     = null;
                    CurrentSystem.MyPipingOrphanNodesTemp = null;
                }
                if (reset)
                {
                    CurrentSystem.IsManualPiping = false;
                    utilPiping.ResetColors();
                    InitAndRemovePipingNodes(ref AddFlowAutoPiping);
                    pipBll.DrawPipingNodes(CurrentSystem, dir, ref AddFlowAutoPiping);
                    pipBll.DrawPipingLinks(CurrentSystem, ref AddFlowAutoPiping);
                    pipBll.DrawLegendText(CurrentSystem, ref AddFlowAutoPiping);
                    pipBll.LoadPipingPlottingScaleNode(CurrentSystem, ref AddFlowAutoPiping);
                    CurrentSystem.MyPipingOrphanNodes     = null;
                    CurrentSystem.MyPipingOrphanNodesTemp = null;
                }
                else
                {
                    if (CurrentSystem.IsManualPiping)
                    {
                    }
                    else
                    {
                        utilPiping.ResetColors();
                    }
                    pipBll.DrawPipingNodesNoCaculation(dir, CurrentSystem);
                }
                //added for internal Bug Find zero length Issue
                pipBll.DrawCorrectionFactorText(CurrentSystem);
                if (CurrentSystem.IsPipingOK)
                {
                    if (CurrentSystem.IsInputLengthManually && CurrentSystem.IsPipingOK)
                    {
                        pipBll.DrawAddRefrigerationText(CurrentSystem);
                    }

                    pipBll.SetDefaultColor(ref AddFlowAutoPiping, isHR);
                }
                pipBll.drawPipelegend(isHR, ref AddFlowAutoPiping);
            }
            catch (Exception ex)
            {
                int?id = Project.GetProjectInstance?.projectID;
                Logger.LogProjectError(id, ex, false);
            }
            return(AddFlowAutoPiping);
        }
Example #5
0
        private WL.AddFlow DoPipingFinalVerification(JCHVRF.Model.NextGen.SystemVRF currentSystem, WL.AddFlow AddFlowAutoPiping)
        {
            NextGenBLL.PipingErrors errorType = NextGenBLL.PipingErrors.OK;
            if (currentSystem.OutdoorItem == null)
            {
                return(AddFlowAutoPiping);
            }
            if (currentSystem.IsManualPiping && currentSystem.IsUpdated)
            {
                return(AddFlowAutoPiping);
            }
            //this.Cursor = Cursors.WaitCursor;
            UtilityValidation ObjPipValidation = new UtilityValidation(this.projectLegacy, ref AddFlowAutoPiping);

            JCHVRF.MyPipingBLL.NextGen.PipingBLL pipBll = GetPipingBLLInstanceValidation(AddFlowAutoPiping);
            bool isHR = NextGenBLL.PipingBLL.IsHeatRecovery(currentSystem);

            pipBll.SetPipingLimitation(currentSystem);

            errorType = pipBll.ValidateSystemHighDifference(currentSystem);

            if (errorType == NextGenBLL.PipingErrors.OK)
            {
                errorType = pipBll.ValidatePipeLength(currentSystem, ref AddFlowAutoPiping);
            }
            #region
            if (errorType == NextGenBLL.PipingErrors.OK)
            {
                if (!currentSystem.IsManualPiping)
                {
                    AddFlowAutoPiping = autoPipingObj.DoDrawingPiping(true, currentSystem, AddFlowAutoPiping);
                }
                if (!currentSystem.IsPipingOK)
                {
                    pipBll.SetDefaultColor(ref AddFlowAutoPiping, isHR);
                }
                if (errorType == NextGenBLL.PipingErrors.OK)
                {
                    if (currentSystem.PipeEquivalentLength < currentSystem.HeightDiff)
                    {
                        errorType = NextGenBLL.PipingErrors.PIPING_LENGTH_HEIGHT_DIFF; //-32;
                    }
                }

                if (currentSystem.IsInputLengthManually)
                {
                    errorType = pipBll.ValMainBranch(currentSystem, ref AddFlowAutoPiping);
                }
                if (errorType == NextGenBLL.PipingErrors.OK)
                {
                    if (NextGenBLL.PipingBLL.IsHeatRecovery(currentSystem) && !pipBll.ValCoolingOnlyIndoorCapacityRate(currentSystem, ref AddFlowAutoPiping))
                    {
                        errorType = NextGenBLL.PipingErrors.COOLINGONLYCAPACITY; //-12;
                    }
                }

                if (errorType == NextGenBLL.PipingErrors.OK)
                {
                    errorType = pipBll.ValidateIDUOfMultiCHBox(currentSystem);
                }

                if (errorType == NextGenBLL.PipingErrors.OK)
                {
                    // SetSystemPipingOK(currentSystem, true);
                    DoPipingCalculation(pipBll, currentSystem.MyPipingNodeOut, currentSystem, out errorType);
                    if (currentSystem.IsPipingOK)
                    {
                        if (currentSystem.IsInputLengthManually && !pipBll.ValCHToIndoorMaxTotalLength(currentSystem, ref AddFlowAutoPiping))
                        {
                            errorType = NextGenBLL.PipingErrors.MKTOINDOORLENGTH1; //-8;
                        }
                        else if (!pipBll.ValMaxIndoorNumberConnectToCH(currentSystem, ref AddFlowAutoPiping))
                        {
                            errorType = NextGenBLL.PipingErrors.INDOORNUMBERTOCH; //-13;
                        }
                        else
                        {
                            //SetSystemPipingOK(currentSystem, true);

                            if (currentSystem.IsInputLengthManually)
                            {
                                double d1 = pipBll.GetAddRefrigeration(currentSystem, ref AddFlowAutoPiping);
                                currentSystem.AddRefrigeration = d1;

                                pipBll.DrawAddRefrigerationText(currentSystem);
                            }
                            else
                            {
                                currentSystem.AddRefrigeration = 0;
                            }
                        }
                    }
                    ObjPipValidation.DrawTextToAllNodes(currentSystem.MyPipingNodeOut, null, currentSystem);
                    UtilTrace.SaveHistoryTraces();
                }
            }
            #endregion
            if (errorType != NextGenBLL.PipingErrors.OK)
            {
                SetSystemPipingOK(currentSystem, false);

                ErrorLog.LogError(Model.ErrorType.Error, Model.ErrorCategory.PipingErrors, WarningMessageObj.ShowWarningMsg(errorType, currentSystem));
            }
            WarningMessageObj.ShowWarningMsg(errorType, currentSystem);
            return(AddFlowAutoPiping);
        }
Example #6
0
        private NextGenBLL.PipingBLL GetPipingBLLInstanceValidation(WL.AddFlow AddFlowAutoPiping)
        {
            bool isInch = CommonBLL.IsDimension_inch();

            return(new NextGenBLL.PipingBLL(this.projectLegacy, utilPiping, AddFlowAutoPiping, isInch, ut_weight, ut_length, ut_power));
        }