예제 #1
0
    ///
    /// \brief Initialization
    ///
    /// \return No return value
    ///
    /// \details Finds all rooms and stores them in a RoomLevels, stores corridors separately
    ///
    void Start()
    {
        List <Room> rooms = new List <Room>();

        foreach (Room room in FindObjectsOfType(typeof(Room)))
        {
            if (!room.name.ToLower().Equals("corridors"))
            {
                rooms.Add(room);
            }
            else
            {
                corridors = room;
            }
        }
        this.rooms = new RoomLevels(rooms.ToArray(), 0);
    }
예제 #2
0
        public ActionResult Index(string Type = "Residential", string MLS = "W4194008")
        {
            var result = new PropertyModel();

            if (Type == EnumValue.GetEnumDescription(EnumValue.PropertyType.Residential))
            {
                result = _ResidentialService.GetSingleProperty(MLS);
            }
            else if (Type == EnumValue.GetEnumDescription(EnumValue.PropertyType.Commercial))
            {
                result = _CommercialService.GetSingleProperty(MLS);
            }
            else
            {
                result = _CondoService.GetSingleProperty(MLS);
            }
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <PropertyModel, PropertyModell>();
            });
            IMapper mapper = config.CreateMapper();
            var     dest   = mapper.Map <PropertyModel, PropertyModell>(result);

            if (Type == EnumValue.GetEnumDescription(EnumValue.PropertyType.Residential))
            {
                dest.images = _ResidentialService.GetImageByMLSID(MLS);
            }
            else if (Type == EnumValue.GetEnumDescription(EnumValue.PropertyType.Commercial))
            {
                dest.images = _CommercialService.GetImageByMLSID(MLS);
            }
            else
            {
                dest.images = _CondoService.GetImageByMLSID(MLS);
            }
            int NoOfRoom           = Convert.ToInt32(result.Rooms);
            List <RoomLevels> list = new List <RoomLevels>();

            int i = 0;

            if (NoOfRoom != i)
            {
                RoomLevels obj = new RoomLevels();
                obj.Level    = result.Level1;
                obj.Room     = result.Room1;
                obj.RoomDesc = result.Room1Desc1 + result.Room1Desc2;
                obj.RoomDim  = result.Room1Length + "x" + result.Room1Width;
                list.Add(obj);
                i = i + 1;
            }

            if (NoOfRoom != i)
            {
                RoomLevels obj1 = new RoomLevels();
                obj1.Level    = result.Level2;
                obj1.Room     = result.Room2;
                obj1.RoomDesc = result.Room2Desc1 + result.Room2Desc2;
                obj1.RoomDim  = result.Room2Length + "x" + result.Room2Width;
                list.Add(obj1);
                i = i + 1;
            }

            if (NoOfRoom != i)
            {
                RoomLevels obj2 = new RoomLevels();
                obj2.Level    = result.Level3;
                obj2.Room     = result.Room3;
                obj2.RoomDesc = result.Room3Desc1 + result.Room3Desc2;
                obj2.RoomDim  = result.Room3Length + "x" + result.Room3Width;
                list.Add(obj2);
                i = i + 1;
            }

            if (NoOfRoom != i)
            {
                RoomLevels obj3 = new RoomLevels();
                obj3.Level    = result.Level4;
                obj3.Room     = result.Room4;
                obj3.RoomDesc = result.Room4Desc1 + result.Room4Desc2;
                obj3.RoomDim  = result.Room4Length + "x" + result.Room4Width;
                list.Add(obj3);
                i = i + 1;
            }
            if (NoOfRoom != i)
            {
                RoomLevels obj4 = new RoomLevels();
                obj4.Level    = result.Level5;
                obj4.Room     = result.Room5;
                obj4.RoomDesc = result.Room5Desc1 + result.Room5Desc2;
                obj4.RoomDim  = result.Room5Length + "x" + result.Room5Width;
                list.Add(obj4);
                i = i + 1;
            }
            if (NoOfRoom != i)
            {
                RoomLevels obj5 = new RoomLevels();
                obj5.Level    = result.Level6;
                obj5.Room     = result.Room6;
                obj5.RoomDesc = result.Room6Desc1 + result.Room6Desc2;
                obj5.RoomDim  = result.Room6Length + "x" + result.Room6Width;
                list.Add(obj5);
                i = i + 1;
            }
            if (NoOfRoom != i)
            {
                RoomLevels obj6 = new RoomLevels();
                obj6.Level    = result.Level7;
                obj6.Room     = result.Room7;
                obj6.RoomDesc = result.Room7Desc1 + result.Room7Desc2;
                obj6.RoomDim  = result.Room7Length + "x" + result.Room7Width;
                list.Add(obj6);
                i = i + 1;
            }
            if (NoOfRoom != i)
            {
                RoomLevels obj7 = new RoomLevels();
                obj7.Level    = result.Level8;
                obj7.Room     = result.Room8;
                obj7.RoomDesc = result.Room8Desc1 + result.Room8Desc2;
                obj7.RoomDim  = result.Room8Length + "x" + result.Room8Width;
                list.Add(obj7);
                i = i + 1;
            }
            if (NoOfRoom != i)
            {
                RoomLevels obj8 = new RoomLevels();
                obj8.Level    = result.Level9;
                obj8.Room     = result.Room9;
                obj8.RoomDesc = result.Room9Desc1 + result.Room9Desc2;
                obj8.RoomDim  = result.Room9Length + "m x " + result.Room9Width + "m";
                list.Add(obj8);
                i = i + 1;
            }
            if (NoOfRoom != i)
            {
                RoomLevels obj9 = new RoomLevels();
                obj9.Level    = result.Level10;
                obj9.Room     = result.Room10;
                obj9.RoomDesc = result.Room10Desc1 + result.Room10Desc2;
                obj9.RoomDim  = result.Room10Length + "m x " + result.Room10Width + "m";
                list.Add(obj9);
                i = i + 1;
            }
            if (NoOfRoom != i)
            {
                RoomLevels obj10 = new RoomLevels();
                obj10.Level    = result.Level11;
                obj10.Room     = result.Room11;
                obj10.RoomDesc = result.Room11Desc1 + result.Room11Desc2;
                obj10.RoomDim  = result.Room11Length + "m x " + result.Room11Width + "m";
                list.Add(obj10);
                i = i + 1;
            }
            if (NoOfRoom != i)
            {
                RoomLevels obj11 = new RoomLevels();
                obj11.Level    = result.Level12;
                obj11.Room     = result.Room12;
                obj11.RoomDesc = result.Room12Desc1 + result.Room12Desc2;
                obj11.RoomDim  = result.Room12Length + "m x " + result.Room12Width + "m";
                list.Add(obj11);
                i = i + 1;
            }

            dest.roomlevels = list.GroupBy(c => c.Level)
                              .Select(group =>
                                      new RoomLevelList
            {
                Level     = group.Key,
                roomlevel = group.ToList()
            })
                              .ToList();
            return(View(dest));
        }