示例#1
0
    /// <summary>
    /// Creates attendee. Called when the "Create attendee" button is pressed.
    /// Expects the CreateEvent method to be run first.
    /// </summary>
    private bool CreateAttendee()
    {
        TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);

        // Get event document
        TreeNode eventNode = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/MyNewDocument/MyNewEvent", null, true);

        if (eventNode != null)
        {
            // Create new attendee object
            EventAttendeeInfo newAttendee = new EventAttendeeInfo();

            // Set the properties
            newAttendee.AttendeeEmail       = "*****@*****.**";
            newAttendee.AttendeeEventNodeID = eventNode.NodeID;
            newAttendee.AttendeeFirstName   = "My firstname";
            newAttendee.AttendeeLastName    = "My lastname";

            // Save the attendee
            EventAttendeeInfoProvider.SetEventAttendeeInfo(newAttendee);

            return(true);
        }

        return(false);
    }
示例#2
0
    /// <summary>
    /// Gets and updates attendee. Called when the "Get and update attendee" button is pressed.
    /// Expects the CreateAttendee method to be run first.
    /// </summary>
    private bool GetAndUpdateAttendee()
    {
        TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);

        // Get event document
        TreeNode eventNode = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/MyNewDocument/MyNewEvent", null, true);

        if (eventNode != null)
        {
            // Get the attendee
            EventAttendeeInfo updateAttendee = EventAttendeeInfoProvider.GetEventAttendeeInfo(eventNode.NodeID, "*****@*****.**");
            if (updateAttendee != null)
            {
                // Update the properties
                updateAttendee.AttendeeEmail = updateAttendee.AttendeeEmail.ToLower();

                // Save the changes
                EventAttendeeInfoProvider.SetEventAttendeeInfo(updateAttendee);

                return(true);
            }
        }

        return(false);
    }
    /// <summary>
    /// Add new attendant to the event.
    /// </summary>
    /// <returns>Newly created attendee</returns>
    private EventAttendeeInfo AddAttendantToEvent()
    {
        EventAttendeeInfo attendeeInfo = null;

        if (EventNode != null)
        {
            attendeeInfo = new EventAttendeeInfo();

            attendeeInfo.AttendeeEventNodeID = EventNode.OriginalNodeID;
            attendeeInfo.AttendeeEmail       = txtEmail.Text.Trim();
            if (RequireName)
            {
                attendeeInfo.AttendeeFirstName = txtFirstName.Text;
                attendeeInfo.AttendeeLastName  = txtLastName.Text;
            }
            if (RequirePhone)
            {
                attendeeInfo.AttendeePhone = txtPhone.Text;
            }

            // Add new attendant to the event
            EventAttendeeInfoProvider.SetEventAttendeeInfo(attendeeInfo);
        }

        return(attendeeInfo);
    }
    /// <summary>
    /// Creates attendee. Called when the "Create attendee" button is pressed.
    /// Expects the CreateEvent method to be run first.
    /// </summary>
    private bool CreateAttendee()
    {
        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

        // Get event document
        TreeNode eventNode = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/MyNewDocument/MyNewEvent", null, true);

        if (eventNode != null)
        {
            // Create new attendee object
            EventAttendeeInfo newAttendee = new EventAttendeeInfo();

            // Set the properties
            newAttendee.AttendeeEmail = "*****@*****.**";
            newAttendee.AttendeeEventNodeID = eventNode.NodeID;
            newAttendee.AttendeeFirstName = "My firstname";
            newAttendee.AttendeeLastName = "My lastname";

            // Save the attendee
            EventAttendeeInfoProvider.SetEventAttendeeInfo(newAttendee);

            return true;
        }

        return false;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int eventNodeId = QueryHelper.GetInteger("eventId", 0);
        int attendeeId  = QueryHelper.GetInteger("attendeeId", 0);

        attendeeEdit.EventID    = eventNodeId;
        attendeeEdit.AttendeeID = attendeeId;
        attendeeEdit.Saved      = QueryHelper.GetBoolean("saved", false);

        string            attEmail = GetString("Events_Attendee_Edit.NewItemCaption");
        EventAttendeeInfo eai      = null;

        if (attendeeId > 0)
        {
            eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(attendeeId);
        }

        if (eai != null)
        {
            attEmail = eai.AttendeeEmail;
        }

        // Initializes breadcrumbs
        PageBreadcrumbs.Items.Add(new BreadcrumbItem()
        {
            Text        = GetString("Events_Attendee_Edit.itemlistlink"),
            RedirectUrl = ResolveUrl("~/CMSModules/EventManager/Tools/Events_Attendee_List.aspx?eventid=" + attendeeEdit.EventID),
        });
        PageBreadcrumbs.Items.Add(new BreadcrumbItem()
        {
            Text = attEmail,
        });

        attendeeEdit.OnCheckPermissions += attendeeEdit_OnCheckPermissions;
    }
 private void LogEventBookingActivity(EventAttendeeInfo attendeeInfo)
 {
     if (EventNode != null && EventNode.GetBooleanValue("EventLogActivity", false))
     {
         var activityLogService  = Service.Resolve <IActivityLogService>();
         var activityInitializer = new EventBookingActivityInitializer(attendeeInfo.AttendeeID, EventNode);
         activityLogService.Log(activityInitializer, CMSHttpContext.Current.Request);
     }
 }
