Beispiel #1
0
        public IDUEquipmentPropertiesViewModel(JCHVRF.Model.Project projectLegacy, RoomIndoor roomIndoor)
        {
            try
            {
                this.ProjectLegacy = projectLegacy;
                pbll = new ProjectBLL(this.ProjectLegacy);

                this.indoorBLL = new IndoorBLL(ProjectLegacy.SubRegionCode, ProjectLegacy.RegionCode, ProjectLegacy.BrandCode);
                // Bind Equipment Pre Selected Data To View Model
                if (roomIndoor != null)
                {
                    this.EquipmentName = roomIndoor.IndoorName;
                    this.SelectedFloor = roomIndoor.RoomName;
                }
                // End Bind Equipment Pre Selected Data To View Model
                GetFloorList();


                BindFanSpeed();
                BindToControl();


                // Bind Equipment Pre Selected Data To View Model
                //if (this.SelectedFanSpeed != null)
                //{
                if (roomIndoor != null)
                {
                    this.SelectedFanSpeed = roomIndoor.FanSpeedLevel;
                    if (ProjectBLL.IsSupportedUniversalSelection(JCHVRF.Model.Project.GetProjectInstance))
                    {
                        GetTypeLookUpData(roomIndoor.DisplayImageName);
                    }
                    else
                    {
                        GetTypeLookUpDataRegionWise(roomIndoor.DisplayImageName);
                    }
                }// roomIndoor.FanSpeedLevel == 1 ? "Max" : roomIndoor.FanSpeedLevel == 0 ? "High2" : roomIndoor.FanSpeedLevel == 1 ? "High" : roomIndoor.FanSpeedLevel == 2 ? "Medium" : roomIndoor.FanSpeedLevel == 3 ? "Low" : "";
                 // }
                 // End Bind Equipment Pre Selected Data To View Model



                // Bind Equipment Pre Selected Data To View Model
                if (roomIndoor != null)
                {
                    if (roomIndoor.IndoorItem.DisplayName != null)
                    {
                        this.SelectedType = roomIndoor.IndoorItem.DisplayName;
                    }
                    // End Bind Equipment Pre Selected Data To View Model
                    // GetSelectedIDUAccessories();


                    //this.AddAccessoryViewModel = new AddAccessoriesTemplateViewModel(this.ProjectLegacy, roomIndoor);
                    OnPropertyChanged(AddAccessoryViewModel.Accessories.ToString());
                }


                //SetEquipmentProperties();
                //To Select

                if (roomIndoor != null && roomIndoor.IndoorItem != null)
                {
                    // this.SelectedType = roomIndoor.IndoorItem.Type;
                }

                // Bind Equipment for Pre Selected Data
                if (roomIndoor != null)
                {
                    if (roomIndoor.IndoorItem != null && roomIndoor.IndoorItem.Model != null)
                    {
                        this.SelectedModel = roomIndoor.IndoorItem.Model;
                        //this.SelectedIndexModel = this.ListModel.FindIndex(a => a.Value == roomIndoor.IndoorItem.Model);
                    }
                    else
                    {
                        if (ListModel != null && ListModel.Count > 0)
                        {
                            this.SelectedModel = ListModel.FirstOrDefault().Value;
                        }
                    }
                }

                if (roomIndoor != null && roomIndoor.IndoorItem != null && roomIndoor.IndoorItem.ListAccessory != null)
                {
                    var itemIndex = this.ProjectLegacy.RoomIndoorList.FindIndex(x => x.IndoorNO == roomIndoor.IndoorNO);
                    var item      = this.ProjectLegacy.RoomIndoorList.ElementAt(itemIndex);
                    this.ProjectLegacy.RoomIndoorList.RemoveAt(itemIndex);
                    item.ListAccessory = roomIndoor.IndoorItem.ListAccessory;
                    this.ProjectLegacy.RoomIndoorList.Insert(itemIndex, item);
                }
                // this.SelectedFanSpeed = 0;
                // End Bind Equipment Pre Selected Data To View Model
            }
            catch (Exception ex)
            {
                int?id = JCHVRF.Model.Project.GetProjectInstance?.projectID;
                Logger.LogProjectError(id, ex);
            }
        }