Example #1
0
        public MobileLocation(Location location)
        {
            this.Location = LocationContract.ToContract(location);
            this.AreaName = new Name();
            this.LocationTypeName = new Name();

            if (location.Area != null)
            {
                this.AreaName.Swedish = location.Area.area_swe;
                this.AreaName.English = location.Area.area_eng;
            }
            else
            {
                this.AreaName.Swedish = "";
                this.AreaName.English = "";
            }

            if (location.LocationType != null)
            {
                this.LocationTypeName.Swedish = location.LocationType.location_type_swe;
                this.LocationTypeName.English = location.LocationType.location_type_eng;
            }
            else
            {
                this.LocationTypeName.Swedish = "";
                this.LocationTypeName.English = "";
            }

            this.CityName = (location.Area.City != null) ? location.Area.City.city1 : "";
        }
Example #2
0
        /* Constructor with location */
        public LocationContract(Location l)
        {
            this.LocationId = l.location_id;
            this.AreaId = l.area_id;
            this.LocationTypeId = l.location_type_id;
            this.FloorNumber = (l.floor_nr != null) ? (int)(l.floor_nr) : 0;
            this.Latitude = l.latitude;
            this.Longitude = l.longitude;
            this.Names = new List<Name>();

            foreach (LocationName locationName in l.LocationNames)
            {
                Name name = new Name();
                name.Swedish = locationName.location_name_swe;
                
                if (locationName.is_main)
                    this.SwedishMainName = locationName.location_name_swe;

                if (locationName.location_name_swe != locationName.location_name_eng)
                {
                    name.English = locationName.location_name_eng;

                    if (locationName.is_main)
                        this.EnglishMainName = locationName.location_name_eng;
                }
                else
                {
                    name.English = "";

                    if (locationName.is_main)
                        this.EnglishMainName = "";
                }

                Names.Add(name);
            }
        }
Example #3
0
 /* Location to Location contract */
 public static LocationContract ToContract(Location l)
 {
     return new LocationContract(l);
 }
Example #4
0
 public static MobileLocation ToMobile(Location location)
 {
     return new MobileLocation(location);
 }