示例#7
0
    /// <summary>
    /// Loads data for edit form.
    /// </summary>
    public void LoadEditData()
    {
        // Check if current event exist
        if (!CheckIfEventExists())
        {
            return;
        }

        if (error)
        {
            return;
        }

        if ((eai != null) && (eai.AttendeeID != AttendeeID))
        {
            // Reload current attendee
            eai          = AttendeeID > 0 ? EventAttendeeInfoProvider.GetEventAttendeeInfo(AttendeeID) : new EventAttendeeInfo();
            EditedObject = eai;
        }

        if ((eai != null) && (eai.AttendeeID > 0))
        {
            txtFirstName.Text = eai.AttendeeFirstName;
            txtLastName.Text  = eai.AttendeeLastName;
            txtEmail.Text     = eai.AttendeeEmail;
            txtPhone.Text     = eai.AttendeePhone;

            // Show warning if duplicity email was used
            bool isDuplicit = EventAttendeeInfoProvider.GetEventAttendees(eai.AttendeeEventNodeID)
                              .And().Where("AttendeeEmail", QueryOperator.Equals, eai.AttendeeEmail)
                              .And().Where("AttendeeID", QueryOperator.NotEquals, eai.AttendeeID).TopN(1).Any();
            if (isDuplicit)
            {
                ShowWarning(GetString("eventmanager.attendeeregisteredwarning"));
            }

            if (!RequestHelper.IsPostBack())
            {
                if (Saved)
                {
                    ShowChangesSaved();
                }
            }
        }
        else
        {
            txtFirstName.Text = String.Empty;
            txtLastName.Text  = String.Empty;
            txtEmail.Text     = String.Empty;
            txtPhone.Text     = String.Empty;
        }
    }
    /// <summary>
    /// Creates breadcrumbs.
    /// </summary>
    public void CreateBreadCrumbs()
    {
        // Initialize breadcrumbs
        ucBreadcrumbs.AddBreadcrumb(new BreadcrumbItem {
            Text          = GetString("events_attendee_list.general"),
            OnClientClick = ControlsHelper.GetPostBackEventReference(lnkBackHidden) + "; return false;"
        });

        EventAttendeeInfo eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(ValidationHelper.GetInteger(hdnState.Value, 0));

        ucBreadcrumbs.AddBreadcrumb(new BreadcrumbItem {
            Text = (eai == null) ? GetString("events_attendee_edit.newitemcaption") : eai.AttendeeEmail,
        });
    }
示例#9
0
    /// <summary>
    /// Creates breadcumbs.
    /// </summary>
    public void CreateBreadCrumbs()
    {
        // Breadcrumbs
        lblEditBack.Text = " <span class=\"TitleBreadCrumbSeparator\">&nbsp;</span> ";
        lnkEditBack.Text = GetString("events_attendee_list.general");

        EventAttendeeInfo eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(ValidationHelper.GetInteger(hdnState.Value, 0));

        if (eai != null)
        {
            lblEditNew.Text = eai.AttendeeEmail;
        }
        else
        {
            lblEditNew.Text = GetString("events_attendee_edit.newitemcaption");
        }
    }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblFirstName.Text = GetString("Event_Attendee_Edit.lblFirstName");
        lblLastName.Text  = GetString("Event_Attendee_Edit.lblLastName");
        lblPhone.Text     = GetString("Event_Attendee_Edit.lblPhone");

        rfvEmail.Text = GetString("Event_Attendee_Edit.rfvEmail");

        // Load current attendee
        eai          = AttendeeID > 0 ? EventAttendeeInfoProvider.GetEventAttendeeInfo(AttendeeID) : new EventAttendeeInfo();
        EditedObject = eai;

        if (Saved)
        {
            ShowChangesSaved();
        }
    }
示例#11
0
    /// <summary>
    /// Deletes attendee. Called when the "Delete attendee" button is pressed.
    /// Expects the CreateAttendee method to be run first.
    /// </summary>
    private bool DeleteAttendee()
    {
        TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);

        // Get event document
        TreeNode eventNode = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/MyNewDocument/MyNewEvent", null, true);

        if (eventNode != null)
        {
            // Get the attendee
            EventAttendeeInfo deleteAttendee = EventAttendeeInfoProvider.GetEventAttendeeInfo(eventNode.NodeID, "*****@*****.**");

            // Delete the attendee
            EventAttendeeInfoProvider.DeleteEventAttendeeInfo(deleteAttendee);

            return(deleteAttendee != null);
        }

        return(false);
    }
    /// <summary>
    /// Loads data for edit form.
    /// </summary>
    public void LoadEditData()
    {
        // Check if current event exist
        if (!CheckIfEventExists())
        {
            return;
        }

        EventAttendeeInfo eai = null;

        if (AttendeeID > 0)
        {
            eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(AttendeeID);
        }

        if (String.IsNullOrEmpty(lblError.Text))
        {
            if (eai != null)
            {
                txtFirstName.Text = eai.AttendeeFirstName;
                txtLastName.Text  = eai.AttendeeLastName;
                txtEmail.Text     = eai.AttendeeEmail;
                txtPhone.Text     = eai.AttendeePhone;

                // Show warning if duplicit email was used
                if ((QueryHelper.GetBoolean("duplicit", false)) || (ValidationHelper.GetBoolean(hdnDuplicit.Value, false)))
                {
                    hdnDuplicit.Value = "false";
                    lblInfo.Visible   = true;
                    lblInfo.Text      = lblInfo.Text + "<br />" + GetString("eventmanager.attendeeregisteredwarning");
                }
            }
            else
            {
                txtFirstName.Text = String.Empty;
                txtLastName.Text  = String.Empty;
                txtEmail.Text     = String.Empty;
                txtPhone.Text     = String.Empty;
            }
        }
    }
