Inheritance: ICountryRepository
Esempio n. 1
0
        public ActionResult show(string id)
        {
            MembershipUser sig_user = Membership.GetUser(new Guid(id));
            CountryRepository cr = new CountryRepository();

            ViewData["user"] = sig_user;
            ViewData["roles"] = Roles.GetRolesForUser(sig_user.UserName);
            ViewData["all_roles"] = Roles.GetAllRoles();
            ViewData["profile"] = Profile.GetProfile(sig_user.UserName);
            VwCountry country = new VwCountry();
            try
            {
                country = cr.getCountry(Profile.GetProfile(sig_user.UserName).country_id);
                ViewData["country"] = country.CtyShort;
            }catch
            {
                ViewData["country"] = "";
            }

            return View();
        }
Esempio n. 2
0
 private void addCountries()
 {
     CountryRepository cr = new CountryRepository();
     ViewData["countries"] = new SelectList( cr.getAll(), "CtyRecID", "CtyShort");
 }
        private List<Actor> GetUserDetails()
        {
            // Get all profile objects
              System.Web.Profile.ProfileInfoCollection profiles = System.Web.Profile.ProfileManager.GetAllProfiles(System.Web.Profile.ProfileAuthenticationOption.All);
              List<Actor> userdetails = new List<Actor>();
              CountryRepository cr = new CountryRepository();
              foreach (System.Web.Profile.ProfileInfo info in profiles)
              {
                // We need to turn a ProfileInfo into a ProfileCommon to access the properties to do the search
                  System.Web.Profile.ProfileBase userProfile = System.Web.Profile.ProfileBase.Create(info.UserName);

                  System.Text.StringBuilder userString = new System.Text.StringBuilder();
                  userString.Append(info.UserName);
                  if (userProfile.GetPropertyValue("Organization").ToString() != "")
                      userString.Append(", " + userProfile.GetPropertyValue("Organization"));
                  if (userProfile.GetPropertyValue("country_id").ToString() != "")
                  {
                      var ctyShort = cr.getCountry(Convert.ToInt32(userProfile.GetPropertyValue("country_id").ToString()));
                      if (ctyShort != null)
                          userString.Append(", " + ctyShort.CtyShort);
                  }
                  userdetails.Add(new Actor(info.UserName, userString.ToString()));
              }
              return userdetails;
        }