示例#1
0
        public NewGuideModel(guide guide)
        {
            foreach (var propertyInfo in guide.GetType().GetProperties())
            {
                if (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType.Name == "String")
                {
                    propertyInfo.SetValue(this, propertyInfo.GetValue(guide));
                }
            }
            Email              = guide.user.Email;
            Password           = guide.user.Password;
            Deleted            = guide.user.Deleted;
            PermittedCountries = new List <int>();
            PermittedCities    = new List <int>();
            //PermittedRegions = new List<int>();
            foreach (var countryPermission in guide.user.country_permission)
            {
                PermittedCountries.Add(countryPermission.country.Id);
            }

            /*foreach (var regionPermission in guide.user.region_permission)
             * {
             *  PermittedRegions.Add(regionPermission.region.Id);
             * }*/
            foreach (var cityPermission in guide.user.city_permission)
            {
                PermittedCities.Add(cityPermission.city.Id);
            }
        }
示例#2
0
 public void CopyTo(ref guide guide)
 {
     foreach (var propertyInfo in guide.GetType().GetProperties())
     {
         if (!propertyInfo.Name.Contains("Id") && (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType.Name == "String"))
         {
             propertyInfo.SetValue(guide, propertyInfo.GetValue(this));
         }
     }
     guide.EditorId = EditorId;
 }