Пример #1
0
        /// <summary>
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                _settings              = new SettingsRepository(base.ModuleContext.ModuleId, base.ModuleContext.TabModuleId);
                DefaultMessage         = System.Web.HttpUtility.JavaScriptStringEncode(_settings.DefaultMessage);
                MaxEmailInputs         = _settings.MaxEmailInvitesPerSubmit;
                MaxDailyInvites        = _settings.MaxEmailInvitesPerDay;
                pnlUserMessage.Visible = _settings.ShowMessageToUser;

                if (!IsPostBack)
                {
                    DotNetNuke.Entities.Tabs.TabController tCtrl = new DotNetNuke.Entities.Tabs.TabController();
                    var activityTab = tCtrl.GetTabByName("Activity Feed", PortalId, -1);
                    if (activityTab != null)
                    {
                        UserProfileTabId = activityTab.TabID;
                    }

                    var mCtrl = new DotNetNuke.Entities.Modules.ModuleController();
                    ModuleName = mCtrl.GetModule(base.ModuleId).DesktopModule.ModuleName;

                    lnkCloseModal.Visible = IsModal;

                    IInviteRepository inviteRepo = new InviteRepository();
                    DailyInviteCount = inviteRepo.GetUserInvites(base.UserId, DateTime.Today).Count();
                }
                DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxScriptSupport();
                DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
            }
            catch (Exception exc) //Module failed to load
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #2
0
        /// <summary>
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    IInviteRepository _repository = new InviteRepository();
                    _invitations = _repository.GetUserInvites(UserId, DateTime.MinValue).ToList();

                    DotNetNuke.Entities.Tabs.TabController tCtrl = new DotNetNuke.Entities.Tabs.TabController();
                    var activityTab = tCtrl.GetTabByName("Activity Feed", PortalId, -1);
                    if (activityTab != null)
                    {
                        UserProfileTabId = activityTab.TabID;
                    }

                    var mCtrl = new DotNetNuke.Entities.Modules.ModuleController();
                    ModuleName = mCtrl.GetModule(base.ModuleId).DesktopModule.ModuleName;
                }
                DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxScriptSupport();
                DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
            }
            catch (Exception exc) //Module failed to load
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #3
0
        public void TestGetUserInvites()
        {
            var userRepo = new UserRepository(database);
            var usr      = userRepo.CreateNew(new User {
                DateCreated = DateTime.Now, Email = "*****@*****.**", Name = "Jaytee"
            });
            var invRepo = new InviteRepository(database, userRepo);
            var project = invRepo.CreateNew(new Project {
                CreatedByUserId = usr.Id, DateCreated = DateTime.Now, Description = "A demo api", Name = "DEMO API"
            });
            var ivc = invRepo.CreateInvite(new Invite {
                Email = "*****@*****.**", InvitedAt = DateTime.Now
            }, project.Id, usr.Id);

            Assert.NotNull(ivc);
            Assert.NotEmpty(ivc.Invites);


            var(invts, _) = invRepo.GetUserInvites("*****@*****.**", 0, 30);
            Assert.NotEmpty(invts);
        }