Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                lblMessage.Text = "";

                if (Page.IsPostBack) return;

                var donorEventList = (DonorEventList)Session["SPLC.Donor.RSVP.DEL"];
                var donorList = (DonorList)Session["SPLC.Donor.RSVP.DL"];
                var eventList = new EventList(User.Identity.Name, donorEventList.fk_Event);

                if (donorList.IsValid)
                {
                    txtName.Text = donorList.AccountName;
                    txtMailingAddress.Text = donorList.AddressLine1;
                    txtAddress2.Text = donorList.AddressLine2;
                    txtCity.Text = donorList.City;
                    ddlState.SelectedValue = donorList.State;
                    txtZipCode.Text = donorList.PostCode;
                    txtEmail.Text = donorList.EmailAddress;
                    txtPhoneNumber.Text = donorList.PhoneNumber;

                    ddlNoGuests.Items.Clear();

                    // Add the allowed ticket number
                    for (var i = 0; i <= eventList.TicketsAllowed; i++)
                    {
                        ddlNoGuests.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }

                    // Add HTML from DB

                    var sbHeader = new StringBuilder(eventList.HTML_Header);
                    var donorEmail = new DonorEmail();

                    sbHeader = donorEmail.ParseTextSubEL(sbHeader, eventList);
                    ltHeader.Text = sbHeader.ToString();  

                    var faq = new StringBuilder(eventList.HTML_FAQ);
                    faq = donorEmail.ParseTextSubEL(faq, eventList);
                    ltFAQ.Text = faq.ToString();

                    lblEvent.Text = eventList.DisplayName;

                    imgHeader.ImageUrl = "ihandler.ashx?eid=" + eventList.pk_Event;

                }
                else
                {
                    lblMessage.ForeColor = Color.Red;
                    lblMessage.Text = @"There appears to be a problem with the information that you have entered, please check 
                                            the information and try again or call 334-956-8200 for assistance.";
                }
            }
            catch (Exception ex)
            {

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                EventList EL = new EventList(User.Identity.Name);

                ddlEvents.DataSource = EL.GetEvents();
                ddlEvents.DataTextField = "EName";
                ddlEvents.DataValueField = "pk_Event";
                ddlEvents.DataBind();

                ddlEvents.Items.Insert(0, new ListItem("Select Event", ""));
                ddlEvents.SelectedIndex = 0;

                DonorList DL = new DonorList();
                ddlDonorType.DataSource = DL.GetDonorTypes();
                ddlDonorType.DataTextField = "DonorType";
                ddlDonorType.DataValueField = "DonorType";
                ddlDonorType.DataBind();

                ddlDonorType.Items.Insert(0, new ListItem("Select Donor Type", ""));
                ddlDonorType.SelectedIndex = 0;

                DonorEventList DEL = new DonorEventList(User.Identity.Name);

                gvDonorEvents.DataSource = DEL.GetWaitingList_Search("", "", "","");
                gvDonorEvents.DataBind();

            }
        }
        protected void gvReport_Sorting(object sender, GridViewSortEventArgs e)
        {
            DonorEventList DEL = new DonorEventList(User.Identity.Name);
            EventList EL = new EventList(User.Identity.Name, int.Parse(Request["eid"].ToString()));



            string[] SortOrder = ViewState["SortExpr"].ToString().Split(' ');
            if (SortOrder[0] == e.SortExpression)
            {
                if (SortOrder[1] == "ASC")
                {
                    ViewState["SortExpr"] = e.SortExpression + " " + "DESC";
                }
                else
                {
                    ViewState["SortExpr"] = e.SortExpression + " " + "ASC";
                }
            }
            else
            {
                ViewState["SortExpr"] = e.SortExpression + " " + "ASC";
            }

            gvReport.PageIndex = 0;
            gvReport.DataSource = DEL.GetDonorEventMailedTickets_ByEvent(EL.pk_Event, ViewState["SortExpr"].ToString());
            gvReport.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) return;
            lblHeader.Text = "Donor Event Details";

            if (Page.IsPostBack) return;

            if (Request["delid"] == null) return;

            var donorEventList = new DonorEventList(User.Identity.Name, int.Parse(Request["delid"].ToString()));
            var eventList = new EventList(User.Identity.Name, donorEventList.fk_Event);
            var donorList = new DonorList(donorEventList.fk_DonorList);

            hfPK.Value = donorEventList.pk_DonorEventList.ToString();
            hfDPK.Value = donorList.pk_DonorList;

            lblEventName.Text = eventList.EventName;
            lblAccountID.Text = donorList.pk_DonorList;


            if (donorEventList.TicketsMailed_Date > DateTime.Parse(BaseDate))
            {
                btnMailCard.Visible = false;
                lblCardMailed.Visible = true;
                lblCMailed.Visible = true;
                lblCMailed.Text = donorEventList.TicketsMailed_Date.ToShortDateString();
            }
            else
            {
                btnMailCard.Visible = true;
                lblCardMailed.Visible = false;
                lblCMailed.Visible = false;
            }

            lblWaitListNote.Visible = donorEventList.WaitingList_Date > DateTime.Parse(BaseDate);

            btnUpdateDemo.Visible = donorEventList.UpdatedInfo;


            hfTicketsAllowed.Value = eventList.TicketsAllowed.ToString();
            txtAttending.Text = donorEventList.TicketsRequested.ToString();
                        
            chkAttending.Checked = donorEventList.Attending;

            lblDonorComments.Text = donorEventList.DonorComments;

            txtName.Text = donorList.AccountName;
            txtAddress.Text = donorList.AddressLine1;
            txtAddress2.Text = donorList.AddressLine2;
            txtAddress3.Text = donorList.AddressLine3;
            txtCity.Text = donorList.City;
            ddlState.SelectedValue = donorList.State;
            txtZipCode.Text = donorList.PostCode;
            txtPhone.Text = donorList.PhoneNumber;
            txtSPLCComments.Text = donorEventList.SPLCComments;
            txtEmail.Text = donorList.EmailAddress;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var donorEventList = (DonorEventList)Session["SPLC.Donor.RSVP.DEL"];
            var donorList = (DonorList)Session["SPLC.Donor.RSVP.DL"];
            var eventList = new EventList(User.Identity.Name, donorEventList.fk_Event);

            // Add HTML from DB
            var html = new StringBuilder(eventList.HTML_Header);
            var donorEmail = new DonorEmail();
            html = donorEmail.ParseText(html, eventList,donorList);
