Exemplo n.º 1
0
        public static bool ValidateAddFlow(Lassalle.WPF.Flow.AddFlow addflow, JCHVRF.Model.NextGen.SystemVRF CurrentSystem)
        {
            var Nodes = Enumerable.OfType <JCHVRF.Model.NextGen.JCHNode>(addflow.Items).ToList();

            foreach (var node in Nodes)
            {
                if (node is JCHVRF.Model.NextGen.MyNodeYP)
                {
                    if (((JCHVRF.Model.NextGen.MyNodeYP)node).ChildCount != 2)
                    {
                        return(false);
                    }
                }
                if (node is JCHVRF.Model.NextGen.MyNodeOut)
                {
                    var MyNodeOut = (JCHVRF.Model.NextGen.MyNodeOut)node;
                    if (MyNodeOut.Links.Count == 0)
                    {
                        return(false);
                    }
                }
                if (node is JCHVRF.Model.NextGen.MyNodeCH)
                {
                    if ((((JCHVRF.Model.NextGen.MyNodeCH)node).ChildNode is JCHVRF.Model.NextGen.MyNodeIn))
                    {
                        var MyNodeIn = (JCHVRF.Model.NextGen.MyNodeIn)((JCHVRF.Model.NextGen.MyNodeCH)node).ChildNode;
                        if (MyNodeIn.MyInLinks == null || MyNodeIn.MyInLinks.Count == 0 || MyNodeIn.Links.Count == 0)
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Exemplo n.º 2
0
 public PipingLengthSettings(IEventAggregator eventAggregator, JCHVRF.Model.NextGen.SystemVRF obj)
 {
     InitializeComponent();
     this._eventAggregator = eventAggregator;
     _eventAggregator      = eventAggregator;
     CurrentSystem         = obj;
 }
Exemplo n.º 3
0
        private void SetIndoorSystemSpecificIndoorInfo()
        {
            if (!string.IsNullOrEmpty(JCHVRF.Model.Project.CurrentSystemId))
            {
                JCHVRF.Model.NextGen.SystemVRF _currentSystem = JCHVRF.Model.Project.CurrentProject.SystemListNextGen.FirstOrDefault(x => ((SystemBase)x).Id.Equals(JCHVRF.Model.Project.CurrentSystemId));
                if (_currentSystem != null)
                {
                    SelectedIDU = new ObservableCollection <IDU>();

                    foreach (var rid in JCHVRF.Model.Project.GetProjectInstance.RoomIndoorList.Where(i => i.SystemID == _currentSystem.Id))
                    {
                        // TODO : this can be incorported in RoomIndoor if no other dependency
                        var model = Convert.ToBoolean(_project?.BrandCode.Equals("Y"))
                            ? rid.IndoorItem.Model_York : rid.IndoorItem.Model_Hitachi;

                        SelectedIDU.Add(new IDU
                        {
                            RoomIndoor       = rid,
                            IsChecked        = rid.IsDelete,
                            DisplayModelName = model
                        });
                    }
                }
            }
        }
Exemplo n.º 4
0
 public static void SaveHistoryTraces(JCHVRF.Model.NextGen.SystemVRF systemVrf)
 {
     byte[] currentSystemBlob = JCHVRF.DAL.New.Utility.Serialize(systemVrf);
     if ((lastsystemblob == null || !lastsystemblob.SequenceEqual(currentSystemBlob)))
     {
         Project.GetProjectInstance.SystemListNextGen[Project.GetProjectInstance.SystemListNextGen.FindIndex(ind => ind.Id.Equals(systemVrf.Id))] = systemVrf;
         SaveHistoryTraces();
     }
 }
Exemplo n.º 5
0
        public static JCHVRF.Model.NextGen.SystemVRF Duplicate(this JCHVRF.Model.NextGen.SystemVRF systemToDuplicate)
        {
            if (systemToDuplicate == null)
            {
                throw new ArgumentNullException("Input VRF system was empty");
            }

            var currentProject = Project.CurrentProject;
            var newSystem      = ((JCHVRF.Model.NextGen.SystemVRF)systemToDuplicate).DeepClone <JCHVRF.Model.NextGen.SystemVRF>();

            var count      = (currentProject.SystemListNextGen.Count + 1);
            var systemName = SystemSetting.UserSetting.defaultSetting.FreshAirAreaName + " " + count;

            while (currentProject.SystemListNextGen.Any(i => i.Name.ToLower() == systemName.ToLower()))
            {
                count++;
                systemName = SystemSetting.UserSetting.defaultSetting.FreshAirAreaName + " " + count;
            }

            newSystem.Name = systemName;
            newSystem.RegenerateId();
            newSystem.IsActiveSystem = true;
            newSystem.ControlGroupID = null;
            //newSystem.ControlGroupID= systemToDuplicate.ControlGroupID.DeepClone();
            newSystem.ControlGroupID = new List <string>();
            if (currentProject.RoomIndoorList.Count > 0)
            {
                var idNo = currentProject.RoomIndoorList.Max(i => i.IndoorNO);

                var newRoomIndoors = new List <RoomIndoor>();
                foreach (var ri in currentProject.RoomIndoorList.Where(ri => ri.SystemID == systemToDuplicate.Id))
                {
                    var newri = ri.DeepClone <RoomIndoor>();
                    newri.SystemID = newSystem.Id;
                    newri.IndoorNO = ++idNo;
                    newRoomIndoors.Add(newri);
                }

                currentProject.RoomIndoorList.AddRange(newRoomIndoors);
            }
            if (newSystem is JCHVRF.Model.NextGen.SystemVRF)
            {
                newSystem.MyPipingNodeOut       = null;
                newSystem.MyPipingNodeOutTemp   = null;
                newSystem.IsInputLengthManually = false;
            }
            currentProject.SystemListNextGen.Add((JCHVRF.Model.NextGen.SystemVRF)newSystem);
            //newSystem.MyPipingNodeOut = ((JCHVRF.Model.NextGen.SystemVRF)systemToDuplicate).MyPipingNodeOut;
            //newSystem.MyPipingNodeOutTemp = ((JCHVRF.Model.NextGen.SystemVRF)systemToDuplicate).MyPipingNodeOutTemp;
            return(newSystem);
        }
Exemplo n.º 6
0
 public InputPipeLengthPopup(double Length, double Elbow, double OilTrapQty, JCHVRF.Model.NextGen.SystemVRF CurrentSystem)
 {
     SizeChanged += (o, e) =>
     {
         var r = SystemParameters.WorkArea;
         Left = r.Right - 100 - ActualWidth;
         Top  = r.Bottom - 450 - ActualHeight;
     };
     ut_length = JCHVRF.Model.SystemSetting.UserSetting.unitsSetting.settingLENGTH;
     InitializeComponent();
     InitilationPipingLength(CurrentSystem);
     ((InputPipeLengthPopupViewModel)this.DataContext).PipeLength = Length.ToString();
     ((InputPipeLengthPopupViewModel)this.DataContext).ElbowQty   = Elbow.ToString("n2");      //Unit.ConvertToControl(Elbow, UnitType.LENGTH_M, ut_length).ToString("n2");
     ((InputPipeLengthPopupViewModel)this.DataContext).OilTrapQty = OilTrapQty.ToString("n2"); //Unit.ConvertToControl(OilTrapQty, UnitType.LENGTH_M, ut_length).ToString("n2");
 }
Exemplo n.º 7
0
        public static bool IsValidatedSystemVRF(JCHVRF.Model.Project project, JCHVRF.Model.NextGen.SystemVRF CurrentSystem, out string ErrMsg)
        {
            bool Result = true;

            ErrMsg = "";
            var IndoorListForCurrentSystem = project.RoomIndoorList.Where(ri => ri.SystemID == (((JCHVRF.Model.SystemBase)CurrentSystem).Id)).ToList();

            if (IndoorListForCurrentSystem == null || IndoorListForCurrentSystem.Count == 0)
            {
                Result = false;
                ErrMsg = Langauge.Current.GetMessage("ALERT_INDOOR");
            }
            else if (CurrentSystem == null)
            {
                Result = false;
                ErrMsg = string.Format(JCHVRF.Const.ValidationMessage.AtleastOneODU);
            }
            else
            {
                if (CurrentSystem.SelOutdoorType == null)
                {
                    Result = false;
                    ErrMsg = string.Format(Langauge.Current.GetMessage("ERROR_PROPERTY") + CurrentSystem.Name);
                }
                else if (CurrentSystem.Power == null || CurrentSystem.Power.Trim() == "")
                {
                    Result = false;
                    ErrMsg = string.Format(Langauge.Current.GetMessage("ERROR_POWER_PROPERTY") + CurrentSystem.Name);
                }
                else if (CurrentSystem.MaxRatio == 0)
                {
                    Result = false;
                    ErrMsg = string.Format(Langauge.Current.GetMessage("ERROR_MAXRATIO_PROPERTY") + CurrentSystem.Name);
                }
            }
            foreach (var indoor in IndoorListForCurrentSystem)
            {
                if (indoor.IndoorItem == null || indoor.IndoorItem.Type == null || indoor.IndoorItem.ModelFull == null)
                {
                    Result = false;
                    ErrMsg = string.Format(Langauge.Current.GetMessage("ERROR_INDOOR_PROPERTY") + indoor.IndoorName);
                    break;
                }
            }

            return(Result);
        }
Exemplo n.º 8
0
        private string GetSystemStatusImg(JCHVRF.Model.NextGen.SystemVRF system)
        {
            switch (system.SystemStatus)
            {
            case JCHVRF_New.Model.SystemStatus.WIP:
                return(_imageRelativePath + "Path 111.png");

            case JCHVRF_New.Model.SystemStatus.VALID:
                return(_imageRelativePath + "Path 113.png");

            case JCHVRF_New.Model.SystemStatus.INVALID:
                return(_imageRelativePath + "Path 112.png");

            default:
                return(_imageRelativePath + "Path 111.png");
            }
        }
Exemplo n.º 9
0
        private void InitilationPipingLength(JCHVRF.Model.NextGen.SystemVRF CurrentSystem)
        {
            string regionCode    = JCHVRF.Model.Project.CurrentProject.RegionCode;
            string subRegionCode = JCHVRF.Model.Project.CurrentProject.SubRegionCode;
            string series        = "";

            if (CurrentSystem != null && CurrentSystem.OutdoorItem != null)
            {
                series = CurrentSystem.OutdoorItem.Series;
            }
            if (regionCode == "EU_W" ||
                regionCode == "EU_S" ||
                regionCode == "EU_E" ||
                ((subRegionCode == "LA_MMA" ||
                  subRegionCode == "LA_PERU" ||
                  subRegionCode == "LA_SC" ||
                  subRegionCode == "LA_BV") &&
                 !series.Contains("Residential")))
            {
                this.lblOilTrap.Visibility      = Visibility.Collapsed;
                this.OilTrapQuantity.Visibility = Visibility.Collapsed;
            }
        }
Exemplo n.º 10
0
 //public double CalOutdoorEstCapacityNextGen(Outdoor outItem, double maxRatio, double OutTemperature, double InTemperature, bool isHeating, JCHVRF.Model.NextGen.SystemVRF sysItem)
 //{
 //    return _dal.CalOutdoorEstCapacitynew(outItem, maxRatio, OutTemperature, InTemperature, isHeating, sysItem);
 //}
 public double CalOutdoorEstCapacitynextgen(Outdoor outItem, double maxRatio, double OutTemperature, double InTemperature, bool isHeating, JCHVRF.Model.NextGen.SystemVRF sysItem)
 {
     return(_dal.CalOutdoorEstCapacitynew(outItem, maxRatio, OutTemperature, InTemperature, isHeating, sysItem));
 }
Exemplo n.º 11
0
        public static bool IsIndoorIsValidForODUSeries(JCHVRF.Model.NextGen.SystemVRF CurrentSys)
        {
            var listRISelected = JCHVRF.Model.Project.GetProjectInstance.RoomIndoorList.Where(ri => ri.SystemID == (((JCHVRF.Model.SystemBase)CurrentSys).Id)).ToList();

            if (ProjectBLL.IsSupportedUniversalSelection(JCHVRF.Model.Project.GetProjectInstance))
            {
                MyProductTypeBLL productTypeBll = new MyProductTypeBLL();
                DataTable        typeDt         = productTypeBll.GetIduTypeBySeries(JCHVRF.Model.Project.GetProjectInstance.BrandCode, JCHVRF.Model.Project.GetProjectInstance.SubRegionCode, CurrentSys.Series);
                if (typeDt != null && typeDt.Rows.Count > 0)
                {
                    foreach (var idu in listRISelected)
                    {
                        if (idu.IndoorItem != null)
                        {
                            if (!typeDt.AsEnumerable().Any(row => row["IDU_UnitType"].ToString() == idu.IndoorItem.Type))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }
            else
            {
                IndoorBLL bll     = new IndoorBLL(JCHVRF.Model.Project.GetProjectInstance.SubRegionCode, JCHVRF.Model.Project.GetProjectInstance.BrandCode);
                string    colName = "UnitType";
                DataTable typeDt  = bll.GetIndoorFacCodeList(CurrentSys.ProductType);
                foreach (DataRow dr in typeDt.Rows)
                {
                    if (System.Convert.ToInt32(dr["FactoryCount"].ToString()) > 1)
                    {
                        dr[colName] = AlterUnitTypeBasedOnFactoryCode(dr["FactoryCode"].ToString(), Convert.ToString(dr[colName]));
                    }
                }
                var dv = new DataView(typeDt);
                if (CurrentSys.ProductType == "Comm. Tier 2, HP")
                {
                    if (CurrentSys.Series == "Commercial VRF HP, FSN6Q" || CurrentSys.Series == "Commercial VRF HP, JVOH-Q")
                    {
                        dv.RowFilter = "UnitType not in ('High Static Ducted-HAPE','Medium Static Ducted-HAPE','Low Static Ducted-HAPE','High Static Ducted-SMZ','Medium Static Ducted-SMZ','Four Way Cassette-SMZ')";
                    }
                    else
                    {
                        dv.RowFilter = "UnitType <>'Four Way Cassette-HAPQ'";
                    }
                }
                typeDt = dv.Table;
                if (typeDt != null && typeDt.Rows.Count > 0)
                {
                    foreach (var idu in listRISelected)
                    {
                        if (idu.IndoorItem != null)
                        {
                            var factoryCode = idu.IndoorItem.GetFactoryCode();
                            var type        = AlterUnitTypeBasedOnFactoryCode(factoryCode, idu.IndoorItem.Type);


                            if (!typeDt.AsEnumerable().Any(row => (row["UnitType"].ToString() == idu.IndoorItem.Type ||
                                                                   (System.Convert.ToInt32(row["FactoryCount"].ToString()) > 1 && row["UnitType"].ToString() == type))))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }