Esempio n. 1
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;
            }
        }
Esempio n. 2
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;
            }
        }