//            ltHeader.Text = html.ToString();

            var faq = new StringBuilder(eventList.HTML_FAQ);
            faq = donorEmail.ParseText(faq, eventList, donorList);
            ltFAQ.Text = faq.ToString();

            lblEvent.Text = eventList.DisplayName;
            imgHeader.ImageUrl = "ihandler.ashx?eid=" + eventList.pk_Event;

            var sbDis = new StringBuilder();
            

            if (donorEventList.WaitingList_Date > DateTime.Parse("1/1/2000"))
            {
                switch (donorEventList.Attending)
                {
                    case false:
                        sbDis.Append(eventList.HTML_No);
                        break;
                    case true:
                        sbDis.Append(eventList.HTML_Wait);
                        break;
                }
            }
            else
            {
                switch (donorEventList.Attending)
                {
                    case false:
                        sbDis.Append(eventList.HTML_No);
                        ltFAQ.Visible = false;
                        break;
                    case true:
                        sbDis.Append(eventList.HTML_Yes);
                        break;
                }
            }

            var email = new DonorEmail();
            sbDis = email.ParseText(sbDis,eventList,donorList);
            
            litConfirm.Text = sbDis.ToString();



        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                EventList EL = new EventList(User.Identity.Name);

                gvEventList.DataSource = EL.GetEventsReport();
                gvEventList.DataBind();

            }
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                EventList EL = new EventList(User.Identity.Name);

                ddlEvents.DataSource = EL.GetEvents();
                ddlEvents.DataTextField = "EName";
                ddlEvents.DataValueField = "pk_Event";
                ddlEvents.DataBind();

            }
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // If the parameter EID is null or the expired date has passed then redirect to the Event Expiration page
                if (Request["eid"] != null)
                {
                    var eventList = new EventList(User.Identity.Name, int.Parse(Request["eid"]));

                    if (eventList.OnlineCloseDate < DateTime.Parse("1/1/2000"))
                        throw new Exception("No Close Date");

                    if (eventList.OnlineCloseDate < DateTime.Now)
                        throw new Exception("Expired");

                    if (!eventList.Active)
                        throw new Exception("Not Active");

                    // Write Page
                    var donorEventList = new DonorEventList(User.Identity.Name)
                    {
                        fk_Event = eventList.pk_Event
                    };

                    if (donorEventList.GetTicketCountForEvent() > eventList.Capacity)
                        pnlCapacity.Visible = true;

                    // Add HTML from DB
                    var sbHeader = new StringBuilder(eventList.HTML_Header);
                    var donorEmail = new DonorEmail();

                    sbHeader = donorEmail.ParseTextSubEL(sbHeader, eventList);
                    ltHeader.Text = sbHeader.ToString();  // EL.HTML_Header;

                    var faq = new StringBuilder(eventList.HTML_FAQ);
                    faq = donorEmail.ParseTextSubEL(faq, eventList);
                    ltFAQ.Text = faq.ToString();

                    lblEvent.Text = eventList.DisplayName;

                    imgHeader.ImageUrl = "ihandler.ashx?eid=" + eventList.pk_Event;
                }
                else
                    throw new Exception("Invalid EID");
            }
            catch (Exception ex)
            {
                Response.Redirect("eventexpired.aspx");
            }

        }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblMessage.Text = User.Identity.Name;

            var browser = Request.Browser;

            if (!Page.IsPostBack)
            {
                var eventList = new EventList(User.Identity.Name);

                ddlEvents.DataSource = eventList.GetEvents();
                ddlEvents.DataTextField = "EName";
                ddlEvents.DataValueField = "pk_Event";
                ddlEvents.DataBind();

                ddlEvent2.DataSource = eventList.GetEvents();
                ddlEvent2.DataTextField = "EName";
                ddlEvent2.DataValueField = "pk_Event";
                ddlEvent2.DataBind();
            }

            if (browser.Type.Contains("Safari"))
            {
                pnlPC.Visible = false;
                pnlIPad.Visible = true;

                if (Page.IsPostBack) return;

                var donorEventList = new DonorEventList(User.Identity.Name);

                gvDonorList.DataSource = donorEventList.GetDonorList_Search(ddlEvent2.SelectedValue, txtLName.Text, 100);
                gvDonorList.DataBind();
            }
            else
            {
                pnlPC.Visible = true;
                pnlIPad.Visible = false;

                lblMessage.ForeColor = System.Drawing.Color.Red;

                if (Page.IsPostBack) return;

                var donorEventList = new DonorEventList(User.Identity.Name);

                gvRegistrations.DataSource = donorEventList.GetRecentResponses(15);
                gvRegistrations.DataBind();
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["SortExpr"] = "AccountName ASC";

                if (Request["eid"] != null)
                {
                    EventList EL = new EventList(User.Identity.Name, int.Parse(Request["eid"].ToString()));

                    lblEvent.Text = EL.EventName.ToString();

                    DataBind();

                    hlExcel.NavigateUrl = "MailedTicketReport_Excel.aspx?eid=" + Request["eid"].ToString();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string attachment = "attachment; filename=EventGuestList-Excel_" + DateTime.Now.ToString() + ".xls";

            Response.ClearContent();
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "application/ms-excel";

            if (Request["eid"] != null)
            {
                DonorEventList DEL = new DonorEventList(User.Identity.Name);
                EventList EL = new EventList(User.Identity.Name, int.Parse(Request["eid"].ToString()));

                gvExcel.DataSource = DEL.GetDonorEventMailedTickets_ByEvent(EL.pk_Event);
                gvExcel.DataBind();

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                var eventList = new EventList(User.Identity.Name);

                ddlEvents.DataSource = eventList.GetEvents();
                ddlEvents.DataTextField = "EName";
                ddlEvents.DataValueField = "pk_Event";
                ddlEvents.DataBind();

                DonorEventList DEL = new DonorEventList(User.Identity.Name);

                gvDonorEvents.DataSource = DEL.GetDonorEventList_Search(ddlEvents.SelectedIndex.ToString(), "", "",500, true);
                gvDonorEvents.DataBind();

            }
        }
Exemple #13
0
        private StringBuilder AddNewEvent(string eventName, string startDate)
        {
            var sbReturn = new StringBuilder();

            try
            {
                // Check if the date is valid
                try
                {
                    var eDate = DateTime.Parse(startDate);
                }
                catch
                {
                    throw new Exception("Error");
                }

                var eventList = new EventList(User.Identity.Name)
                {
                    EventName = eventName,
                    StartDate = DateTime.Parse(startDate)
                };
                eventList.AddNew();

                if (eventList.pk_Event.Equals(0))
                    throw new Exception("Error");
                else if (eventList.pk_Event.Equals(-1))
                    throw new Exception("Duplicate");
                else
                    sbReturn.Append(eventList.pk_Event.ToString());
            }
            catch
            {
                sbReturn.Append("Error");
            }

            return sbReturn;
        }
Exemple #14
0
 protected void btnUpdateWait_Click(object sender, EventArgs e)
 {
     var eventList = new EventList(User.Identity.Name, int.Parse(Request["eid"])) { HTML_Wait = txtWait.Text };
     //            eventList.Update();
     eventList.SaveChanges();
 }
Exemple #15
0
        protected void btnUpdateFAQ_Click(object sender, EventArgs e)
        {
            var eventList = new EventList(User.Identity.Name, int.Parse(Request["eid"]));
            eventList.HTML_FAQ = txtFAQ.Text;
//            eventList.Update();
            eventList.SaveChanges();
        }
Exemple #16
0
        private StringBuilder UpdateEvent(string id, string field, string value)
        {
            var sbReturn = new StringBuilder();

            try
            {
                var eventList = new EventList(User.Identity.Name, int.Parse(id));

                switch (field)
                {
                    case "name":
                        if (value.Equals("True"))
                            eventList.Active = true;
                        else
                            eventList.Active = false;
                        break;
                    case "EventName":
                        eventList.EventName = value;
                        break;
                    case "DisplayName":
                        eventList.DisplayName = value;
                        break;
                    case "Speaker":
                        eventList.Speaker = value;
                        break;
                    case "EventDate":
                        string strDate = value + " " + eventList.StartDate.Hour + ":" + eventList.StartDate.Minute;
                        eventList.StartDate = DateTime.Parse(strDate);
                        // When the Event Date is changed allso update the Date for End Date and Doors Open Date
                        strDate = value + " " + eventList.EndDate.Hour + ":" + eventList.EndDate.Minute;
                        eventList.EndDate = DateTime.Parse(strDate);
                        strDate = value + " " + eventList.DoorsOpenDate.Hour + ":" + eventList.DoorsOpenDate.Minute;
                        eventList.DoorsOpenDate = DateTime.Parse(strDate);
                        break;
                    case "VenueName":
                        eventList.VenueName = value;
                        break;
                    case "VenueAddress":
                        eventList.VenueAddress = value;
                        break;
                    case "VenueCity":
                        eventList.VenueCity = value;
                        break;
                    case "VenueState":
                        eventList.VenueState = value;
                        break;
                    case "VenueZipCode":
                        eventList.VenueZipCode = value;
                        break;
                    case "Capacity":
                        eventList.Capacity = int.Parse(value);
                        break;
                    case "ImageURL":
                        eventList.ImageURL = value;
                        break;
                    case "StartDate":
                        eventList.StartDate = DateTime.Parse(value);
                        break;
                    case "EndDate":
                        eventList.EndDate = DateTime.Parse(value);
                        break;
                    case "DoorsOpenDate":
                        eventList.DoorsOpenDate = DateTime.Parse(value);
                        break;
                    case "OnlineCloseDate":
                        eventList.OnlineCloseDate = DateTime.Parse(value);
                        break;
                    case "Active":
                        eventList.Active = bool.Parse(value);
                        if (!bool.Parse(value))
                        {
                            eventList.InActive_Date = DateTime.Now;
                            eventList.InActive_User = User.Identity.Name;
                        }
                        break;
                    case "TicketsAllowed":
                        eventList.TicketsAllowed = int.Parse(value);
                        break;

                }

//                eventList.Update();
                eventList.SaveChanges();
                sbReturn.Append("True");
            }
            catch (Exception ex)
            {
                sbReturn.Append("Error");
            }

            return sbReturn;
        }
Exemple #17
0
        protected void btnImageUpload_Click(object sender, EventArgs e)
        {
            if (!fuImage.HasFile) return;

            var eventList = new EventList(User.Identity.Name, int.Parse(Request["eid"]))
            {
                Header_Image = System.Drawing.Image.FromStream(fuImage.PostedFile.InputStream)
            };
            //            eventList.Update();
            eventList.SaveChanges();

            imgHeader.Visible = true;
            imgHeader.ImageUrl = "ihandler.ashx?eid=" + eventList.pk_Event;
        }
Exemple #18
0
        protected void btnRegisterUser_Click(object sender, EventArgs e)
        {
            try
            {

                if (!Page.IsValid)
                {
                    lblMessage.Text = "NO";
                }
                else
                {
                    if (txtAttending.Text.Equals(""))
                        txtAttending.Text = "0";

                    // Validate Data Entry
                    if (!chkGuest.Checked)
                    {
                        if (txtDonorID.Text.Length.Equals(0))
                            throw new Exception("Please enter a valid Donor ID!");
                    }

                    if (chkAttending.Checked && int.Parse(txtAttending.Text) < 1)
                        throw new Exception("Please enter the number of attendees!");

                    if (!chkAttending.Checked && int.Parse(txtAttending.Text) > 0)
                        throw new Exception("If not attending please remove the number of attendees!");

                    var eventList = new EventList(User.Identity.Name, int.Parse(ddlEvents.SelectedValue));
                    var donorEventList = new DonorEventList(User.Identity.Name);
                    DonorList donorList;

                    if (chkGuest.Checked)
                    {
                        donorList = new DonorList();
                        donorList.AddNewGuestToEvent(eventList.pk_Event);

                        donorEventList.fk_Event = eventList.pk_Event;
                        donorEventList.fk_DonorList = donorList.pk_DonorList;
                        donorEventList.AddNew();

                    }
                    else
                    {

                        var specialEventCodes = new[] { "jbond", "jsncc", "naacp", "splcj", "jbhrc", "bondj", "jhbms" };
                        var finderNumber = txtDonorID.Text.Trim();


                        if (specialEventCodes.Contains(finderNumber.ToLower()))
                        {
                            var guid = Guid.NewGuid();

                            var key = finderNumber + guid.ToString().Replace("-", "").Substring(0, 5).ToUpper();
                            var donor = new DonorList() { pk_DonorList = key.ToUpper(), IsValid = true, AccountType = "Guest", DonorType = "Guest" };
                            donor.Create();

                            var del = new DonorEventList("") { fk_Event = eventList.pk_Event, fk_DonorList = key };
                            del.Create();
                            finderNumber = key;
                        }

                        donorEventList.Load(eventList.pk_Event, finderNumber);

                        if (donorEventList.pk_DonorEventList <= 0)
                            throw new Exception("Donor ID is not registered with this Event!");

                        if (donorEventList.Response_Date > DateTime.Parse(BaseDate))
                            throw new Exception("Donor has already registered for this Event!");
                    }

                    donorList = new DonorList(donorEventList.fk_DonorList);

                    // Update Donor Information
                    if (UpdateDonorList(donorList))
                    {
                        donorEventList.UpdatedInfo = true;
                        donorEventList.UpdatedInfoDateTime = DateTime.Now;
                        donorEventList.UpdatedInfo_User = donorList.AccountName;
                    }

                    // Register User
                    donorEventList.Response_Date = DateTime.Now;
                    donorEventList.Response_Type = "SPLC Admin";

                    if (chkAttending.Checked)
                    {
                        donorEventList.Attending = true;
                        lblMessage.Text = "Donor is registered";
                    }
                    else
                    {
                        donorEventList.Attending = false;
                        lblMessage.Text = "Donor is not attending.";
                    }

                    // Register User
                    if (donorEventList.GetTicketCountForEvent() > eventList.Capacity && chkAttending.Checked)
                    {
                        // Add to Waiting List
                        donorEventList.Response_Date = DateTime.Now;
                        donorEventList.Response_Type = "SPLC Admin";

                        donorEventList.WaitingList_Date = DateTime.Now;
                        donorEventList.WaitingListOrder = donorEventList.GetNextWaitListNumber();
                        donorEventList.TicketsRequested = int.Parse(txtAttending.Text);
                        lblMessage.Text = "Donor was added to the Waiting List";
                    }
                    else
                    {

                        donorEventList.TicketsRequested = int.Parse(txtAttending.Text);
                        lblMessage.ForeColor = System.Drawing.Color.Green;
                    }

                    //                    DonorEL.Update();
                    donorEventList.SaveChanges();
                    txtDonorID.Text = "";
                    txtAttending.Text = "0";
                    chkAttending.Checked = false;

                    if (donorList.EmailAddress.Equals("")) return;

                    var donorEmail = new DonorEmail(User.Identity.ToString(), ConfigurationManager.AppSettings["EmailTemplatesURL"], donorList, donorEventList);
                    donorEmail.SendEmail();
                    ClearControl(Form);
                }

            }
            catch (Exception ex)
            {
                lblMessage.ForeColor = System.Drawing.Color.Red;
                lblMessage.Text = ex.Message; // "Donor ID is not registered with this Event!";
            }

        }
Exemple #19
0
 public StringBuilder ParseText(StringBuilder message, EventList eventList, DonorList donorList)
 {
     message = ParseTextSubDL(message, donorList);
     message = ParseTextSubEL(message, eventList);
     return(message);
 }
Exemple #20
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {

                if (attendingRadio.SelectedValue.Equals("0") && (ddlNoGuests.SelectedValue.Equals("0")))
                    throw new Exception("Please select the number of tickets that you are requesting.");

                if (attendingRadio.SelectedValue.Equals("1") && (!ddlNoGuests.SelectedValue.Equals("0")))
                    throw new Exception("If you are not attending please select (0) for the number of Guests attending.");

                var donorEventList = (DonorEventList)Session["SPLC.Donor.RSVP.DEL"];
                var donorList = (DonorList)Session["SPLC.Donor.RSVP.DL"];

                //Special case for event without normal invitation distribution

                var finderNumber = donorList.pk_DonorList.ToLower();
                //var specialEventCodes = new[] { "jbond", "jsncc", "naacp", "splcj", "jbhrc", "bondj", "jhbms" };

                //if (specialEventCodes.Contains(finderNumber.Substring(0, 5)))
                //{
                //    donorList.KeyName = txtName.Text;
                //    donorList.AccountName = txtName.Text;
                //    donorList.AddressLine1 = txtMailingAddress.Text;
                //    donorList.AddressLine2 = txtAddress2.Text;
                //    donorList.City = txtCity.Text;
                //    donorList.State = ddlState.Text;
                //    donorList.PostCode = txtZipCode.Text;
                //    donorList.PhoneNumber = txtPhoneNumber.Text;
                //    donorList.EmailAddress = txtEmail.Text;
                //    donorList.Save();
                //}


                // Update Donor Information
                if (UpdateDonorList(donorList))
                {
                    donorEventList.UpdatedInfo = true;
                    donorEventList.UpdatedInfoDateTime = DateTime.Now;
                    donorEventList.UpdatedInfo_User = donorList.AccountName;
                }

                donorList.EmailAddress = txtEmail.Text;
                //DL.Update();

                if (donorEventList.pk_DonorEventList <= 0)
                    throw new Exception("Donor ID is not registered with this Event!");

                if (donorEventList.Response_Date > DateTime.Parse("1/1/2000"))
                    throw new Exception(@"It appears you have already registered for this event, please check 
                                            the information and try again or call 334-956-8200 for assistance.");

                var eventList = new EventList(User.Identity.Name, donorEventList.fk_Event);

                if (attendingRadio.SelectedValue.Equals("0"))
                {
                    donorEventList.Attending = true;
                    donorEventList.TicketsRequested = int.Parse(ddlNoGuests.SelectedValue);
                }
                else
                {
                    donorEventList.Attending = false;
                    donorEventList.TicketsRequested = 0;
                }

                donorEventList.DonorComments = txtComments.Text;
                donorEventList.Response_Date = DateTime.Now;
                donorEventList.Response_Type = "RSVP Web";

                if (donorEventList.GetTicketCountForEvent() > eventList.Capacity)
                {
                    // Add to Waiting List
                    donorEventList.WaitingList_Date = DateTime.Now;
                    donorEventList.WaitingListOrder = donorEventList.GetNextWaitListNumber();
                }


                //                donorEventList.Update();
                donorEventList.SaveChanges();

                Session["SPLC.Donor.RSVP.DEL"] = donorEventList;


                var donorEmail = new DonorEmail(User.Identity.ToString(), ConfigurationManager.AppSettings["EmailTemplatesURL"], donorList, donorEventList);
                donorEmail.SendEmail();

                var pkEvent = int.Parse(Request["eid"]);
                Response.Redirect("Confirmation.aspx?eid=" + pkEvent);

            }
            catch (Exception ex)
            {
                lblMessage.ForeColor = Color.Red;
                lblMessage.Text = ex.Message;
            }

        }
Exemple #21
0
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime eDate;
                // Check if the date is valid
                try { eDate = DateTime.Parse(txtNEventDate.Text); }
                catch { throw new Exception("Event Date"); }

                if (txtNEventName.Text.Length <= 0)
                    throw new Exception("Missing Event Name");

                if (eDate < DateTime.Now)
                    throw new Exception("Cannot create an event in the past!");

                var eventList = new EventList(User.Identity.Name)
                {
                    EventName = txtNEventName.Text,
                    StartDate = eDate
                };
                eventList.AddNew();

                if (eventList.pk_Event.Equals(0))
                    throw new Exception("Error");
                else if (eventList.pk_Event.Equals(-1))
                    throw new Exception("Event Name Already Exists");
                else
                    Response.Redirect("event.aspx?eid=" + eventList.pk_Event);
            }
            catch (Exception ex)
            {
                lblError.Text = "Error Adding new Event: " + ex.Message;
            }
        }