示例#13
0
    /// <summary>
    /// Handles the UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of item (button) that throws event</param>
    /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
    protected void UniGrid_OnAction(string actionName, object actionArgument)
    {
        // Check 'Modify' permission (because of delete action in unigrid)
        if (!CheckPermissions("cms.eventmanager", "Modify"))
        {
            return;
        }

        switch (actionName)
        {
        case "delete":
            EventAttendeeInfoProvider.DeleteEventAttendeeInfo(ValidationHelper.GetInteger(actionArgument, 0));
            // Refresh parent frame header
            ltlScript.Text = ScriptHelper.GetScript("RefreshHeader();");
            UniGrid.ReloadData();
            ShowEventInfo();
            break;

        case "sendemail":
            // Resend invitation email
            TreeProvider mTree = new TreeProvider(MembershipContext.AuthenticatedUser);
            TreeNode     node  = mTree.SelectSingleNode(EventID);

            EventAttendeeInfo eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(ValidationHelper.GetInteger(actionArgument, 0));

            if ((node != null) && (node.NodeClassName.EqualsCSafe("cms.bookingevent", true)) && (eai != null))
            {
                EventProvider.SendInvitation(SiteContext.CurrentSiteName, node, eai, TimeZoneHelper.ServerTimeZone);

                ShowConfirmation(GetString("eventmanager.invitationresend"));
            }
            break;

        case "edit":
            SelectedAttendeeID = ValidationHelper.GetInteger(actionArgument, 0);
            break;
        }
    }
示例#14
0
    /// <summary>
    /// Sets (updates or inserts) specified order.
    /// </summary>
    /// <param name="orderObj">Order to be set</param>
    protected override void SetOrderInfoInternal(OrderInfo orderObj)
    {
        // Add or update the order
        base.SetOrderInfoInternal(orderObj);

        // Remember whether the order is paid
        bool isPaid = ((orderObj != null) && (orderObj.OrderIsPaid));

        if (isPaid)
        {
            // Get all attendees that are connected with the current order
            var ds = CustomEventHelper.GetAttendees(orderObj.OrderID);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    // Update attendee payment status
                    var attendee = new EventAttendeeInfo(dr);
                    attendee.SetValue(CustomEventHelper.COLUMN_ATTENDEE_PAYMENTCOMPLETED, true);
                    attendee.Update();
                }
            }
        }
    }
示例#15
0
    /// <summary>
    /// Gets and bulk updates attendees. Called when the "Get and bulk update attendees" button is pressed.
    /// Expects the CreateAttendee method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateAttendees()
    {
        TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);

        // Get event document
        TreeNode eventNode = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/MyNewDocument/MyNewEvent", null, true);

        if (eventNode != null)
        {
            // Prepare the parameters
            string where = "AttendeeEmail LIKE N'MyNewAttendee%'";

            // Get the data
            DataSet attendees = EventAttendeeInfoProvider.GetEventAttendees(eventNode.NodeID, where, null, null, 0);

            if (!DataHelper.DataSourceIsEmpty(attendees))
            {
                // Loop through the individual items
                foreach (DataRow attendeeDr in attendees.Tables[0].Rows)
                {
                    // Create object from DataRow
                    EventAttendeeInfo modifyAttendee = new EventAttendeeInfo(attendeeDr);

                    // Update the properties
                    modifyAttendee.AttendeeEmail = modifyAttendee.AttendeeEmail.ToUpper();

                    // Save the changes
                    EventAttendeeInfoProvider.SetEventAttendeeInfo(modifyAttendee);
                }

                return(true);
            }
        }

        return(false);
    }
    /// <summary>
    /// Sets (updates or inserts) specified order.
    /// </summary>
    /// <param name="orderObj">Order to be set</param>  
    protected override void SetOrderInfoInternal(OrderInfo orderObj)
    {
        // Add or update the order
        base.SetOrderInfoInternal(orderObj);

        // Remember whether the order is paid
        bool isPaid = ((orderObj != null) && (orderObj.OrderIsPaid));
      
        if (isPaid)
        {
            // Get all attendees that are connected with the current order
            var ds = CustomEventHelper.GetAttendees(orderObj.OrderID);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    // Update attendee payment status
                    var attendee = new EventAttendeeInfo(dr);
                    attendee.SetValue(CustomEventHelper.COLUMN_ATTENDEE_PAYMENTCOMPLETED, true);
                    attendee.Update();
                }
            }
        }
    }
