Exemple #1
0
        protected void btnSubscribe_Click(object sender, ImageClickEventArgs e)
        {
            var objEventSubscriptionController = new EventSubscriptionController();

            if (btnSubscribe.ImageUrl == IconController.IconURL("Unchecked"))
            {
                var objEventSubscription = new EventSubscriptionInfo();
                objEventSubscription.SubscriptionID = -1;
                objEventSubscription.ModuleID       = ModuleId;
                objEventSubscription.PortalID       = PortalId;
                objEventSubscription.UserID         = UserId;
                objEventSubscriptionController.EventsSubscriptionSave(objEventSubscription);
                btnSubscribe.Visible       = true;
                lblSubscribe.Text          = Localization.GetString("lblUnsubscribe", LocalResourceFile);
                btnSubscribe.AlternateText = Localization.GetString("MenuUnsubscribe", LocalResourceFile);
                btnSubscribe.ToolTip       = Localization.GetString("MenuTTUnsubscribe", LocalResourceFile);
                btnSubscribe.ImageUrl      = IconController.IconURL("Checked");
            }
            else
            {
                objEventSubscriptionController.EventsSubscriptionDeleteUser(UserId, ModuleId);
                btnSubscribe.Visible       = true;
                lblSubscribe.Text          = Localization.GetString("lblSubscribe", LocalResourceFile);
                btnSubscribe.AlternateText = Localization.GetString("MenuSubscribe", LocalResourceFile);
                btnSubscribe.ToolTip       = Localization.GetString("MenuTTSubscribe", LocalResourceFile);
                btnSubscribe.ImageUrl      = IconController.IconURL("Unchecked");
            }
        }
Exemple #2
0
        private void UpdateSubscriptions()
        {
            var objCtlEventSubscriptions = new EventSubscriptionController();
            var lstEventSubscriptions    = default(ArrayList);

            lstEventSubscriptions = objCtlEventSubscriptions.EventsSubscriptionGetModule(this.ModuleId);
            if (lstEventSubscriptions.Count == 0)
            {
                return;
            }

            var objEventInfo = new EventInfoHelper(this.ModuleId, this.TabId, this.PortalId, null);
            var lstusers     = objEventInfo.GetEventModuleViewers();

            var objEventSubscription = default(EventSubscriptionInfo);

            foreach (EventSubscriptionInfo tempLoopVar_objEventSubscription in lstEventSubscriptions)
            {
                objEventSubscription = tempLoopVar_objEventSubscription;
                if (!lstusers.Contains(objEventSubscription.UserID))
                {
                    var objCtlUser = new UserController();
                    var objUser    = objCtlUser.GetUser(this.PortalId, objEventSubscription.UserID);

                    if (ReferenceEquals(objUser, null) || !objUser.IsSuperUser)
                    {
                        objCtlEventSubscriptions.EventsSubscriptionDeleteUser(
                            objEventSubscription.UserID, this.ModuleId);
                    }
                }
            }
        }