Exemple #22
0
        public void SendEmail()
        {

            try
            {
                var msg = new StringBuilder();
                var getUrl = "";

                if (_DEL.WaitingList_Date > DateTime.Parse(BaseDate))
                {
                    switch (_DEL.Attending)
                    {
                        case true:
                            getUrl = _URL + @"/templates/wait_yes.html";
                            break;
                        case false:
                            getUrl = _URL + @"/templates/rsvp_no.html";
                            break;
                    }
                }
                else
                {
                    switch (_DEL.Attending)
                    {
                        case true:
                            getUrl = _URL + @"/templates/rsvp_yes.html";
                            break;
                        case false:
                            getUrl = _URL + @"/templates/rsvp_yes.html";
                            break;
                    }
                }

                var request = (HttpWebRequest)WebRequest.Create(getUrl);
                request.Method = "GET";
                var response = request.GetResponse();
                
                var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                msg.Append(reader.ReadToEnd());
                reader.Close();
                response.Close();

                var eventList = new EventList(_user, _DEL.fk_Event);
                
                if (_DEL.WaitingList_Date > DateTime.Parse(BaseDate))
                {
                    switch (_DEL.Attending)
                    {
                        case true:
                            msg = msg.Replace("@{TEXT}", eventList.HTML_Wait);
                            break;
                        case false:
                            msg = msg.Replace("@{TEXT}", eventList.HTML_No);
                            break;
                    }
                }
                else
                {
                    switch (_DEL.Attending)
                    {
                        case true:
                            msg = msg.Replace("@{TEXT}", eventList.HTML_Yes);
                            break;
                        case false:
                            msg = msg.Replace("@{TEXT}", eventList.HTML_No);
                            break;
                    }
                }

                msg = ParseText(msg, eventList, _DL);

                var smtpClient = new SmtpClient {EnableSsl = false};
                
                var mail = new MailMessage
                {
                    BodyEncoding = Encoding.GetEncoding("utf-8"),
                    IsBodyHtml = true,
                    //TODO: Uncomment this after event
                    Subject = "SPLC Event Confirmation",
//                    Subject = "Julian Bond Memorial Service Confirmation", 
                    Body = msg.ToString()
                };

                mail.To.Add(new MailAddress(_DL.EmailAddress));
                smtpClient.Send(mail);

            }
            catch (Exception ex)
            {
                var donorMessages = new DonorMessages()
                {
                    MessageId = 2200,
                    MessageText = "ERROR: DonorEmail.SendEmail()",
                    MessageDescription = ex.Message,
                    User_Added = _user
                };
                donorMessages.AddNew();
            }
        }