示例#17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int eventNodeId = QueryHelper.GetInteger("eventId", 0);
        int attendeeId  = QueryHelper.GetInteger("attendeeId", 0);

        attendeeEdit.EventID    = eventNodeId;
        attendeeEdit.AttendeeID = attendeeId;
        attendeeEdit.Saved      = QueryHelper.GetBoolean("saved", false);

        string            attEmail = GetString("Events_Attendee_Edit.NewItemCaption");
        EventAttendeeInfo eai      = null;

        if (attendeeId > 0)
        {
            eai          = EventAttendeeInfoProvider.GetEventAttendeeInfo(attendeeId);
            EditedObject = eai;
        }
        if (eai != null)
        {
            attEmail = eai.AttendeeEmail;
        }

        string[,] breadcrumbs = new string[2, 3];
        breadcrumbs[0, 0]     = GetString("Events_Attendee_Edit.itemlistlink");
        breadcrumbs[0, 1]     = "~/CMSModules/EventManager/Tools/Events_Attendee_List.aspx?eventid=" + attendeeEdit.EventID;
        breadcrumbs[0, 2]     = "eventsContent";
        breadcrumbs[1, 0]     = attEmail;
        breadcrumbs[1, 1]     = "";
        breadcrumbs[1, 2]     = "";

        this.CurrentMaster.Title.Breadcrumbs   = breadcrumbs;
        this.CurrentMaster.Title.HelpName      = "helpTopic";
        this.CurrentMaster.Title.HelpTopicName = "attendees_edit";

        attendeeEdit.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(attendeeEdit_OnCheckPermissions);
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check if current event exist
        if (!CheckIfEventExists())
        {
            return;
        }

        // Check 'Modify' permission
        if (!CheckPermissions("cms.eventmanager", "Modify"))
        {
            return;
        }

        txtEmail.Text = txtEmail.Text.Trim();

        // Validate fields
        string errorMessage = new Validator()
            .NotEmpty(txtEmail.Text, rfvEmail.ErrorMessage)
            .IsEmail(txtEmail.Text, GetString("Event_Attendee_Edit.IncorectEmailFormat"))
            .Result;

        // Update database
        if (errorMessage == "")
        {
            // Indicates new attendee
            bool isNew = false;

            // Indicates duplicit attendee/email
            bool isDuplicit = false;

            EventAttendeeInfo eai = null;
            if (AttendeeID == 0)
            {
                eai = new EventAttendeeInfo();
                eai.AttendeeEventNodeID = EventID;
                isNew = true;
                isDuplicit = EventAttendeeInfoProvider.GetEventAttendeeInfo(EventID, txtEmail.Text) != null;
            }
            else
            {
                eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(AttendeeID);
            }

            if (eai != null)
            {
                eai.AttendeeFirstName = txtFirstName.Text;
                eai.AttendeeLastName = txtLastName.Text;
                eai.AttendeeEmail = txtEmail.Text;
                eai.AttendeePhone = txtPhone.Text;
                EventAttendeeInfoProvider.SetEventAttendeeInfo(eai);

                if (!UsePostBack)
                {
                    if (!isNew)
                    {
                        URLHelper.Redirect("Events_Attendee_Edit.aspx?eventid=" + Convert.ToString(EventID) + "&attendeeId=" + Convert.ToString(eai.AttendeeID) + "&saved=true");
                    }
                    else
                    {
                        ltlScript.Text = ScriptHelper.GetScript("RefreshHeader(" + Convert.ToString(eai.AttendeeID) + ", " + (isDuplicit ? "1" : "0") + ");");
                    }
                }

                lblInfo.Text = GetString("General.ChangesSaved");
                lblInfo.Visible = true;
                hdnDuplicit.Value = isDuplicit.ToString();

                // If new item store new attendeeID .. used in postback situations
                if (isNew)
                {
                    NewItemID = eai.AttendeeID;
                }
            }
            else
            {
                errorMessage = GetString("general.invalidid");
            }
        }

        if (errorMessage != "")
        {
            lblError.Visible = true;
            lblError.Text = errorMessage;
        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check if current event exist
        if (!CheckIfEventExists())
        {
            return;
        }

        // Check 'Modify' permission
        if (!CheckPermissions("cms.eventmanager", "Modify"))
        {
            return;
        }

        txtEmail.Text = txtEmail.Text.Trim();

        // Validate fields
        string errorMessage = new Validator()
                              .NotEmpty(txtEmail.Text, rfvEmail.ErrorMessage)
                              .IsEmail(txtEmail.Text, GetString("Event_Attendee_Edit.IncorectEmailFormat"))
                              .Result;

        // Update database
        if (errorMessage == "")
        {
            // Indicates new attendee
            bool isNew = false;

            // Indicates duplicit attendee/email
            bool isDuplicit = false;

            EventAttendeeInfo eai = null;
            if (AttendeeID == 0)
            {
                eai = new EventAttendeeInfo();
                eai.AttendeeEventNodeID = EventID;
                isNew      = true;
                isDuplicit = EventAttendeeInfoProvider.GetEventAttendeeInfo(EventID, txtEmail.Text) != null;
            }
            else
            {
                eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(AttendeeID);
            }

            if (eai != null)
            {
                eai.AttendeeFirstName = txtFirstName.Text;
                eai.AttendeeLastName  = txtLastName.Text;
                eai.AttendeeEmail     = txtEmail.Text;
                eai.AttendeePhone     = txtPhone.Text;
                EventAttendeeInfoProvider.SetEventAttendeeInfo(eai);

                if (!UsePostBack)
                {
                    if (!isNew)
                    {
                        URLHelper.Redirect("Events_Attendee_Edit.aspx?eventid=" + Convert.ToString(EventID) + "&attendeeId=" + Convert.ToString(eai.AttendeeID) + "&saved=true");
                    }
                    else
                    {
                        ltlScript.Text = ScriptHelper.GetScript("RefreshHeader(" + Convert.ToString(eai.AttendeeID) + ", " + (isDuplicit ? "1" : "0") + ");");
                    }
                }

                ShowChangesSaved();
                hdnDuplicit.Value = isDuplicit.ToString();


                // If new item store new attendeeID .. used in postback situations
                if (isNew)
                {
                    NewItemID = eai.AttendeeID;
                }
            }
            else
            {
                errorMessage = GetString("general.invalidid");
            }
        }

        if (!String.IsNullOrEmpty(errorMessage))
        {
            ShowError(errorMessage);
        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check if current event exist
        if (!CheckIfEventExists())
        {
            return;
        }

        // Check 'Modify' permission
        if (!CheckPermissions("cms.eventmanager", "Modify"))
        {
            return;
        }

        txtEmail.Text = txtEmail.Text.Trim();

        // Validate fields
        string errorMessage = new Validator()
            .NotEmpty(txtEmail.Text, rfvEmail.ErrorMessage)
            .IsEmail(txtEmail.Text, GetString("Event_Attendee_Edit.IncorectEmailFormat"))
            .Result;

        // Update database
        if (errorMessage == "")
        {
            // Indicates new attendee
            bool isNew = false;

            if (AttendeeID <= 0)
            {
                eai.AttendeeEventNodeID = EventID;
                isNew = true;
            }
            else
            {
                eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(AttendeeID);
            }

            if (eai != null)
            {
                eai.AttendeeFirstName = txtFirstName.Text;
                eai.AttendeeLastName = txtLastName.Text;
                eai.AttendeeEmail = txtEmail.Text;
                eai.AttendeePhone = txtPhone.Text;
                EventAttendeeInfoProvider.SetEventAttendeeInfo(eai);

                // If new item store new attendeeID .. used in post back situations
                if (isNew)
                {
                    NewItemID = eai.AttendeeID;
                    if (RedirectAfterInsert)
                    {
                        string redirectTo = "~/CMSModules/EventManager/Tools/Events_Attendee_Edit.aspx";
                        redirectTo = URLHelper.AddParameterToUrl(redirectTo, "eventId", EventID.ToString());
                        redirectTo = URLHelper.AddParameterToUrl(redirectTo, "attendeeId", NewItemID.ToString());
                        redirectTo = URLHelper.AddParameterToUrl(redirectTo, "saved", "1");
                        URLHelper.Redirect(redirectTo);
                    }
                    else
                    {
                        RefreshBreadCrumbs();
                        ShowChangesSaved();
                    }
                }
                else
                {
                    RefreshBreadCrumbs();
                    ShowChangesSaved();
                }
            }
            else
            {
                errorMessage = GetString("general.invalidid");
            }
        }

        if (!String.IsNullOrEmpty(errorMessage))
        {
            ShowError(errorMessage);
        }
    }
    /// <summary>
    /// Add new attendant to the event.
    /// </summary>
    /// <returns>Newly created attendee</returns>
    private EventAttendeeInfo AddAttendantToEvent()
    {
        EventAttendeeInfo attendeeInfo = null;

        if (EventNode != null)
        {
            attendeeInfo = new EventAttendeeInfo();

            attendeeInfo.AttendeeEventNodeID = EventNode.OriginalNodeID;
            attendeeInfo.AttendeeEmail = txtEmail.Text.Trim();
            if (RequireName)
            {
                attendeeInfo.AttendeeFirstName = txtFirstName.Text;
                attendeeInfo.AttendeeLastName = txtLastName.Text;
            }
            if (RequirePhone)
            {
                attendeeInfo.AttendeePhone = txtPhone.Text;
            }

            // Add new attendant to the event
            EventAttendeeInfoProvider.SetEventAttendeeInfo(attendeeInfo);
        }

        return attendeeInfo;
    }
示例#22
0
        /// <summary>
        /// Create attendees for each product of the specified order.
        /// </summary>
        /// <param name="cart">Shopping cart object with order data.</param>
        public static void SetAttendees(ShoppingCartInfo cart)
        {
            if ((cart != null) && (cart.Customer != null))
            {
                // Is order payment completed?
                var order = OrderInfoProvider.GetOrderInfo(cart.OrderId);
                var isPaymentCompleted = false;
                if (order != null)
                {
                    isPaymentCompleted = order.OrderIsPaid;
                }

                // Build WHERE condition to get specified tree nodes which represent specified products of the order
                var where = string.Empty;
                foreach (var item in cart.CartItems)
                {
                    where += item.SKUID + ",";
                }

                // Trim ending comma from WHERE condition
                if (where != "")
                {
                    where = where.Remove(where.Length - 1);
                    where = "NODESKUID IN (" + where + ")";
                }

                // Remove old attendees
                DeleteAttendees(cart.OrderId);

                // Select events (tree nodes) that represents specified products of the order
                var     tree = new TreeProvider();
                DataSet ds   = tree.SelectNodes(cart.SiteName, "/%", TreeProvider.ALL_CULTURES, false, "cms.bookingevent", where);

                if (!DataHelper.DataSourceIsEmpty(ds))
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        // Get tree node ID of the event
                        int nodeId = ValidationHelper.GetInteger(dr["NodeID"], 0);

                        // Get product ID
                        int skuId = ValidationHelper.GetInteger(dr["SKUID"], 0);

                        // Get product units
                        int units = GetSKUShoppingCartUnits(cart, skuId);

                        // Create attendees and assign them to the specified event
                        for (int i = 1; i < units + 1; i++)
                        {
                            var attendee = new EventAttendeeInfo
                            {
                                AttendeeFirstName   = cart.Customer.CustomerFirstName,
                                AttendeeLastName    = cart.Customer.CustomerLastName + " (" + i + ")",
                                AttendeeEmail       = cart.Customer.CustomerEmail,
                                AttendeeEventNodeID = nodeId
                            };
                            attendee.SetValue(COLUMN_ATTENDEE_ORDERID, cart.OrderId);
                            attendee.SetValue(COLUMN_ATTENDEE_PAYMENTCOMPLETED, isPaymentCompleted);

                            // Set attendee phone from billing address
                            var address = cart.ShoppingCartBillingAddress;
                            if (address != null)
                            {
                                attendee.AttendeePhone = address.AddressPhone;
                            }

                            EventAttendeeInfoProvider.SetEventAttendeeInfo(attendee);
                        }
                    }
                }
            }
        }
    /// <summary>
    /// Loads data for edit form.
    /// </summary>
    public void LoadEditData()
    {
        // Check if current event exist
        if (!CheckIfEventExists())
        {
            return;
        }

        if (!error)
        {
            if ((eai != null) && (eai.AttendeeID != AttendeeID))
            {
                // Reload current attendee
                eai = AttendeeID > 0 ? EventAttendeeInfoProvider.GetEventAttendeeInfo(AttendeeID) : new EventAttendeeInfo();
                EditedObject = eai;
            }

            if ((eai != null) && (eai.AttendeeID > 0))
            {
                txtFirstName.Text = eai.AttendeeFirstName;
                txtLastName.Text = eai.AttendeeLastName;
                txtEmail.Text = eai.AttendeeEmail;
                txtPhone.Text = eai.AttendeePhone;

                // Show warning if duplicity email was used
                bool isDuplicit = EventAttendeeInfoProvider.GetEventAttendees().Where("AttendeeEventNodeID", QueryOperator.Equals, eai.AttendeeEventNodeID)
                    .And().Where("AttendeeEmail", QueryOperator.Equals, eai.AttendeeEmail)
                    .And().Where("AttendeeID", QueryOperator.NotEquals, eai.AttendeeID).TopN(1).Any();
                if (isDuplicit)
                {
                    ShowWarning(GetString("eventmanager.attendeeregisteredwarning"));
                }

                if (!URLHelper.IsPostback())
                {
                    if (Saved)
                    {
                        ShowChangesSaved();
                    }
                }
            }
            else
            {
                txtFirstName.Text = String.Empty;
                txtLastName.Text = String.Empty;
                txtEmail.Text = String.Empty;
                txtPhone.Text = String.Empty;
            }
        }
    }
