//GETTING SERIES FROM DATABASE AND BINDING WITH COMBOBOX private void BindSeries() { var sourceDir = System.IO.Path.Combine(defaultFolder, navigateToFolder); SelectedSeries = new SeriesModel(); _project = Project.GetProjectInstance; ListSeries = new ObservableCollection <SeriesModel>(); _indoorBll = new JCHVRF.BLL.IndoorBLL(JCHVRF.Model.Project.CurrentProject.SubRegionCode, JCHVRF.Model.Project.CurrentProject.BrandCode); DataTable dtSeries = _indoorBll.GetExchangerTypeList(); int excount = _project.ExchangerList.Count; if (dtSeries != null) { foreach (DataRow dtSeriesTypeRow in dtSeries.Rows) { if (ListSeries.Count == 0) { ListSeries.Add(new SeriesModel() { DisplayName = dtSeriesTypeRow.ItemArray[0].ToString(), SelectedValues = dtSeriesTypeRow.ItemArray[0].ToString(), }); } else { if (ListSeries.Any(MM => MM.DisplayName == dtSeriesTypeRow.ItemArray[0].ToString())) { continue; } else { ListSeries.Add(new SeriesModel() { DisplayName = dtSeriesTypeRow.ItemArray[0].ToString(), SelectedValues = dtSeriesTypeRow.ItemArray[0].ToString(), }); } } } //Binding of default series if (ListSeries.Count > 0 && excount > 0) { SelectedSeries = ListSeries.First(mm => mm.SelectedValues.Equals(_project.ExchangerList[excount - 1].IndoorItem.Series)); } else if (ListSeries.Count > 0) { SelectedSeries = ListSeries[0]; } } }
public TotalHeatExUnitInfoViewModel(IEventAggregator EventAggregator, IModalWindowService winService, JCHVRF_New.Model.LightProject thisProj) { try { NumericOutdoorCDBCommand = new DelegateCommand(NumericOutdoorCDB_LostFocus); NumericOutdoorCWBCommand = new DelegateCommand(NumericOutdoorCWBCommand_LostFocus); NumericOutdoorHDBCommand = new DelegateCommand(NumericOutdoorHDBCommand_LostFocus); NumericRHommand = new DelegateCommand(NumericRHommand_LostFocus); //CreateClickCommand = new DelegateCommand(CreateHENextClick); ChangeTempCommand = new DelegateCommand(btnChangeTempUClicked); AddFloorCommand = new DelegateCommand(OnAddFloorClicked); AddEditRoomCommand = new DelegateCommand(OnAddEditRoomClicked); ValidateUnitNameCommand = new DelegateCommand(ValidateUnitNameOnLostFocus); _eventAggregator = EventAggregator; _winService = winService; _eventAggregator.GetEvent <RoomListSaveSubscriber>().Subscribe(GetRoomList); _eventAggregator.GetEvent <FloorListSaveSubscriber>().Subscribe(OpenGetFloorList); GetRoomList(); BindFloor(); //BindDefaultFanSpeed(); _eventAggregator.GetEvent <TheuInfoVisibility>().Subscribe(OnTypeSelected); _eventAggregator.GetEvent <BeforeCreate>().Subscribe(OnBeforeCreate); _eventAggregator.GetEvent <Cleanup>().Subscribe(OnCleanup); _indoorBll = new JCHVRF.BLL.IndoorBLL(JCHVRF.Model.Project.CurrentProject.SubRegionCode, JCHVRF.Model.Project.CurrentProject.BrandCode); WorkFlowContext.FloorNames = null; bll = new JCHVRF.BLL.OutdoorBLL(JCHVRF.Model.Project.CurrentProject.SubRegionCode, JCHVRF.Model.Project.CurrentProject.BrandCode); if (JCHVRF.Model.Project.GetProjectInstance.DesignCondition != null) { BindInternalDesignConditions(); } WorkFlowContext.FloorNames = new List <string>(); } catch (Exception ex) { int?id = Project.GetProjectInstance?.projectID; Logger.LogProjectError(id, ex); } }