private StringBuilder UpdateDonorEventList(string id, string field, string value) { var sbReturn = new StringBuilder(); try { var donorEventList = new DonorEventList(User.Identity.Name, int.Parse(id)); switch (field) { case "TicketsRequested": donorEventList.TicketsRequested = int.Parse(value); break; case "Attending": donorEventList.Attending = bool.Parse(value); break; case "SPLCComments": donorEventList.SPLCComments = value; break; } // donorEventList.Update(); donorEventList.SaveChanges(); sbReturn.Append("True"); } catch (Exception ex) { sbReturn.Append("Error"); } return(sbReturn); }
protected void btnSearch_Click(object sender, EventArgs e) { DonorEventList DEL = new DonorEventList(User.Identity.Name); gvDonorEvents.DataSource = DEL.GetWaitingList_Search(ddlEvents.SelectedValue.ToString(), txtDonorID.Text.ToString(), txtName.Text.ToString(), ddlDonorType.SelectedValue.ToString()); gvDonorEvents.DataBind(); }
protected void btnMailNow_OnClick(object sender, EventArgs e) { for (var i = 0; i < gvReport.Rows.Count; i++) { var chkMail = gvReport.Rows[i].FindControl("chkMail") as CheckBox; if (chkMail == null || !chkMail.Checked) { continue; } var ticketCount = gvReport.Rows[i].Cells[8].Text; var dataKey = gvReport.DataKeys[i]; if (dataKey == null) { continue; } var key = dataKey.Value; var DEL = new DonorEventList(User.Identity.Name, int.Parse(key.ToString())) { TicketsMailed_Date = DateTime.Now, TicketsMailed_User = User.Identity.Name, TicketsRequested = int.Parse(ticketCount), Response_Type = "SPLC Admin", WaitingListOrder = 0, UpdatedInfoDateTime = DateTime.Now }; DEL.MailCards(); } DataBind(); }
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 btnSearchDonor_Click(object sender, EventArgs e) { var donorEventList = new DonorEventList(User.Identity.Name); gvDonorList.DataSource = donorEventList.GetDonorList_Search(ddlEvent2.SelectedValue, txtLName.Text, 0); gvDonorList.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) { 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"); } }
private StringBuilder UpdateDonorList(string id, string field, string value, string donorEventListId) { var sbReturn = new StringBuilder(); try { var donorList = new DonorList(id); switch (field) { case "AccountName": donorList.AccountName = value; break; case "AddressLine1": donorList.AddressLine1 = value; break; case "City": donorList.City = value; break; case "State": donorList.State = value; break; case "PostCode": donorList.PostCode = value; break; case "PhoneNumber": donorList.PhoneNumber = value; break; case "Email": donorList.EmailAddress = value; break; } // donorList.Update(); donorList.Save(); var donorEventList = new DonorEventList(User.Identity.Name, int.Parse(donorEventListId)) { UpdatedInfo = true, UpdatedInfoDateTime = DateTime.Now, UpdatedInfo_User = User.Identity.Name }; donorEventList.Update(); sbReturn.Append("True"); } catch { sbReturn.Append("Error"); } return(sbReturn); }
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 btnUpdateDemo_Click(object sender, EventArgs e) { var donorEventList = new DonorEventList(User.Identity.Name, int.Parse(Request["delid"])) { UpdatedInfo = false, UpdatedInfo_User = User.Identity.Name, UpdatedInfoDateTime = DateTime.Parse("1/1/1000") }; donorEventList.SaveChanges(); Response.Redirect("DonorEventListDetails.aspx?delid=" + donorEventList.pk_DonorEventList); }
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.GetDonorEventList_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(); } }
protected void btnMailCard_Click(object sender, EventArgs e) { var donorEventList = new DonorEventList(User.Identity.Name, int.Parse(Request["delid"])) { TicketsMailed_Date = DateTime.Now, TicketsMailed_User = User.Identity.Name, TicketsRequested = int.Parse(txtAttending.Text), WaitingList_Date = DateTime.Parse(BaseDate), WaitingListOrder = 0 }; donorEventList.SaveChanges(); btnMailCard.Visible = false; lblCardMailed.Visible = true; lblCMailed.Visible = true; lblCMailed.Text = donorEventList.TicketsMailed_Date.ToShortDateString(); Response.Redirect("DonorEventListDetails.aspx?delid=" + donorEventList.pk_DonorEventList); }
protected void gvDonorEvents_RowCommand(object sender, GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvDonorEvents.Rows[index]; int intEL = int.Parse(ddlEvents.SelectedValue.ToString()); string strDonor = row.Cells[0].Text.ToString(); DonorEventList DEL = new DonorEventList(User.Identity.Name); DEL.Load(intEL, strDonor); DEL.TicketsMailed_Date = DateTime.Now; DEL.TicketsMailed_User = User.Identity.Name; //DEL.TicketsRequested = int.Parse(txtAttending.Text.ToString()); DEL.MailCards(); LoadGrid(); //gvDonorEvents.Rows[index].Visible = false; }
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(); }
private void LoadGrid() { DonorEventList DEL = new DonorEventList(User.Identity.Name); bool blShow = chMailListOnly.Checked; gvDonorEvents.DataSource = DEL.GetDonorEventList_Search(ddlEvents.SelectedValue.ToString(), txtDonorID.Text.ToString(), txtName.Text.ToString(), 500, blShow); gvDonorEvents.DataBind(); if (blShow) { gvDonorEvents.Columns[6].Visible = true; gvDonorEvents.Columns[7].Visible = false; } else { gvDonorEvents.Columns[6].Visible = false; gvDonorEvents.Columns[7].Visible = true; } }
protected void btnSubmit_Click(object sender, EventArgs e) { var finderNumber = txtFinderNumber.Text.ToLower(); //var specialEventCodes = new[] { "jbond", "jsncc", "naacp", "splcj", "jbhrc", "bondj", "jhbms" }; var pkEvent = int.Parse(Request["eid"]); //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 }; // donor.Create(); // var donorEventList = new DonorEventList("") { fk_Event = pkEvent, fk_DonorList = key }; // donorEventList.Create(); // donorEventList.GetDonorEventListID(donor.pk_DonorList, pkEvent, true); // Session["SPLC.Donor.RSVP.DL"] = donor; // Session["SPLC.Donor.RSVP.DEL"] = donorEventList; // if (finderNumber.Length >= 5) // { // Response.Redirect("DonorEvent.aspx?eid=" + pkEvent); // } // else // { // throw new Exception( // "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."); // } //} try { if (txtFinderNumber.Text.Equals("")) { throw new Exception("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."); } var donorList = new DonorList(txtFinderNumber.Text.Trim()); if (!donorList.IsValid) { throw new Exception("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."); } Session["SPLC.Donor.RSVP.DL"] = donorList; var donorEventList = new DonorEventList(""); donorEventList.GetDonorEventListID(donorList.pk_DonorList, int.Parse(Request["eid"]), true); if (!donorEventList.IsValid) { throw new Exception("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."); } if (donorEventList.Response_Date > DateTime.Parse("1/1/2000")) { throw new Exception("The code you have entered has already been used. If you need to change your reservation please call Courtney at 334-956-8269."); } Session["SPLC.Donor.RSVP.DEL"] = donorEventList; Response.Redirect("DonorEvent.aspx?eid=" + pkEvent); } catch (Exception ex) { ReservationCodeCustomValidator.ErrorMessage = ex.Message; ReservationCodeCustomValidator.IsValid = false; } }
protected void txtDonorID_TextChanged(object sender, EventArgs e) { if (txtDonorID.Text.Length < 5) { return; } var specialEventCodes = new[] { "jbond", "jsncc", "naacp", "splcj", "jbhrc", "bondj", "jhbms" }; var finderNumber = txtDonorID.Text.Trim(); if (finderNumber.Length == 5) { if (!specialEventCodes.Contains(finderNumber.ToLower())) { return; } // lblMessage.Text = $"Found promo {finderNumber}"; pnlDemo.Enabled = true; btnRegisterUser.Visible = true; return; } try { var donorEventList = new DonorEventList(User.Identity.Name); donorEventList.GetDonorEventListID(txtDonorID.Text, int.Parse(ddlEvents.SelectedValue), true); if (donorEventList.IsValid) { var donorList = new DonorList(donorEventList.fk_DonorList); if (donorList.IsValid) { 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; txtEmail.Text = donorList.EmailAddress; pnlDemo.Enabled = true; btnRegisterUser.Visible = true; } else { throw new Exception("Donor ID is not valid."); } } else { throw new Exception("Donor ID does not exist for this event."); } } catch (Exception ex) { lblMessage.Text = ex.Message; } }
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!"; } }
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; }