示例#24
0
    /// <summary>
    /// On btnRegister click.
    /// </summary>
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        string currentSiteName = CMSContext.CurrentSiteName;

        // Check banned ip
        if (!BannedIPInfoProvider.IsAllowed(currentSiteName, BanControlEnum.AllNonComplete))
        {
            lblError.Visible = true;
            lblError.Text    = GetString("General.BannedIP");
            return;
        }

        // Exit if problem occurs
        if (errorOccurs)
        {
            return;
        }

        string    result = null;
        Validator val    = new Validator();

        // Check name fields if required
        if (this.RequireName)
        {
            result = val.NotEmpty(txtFirstName.Text.Trim(), GetString("eventmanager.firstnamerequired"))
                     .NotEmpty(txtLastName.Text.Trim(), GetString("eventmanager.lastnamerequired")).Result;
        }
        // Check e-mail field
        if (string.IsNullOrEmpty(result))
        {
            result = val.IsEmail(txtEmail.Text.Trim(), GetString("eventmanager.emailrequired")).Result;
        }
        // Check phone field if required
        if (this.RequirePhone && string.IsNullOrEmpty(result))
        {
            result = val.NotEmpty(txtPhone.Text.Trim(), GetString("eventmanager.phonerequired")).Result;
        }

        if (string.IsNullOrEmpty(result))
        {
            DateTime now = DateTime.Now;
            // Allow registration if opened
            if ((openFrom == DataHelper.DATETIME_NOT_SELECTED || openFrom < now) && (openTo == DataHelper.DATETIME_NOT_SELECTED || now <= openTo) && (now <= eventDate))
            {
                if (EventNode != null)
                {
                    if (!EventAttendeeInfoProvider.IsRegisteredForEvent(EventNode.NodeID, txtEmail.Text.Trim()))
                    {
                        // Add new attendant to the event
                        EventAttendeeInfo eai = AddAttendantToEvent();

                        if (eai != null)
                        {
                            // Log activity
                            if ((CMSContext.ViewMode == ViewModeEnum.LiveSite) && ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(currentSiteName) &&
                                ActivitySettingsHelper.ActivitiesEnabledForThisUser(CMSContext.CurrentUser) && ActivitySettingsHelper.EventBookingEnabled(currentSiteName))
                            {
                                if (ValidationHelper.GetBoolean(EventNode.GetValue("EventLogActivity"), false))
                                {
                                    var data = new ActivityData()
                                    {
                                        ContactID    = ModuleCommands.OnlineMarketingGetCurrentContactID(),
                                        SiteID       = CMSContext.CurrentSiteID,
                                        Type         = PredefinedActivityType.EVENT_BOOKING,
                                        TitleData    = EventNode.DocumentName,
                                        ItemID       = eai.AttendeeID,
                                        URL          = URLHelper.CurrentRelativePath,
                                        ItemDetailID = EventNode.DocumentID,
                                        NodeID       = EventNode.NodeID,
                                        Culture      = EventNode.DocumentCulture,
                                        Campaign     = CMSContext.Campaign
                                    };
                                    ActivityLogProvider.LogActivity(data);
                                }
                            }

                            // Send invitation e-mail
                            TimeZoneInfo tzi = null;
                            CMSContext.GetDateTimeForControl(this, DateTime.Now, out tzi);
                            EventProvider.SendInvitation(currentSiteName, EventNode, eai, tzi);

                            lblRegInfo.Text    = GetString("eventmanager.registrationsucceeded");
                            lblRegInfo.Visible = true;
                            // Hide registration form
                            pnlReg.Visible = false;
                        }
                    }
                    else
                    {
                        // User is already registered
                        lblError.Text    = GetString("eventmanager.attendeeregistered");
                        lblError.Visible = true;
                    }
                }
                else
                {
                    // Event does not exist
                    lblError.Text    = GetString("eventmanager.eventnotexist");
                    lblError.Visible = true;
                    // Hide registration form
                    pnlReg.Visible = false;
                }
            }
            else
            {
                // Event registration is not opened
                lblError.Text    = GetString("eventmanager.notopened");
                lblError.Visible = true;
                // Hide registration form
                pnlReg.Visible = false;
            }
        }
        else
        {
            // Display error message
            lblError.Text    = result;
            lblError.Visible = true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblFirstName.Text = GetString("Event_Attendee_Edit.lblFirstName");
        lblLastName.Text = GetString("Event_Attendee_Edit.lblLastName");
        lblPhone.Text = GetString("Event_Attendee_Edit.lblPhone");

        rfvEmail.Text = GetString("Event_Attendee_Edit.rfvEmail");

        // Load current attendee
        eai = AttendeeID > 0 ? EventAttendeeInfoProvider.GetEventAttendeeInfo(AttendeeID) : new EventAttendeeInfo();
        EditedObject = eai;

        if (Saved)
        {
            ShowChangesSaved();
        }
    }
