public SqlAccountSettings(AccountSettingsModel u)
 {
     this.CalendarId = u.CalendarId;
     this.ChallengeCount = u.ChallengeCount;
     this.IsApartOfLeague = u.IsApartOfLeague;
     this.IsDuesManagementLockedDown = u.IsDuesManagementLockedDown;
     this.IsEventsCoordinatorOrBetter = u.IsEventsCoordinatorOrBetter;
     this.IsManagerOrBetter = u.IsManagerOrBetter;
     this.IsSubscriptionActive = u.IsSubscriptionActive;
     this.IsTreasurer = u.IsTreasurer;
     this.LeagueLogo = u.LeagueLogo;
     this.OfficialsRequestCount = u.OfficialsRequestCount;
     this.ShopEndUrl = u.ShopEndUrl;
     this.UnreadMessagesCount = u.UnreadMessagesCount;
 }
        public ActionResult AccountSettings()
        {
            try
            {
                if (HttpContext.Request.InputStream != null)
                {
                    Stream stream = HttpContext.Request.InputStream;
                    var ob = Network.LoadObject<UserMobile>(ref stream);
                    var mem = MemberCache.GetMemberDisplay(ob.MemberId);
                    if (ob.LoginId == mem.UserId)
                    {
                        AccountSettingsModel settings = new AccountSettingsModel();
                        if (mem.CurrentLeagueId != new Guid())
                        {
                            var league = MemberCache.GetLeagueOfMember(ob.MemberId);
                            if (league != null && league.Logo != null)
                                settings.LeagueLogo = league.Logo.ImageUrl;
                            settings.IsApartOfLeague = true;
                            settings.IsDuesManagementLockedDown = MemberCache.IsDuesManagementLockedDown(ob.MemberId);
                            settings.IsSubscriptionActive = MemberCache.CheckIsLeagueSubscriptionPaid(ob.MemberId);
                            settings.IsTreasurer = MemberCache.IsTreasurerOrBetterOfLeague(ob.MemberId);
                            settings.IsManagerOrBetter = MemberCache.IsManagerOrBetterOfLeague(ob.MemberId);
                            settings.IsEventsCoordinatorOrBetter = MemberCache.IsEventsCourdinatorOrBetterOfLeague(ob.MemberId);
                            settings.CalendarId = MemberCache.GetCalendarIdForMemberLeague(ob.MemberId);
                            settings.ShopEndUrl = MemberCache.GetStoreManagerKeysForUrlLeague(ob.MemberId);
                            settings.UnreadMessagesCount = MemberCache.GetUnreadMessagesCount(ob.MemberId);
                            settings.ChallengeCount = ManagementCache.GetBoutChallengesCount();
                            settings.OfficialsRequestCount = ManagementCache.GetOfficiatingRequestsCount();
                        }
                        settings.IsSuccessful = true;
                        return Json(settings, JsonRequestBehavior.AllowGet);
                    }
                }
            }
            catch (Exception e)
            {
                ErrorDatabaseManager.AddException(e, GetType());

            }
            return Json(new MobileNotification() { IsSuccessful = false }, JsonRequestBehavior.AllowGet);
        }