private void AddAccessoriesToHeatExchanger(object win)
        {
            List <string> modelNames = new List <string>();

            try
            {
                if (objIndoor.ListAccessory == null)
                {
                    objIndoor.ListAccessory = new List <Accessory>();
                }

                var selectedItems      = (from s in ListAccessory where s.IsSelect == true select s).ToList();
                var applyToSimilar     = (from a in ListAccessory where a.IsApplyToSimilarUnit == true select a).ToList();
                var applyToSimilarOnly = (from a in ListAccessory where a.IsApplyToSimilarUnit == true && a.IsSelect != true select a);
                foreach (AccessoryModel accessory in selectedItems)
                {
                    Accessory acc = new Accessory()
                    {
                        Type          = accessory.Type,
                        BrandCode     = Project.CurrentProject.BrandCode,
                        FactoryCode   = Project.CurrentProject.FactoryCode,
                        IsDefault     = false, //? todo
                        IsShared      = false, //todo
                        MaxCapacity   = 10,    //todo
                        Model_Hitachi = accessory.Model,
                        MaxNumber     = accessory.MaxCount,
                        Count         = accessory.Count,
                        MinCapacity   = 5,
                        Model_York    = "", //todo
                        UnitType      = "", //todo
                        IsSelect      = true
                    };

                    if (accessory.Count > 0)
                    {
                        if (objIndoor != null)
                        {
                            if (objIndoor.ListAccessory.Count > 0)
                            {
                                int accCount = objIndoor.ListAccessory.Count;
                                for (int i = 0; i < accCount; i++)
                                {
                                    var result = objIndoor.ListAccessory.Select(x => x.Model_Hitachi).Distinct();
                                    foreach (var type in result)
                                    {
                                        modelNames.Add(type);
                                    }

                                    if (!modelNames.Contains(acc.Model_Hitachi))
                                    {
                                        objIndoor.ListAccessory.Add(acc);
                                    }
                                    else
                                    {
                                        foreach (Accessory ac in objIndoor.ListAccessory)
                                        {
                                            if (ac.Model_Hitachi.Equals(acc.Model_Hitachi))
                                            {
                                                ac.Count = acc.Count;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                objIndoor.ListAccessory.Add(acc);
                            }
                        }
                    }

                    else
                    {
                        JCHMessageBox.Show("Count can not be zero");
                        return;
                    }
                }
                _projectBAL.UpdateProject(Project.CurrentProject);
                CloseWindow(win);
            }
            catch (Exception ex)
            {
                int?id = Project.GetProjectInstance?.projectID;
                Logger.LogProjectError(id, ex);
            }
        }
        //ACC - RAG START

        //ACC - RAG END

        //IRegionManager regionManager;
        private void CreateClick(Window win)
        {
            _eventAggregator.GetEvent <BeforeCreate>().Publish();

            var        proj      = Project.GetProjectInstance;
            SystemBase newSystem = WorkFlowContext.NewSystem;

            int sysTypeAsInt = Convert.ToInt32(newSystem.HvacSystemType);

            switch (sysTypeAsInt)
            {
            case 1:
                proj.SystemListNextGen.Add((JCHVRF.Model.NextGen.SystemVRF)newSystem);
                _eventAggregator.GetEvent <ErrorMessageUC>().Publish(string.Empty);
                Views.ucDesignerCanvas.__errorMessage = string.Empty;
                break;

            case 2:
                proj.HeatExchangerSystems.Add((SystemHeatExchanger)newSystem);
                _eventAggregator.GetEvent <ErrorMessageUC>().Publish(string.Empty);
                Views.ucDesignerCanvas.__errorMessage = string.Empty;
                break;

            case 6:
                if ((proj.SystemListNextGen.Count <= 0) && (proj.HeatExchangerSystems.Count <= 0))
                {
                    _eventAggregator.GetEvent <ErrorMessageUC>().Publish(JCHVRF_New.LanguageData.LanguageViewModel.Current.GetMessage("CENTRAL_CONTROLLER_BLANK"));
                    Views.ucDesignerCanvas.__errorMessage = JCHVRF_New.LanguageData.LanguageViewModel.Current.GetMessage("CENTRAL_CONTROLLER_BLANK");
                }
                else
                {
                    _eventAggregator.GetEvent <ErrorMessageUC>().Publish(string.Empty);
                    Views.ucDesignerCanvas.__errorMessage = string.Empty;
                }
                proj.ControlSystemList.Add((ControlSystem)newSystem);
                break;
            }

            if (_projectBAL.UpdateProject(proj))
            {
                Project.GetProjectInstance.SelectedSystemID = newSystem.Id;
                UndoRedoSetup.SetInstanceNull();
                //WorkFlowContext.Clear();
                JCHMessageBox.Show(Langauge.Current.GetMessage("SYSTEM_SAVED_SUCCESSFULLY"));//System Saved Successfully
                if (win != null)
                {
                    var w = Application.Current.MainWindow;
                    w.Hide();
                    //RefreshDashBoard();
                    var projectId = proj.projectID;
                    Application.Current.Properties["ProjectId"] = projectId;
                    ProjectInfoBLL            bll            = new ProjectInfoBLL();
                    JCHVRF.Entity.ProjectInfo projectNextGen = bll.GetProjectInfo(projectId);
                    projectNextGen.ProjectLegacy.RegionCode    = JCHVRF.Model.Project.CurrentProject.RegionCode;
                    projectNextGen.ProjectLegacy.SubRegionCode = JCHVRF.Model.Project.CurrentProject.SubRegionCode;
                    projectNextGen.ProjectLegacy.projectID     = projectId;

                    NavigationParameters param = new NavigationParameters();
                    param.Add("Project", projectNextGen.ProjectLegacy);

                    RegionManager.RequestNavigate(RegionNames.ContentRegion, ViewKeys.MasterDesigner, (a) => { win.Close(); }, param);
                    w.Show();
                }
                //event to trigger to all view models to unsubscribe events they have subscibed to
                _eventAggregator.GetEvent <Cleanup>().Publish();
                _eventAggregator.GetEvent <SystemCreated>().Publish(newSystem);
                _eventAggregator.GetEvent <RefreshSystems>().Publish();
            }
        }
        //IRegionManager regionManager;
        //
        private void SaveClick(Window win)
        {
            try
            {
                var proj         = Project.GetProjectInstance;
                int sysTypeAsInt = System.Convert.ToInt32(_hvacSystem.HvacSystemType);
                NextGenModel.SystemVRF currentSystem = new NextGenModel.SystemVRF();
                switch (sysTypeAsInt)
                {
                case 1:
                    proj.SystemListNextGen = JCHVRF.Model.Project.CurrentProject.SystemListNextGen;
                    currentSystem          = proj.SystemListNextGen.Find(sys => sys.Id == JCHVRF.Model.Project.CurrentSystemId);
                    _eventAggregator.GetEvent <BeforeSaveVRF>().Publish(currentSystem);
                    if (this.SelectedTabIndex != 0)
                    {
                        _eventAggregator.GetEvent <ODUTypeTabSave>().Publish();
                        if (!currentSystem.IsOutDoorUpdated)
                        {
                            return;
                        }
                    }
                    else
                    {
                        currentSystem.IsOutDoorUpdated = false;
                    }
                    UtilTrace.SaveHistoryTraces();
                    //proj.CanvasODUList = null;
                    break;

                case 2:
                    _eventAggregator.GetEvent <BeforeHESave>().Publish();
                    int k = proj.HeatExchangerSystems.IndexOf((SystemHeatExchanger)_hvacSystem);
                    proj.HeatExchangerSystems[k] = ((SystemHeatExchanger)_hvacSystem);
                    if (PropertyInfoViewModel._strHEName != null)
                    {
                        if (proj.HeatExchangerSystems[k].Id.Equals(PropertyInfoViewModel._strHEName[0]))
                        {
                            proj.HeatExchangerSystems[k].Name = PropertyInfoViewModel._strHEName[1];
                        }
                    }

                    UtilTrace.SaveHistoryTraces();
                    break;

                case 6:
                    _eventAggregator.GetEvent <BeforeSave>().Publish();
                    int j = proj.ControlSystemList.IndexOf((ControlSystem)_hvacSystem);
                    proj.ControlSystemList[j] = ((ControlSystem)_hvacSystem);
                    UtilTrace.SaveHistoryTraces();
                    break;
                }

                if (_projectBAL.UpdateProject(proj))
                {
                    _eventAggregator.GetEvent <RefreshSystems>().Publish();
                    if (sysTypeAsInt == 1)
                    {
                        HeatExchangerCanvasEquipmentViewModel.IsPropOrNewExch = false;
                        if (currentSystem.IsOutDoorUpdated)
                        {
                            bool IsSystemValidated = ((NextGenModel.SystemVRF)_hvacSystem).IsPipingOK;
                            JCHMessageBox.Show(Langauge.Current.GetMessage("SYSTEM_SAVED_SUCCESSFULLY")); //"System Saved Successfully");
                            _eventAggregator.GetEvent <AuToPipingBtnSubscriber>().Publish((NextGenModel.SystemVRF)_hvacSystem);

                            if (IsSystemValidated == true)
                            {
                                currentSystem.IsPipingOK = true;
                                _eventAggregator.GetEvent <PipingValidationBtnSubscriber>().Publish((NextGenModel.SystemVRF)_hvacSystem);
                            }
                        }
                        else
                        {
                            JCHMessageBox.Show(Langauge.Current.GetMessage("SYSTEM_SAVED_SUCCESSFULLY")); //"System Saved Successfully");
                        }
                    }
                    else
                    {
                        JCHMessageBox.Show(Langauge.Current.GetMessage("SYSTEM_SAVED_SUCCESSFULLY"));// "System Saved Successfully");
                    }
                    if (win != null)
                    {
                        var w = Application.Current.MainWindow;
                        w.Hide();
                        //RefreshDashBoard();
                        var projectId = proj.projectID;
                        Application.Current.Properties["ProjectId"] = projectId;
                        ProjectInfoBLL            bll            = new ProjectInfoBLL();
                        JCHVRF.Entity.ProjectInfo projectNextGen = bll.GetProjectInfo(projectId);


                        projectNextGen.ProjectLegacy.RegionCode    = JCHVRF.Model.Project.CurrentProject.RegionCode;
                        projectNextGen.ProjectLegacy.SubRegionCode = JCHVRF.Model.Project.CurrentProject.SubRegionCode;
                        projectNextGen.ProjectLegacy.projectID     = projectId;
                        NavigationParameters param = new NavigationParameters();
                        param.Add("Project", projectNextGen.ProjectLegacy);
                        _eventAggregator.GetEvent <CleanupSystemWizard>().Publish();
                        //RegionManager.RequestNavigate(RegionNames.ContentRegion, ViewKeys.Splash, (a) => { win.Close(); }, param);
                        RegionManager.RequestNavigate(RegionNames.ContentRegion, ViewKeys.MasterDesigner, (a) => { win.Close(); }, param);
                        w.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                int?id = Project.GetProjectInstance?.projectID;
                Logger.LogProjectError(id, ex);
            }
        }