示例#26
0
    /// <summary>
    /// On btnRegister click.
    /// </summary>
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        string currentSiteName = SiteContext.CurrentSiteName;

        // Check banned ip
        if (!BannedIPInfoProvider.IsAllowed(currentSiteName, BanControlEnum.AllNonComplete))
        {
            lblError.Visible = true;
            lblError.Text    = GetString("General.BannedIP");
            return;
        }

        // Exit if problem occurs
        if (errorOccurs)
        {
            return;
        }

        string    result = null;
        Validator val    = new Validator();

        // Check name fields if required
        if (RequireName)
        {
            result = val.NotEmpty(txtFirstName.Text.Trim(), GetString("eventmanager.firstnamerequired"))
                     .NotEmpty(txtLastName.Text.Trim(), GetString("eventmanager.lastnamerequired")).Result;
        }
        // Check e-mail field
        if (string.IsNullOrEmpty(result))
        {
            result = val.IsEmail(txtEmail.Text.Trim(), GetString("eventmanager.emailrequired")).Result;
        }
        // Check phone field if required
        if (RequirePhone && string.IsNullOrEmpty(result))
        {
            result = val.NotEmpty(txtPhone.Text.Trim(), GetString("eventmanager.phonerequired")).Result;
        }

        if (string.IsNullOrEmpty(result))
        {
            DateTime now = DateTime.Now;
            // Allow registration if opened
            if ((openFrom == DateTimeHelper.ZERO_TIME || openFrom < now) && (openTo == DateTimeHelper.ZERO_TIME || now <= openTo) && (now <= eventDate))
            {
                if (EventNode != null)
                {
                    if (!EventAttendeeInfoProvider.IsRegisteredForEvent(EventNode.NodeID, txtEmail.Text.Trim()))
                    {
                        // Add new attendant to the event
                        EventAttendeeInfo eai = AddAttendantToEvent();

                        if (eai != null)
                        {
                            // Log activity
                            Activity activity = new ActivityEventBooking(EventNode, EventNode.GetDocumentName(), eai, AnalyticsContext.ActivityEnvironmentVariables);
                            activity.Log();

                            // Send invitation e-mail
                            TimeZoneInfo tzi = null;
                            TimeZoneMethods.GetDateTimeForControl(this, DateTime.Now, out tzi);
                            EventProvider.SendInvitation(currentSiteName, EventNode, eai, tzi);

                            lblRegInfo.Text    = GetString("eventmanager.registrationsucceeded");
                            lblRegInfo.Visible = true;
                            // Hide registration form
                            pnlReg.Visible = false;
                        }
                    }
                    else
                    {
                        // User is already registered
                        lblError.Text    = GetString("eventmanager.attendeeregistered");
                        lblError.Visible = true;
                    }
                }
                else
                {
                    // Event does not exist
                    lblError.Text    = GetString("eventmanager.eventnotexist");
                    lblError.Visible = true;
                    // Hide registration form
                    pnlReg.Visible = false;
                }
            }
            else
            {
                // Event registration is not opened
                lblError.Text    = GetString("eventmanager.notopened");
                lblError.Visible = true;
                // Hide registration form
                pnlReg.Visible = false;
            }
        }
        else
        {
            // Display error message
            lblError.Text    = result;
            lblError.Visible = true;
        }
    }
    /// <summary>
    /// On btnRegister click.
    /// </summary>
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        string currentSiteName = SiteContext.CurrentSiteName;

        // Check banned IPs
        if (!BannedIPInfoProvider.IsAllowed(currentSiteName, BanControlEnum.AllNonComplete))
        {
            lblError.Visible = true;
            lblError.Text    = GetString("General.BannedIP");
            return;
        }

        // Exit if problem occurs
        if (errorOccurs)
        {
            return;
        }

        string    result = null;
        Validator val    = new Validator();

        // Check name fields if required
        if (RequireName)
        {
            result = val
                     .NotEmpty(txtFirstName.Text.Trim(), GetString("eventmanager.firstnamerequired"))
                     .NotEmpty(txtLastName.Text.Trim(), GetString("eventmanager.lastnamerequired"))
                     .Result;
        }
        // Check e-mail field
        if (String.IsNullOrEmpty(result))
        {
            result = val
                     .NotEmpty(txtEmail.Text.Trim(), GetString("eventmanager.emailrequired"))
                     .MatchesCondition(txtEmail, input => input.IsValid(), GetString("eventmanager.emailrequired"))
                     .Result;
        }
        // Check phone field if required
        if (RequirePhone && String.IsNullOrEmpty(result))
        {
            result = val.NotEmpty(txtPhone.Text.Trim(), GetString("eventmanager.phonerequired")).Result;
        }

        if (String.IsNullOrEmpty(result))
        {
            // Allow registration if opened
            if (IsRegistrationOpened)
            {
                if (EventNode != null)
                {
                    if (!EventAttendeeInfoProvider.IsRegisteredForEvent(EventNode.NodeID, txtEmail.Text.Trim()))
                    {
                        // Add new attendant to the event
                        EventAttendeeInfo eai = AddAttendantToEvent();

                        if (eai != null)
                        {
                            // Log activity
                            LogEventBookingActivity(eai);

                            // Send invitation e-mail
                            TimeZoneInfo tzi;
                            TimeZoneUIMethods.GetDateTimeForControl(this, DateTime.Now, out tzi);
                            EventProvider.SendInvitation(currentSiteName, EventNode, eai, tzi);

                            lblRegInfo.Text    = GetString("eventmanager.registrationsucceeded");
                            lblRegInfo.Visible = true;
                            // Hide registration form
                            pnlReg.Visible = false;
                        }
                    }
                    else
                    {
                        // User is already registered
                        lblError.Text    = GetString("eventmanager.attendeeregistered");
                        lblError.Visible = true;
                    }
                }
                else
                {
                    // Event does not exist
                    lblError.Text    = GetString("eventmanager.eventnotexist");
                    lblError.Visible = true;
                    // Hide registration form
                    pnlReg.Visible = false;
                }
            }
            else
            {
                // Event registration is not opened
                lblError.Text    = GetString("eventmanager.notopened");
                lblError.Visible = true;
                // Hide registration form
                pnlReg.Visible = false;
            }
        }
        else
        {
            // Display error message
            lblError.Text    = result;
            lblError.Visible = true;
        }
    }
    /// <summary>
    /// Gets and bulk updates attendees. Called when the "Get and bulk update attendees" button is pressed.
    /// Expects the CreateAttendee method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateAttendees()
    {
        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

        // Get event document
        TreeNode eventNode = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/MyNewDocument/MyNewEvent", null, true);

        if (eventNode != null)
        {
            // Prepare the parameters
            string where = "AttendeeEmail LIKE N'MyNewAttendee%'";

            // Get the data
            DataSet attendees = EventAttendeeInfoProvider.GetEventAttendees(eventNode.NodeID, where, null, null, 0);

            if (!DataHelper.DataSourceIsEmpty(attendees))
            {
                // Loop through the individual items
                foreach (DataRow attendeeDr in attendees.Tables[0].Rows)
                {
                    // Create object from DataRow
                    EventAttendeeInfo modifyAttendee = new EventAttendeeInfo(attendeeDr);

                    // Update the properties
                    modifyAttendee.AttendeeEmail = modifyAttendee.AttendeeEmail.ToUpper();

                    // Save the changes
                    EventAttendeeInfoProvider.SetEventAttendeeInfo(modifyAttendee);
                }

                return true;
            }
        }

        return false;
    }
