Пример #1
0
        public void grdEnrollment_ItemCommand(object sender, DataGridCommandEventArgs e)
        {
            var objEnroll = default(EventSignupsInfo);

            objEnroll = _objCtlEventSignups.EventsSignupsGet(
                Convert.ToInt32(grdEnrollment.DataKeys[e.Item.ItemIndex]), ModuleId, false);

            try
            {
                switch (e.CommandName)
                {
                case "Select":
                    try
                    {
                        var itemID             = objEnroll.EventID;
                        var objEventInfoHelper =
                            new EventInfoHelper(ModuleId, TabId, PortalId, Settings);
                        Response.Redirect(
                            objEventInfoHelper.AddSkinContainerControls(
                                EditUrl("ItemID", itemID.ToString(), "Edit"), "?"));
                    }
                    // ReSharper disable once EmptyGeneralCatchClause
                    catch (Exception)
                    { }
                    break;

                case "User":
                    var objCtlEvent = new EventController();
                    var objEvent    = objCtlEvent.EventsGet(objEnroll.EventID, objEnroll.ModuleID);

                    var objEventEmailInfo = new EventEmailInfo();
                    var objEventEmail     = new EventEmails(PortalId, ModuleId, LocalResourceFile,
                                                            ((PageBase)Page).PageCulture.Name);
                    objEventEmailInfo.TxtEmailSubject = txtEmailSubject.Text;
                    objEventEmailInfo.TxtEmailBody    = txtEmailMessage.Text;
                    objEventEmailInfo.TxtEmailFrom    = txtEmailFrom.Text;
                    if (objEnroll.UserID > -1)
                    {
                        objEventEmailInfo.UserIDs.Add(objEnroll.UserID);
                    }
                    else
                    {
                        objEventEmailInfo.UserEmails.Add(objEnroll.AnonEmail);
                        objEventEmailInfo.UserLocales.Add(objEnroll.AnonCulture);
                        objEventEmailInfo.UserTimeZoneIds.Add(objEnroll.AnonTimeZoneId);
                    }
                    objEventEmail.SendEmails(objEventEmailInfo, objEvent, objEnroll);
                    break;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
            BindData();
        }
Пример #2
0
        protected void btnModerate_Click(object sender, ImageClickEventArgs e)
        {
            var objEventInfoHelper = new EventInfoHelper(ModuleId, TabId, PortalId, Settings);
            var socialGroupId      = GetUrlGroupId();
            var socialUserId       = GetUrlUserId();

            if (socialGroupId > 0)
            {
                Response.Redirect(
                    objEventInfoHelper.AddSkinContainerControls(
                        EditUrl("groupid", socialGroupId.ToString(), "Moderate"), "?"));
            }
            else if (socialUserId > 0)
            {
                Response.Redirect(
                    objEventInfoHelper.AddSkinContainerControls(
                        EditUrl("userid", socialUserId.ToString(), "Moderate"), "?"));
            }
            else
            {
                Response.Redirect(objEventInfoHelper.AddSkinContainerControls(EditUrl("Moderate"), "?"));
            }
        }
Пример #3
0
 public void grdRecurEvents_ItemCommand(object sender, DataGridCommandEventArgs e)
 {
     switch (e.CommandName)
     {
     case "Select":
         var itemID             = Convert.ToInt32(e.Item.Cells[4].Text);
         var objEventInfoHelper =
             new EventInfoHelper(this.ModuleId, this.TabId, this.PortalId, this.Settings);
         this.Response.Redirect(
             objEventInfoHelper.AddSkinContainerControls(
                 Globals.NavigateURL(this.TabId, "Edit", "Mid=" + this.ModuleId, "ItemID=" + itemID,
                                     "EditRecur=All"), "?"));
         break;
     }
 }
Пример #4
0
 public void grdEvents_ItemCommand(object sender, DataGridCommandEventArgs e)
 {
     switch (e.CommandName)
     {
     case "Select":
         var itemID             = Convert.ToInt32(grdEvents.DataKeys[e.Item.ItemIndex]);
         var objEventInfoHelper =
             new EventInfoHelper(ModuleId, TabId, PortalId, Settings);
         Response.Redirect(
             objEventInfoHelper.AddSkinContainerControls(
                 Globals.NavigateURL(TabId, "Edit", "Mid=" + ModuleId, "ItemID=" + itemID,
                                     "EditRecur=Single"), "?"));
         break;
     }
 }
Пример #5
0
        protected void EventCalendar_SelectionChanged(object sender, EventArgs e)
        {
            EventCalendar.VisibleDate = EventCalendar.SelectedDate;
            SelectedDate = Convert.ToDateTime(EventCalendar.SelectedDate.Date);
            var urlDate = Convert.ToString(EventCalendar.SelectedDate.Date.ToShortDateString());

            dpGoToDate.SelectedDate = SelectedDate.Date;
            if (Settings.Monthcellnoevents)
            {
                try
                {
                    EventCalendar.SelectedDate = new DateTime();
                    if (Settings.Eventdaynewpage)
                    {
                        var objEventInfoHelper =
                            new EventInfoHelper(ModuleId, TabId, PortalId, Settings);
                        Response.Redirect(
                            objEventInfoHelper.AddSkinContainerControls(
                                Globals.NavigateURL(TabId, "Day", "Mid=" + ModuleId,
                                                    "selecteddate=" + urlDate), "&"));
                    }
                    else
                    {
                        Response.Redirect(
                            Globals.NavigateURL(TabId, "", "ModuleID=" + ModuleId, "mctl=EventDay",
                                                "selecteddate=" + urlDate));
                    }
                }
                // ReSharper disable once EmptyGeneralCatchClause
                catch (Exception)
                { }
            }
            else
            {
                //fill grid with current selection's data
                BindDataGrid();
            }
        }
Пример #6
0
        protected void EventCalendar_SelectionChanged(object sender, EventArgs e)
        {
            this.EventCalendar.VisibleDate = this.EventCalendar.SelectedDate;
            this.SelectedDate = Convert.ToDateTime(this.EventCalendar.SelectedDate.Date);
            var urlDate = Convert.ToString(this.EventCalendar.SelectedDate.Date.ToShortDateString());

            this.dpGoToDate.SelectedDate = this.SelectedDate.Date;
            if (this.Settings.Monthcellnoevents)
            {
                try
                {
                    this.EventCalendar.SelectedDate = new DateTime();
                    if (this.Settings.Eventdaynewpage)
                    {
                        var objEventInfoHelper =
                            new EventInfoHelper(this.ModuleId, this.TabId, this.PortalId, this.Settings);
                        this.Response.Redirect(
                            objEventInfoHelper.AddSkinContainerControls(
                                Globals.NavigateURL(this.TabId, "Day", "Mid=" + this.ModuleId,
                                                    "selecteddate=" + urlDate), "&"));
                    }
                    else
                    {
                        this.Response.Redirect(
                            Globals.NavigateURL(this.TabId, "", "ModuleID=" + this.ModuleId, "mctl=EventDay",
                                                "selecteddate=" + urlDate));
                    }
                }
                catch (Exception)
                { }
            }
            else
            {
                //fill grid with current selection's data
                this.BindDataGrid();
            }
        }
Пример #7
0
        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                btnMonth.Visible = false;
                if (Settings.MonthAllowed && Parent.ID.ToLower() != "eventmonth")
                {
                    btnMonth.Visible       = true;
                    btnMonth.AlternateText = Localization.GetString("MenuMonth", LocalResourceFile);
                    btnMonth.ToolTip       = Localization.GetString("MenuMonth", LocalResourceFile);
                }
                btnWeek.Visible = false;
                if (Settings.WeekAllowed && Parent.ID.ToLower() != "eventweek")
                {
                    btnWeek.Visible       = true;
                    btnWeek.AlternateText = Localization.GetString("MenuWeek", LocalResourceFile);
                    btnWeek.ToolTip       = Localization.GetString("MenuWeek", LocalResourceFile);
                }
                btnList.Visible = false;
                if (Settings.ListAllowed && Parent.ID.ToLower() != "eventlist" &&
                    Parent.ID.ToLower() != "eventrpt")
                {
                    btnList.Visible       = true;
                    btnList.AlternateText = Localization.GetString("MenuList", LocalResourceFile);
                    btnList.ToolTip       = Localization.GetString("MenuList", LocalResourceFile);
                }
                btnEnroll.Visible = false;
                if (Settings.Eventsignup && Parent.ID.ToLower() != "eventmyenrollments")
                {
                    btnEnroll.Visible       = true;
                    btnEnroll.AlternateText = Localization.GetString("MenuMyEnrollments", LocalResourceFile);
                    btnEnroll.ToolTip       = Localization.GetString("MenuMyEnrollments", LocalResourceFile);
                }

                var socialGroupId = GetUrlGroupId();
                var groupStr      = "";
                if (socialGroupId > 0)
                {
                    groupStr = "&GroupId=" + socialGroupId;
                }
                var socialUserId = GetUrlUserId();

                hypiCal.Visible     = Settings.IcalOnIconBar;
                hypiCal.ToolTip     = Localization.GetString("MenuiCal", LocalResourceFile);
                hypiCal.NavigateUrl = "~/DesktopModules/Events/EventVCal.aspx?ItemID=0&Mid=" +
                                      Convert.ToString(ModuleId) + "&tabid=" + Convert.ToString(TabId) +
                                      groupStr;

                btnRSS.Visible     = Settings.RSSEnable;
                btnRSS.ToolTip     = Localization.GetString("MenuRSS", LocalResourceFile);
                btnRSS.NavigateUrl = "~/DesktopModules/Events/EventRSS.aspx?mid=" +
                                     Convert.ToString(ModuleId) + "&tabid=" + Convert.ToString(TabId) +
                                     groupStr;
                btnRSS.Target = "_blank";

                btnAdd.Visible        = false;
                btnModerate.Visible   = false;
                btnSettings.Visible   = false;
                btnCategories.Visible = false;
                btnLocations.Visible  = false;
                btnSubscribe.Visible  = false;
                lblSubscribe.Visible  = false;
                imgBar.Visible        = false;

                if (Request.IsAuthenticated)
                {
                    var objEventInfoHelper =
                        new EventInfoHelper(ModuleId, TabId, PortalId, Settings);

                    //Module Editor.
                    if (IsModuleEditor())
                    {
                        btnAdd.ToolTip = Localization.GetString("MenuAddEvents", LocalResourceFile);
                        if (socialGroupId > 0)
                        {
                            btnAdd.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("groupid", socialGroupId.ToString(), "Edit"), "?");
                            btnAdd.Visible = true;
                        }
                        else if (socialUserId > 0)
                        {
                            if (socialUserId == UserId || IsModerator())
                            {
                                btnAdd.NavigateUrl =
                                    objEventInfoHelper.AddSkinContainerControls(
                                        EditUrl("Userid", socialUserId.ToString(), "Edit"), "?");
                                btnAdd.Visible = true;
                            }
                        }
                        else
                        {
                            btnAdd.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(EditUrl("Edit"), "?");
                            btnAdd.Visible = true;
                        }
                    }
                    if (Settings.Moderateall &&
                        (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) || IsModerator()))
                    {
                        btnModerate.Visible       = true;
                        btnModerate.AlternateText = Localization.GetString("MenuModerate", LocalResourceFile);
                        btnModerate.ToolTip       = Localization.GetString("MenuModerate", LocalResourceFile);
                    }
                    // Settings Editor.
                    if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) || IsSettingsEditor())
                    {
                        btnSettings.Visible = true;
                        btnSettings.ToolTip = Localization.GetString("MenuSettings", LocalResourceFile);
                        if (socialGroupId > 0)
                        {
                            btnSettings.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("groupid", socialGroupId.ToString(), "EventSettings"), "?");
                        }
                        else if (socialUserId > 0)
                        {
                            btnSettings.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("userid", socialUserId.ToString(), "EventSettings"), "?");
                        }
                        else
                        {
                            btnSettings.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(EditUrl("EventSettings"), "?");
                        }
                    }
                    // Categories Editor.
                    if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) || IsCategoryEditor())
                    {
                        btnCategories.Visible = true;
                        btnCategories.ToolTip = Localization.GetString("MenuCategories", LocalResourceFile);
                        if (socialGroupId > 0)
                        {
                            btnCategories.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("groupid", socialGroupId.ToString(), "Categories"), "?");
                        }
                        else if (socialUserId > 0)
                        {
                            btnCategories.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("userid", socialUserId.ToString(), "Categories"), "?");
                        }
                        else
                        {
                            btnCategories.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(EditUrl("Categories"), "?");
                        }
                    }
                    // Locations Editor.
                    if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName) || IsLocationEditor())
                    {
                        btnLocations.Visible = true;
                        btnLocations.ToolTip = Localization.GetString("MenuLocations", LocalResourceFile);
                        if (socialGroupId > 0)
                        {
                            btnLocations.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("groupid", socialGroupId.ToString(), "Locations"), "?");
                        }
                        else if (socialUserId > 0)
                        {
                            btnLocations.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(
                                    EditUrl("userid", socialUserId.ToString(), "Locations"), "?");
                        }
                        else
                        {
                            btnLocations.NavigateUrl =
                                objEventInfoHelper.AddSkinContainerControls(EditUrl("Locations"), "?");
                        }
                    }

                    if (Settings.Neweventemails == "Subscribe")
                    {
                        btnSubscribe.Visible = true;
                        lblSubscribe.Visible = true;
                        imgBar.Visible       = true;
                        var objEventSubscriptionController = new EventSubscriptionController();
                        var objEventSubscription           =
                            objEventSubscriptionController.EventsSubscriptionGetUser(UserId, ModuleId);
                        if (ReferenceEquals(objEventSubscription, null))
                        {
                            lblSubscribe.Text          = Localization.GetString("lblSubscribe", LocalResourceFile);
                            btnSubscribe.AlternateText =
                                Localization.GetString("MenuSubscribe", LocalResourceFile);
                            btnSubscribe.ToolTip =
                                Localization.GetString("MenuTTSubscribe", LocalResourceFile);
                            btnSubscribe.ImageUrl = IconController.IconURL("Unchecked");
                        }
                        else
                        {
                            lblSubscribe.Text          = Localization.GetString("lblUnsubscribe", LocalResourceFile);
                            btnSubscribe.AlternateText =
                                Localization.GetString("MenuUnsubscribe", LocalResourceFile);
                            btnSubscribe.ToolTip =
                                Localization.GetString("MenuTTUnsubscribe", LocalResourceFile);
                            btnSubscribe.ImageUrl = IconController.IconURL("Checked");
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #8
0
        private void LoadModuleControl()
        {
            try
            {
                _socialGroupId = GetUrlGroupId();
                _socialUserId  = GetUrlUserId();
                var objModules       = new ModuleController();
                var objModule        = objModules.GetModule(ModuleId, TabId);
                var objDesktopModule =
                    DesktopModuleController.GetDesktopModule(objModule.DesktopModuleID, PortalId);
                var objEventInfoHelper = new EventInfoHelper(ModuleId, TabId, PortalId, Settings);

                // Force Module Default Settings on new Version or New Module Instance
                if (objDesktopModule.Version != Settings.Version)
                {
                    CreateThemeDirectory();
                    //                    objEventInfoHelper.SetDefaultModuleSettings(ModuleId, TabId, Page, LocalResourceFile)
                }

                if (!(Request.QueryString["mctl"] == null) &&
                    (ModuleId == Convert.ToInt32(Request.QueryString["ModuleID"]) ||
                     ModuleId == Convert.ToInt32(Request.QueryString["mid"])))
                {
                    if (Request["mctl"].EndsWith(".ascx"))
                    {
                        _mcontrolToLoad = Request["mctl"];
                    }
                    else
                    {
                        _mcontrolToLoad = Request["mctl"] + ".ascx";
                    }
                }

                // Set Default, if none selected
                if (_mcontrolToLoad.Length == 0)
                {
                    if (!ReferenceEquals(Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)), null))
                    {
                        _mcontrolToLoad = Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)).Value;
                    }
                    else
                    {
                        // See if Default View Set
                        _mcontrolToLoad = Settings.DefaultView;
                    }
                }

                // Check for Valid Module to Load
                _mcontrolToLoad = Path.GetFileNameWithoutExtension(_mcontrolToLoad) + ".ascx";
                switch (_mcontrolToLoad.ToLower())
                {
                case "eventdetails.ascx":
                    // Search and RSS feed may direct detail page url to base module -
                    // should be put in new page
                    if (Settings.Eventdetailnewpage)
                    {
                        //Get the item id of the selected event
                        if (!ReferenceEquals(Request.Params["ItemId"], null))
                        {
                            _itemId = int.Parse(Request.Params["ItemId"]);
                            var objCtlEvents = new EventController();
                            var objEvent     = objCtlEvents.EventsGet(_itemId, ModuleId);
                            if (!ReferenceEquals(objEvent, null))
                            {
                                Response.Redirect(
                                    objEventInfoHelper.GetDetailPageRealURL(
                                        objEvent.EventID, _socialGroupId, _socialUserId));
                            }
                        }
                    }
                    break;

                case "eventday.ascx":
                    break;

                case "eventmonth.ascx":
                    break;

                case "eventweek.ascx":
                    break;

                case "eventrpt.ascx":
                    if (Settings.ListViewGrid)
                    {
                        _mcontrolToLoad = "EventList.ascx";
                    }
                    break;

                case "eventlist.ascx":
                    if (!Settings.ListViewGrid)
                    {
                        _mcontrolToLoad = "EventRpt.ascx";
                    }
                    break;

                case "eventmoderate.ascx":
                    Response.Redirect(
                        objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(TabId, "Moderate", "Mid=" + ModuleId),
                            "?"));
                    break;

                case "eventmyenrollments.ascx":
                    break;

                default:
                    lblModuleSettings.Text    = Localization.GetString("lblBadControl", LocalResourceFile);
                    lblModuleSettings.Visible = true;
                    return;
                }

                var objPortalModuleBase = (PortalModuleBase)LoadControl(_mcontrolToLoad);
                objPortalModuleBase.ModuleConfiguration = ModuleConfiguration.Clone();
                objPortalModuleBase.ID = Path.GetFileNameWithoutExtension(_mcontrolToLoad);
                phMain.Controls.Add(objPortalModuleBase);

                //EVT-4499 Exlude the EventMyEnrollment.ascx to be set as cookie
                if (_mcontrolToLoad.ToLower() != "eventdetails.ascx" &&
                    _mcontrolToLoad.ToLower() != "eventday.ascx" &&
                    _mcontrolToLoad.ToLower() != "eventmyenrollments.ascx")
                {
                    var objCookie = new HttpCookie("DNNEvents" + Convert.ToString(ModuleId));
                    objCookie.Value = _mcontrolToLoad;
                    if (ReferenceEquals(Request.Cookies.Get("DNNEvents" + Convert.ToString(ModuleId)), null))
                    {
                        Response.Cookies.Add(objCookie);
                    }
                    else
                    {
                        Response.Cookies.Set(objCookie);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #9
0
        protected void cmdPurchase_Click(object sender, EventArgs e)
        {
            var objEvent = default(EventInfo);

            try
            {
                if (this.Page.IsValid)
                {
                    objEvent = this._objCtlEvent.EventsGet(this._itemID, this.ModuleId);
                    // User wants to purchase event, create Event Signup Record
                    this._objEventSignups = new EventSignupsInfo();

                    //Just in case the user has clicked back and has now clicked Purchase again!!
                    var objEventSignupsChk = default(EventSignupsInfo);
                    if (string.IsNullOrEmpty(this._anonEmail))
                    {
                        objEventSignupsChk =
                            this._objCtlEventSignups.EventsSignupsGetUser(
                                objEvent.EventID, this.UserId, objEvent.ModuleID);
                    }
                    else
                    {
                        objEventSignupsChk =
                            this._objCtlEventSignups.EventsSignupsGetAnonUser(
                                objEvent.EventID, this._anonEmail, objEvent.ModuleID);
                    }
                    if (!ReferenceEquals(objEventSignupsChk, null))
                    {
                        this._objEventSignups.SignupID = objEventSignupsChk.SignupID;
                    }
                    this._objEventSignups.EventID  = objEvent.EventID;
                    this._objEventSignups.ModuleID = objEvent.ModuleID;
                    if (string.IsNullOrEmpty(this._anonEmail))
                    {
                        this._objEventSignups.UserID         = this.UserId;
                        this._objEventSignups.AnonEmail      = null;
                        this._objEventSignups.AnonName       = null;
                        this._objEventSignups.AnonTelephone  = null;
                        this._objEventSignups.AnonCulture    = null;
                        this._objEventSignups.AnonTimeZoneId = null;
                    }
                    else
                    {
                        var objSecurity = new PortalSecurity();
                        this._objEventSignups.UserID    = -1;
                        this._objEventSignups.AnonEmail =
                            objSecurity.InputFilter(this._anonEmail, PortalSecurity.FilterFlag.NoScripting);
                        this._objEventSignups.AnonName =
                            objSecurity.InputFilter(this._anonName, PortalSecurity.FilterFlag.NoScripting);
                        this._objEventSignups.AnonTelephone =
                            objSecurity.InputFilter(this._anonTelephone, PortalSecurity.FilterFlag.NoScripting);
                        this._objEventSignups.AnonCulture    = Thread.CurrentThread.CurrentCulture.Name;
                        this._objEventSignups.AnonTimeZoneId = this.GetDisplayTimeZoneId();
                    }
                    this._objEventSignups.PayPalStatus      = "none";
                    this._objEventSignups.PayPalReason      = "PayPal call initiated...";
                    this._objEventSignups.PayPalPaymentDate = DateTime.UtcNow;
                    this._objEventSignups.Approved          = false;
                    this._objEventSignups.NoEnrolees        = int.Parse(this.lblNoEnrolees.Text);

                    this._objEventSignups = this.CreateEnrollment(this._objEventSignups, objEvent);

                    if (!ReferenceEquals(objEventSignupsChk, null))
                    {
                        this._objEventSignups =
                            this._objCtlEventSignups.EventsSignupsGet(objEventSignupsChk.SignupID,
                                                                      objEventSignupsChk.ModuleID, false);
                    }

                    // Mail users
                    if (this.Settings.SendEnrollMessagePaying)
                    {
                        var objEventEmailInfo = new EventEmailInfo();
                        var objEventEmail     = new EventEmails(this.PortalId, this.ModuleId, this.LocalResourceFile,
                                                                ((PageBase)this.Page).PageCulture.Name);
                        objEventEmailInfo.TxtEmailSubject = this.Settings.Templates.txtEnrollMessageSubject;
                        objEventEmailInfo.TxtEmailBody    = this.Settings.Templates.txtEnrollMessagePaying;
                        objEventEmailInfo.TxtEmailFrom    = this.Settings.StandardEmail;
                        if (string.IsNullOrEmpty(this._anonEmail))
                        {
                            objEventEmailInfo.UserEmails.Add(this.PortalSettings.UserInfo.Email);
                            objEventEmailInfo.UserLocales.Add(this.PortalSettings.UserInfo.Profile.PreferredLocale);
                            objEventEmailInfo.UserTimeZoneIds.Add(this.PortalSettings.UserInfo.Profile.PreferredTimeZone
                                                                  .Id);
                        }
                        else
                        {
                            objEventEmailInfo.UserEmails.Add(this._objEventSignups.AnonEmail);
                            objEventEmailInfo.UserLocales.Add(this._objEventSignups.AnonCulture);
                            objEventEmailInfo.UserTimeZoneIds.Add(this._objEventSignups.AnonTimeZoneId);
                        }
                        objEventEmailInfo.UserIDs.Add(objEvent.OwnerID);
                        objEventEmail.SendEmails(objEventEmailInfo, objEvent, this._objEventSignups);
                    }

                    // build PayPal URL
                    var ppurl = this.Settings.Paypalurl + "/cgi-bin/webscr?cmd=_xclick&business=";

                    var socialGroupId = this.GetUrlGroupId();

                    var objEventInfoHelper =
                        new EventInfoHelper(this.ModuleId, this.TabId, this.PortalId, this.Settings);
                    var returnURL = "";
                    if (socialGroupId > 0)
                    {
                        returnURL = objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(this.TabId, "PPEnroll", "Mid=" + Convert.ToString(this.ModuleId),
                                                "signupid=" + Convert.ToString(this._objEventSignups.SignupID),
                                                "status=enrolled", "groupid=" + socialGroupId), "?");
                    }
                    else
                    {
                        returnURL = objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(this.TabId, "PPEnroll", "Mid=" + Convert.ToString(this.ModuleId),
                                                "signupid=" + Convert.ToString(this._objEventSignups.SignupID),
                                                "status=enrolled"), "?");
                    }
                    if (returnURL.IndexOf("://") + 1 == 0)
                    {
                        returnURL = Globals.AddHTTP(Globals.GetDomainName(this.Request)) + returnURL;
                    }
                    var cancelURL = "";
                    if (socialGroupId > 0)
                    {
                        cancelURL = objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(this.TabId, "PPEnroll", "Mid=" + Convert.ToString(this.ModuleId),
                                                "signupid=" + Convert.ToString(this._objEventSignups.SignupID),
                                                "status=cancelled", "groupid=" + socialGroupId), "?");
                    }
                    else
                    {
                        cancelURL = objEventInfoHelper.AddSkinContainerControls(
                            Globals.NavigateURL(this.TabId, "PPEnroll", "Mid=" + Convert.ToString(this.ModuleId),
                                                "signupid=" + Convert.ToString(this._objEventSignups.SignupID),
                                                "status=cancelled"), "?");
                    }
                    if (cancelURL.IndexOf("://") + 1 == 0)
                    {
                        cancelURL = Globals.AddHTTP(Globals.GetDomainName(this.Request)) + cancelURL;
                    }
                    var strPayPalURL = "";
                    strPayPalURL = ppurl + Globals.HTTPPOSTEncode(objEvent.PayPalAccount);
                    strPayPalURL = strPayPalURL + "&item_name=" +
                                   Globals.HTTPPOSTEncode(objEvent.ModuleTitle + " - " + this.lblEventName.Text +
                                                          " ( " + this.lblFee.Text + " " + this.lblFeeCurrency.Text +
                                                          " )");
                    strPayPalURL = strPayPalURL + "&item_number=" +
                                   Globals.HTTPPOSTEncode(Convert.ToString(this._objEventSignups.SignupID));
                    strPayPalURL = strPayPalURL + "&quantity=" +
                                   Globals.HTTPPOSTEncode(Convert.ToString(this._objEventSignups.NoEnrolees));
                    strPayPalURL = strPayPalURL + "&custom=" +
                                   Globals.HTTPPOSTEncode(
                        Convert.ToDateTime(this.lblStartDate.Text).ToShortDateString());

                    // Make sure currency is in correct format
                    var dblFee    = double.Parse(this.lblFee.Text);
                    var uiculture = Thread.CurrentThread.CurrentCulture;
                    Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
                    strPayPalURL = strPayPalURL + "&amount=" +
                                   Globals.HTTPPOSTEncode(Strings.Format(dblFee, "#,##0.00"));
                    Thread.CurrentThread.CurrentCulture = uiculture;

                    strPayPalURL = strPayPalURL + "&currency_code=" +
                                   Globals.HTTPPOSTEncode(this.lblTotalCurrency.Text);
                    strPayPalURL = strPayPalURL + "&return=" + returnURL;
                    strPayPalURL = strPayPalURL + "&cancel_return=" + cancelURL;
                    strPayPalURL = strPayPalURL + "&notify_url=" +
                                   Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(this.Request)) +
                                                          "/DesktopModules/Events/EventIPN.aspx");
                    strPayPalURL = strPayPalURL + "&undefined_quantity=&no_note=1&no_shipping=1";
                    //strPayPalURL = strPayPalURL & "&undefined_quantity=&no_note=1&no_shipping=1&rm=2"

                    // redirect to PayPal
                    this.Response.Redirect(strPayPalURL, true);
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #10
0
        /// <summary>
        ///     Render each day in the event (i.e. Cells)
        /// </summary>
        protected void EventCalendar_DayRender(object sender, DayRenderEventArgs e)
        {
            var objEvent    = default(EventInfo);
            var cellcontrol = new LiteralControl();

            _objEventInfoHelper = new EventInfoHelper(ModuleId, TabId, PortalId, Settings);

            // Get Events/Sub-Calendar Events
            var dayEvents    = new ArrayList();
            var allDayEvents = default(ArrayList);

            allDayEvents = _objEventInfoHelper.GetDateEvents(_selectedEvents, e.Day.Date);
            allDayEvents.Sort(new EventInfoHelper.EventDateSort());

            foreach (EventInfo tempLoopVar_objEvent in allDayEvents)
            {
                objEvent = tempLoopVar_objEvent;
                //if day not in current (selected) Event month OR full enrollments should be hidden, ignore
                if ((Settings.ShowEventsAlways || e.Day.Date.Month == SelectedDate.Month) &&
                    !HideFullEvent(objEvent))
                {
                    dayEvents.Add(objEvent);
                }
            }

            // If No Cell Event Display...
            if (Settings.Monthcellnoevents)
            {
                if (Settings.ShowEventsAlways == false && e.Day.IsOtherMonth)
                {
                    e.Cell.Text = "";
                    return;
                }

                if (dayEvents.Count > 0)
                {
                    e.Day.IsSelectable = true;

                    if (e.Day.Date == SelectedDate)
                    {
                        e.Cell.CssClass = "EventSelectedDay";
                    }
                    else
                    {
                        if (e.Day.IsWeekend)
                        {
                            e.Cell.CssClass = "EventWeekendDayEvents";
                        }
                        else
                        {
                            e.Cell.CssClass = "EventDayEvents";
                        }
                    }

                    if (Settings.Eventtooltipmonth)
                    {
                        var themeCss = GetThemeSettings().CssClass;

                        var tmpToolTipTitle = Settings.Templates.txtTooltipTemplateTitleNT;
                        if (tmpToolTipTitle.IndexOf("{0}") + 1 > 0)
                        {
                            tmpToolTipTitle = tmpToolTipTitle.Replace("{0}", "{0:d}");
                        }
                        var tooltipTitle =
                            Convert.ToString(HttpUtility.HtmlDecode(string.Format(tmpToolTipTitle, e.Day.Date))
                                             .Replace(Environment.NewLine, ""));
                        var cellToolTip = ""; //Holds control generated tooltip

                        foreach (EventInfo tempLoopVar_objEvent in dayEvents)
                        {
                            objEvent = tempLoopVar_objEvent;
                            //Add horizontal row to seperate the eventdescriptions
                            if (!string.IsNullOrEmpty(cellToolTip))
                            {
                                cellToolTip = cellToolTip + "<hr/>";
                            }

                            cellToolTip +=
                                CreateEventName(
                                    objEvent,
                                    Convert.ToString(Settings.Templates.txtTooltipTemplateBodyNT
                                                     .Replace(Constants.vbLf, "").Replace(Constants.vbCr, "")));
                        }
                        e.Cell.Attributes.Add(
                            "title",
                            "<table class=\"" + themeCss + " Eventtooltiptable\"><tr><td class=\"" + themeCss +
                            " Eventtooltipheader\">" + tooltipTitle + "</td></tr><tr><td class=\"" + themeCss +
                            " Eventtooltipbody\">" + cellToolTip + "</td></tr></table>");
                        e.Cell.ID = "ctlEvents_Mod_" + ModuleId + "_EventDate_" + e.Day.Date.ToString("yyyyMMMdd");
                    }

                    var dailyLink = new HyperLink();
                    dailyLink.Text = string.Format(Settings.Templates.txtMonthDayEventCount, dayEvents.Count);
                    var socialGroupId = GetUrlGroupId();
                    var socialUserId  = GetUrlUserId();
                    if (dayEvents.Count > 1)
                    {
                        if (Settings.Eventdaynewpage)
                        {
                            if (socialGroupId > 0)
                            {
                                dailyLink.NavigateUrl =
                                    _objEventInfoHelper.AddSkinContainerControls(
                                        Globals.NavigateURL(TabId, "Day", "Mid=" + ModuleId,
                                                            "selecteddate=" +
                                                            Strings.Format(e.Day.Date, "yyyyMMdd"),
                                                            "groupid=" + socialGroupId), "?");
                            }
                            else if (socialUserId > 0)
                            {
                                dailyLink.NavigateUrl =
                                    _objEventInfoHelper.AddSkinContainerControls(
                                        Globals.NavigateURL(TabId, "Day", "Mid=" + ModuleId,
                                                            "selecteddate=" +
                                                            Strings.Format(e.Day.Date, "yyyyMMdd"),
                                                            "userid=" + socialUserId), "?");
                            }
                            else
                            {
                                dailyLink.NavigateUrl =
                                    _objEventInfoHelper.AddSkinContainerControls(
                                        Globals.NavigateURL(TabId, "Day", "Mid=" + ModuleId,
                                                            "selecteddate=" +
                                                            Strings.Format(e.Day.Date, "yyyyMMdd")), "?");
                            }
                        }
                        else
                        {
                            if (socialGroupId > 0)
                            {
                                dailyLink.NavigateUrl =
                                    Globals.NavigateURL(TabId, "", "ModuleID=" + ModuleId, "mctl=EventDay",
                                                        "selecteddate=" + Strings.Format(e.Day.Date, "yyyyMMdd"),
                                                        "groupid=" + socialGroupId);
                            }
                            else if (socialUserId > 0)
                            {
                                dailyLink.NavigateUrl =
                                    Globals.NavigateURL(TabId, "", "ModuleID=" + ModuleId, "mctl=EventDay",
                                                        "selecteddate=" + Strings.Format(e.Day.Date, "yyyyMMdd"),
                                                        "userid=" + socialUserId);
                            }
                            else
                            {
                                dailyLink.NavigateUrl =
                                    Globals.NavigateURL(TabId, "", "ModuleID=" + ModuleId, "mctl=EventDay",
                                                        "selecteddate=" + Strings.Format(e.Day.Date, "yyyyMMdd"));
                            }
                        }
                    }
                    else
                    {
                        // Get detail page url
                        dailyLink = GetDetailPageUrl((EventInfo)dayEvents[0], dailyLink);
                    }
                    using (var stringWrite = new StringWriter())
                    {
                        using (var eventoutput = new HtmlTextWriter(stringWrite))
                        {
                            dailyLink.RenderControl(eventoutput);
                            cellcontrol.Text = "<div class='EventDayScroll'>" + stringWrite + "</div>";
                            e.Cell.Controls.Add(cellcontrol);
                        }
                    }
                }
                else
                {
                    e.Day.IsSelectable = false;
                }
                return;
            }

            //Make day unselectable
            if (!Settings.Monthdayselect)
            {
                e.Day.IsSelectable = false;
            }

            //loop through records and render if startDate = current day and is not null
            var celldata = ""; // Holds Control Generated HTML

            foreach (EventInfo tempLoopVar_objEvent in dayEvents)
            {
                objEvent = tempLoopVar_objEvent;
                var dailyLink  = new HyperLink();
                var iconString = "";

                // See if an Image is to be displayed for the Event
                if (Settings.Eventimage && Settings.EventImageMonth && objEvent.ImageURL != null &&
                    objEvent.ImageDisplay)
                {
                    dailyLink.Text = ImageInfo(objEvent.ImageURL, objEvent.ImageHeight, objEvent.ImageWidth);
                }

                if (Settings.Timeintitle)
                {
                    dailyLink.Text = dailyLink.Text + objEvent.EventTimeBegin.ToString("t") + " - ";
                }

                var eventtext = CreateEventName(objEvent, Settings.Templates.txtMonthEventText);
                dailyLink.Text = dailyLink.Text + eventtext.Trim();

                if (!IsPrivateNotModerator || UserId == objEvent.OwnerID)
                {
                    dailyLink.ForeColor = GetColor(objEvent.FontColor);
                    iconString          = CreateIconString(objEvent, Settings.IconMonthPrio,
                                                           Settings.IconMonthRec, Settings.IconMonthReminder,
                                                           Settings.IconMonthEnroll);

                    // Get detail page url
                    dailyLink = GetDetailPageUrl(objEvent, dailyLink);
                }
                else
                {
                    dailyLink.Style.Add("cursor", "text");
                    dailyLink.Style.Add("text-decoration", "none");
                    dailyLink.Attributes.Add("onclick", "javascript:return false;");
                }

                // See If Description Tooltip to be added
                if (Settings.Eventtooltipmonth)
                {
                    var isEvtEditor = IsEventEditor(objEvent, false);
                    dailyLink.Attributes.Add(
                        "title",
                        ToolTipCreate(objEvent, Settings.Templates.txtTooltipTemplateTitle,
                                      Settings.Templates.txtTooltipTemplateBody, isEvtEditor));
                }

                // Capture Control Info & save
                using (var stringWrite = new StringWriter())
                {
                    using (var eventoutput = new HtmlTextWriter(stringWrite))
                    {
                        dailyLink.ID = "ctlEvents_Mod_" + ModuleId + "_EventID_" + objEvent.EventID +
                                       "_EventDate_" + e.Day.Date.ToString("yyyyMMMdd");
                        dailyLink.RenderControl(eventoutput);
                        if (objEvent.Color != null && (!IsPrivateNotModerator || UserId == objEvent.OwnerID))
                        {
                            celldata = celldata + "<div style=\"background-color: " + objEvent.Color + ";\">" +
                                       iconString + stringWrite + "</div>";
                        }
                        else
                        {
                            celldata = celldata + "<div>" + iconString + stringWrite + "</div>";
                        }
                    }
                }
            }

            // Add Literal Control Data to Cell w/DIV tag (in order to support scrolling in cell)
            cellcontrol.Text = "<div class='EventDayScroll'>" + celldata + "</div>";
            e.Cell.Controls.Add(cellcontrol);
        }