Пример #1
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();

                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();
            }
        }
Пример #2
0
        protected void gvReport_Sorting(object sender, GridViewSortEventArgs e)
        {
            DonorList DL = new DonorList();

            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 = DL.GetDonorDemoUpdates(ViewState["SortExpr"].ToString());
            gvReport.DataBind();
        }
Пример #3
0
        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);
        }
Пример #4
0
        private bool UpdateDonorList(DonorList donorList)
        {
            var blReturn = false;

            if (!donorList.AccountName.Equals(txtName.Text))
            {
                donorList.AccountName = txtName.Text;
                blReturn = true;
            }

            if (!donorList.AddressLine1.Equals(txtMailingAddress.Text))
            {
                donorList.AddressLine1 = txtMailingAddress.Text;
                blReturn = true;
            }

            if (!donorList.City.Equals(txtCity.Text))
            {
                donorList.City = txtCity.Text;
                blReturn       = true;
            }

            if (!donorList.State.Equals(ddlState.SelectedValue))
            {
                donorList.State = ddlState.SelectedValue;
                blReturn        = true;
            }

            if (!donorList.PostCode.Equals(txtZipCode.Text))
            {
                donorList.PostCode = txtZipCode.Text;
                blReturn           = true;
            }

            if (!donorList.PhoneNumber.Equals(txtPhoneNumber.Text))
            {
                donorList.PhoneNumber = txtPhoneNumber.Text;
                blReturn = true;
            }

            if (!donorList.EmailAddress.Equals(txtEmail.Text))
            {
                donorList.EmailAddress = txtEmail.Text;
                blReturn = true;
            }

            if (blReturn)
            {
                //                donorList.Update();

                donorList.Save();
            }
            return(blReturn);
        }
Пример #5
0
        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";

            DonorList DL = new DonorList();

            gvExcel.DataSource = DL.GetDonorDemoUpdates();
            gvExcel.DataBind();
        }
Пример #6
0
        private static StringContent SerializeJsonForDrapi <T>(DonorList <T> requestFilter)
        {
            string json = JsonConvert.SerializeObject(
                requestFilter,
                Formatting.Indented,
                new JsonSerializerSettings
            {
                ContractResolver  = CamelCaseContractResolver,
                NullValueHandling = NullValueHandling.Ignore,
            });

            // note the awkward JSON syntax - wrapped in quotes and using single quotes for identifiers
            return(new StringContent($"\"{json.Replace("\"", "'", StringComparison.InvariantCultureIgnoreCase)}\"", Encoding.UTF8, "application/json"));
        }
Пример #7
0
        private void DataBind(int pPageIndex = 0)
        {
            if (pPageIndex <= 0)
            {
                pPageIndex = 0;
            }
            else
            {
                if (pPageIndex > gvReport.PageCount)
                {
                    pPageIndex = gvReport.PageCount;
                }
            }

            DonorList DL = new DonorList();

            gvReport.PageIndex  = pPageIndex;
            gvReport.DataSource = DL.GetDonorDemoUpdates(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;
        }
Пример #9
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!";
            }
        }
Пример #10
0
        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;
            }
        }
Пример #11
0
        private bool UpdateDonorList(DonorList donorList)
        {
            var result = false;

            if (!donorList.AccountName.Equals(txtName.Text))
            {
                donorList.AccountName = txtName.Text;
                result = true;
            }

            if (!donorList.AddressLine1.Equals(txtAddress.Text))
            {
                donorList.AddressLine1 = txtAddress.Text;
                result = true;
            }

            if (!donorList.AddressLine2.Equals(txtAddress2.Text))
            {
                donorList.AddressLine2 = txtAddress2.Text;
                result = true;
            }

            if (!donorList.AddressLine3.Equals(txtAddress3.Text))
            {
                donorList.AddressLine3 = txtAddress3.Text;
                result = true;
            }


            if (!donorList.City.Equals(txtCity.Text))
            {
                donorList.City = txtCity.Text;
                result         = true;
            }

            if (!donorList.State.Equals(ddlState.SelectedValue))
            {
                donorList.State = ddlState.SelectedValue;
                result          = true;
            }

            if (!donorList.PostCode.Equals(txtZipCode.Text))
            {
                donorList.PostCode = txtZipCode.Text;
                result             = true;
            }

            if (!donorList.PhoneNumber.Equals(txtPhone.Text))
            {
                donorList.PhoneNumber = txtPhone.Text;
                result = true;
            }

            if (!donorList.EmailAddress.Equals(txtEmail.Text))
            {
                donorList.EmailAddress = txtEmail.Text;
                result = true;
            }

            if (result)
            {
                donorList.Save();
            }
            //                donorList.Update();

            return(result);
        }
Пример #12
0
        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;
            }
        }