Пример #1
0
        public ActionResult Outfits()
        {
            RegisteredUser user = GetOutfitsInfo();
            int            totalCount;
            int            season = 4;

            ViewData["Outfits"]      = closetOutfitViewRepository.Search(out totalCount, 10, 1, 1, user.Id, string.Empty, "1", user.Closet);
            ViewData["TotalOutfits"] = totalCount;
            ViewData["Pages"]        = Common.Paging(totalCount, 1, 10, 10);
            ViewData["PrivacyLevel"] = user.Closet.PrivacyLevel.ToString();

            if (DateTime.Today >= new DateTime(DateTime.Today.Year, 3, 21))
            {
                season = 1;
            }
            if (DateTime.Today >= new DateTime(DateTime.Today.Year, 6, 21))
            {
                season = 2;
            }
            if (DateTime.Today >= new DateTime(DateTime.Today.Year, 9, 21))
            {
                season = 3;
            }
            if (DateTime.Today >= new DateTime(DateTime.Today.Year, 12, 21))
            {
                season = 4;
            }

            ViewData["Season"] = season;
            return(View(user.Closet));
        }
Пример #2
0
        public ActionResult Outfits(string SortBy, string Search, string Page, string Season)
        {
            RegisteredUser user = GetOutfitsInfo();
            int            totalCount;

            if (Search == "Type a color, name or function to filter the results")
            {
                Search = string.Empty;
            }
            ViewData["Outfits"]      = this.Search(out totalCount, SortBy, Search, Page, Season, user.Id);
            ViewData["Season"]       = Season;
            ViewData["TotalOutfits"] = totalCount;
            ViewData["Pages"]        = Common.Paging(totalCount, Convert.ToInt32(Page), 10, 10);
            ViewData["PrivacyLevel"] = user.Closet.PrivacyLevel.ToString();
            return(View(user.Closet));
        }
Пример #3
0
        private List <Friend> GetGmailContacts(int page, List <int> selectedIndexs)
        {
            int            pageSize = 10;
            List <Friend>  friends  = new List <Friend>();
            MembershipUser mu       = Membership.GetUser();
            RegisteredUser user     = registeredUserRepository.GetByMembershipId(Convert.ToInt32(mu.ProviderUserKey));

            if (Session["GMailToken"] == null)
            {
                String token = Request.QueryString["token"];
                Session["GMailToken"] = AuthSubUtil.exchangeForSessionToken(token, null).ToString();
            }

            GAuthSubRequestFactory authFactory = new GAuthSubRequestFactory("cp", "testingFADE");
            RequestSettings        rs          = new RequestSettings("testingFADE", (String)Session["GMailToken"]);

            rs.AutoPaging = true;
            ContactsRequest cr = new ContactsRequest(rs);

            Feed <Contact> contacts = cr.GetContacts();
            int            i        = 1;

            if (page > 0)
            {
                foreach (Contact e in contacts.Entries)
                {
                    if (i < (page * pageSize) - 9)
                    {
                        i++;
                        continue;
                    }
                    if (i > (page * pageSize))
                    {
                        break;
                    }
                    if (e.PrimaryEmail == null)
                    {
                        continue;
                    }
                    Friend friend = new Friend();
                    friend.FirstName    = e.Title;
                    friend.EmailAddress = e.PrimaryEmail.Address;
                    friend.InvitedBy    = user;
                    friends.Add(friend);
                    i++;
                }
                ViewData["Pages"] = Common.Paging(contacts.TotalResults, page, pageSize, 10);
            }
            else if (selectedIndexs != null)
            {
                foreach (Contact e in contacts.Entries)
                {
                    if (!selectedIndexs.Exists(delegate(int record) { if (record == i)
                                                                      {
                                                                          return(true);
                                                                      }
                                                                      return(false); }))
                    {
                        i++;
                        continue;
                    }
                    Friend friend = new Friend();
                    friend.FirstName    = e.Title;
                    friend.EmailAddress = e.PrimaryEmail.Address;
                    friend.InvitedBy    = user;
                    friends.Add(friend);
                    i++;
                }
            }

            return(friends);
        }