示例#29
0
        /// <summary>
        /// Create attendees for each product of the specified order.
        /// </summary>
        /// <param name="cart">Shopping cart object with order data.</param>
        public static void SetAttendees(ShoppingCartInfo cart)
        {
            if ((cart != null) && (cart.Customer != null))
            {                
                // Is order payment completed?
                var order = OrderInfoProvider.GetOrderInfo(cart.OrderId);
                var isPaymentCompleted = false;
                if (order != null)
                {
                    isPaymentCompleted = order.OrderIsPaid;
                }

                // Build WHERE condition to get specified tree nodes which represent specified products of the order
                var where = string.Empty;
                foreach (var item in cart.CartItems)
                {
                    where += item.SKUID + ",";                    
                }

                // Trim ending comma from WHERE condition
                if (where != "")
                {
                    where = where.Remove(where.Length - 1);
                    where = "NODESKUID IN (" + where + ")";
                }

                // Remove old attendees
                DeleteAttendees(cart.OrderId);

                // Select events (tree nodes) that represents specified products of the order
                var tree = new TreeProvider();
                DataSet ds = tree.SelectNodes(cart.SiteName, "/%", TreeProvider.ALL_CULTURES, false, "cms.bookingevent", where);

                if (!DataHelper.DataSourceIsEmpty(ds))
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        // Get tree node ID of the event
                        int nodeId = ValidationHelper.GetInteger(dr["NodeID"], 0);

                        // Get product ID
                        int skuId = ValidationHelper.GetInteger(dr["SKUID"], 0);

                        // Get product units
                        int units = GetSKUShoppingCartUnits(cart, skuId);

                        // Create attendees and assign them to the specified event
                        for (int i = 1; i < units + 1; i++)
                        {                            
                            var attendee = new EventAttendeeInfo
                            {
                                AttendeeFirstName = cart.Customer.CustomerFirstName,
                                AttendeeLastName = cart.Customer.CustomerLastName + " (" + i + ")",
                                AttendeeEmail = cart.Customer.CustomerEmail,
                                AttendeeEventNodeID = nodeId
                            };
                            attendee.SetValue(COLUMN_ATTENDEE_ORDERID, cart.OrderId);
                            attendee.SetValue(COLUMN_ATTENDEE_PAYMENTCOMPLETED, isPaymentCompleted);

                            // Set attendee phone from billing address
                            var address = cart.ShoppingCartBillingAddress;
                            if (address != null)
                            {
                                attendee.AttendeePhone = address.AddressPhone;
                            }

                            EventAttendeeInfoProvider.SetEventAttendeeInfo(attendee);
                        }
                    }
                }
            }
        }