Exemple #23
0
 public StringBuilder ParseTextSubEL(StringBuilder message, EventList eventList)
 {
     message = message.Replace("@{DATE}", DateTime.Today.ToString("MMMM dd, yyyy"));
     message = message.Replace("@{DisplayName}", eventList.DisplayName);
     message = message.Replace("@{City}", eventList.VenueCity);
     message = message.Replace("@{StartDate}", eventList.StartDate.ToLongDateString());
     message = message.Replace("@{StartTime}", eventList.StartDate.ToShortTimeString());
     return message;
 }
Exemple #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) return;

            if (Request["eid"] == null)
            {
                lblHeader.Text = "New Event";
            }
            else
            {
                pnlAddEvent.Visible = false;
                pnlEditEvent.Visible = true;

                lblHeader.Text = "Event";

                var eventList = new EventList(User.Identity.Name, int.Parse(Request["eid"]));
                hfPK.Value = eventList.pk_Event.ToString();
                txtEventName.Text = eventList.EventName;
                txtDisplayName.Text = eventList.DisplayName;
                txtSpeaker.Text = eventList.Speaker;
                txtEventDate.Text = eventList.StartDate.ToShortDateString();
                txtVName.Text = eventList.VenueName;
                txtVAddress.Text = eventList.VenueAddress;
                txtVCity.Text = eventList.VenueCity;
                txtVZipCode.Text = eventList.VenueZipCode;
                cbActive.Checked = eventList.Active;

                var url = Request.ServerVariables["SERVER_NAME"];

                hlTicketURL.NavigateUrl = "http://rsvp.splcenter.org/" + eventList.VenueCity;
                hlTicketURL.Text = hlTicketURL.NavigateUrl;
                hlTicketURL.Target = "_blank";


                if (url.Contains("donor.splcenter.org"))
                {
                    // Production site
                    hlEventURL.NavigateUrl = ConfigurationManager.AppSettings["EmailTemplatesURL"] +
                                             "/default.aspx?eid=" + eventList.pk_Event;
                    hlEventURL.Text = hlEventURL.NavigateUrl;
                }
                else
                {
                    // DEV or UAT site
                    hlEventURL.NavigateUrl = "http://" + url + "/rsvp/default.aspx?eid=" + eventList.pk_Event;
                    hlEventURL.Text = hlEventURL.NavigateUrl;
                }

                hlEventURL.Target = "_blank";

                ddlState.SelectedValue = eventList.VenueState;
                txtCapasity.Text = eventList.Capacity.ToString();
                txtTicketsAllowed.Text = eventList.TicketsAllowed.ToString();

                txtSTimeHour.Text = GetHour(eventList.StartDate);
                txtSTimeMin.Text = GetMinute(eventList.StartDate);
                ddlStartTime.SelectedValue = GetAMPM(eventList.StartDate);

                txtETimeHour.Text = GetHour(eventList.EndDate);
                txtETimeMin.Text = GetMinute(eventList.EndDate);
                ddlEndTime.SelectedValue = GetAMPM(eventList.EndDate);

                txtOOTimeHour.Text = GetHour(eventList.DoorsOpenDate);
                txtOOTimeMin.Text = GetMinute(eventList.DoorsOpenDate);
                ddlOOTime.SelectedValue = GetAMPM(eventList.DoorsOpenDate);

                txtOnlineCloseDate.Text = eventList.OnlineCloseDate.ToShortDateString();

                txtHeader.Text = eventList.HTML_Header;
                txtFAQ.Text = eventList.HTML_FAQ;

                txtYes.Text = eventList.HTML_Yes;
                txtNo.Text = eventList.HTML_No;
                txtWait.Text = eventList.HTML_Wait;

                imgHeader.Visible = true;
                imgHeader.ImageUrl = "ihandler.ashx?eid=" + eventList.pk_Event;
            }
        }
