private void DrawAutoWiring(ControlSystem system) { try { var findgroup = Project.CurrentProject.ControlGroupList.Find(g => g.ControlSystemID == system.Id); if (findgroup != null) { if (findgroup.IsValidGrp) { AutoControlWiring objAutoControlWiring = new AutoControlWiring(true, Project.GetProjectInstance, system, designerCanvas.addflow); system.IsAutoWiringPerformed = true; } else { JCHMessageBox.Show("The Group has some errors. Please Check!", MessageType.Error); } UtilTrace.SaveHistoryTraces(); } else { JCHMessageBox.Show("Cannot perform Auto-Control Wiring on Empty Group", MessageType.Warning); } } catch (Exception ex) { //ToDo } }
private static void IsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; SystemTab systemTab = (SystemTab)d; SystemTabViewModel viewModel = (SystemTabViewModel)systemTab.DataContext; WorkFlowContext.CurrentSystem = systemTab.HvacSystem; viewModel.CurrentSystem = systemTab.HvacSystem; if (systemTab?.HvacSystem != null) { Project.GetProjectInstance.SelectedSystemID = systemTab.HvacSystem.Id; } else { Project.GetProjectInstance.SelectedSystemID = string.Empty; } systemTab.designerCanvas.Refresh((SystemBase)e.OldValue, (SystemBase)e.NewValue); //UndoRedoSetup.SetInstanceNull(); if (!Project.GetProjectInstance.IsPerformingUndoRedo && !string.IsNullOrEmpty(Project.GetProjectInstance.SelectedSystemID)) { UtilTrace.SaveHistoryTraces(); } System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; }
/// <summary> /// Checking for Errors on Central Controller system /// </summary> /// <param name="selectedSystems"></param> /// <param name="count"></param> public void CheckForErrors(List <SystemsOnCanvas> selectedSystems, int count) { Project.CurrentProject.ControlSystemList.Find(c => c.Id == _currentSystem.Id).IsAutoWiringPerformed = false; if (selectedSystems.Count > 0 && count > 0 || selectedSystems.Count + count == 0) { ClearErrorLogs(); } else { if (selectedSystems.Count == 0) { ErrorLoggingController(60); } else { ErrorLoggingController(59); } } if (Project.CurrentProject.RegionCode == "EU_W" || Project.CurrentProject.RegionCode == "EU_S" || Project.CurrentProject.RegionCode == "EU_E") { ValidateMandatoryCompatibleControllers(); } UtilTrace.SaveHistoryTraces(); }
private void OnSaveClickedCommand() { _eventAggregator.GetEvent <ProjectSettingsSave>().Publish(); var proj = JCHVRF.Model.Project.GetProjectInstance; if (proj.IsBothMode == true) { proj.IsCoolingModeEffective = true; proj.IsHeatingModeEffective = true; } ProjectInfoBLL objPrjbll = new ProjectInfoBLL(); if (objPrjbll.UpdateProject(proj)) { JCHMessageBox.Show(Langauge.Current.GetMessage("SUCCESSFULLY_UPDATE"));//"Successfully Updated!"); RefreshDashBoard(); } //bug 3825 var currentSystem = WorkFlowContext.CurrentSystem as JCHVRF.Model.NextGen.SystemVRF; _eventAggregator.GetEvent <SystemDetailsSubscriber>().Publish(currentSystem); //bug 3825 UtilTrace.SaveHistoryTraces(); }
// end added for Side bar collapse Setting Panel 12-15-2018 private void lnkBtnValidate_Click(object sender, RoutedEventArgs e) { var evm = new ErrorLogViewModel();//to clear the previous errors, line added by anup var MDViewModel = (MasterDesignerViewModel)this.DataContext; var SysIndex = MDViewModel.SelectedTabIndex; if (SysIndex >= 0) { SystemBase system = MDViewModel.Systems[SysIndex]; if (system != null) { if (system.HvacSystemType.Equals("1")) { var sys = (JCHVRF.Model.NextGen.SystemVRF)system; if (sys != null && sys.IsAuto == true && sys.IsManualPiping == true && sys.SystemStatus == SystemStatus.INVALID) { JCHMessageBox.Show(language.Current.GetMessage("ALERT_CHANGES_CANVAS")); } else { _eventAggregator.GetEvent <PipingValidationBtnSubscriber>().Publish(sys); _eventAggregator.GetEvent <SystemExportSubscriber>().Publish(sys); if (!sys.IsPipingOK) { _eventAggregator.GetEvent <DisplayPipingLength>().Publish(); } } //UtilTrace.SaveHistoryTraces();//uncommented by vijay } else if (system.HvacSystemType.Equals("6")) { bool hasControllers = false; var proj = Project.CurrentProject; var hasSystem = proj.ControlGroupList.Find(c => c.ControlSystemID == system.Id); if (((ControlSystem)system).IsAutoWiringPerformed) { if (hasSystem != null) { foreach (Controller ctrl in proj.ControllerList) { if (ctrl.ControlGroupID == hasSystem.Id) { hasControllers = true; } } if (system.SystemStatus.Equals(SystemStatus.INVALID)) { hasSystem.IsValidGrp = false; JCHMessageBox.Show(language.Current.GetMessage("ALERT_CONTROL_SYSTEM_ERROR"), MessageType.Error); } else if (!hasControllers) { hasSystem.IsValidGrp = false; JCHMessageBox.Show(language.Current.GetMessage("ALERT_CANNOT_VALIDATE_SYSTEM"), MessageType.Warning); system.SystemStatus = SystemStatus.INVALID; } else { proj.ControlSystemList.Find(sys => sys.Id == system.Id).SystemStatus = SystemStatus.VALID; // to change the status icon in opened tab hasSystem.IsValidGrp = true; system.SystemStatus = SystemStatus.VALID; } } } else { JCHMessageBox.Show("System Cannot be validated unless Auto-Control Wiring is Performed"); } UtilTrace.SaveHistoryTraces(); } //_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); } }