示例#30
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check if current event exist
        if (!CheckIfEventExists())
        {
            return;
        }

        // Check 'Modify' permission
        if (!CheckPermissions("cms.eventmanager", "Modify"))
        {
            return;
        }

        txtEmail.Text = txtEmail.Text.Trim();

        // Validate fields
        string errorMessage = new Validator()
                              .NotEmpty(txtEmail.Text, rfvEmail.Text)
                              .MatchesCondition(txtEmail, input => input.IsValid(), GetString("Event_Attendee_Edit.IncorectEmailFormat"))
                              .Result;

        if (!String.IsNullOrEmpty(errorMessage))
        {
            ShowError(errorMessage);
            return;
        }

        // Indicates new attendee
        bool isNew = false;

        if (AttendeeID <= 0)
        {
            eai.AttendeeEventNodeID = EventID;
            isNew = true;
        }
        else
        {
            eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(AttendeeID);
        }

        if (eai != null)
        {
            eai.AttendeeFirstName = txtFirstName.Text;
            eai.AttendeeLastName  = txtLastName.Text;
            eai.AttendeeEmail     = txtEmail.Text;
            eai.AttendeePhone     = txtPhone.Text;
            EventAttendeeInfoProvider.SetEventAttendeeInfo(eai);

            // If new item store new attendeeID .. used in post back situations
            if (isNew)
            {
                NewItemID = eai.AttendeeID;
                if (RedirectAfterInsert)
                {
                    string redirectTo = "~/CMSModules/EventManager/Tools/Events_Attendee_Edit.aspx";
                    redirectTo = URLHelper.AddParameterToUrl(redirectTo, "eventId", EventID.ToString());
                    redirectTo = URLHelper.AddParameterToUrl(redirectTo, "attendeeId", NewItemID.ToString());
                    redirectTo = URLHelper.AddParameterToUrl(redirectTo, "saved", "1");
                    URLHelper.Redirect(redirectTo);
                }
                else
                {
                    RefreshBreadCrumbs();
                    ShowChangesSaved();
                }
            }
            else
            {
                RefreshBreadCrumbs();
                ShowChangesSaved();
            }
        }
        else
        {
            ShowError(GetString("general.invalidid"));
        }
    }