Exemple #25
0
        public void SendEmail()
        {
            try
            {
                var msg    = new StringBuilder();
                var getUrl = "";

                if (_DEL.WaitingList_Date > DateTime.Parse(BaseDate))
                {
                    switch (_DEL.Attending)
                    {
                    case true:
                        getUrl = _URL + @"/templates/wait_yes.html";
                        break;

                    case false:
                        getUrl = _URL + @"/templates/rsvp_no.html";
                        break;
                    }
                }
                else
                {
                    switch (_DEL.Attending)
                    {
                    case true:
                        getUrl = _URL + @"/templates/rsvp_yes.html";
                        break;

                    case false:
                        getUrl = _URL + @"/templates/rsvp_yes.html";
                        break;
                    }
                }

                var request = (HttpWebRequest)WebRequest.Create(getUrl);
                request.Method = "GET";
                var response = request.GetResponse();

                var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                msg.Append(reader.ReadToEnd());
                reader.Close();
                response.Close();

                var eventList = new EventList(_user, _DEL.fk_Event);

                if (_DEL.WaitingList_Date > DateTime.Parse(BaseDate))
                {
                    switch (_DEL.Attending)
                    {
                    case true:
                        msg = msg.Replace("@{TEXT}", eventList.HTML_Wait);
                        break;

                    case false:
                        msg = msg.Replace("@{TEXT}", eventList.HTML_No);
                        break;
                    }
                }
                else
                {
                    switch (_DEL.Attending)
                    {
                    case true:
                        msg = msg.Replace("@{TEXT}", eventList.HTML_Yes);
                        break;

                    case false:
                        msg = msg.Replace("@{TEXT}", eventList.HTML_No);
                        break;
                    }
                }

                msg = ParseText(msg, eventList, _DL);

                var smtpClient = new SmtpClient {
                    EnableSsl = false
                };

                var mail = new MailMessage
                {
                    BodyEncoding = Encoding.GetEncoding("utf-8"),
                    IsBodyHtml   = true,
                    //TODO: Uncomment this after event
                    Subject = "SPLC Event Confirmation",
//                    Subject = "Julian Bond Memorial Service Confirmation",
                    Body = msg.ToString()
                };

                mail.To.Add(new MailAddress(_DL.EmailAddress));
                smtpClient.Send(mail);
            }
            catch (Exception ex)
            {
                var donorMessages = new DonorMessages()
                {
                    MessageId          = 2200,
                    MessageText        = "ERROR: DonorEmail.SendEmail()",
                    MessageDescription = ex.Message,
                    User_Added         = _user
                };
                donorMessages.AddNew();
            }
        }
Exemple #26
0
 public StringBuilder ParseText(StringBuilder message, EventList eventList, DonorList donorList)
 {
     message = ParseTextSubDL(message, donorList);
     message = ParseTextSubEL(message, eventList);
     return message;
 }
        private void DataBind(int pPageIndex = 0)
        {


            if (pPageIndex <= 0)
            {
                pPageIndex = 0;
            }
            else
            {
                if (pPageIndex > gvReport.PageCount)
                    pPageIndex = gvReport.PageCount;

            }

            DonorEventList DEL = new DonorEventList(User.Identity.Name);
            EventList EL = new EventList(User.Identity.Name, int.Parse(Request["eid"].ToString()));

            gvReport.PageIndex = pPageIndex;
            gvReport.DataSource = DEL.GetDonorEventMailedTickets_ByEvent(EL.pk_Event, ViewState["SortExpr"].ToString());
            gvReport.DataBind();
        }