Exemplo n.º 1
0
 protected void FormView1_DataBound(object sender, EventArgs e)
 {
     FormView fv = (FormView)sender;
     DataRowView dv = (DataRowView)fv.DataItem;
     if (dv != null)
     {
         int version = (int)dv["Version"];
         if (version == 2011)
         {
             int id = (int)dv["Id"];
             StudentVolunteerDA DA = new StudentVolunteerDA();
             StringBuilder sb = DA.GetEmailBody(id, Server.MapPath(MailUtil.StudentVolunteerInfoTemplate));
             Literal litCurrentInfo = FormView1.FindControl("litCurrentInfo") as Literal;
             litCurrentInfo.Text = sb.ToString();
         }
         else
         {
             ShowLegacyVersionPanel();
         }
     }
 }
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            int newID = 0;

            if (IsValid)
            {
                SqlCommand cmd = null;
                try {
                    cmd = new SqlCommand("dbo.FSFPL_AddStudentVolunteer");
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("FirstName", txtFirstName.Text.Trim());
                    cmd.Parameters.AddWithValue("LastName", txtLastName.Text.Trim());
                    cmd.Parameters.AddWithValue("Address1", txtAddress1.Text.Trim());
                    cmd.Parameters.AddWithValue("Address2", txtAddress2.Text.Trim());
                    cmd.Parameters.AddWithValue("City", txtCity.Text.Trim());
                    cmd.Parameters.AddWithValue("StateCode", ddlState.SelectedValue);
                    cmd.Parameters.AddWithValue("ZipCode", txtZipCode.Text.Trim());
                    cmd.Parameters.AddWithValue("HomePhone", txtHomePhone.Text.Trim());
                    cmd.Parameters.AddWithValue("WorkPhone", "");
                    cmd.Parameters.AddWithValue("Email", txtEmail.Text.Trim());

                    cmd.Parameters.AddWithValue("OpportunityStepSale", cbxOpportunityStepSale.Checked);
                    // added Dec 2, 2009
                    cmd.Parameters.AddWithValue("OpportunityStepSaleTime1", cbxOpportunityStepSaleTime1.Checked);
                    cmd.Parameters.AddWithValue("OpportunityStepSaleTime2", cbxOpportunityStepSaleTime2.Checked);

                    cmd.Parameters.AddWithValue("OpportunityDonationCenter", cbxOpportunityDonationCenter.Checked);
                    // added Dec 2, 2009
                    cmd.Parameters.AddWithValue("OpportunityDonationCenterTime1", cbxOpportunityDonationCenterTime1.Checked);
                    cmd.Parameters.AddWithValue("OpportunityDonationCenterTime2", cbxOpportunityDonationCenterTime2.Checked);

                    // removed Dec 2, 2009
                    cmd.Parameters.AddWithValue("OpportunityDonationCenterFortMason", false); //cbxOpportunityDonationCenterFortMason.Checked
                    cmd.Parameters.AddWithValue("OpportunityBookBayFortMason", false); //cbxOpportunityBookBayFortMason.Checked
                    cmd.Parameters.AddWithValue("OpportunityBookBayFortMasonVolunteered", false); //cbxOpportunityBookBayFortMasonVolunteered.Checked
                    cmd.Parameters.AddWithValue("OpportunityBookBayFortMasonVolunteeredDay", ""); //txtOpportunityBookBayFortMasonVolunteeredDay.Text
                    cmd.Parameters.AddWithValue("OpportunityBookBayFortMasonVolunteeredTime", ""); //txtOpportunityBookBayFortMasonVolunteeredTime.Text
                    cmd.Parameters.AddWithValue("OpportunityBookBayMain", false); //cbxOpportunityBookBayMain.Checked
                    cmd.Parameters.AddWithValue("OpportunityBookBayMainVolunteered", false); //cbxOpportunityBookBayMainVolunteered.Checked
                    cmd.Parameters.AddWithValue("OpportunityBookBayMainVolunteeredDay", ""); //txtOpportunityBookBayMainVolunteeredDay.Text
                    cmd.Parameters.AddWithValue("OpportunityBookBayMainVolunteeredTime", ""); //txtOpportunityBookBayMainVolunteeredTime.Text

                    cmd.Parameters.AddWithValue("OpportunityFriendsOffice", cbxOpportunityFriendsOffice.Checked);
                    // added Dec 2, 2009
                    cmd.Parameters.AddWithValue("OpportunityFriendsOfficeSkill", cbxOpportunityFriendsOfficeSkill.Checked);
                    cmd.Parameters.AddWithValue("OpportunityFriendsOfficeSkillOther", txtOpportunityFriendsOfficeSkillOther.Text);

                    cmd.Parameters.AddWithValue("OpportunitySpecialEvents", cbxOpportunitySpecialEvents.Checked);
                    // added Dec 2, 2009
                    cmd.Parameters.AddWithValue("OpportunitySpecialEventsDaytime", cbxOpportunitySpecialEventsDaytime.Checked);
                    cmd.Parameters.AddWithValue("OpportunitySpecialEventsEvening", cbxOpportunitySpecialEventsEvening.Checked);
                    cmd.Parameters.AddWithValue("OpportunitySpecialEventsWeekend", cbxOpportunitySpecialEventsWeekend.Checked);

                    cmd.Parameters.AddWithValue("OpportunityBigBookSale", cbxOpportunityBigBookSale.Checked);

                    // removed Dec 2, 2009
                    cmd.Parameters.AddWithValue("OpportunityBookDonationPickups", false); //cbxOpportunityBookDonationPickups.Checked

                    // added Dec 2, 2009
                    cmd.Parameters.AddWithValue("OpportunityStreetTeam", cbxOpportunityStreetTeam.Checked);

                    // added Dec 2, 2009
                    cmd.Parameters.AddWithValue("OpportunityDollarBookSale", cbxOpportunityDollarBookSale.Checked);
                    cmd.Parameters.AddWithValue("OpportunityDollarBookSaleTime1", cbxOpportunityDollarBookSaleTime1.Checked);
                    cmd.Parameters.AddWithValue("OpportunityDollarBookSaleTime2", cbxOpportunityDollarBookSaleTime2.Checked);

                    cmd.Parameters.AddWithValue("OpportunityAdvocacyEfforts", cbxOpportunityAdvocacy.Checked);
                    cmd.Parameters.AddWithValue("NewsLetter", cbxNewsLetter.Checked);

                    // added Apr 17, 2010
                    cmd.Parameters.AddWithValue("School", txtSchool.Text.Trim());
                    cmd.Parameters.AddWithValue("Grade", txtGrade.Text.Trim());

                    SqlParameter param = new SqlParameter("Id", SqlDbType.Int);
                    param.Size = 8;
                    param.Direction = ParameterDirection.Output;
                    cmd.Parameters.Add(param);

                    cmd.Connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["FSFPL"].ConnectionString);
                    cmd.Connection.Open();
                    cmd.ExecuteNonQuery();

                    newID = (int)cmd.Parameters["Id"].Value;

                    StudentVolunteerDA DA = new StudentVolunteerDA();
                    StringBuilder sbEmailBody = DA.GetEmailBody(newID, Server.MapPath(MailUtil.StudentVolunteerTemplate));
                    //MailUtil.SendVolunteerEmail(txtEmail.Text, sbEmailBody);

                    Response.Redirect(String.Format("/?Confirmation&id={0}&typeid={1}", Server.UrlEncode(Security.Encrypt(newID.ToString())), MailUtil.EmailType.StudentVolunteer.ToString("D")), true);

                } catch (Exception ex) {
                    throw ex;
                } finally {
                    if (cmd.Connection != null && cmd.Connection.State == ConnectionState.Open) {
                        cmd.Connection.Close();
                    }
                    cmd.Dispose();
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int ID = 0;
            string strID = Security.Decrypt(Request["id"]);
            string strTypeID = Request["typeid"];

            masterPage = (masterpages_Site)Master;

            if (!String.IsNullOrEmpty(strID)) {
                Int32.TryParse(strID, out ID);
            }

            try {
                if (strTypeID == MailUtil.EmailType.Donation.ToString("D")) {
                    DonationDA DA = new DonationDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.DonationTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Donation_Confirmation_Template";
                } else if (strTypeID == MailUtil.EmailType.Membership.ToString("D")) {
                    MembershipDA DA = new MembershipDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.MembershipTemplate));
                    litEmailBody.Text += sb.ToString().Replace("Please keep this email as receipt for your order.", "Please keep this as receipt for your order.");
                    pageName = "Membership_Confirmation_Template";
                } else if (strTypeID == MailUtil.EmailType.Volunteer.ToString("D")) {
                    VolunteerDA DA = new VolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.VolunteerTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                } else if (strTypeID == MailUtil.EmailType.StudentVolunteer.ToString("D")) {
                    StudentVolunteerDA DA = new StudentVolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.StudentVolunteerTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                } else if (strTypeID == MailUtil.EmailType.Advocacy.ToString("D")) {
                    AdvocacyDA DA = new AdvocacyDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.AdvocacyTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                } else if (strTypeID == MailUtil.EmailType.BigBookSaleVolunteer.ToString("D")) {
                    BigBookSaleVolunteerDA DA = new BigBookSaleVolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.BigBookSaleVolunteerTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                }
                else if (strTypeID == MailUtil.EmailType.BigBookSaleVolunteerTest.ToString("D"))
                {
                    BigBookSaleVolunteerDA DA = new BigBookSaleVolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.BigBookSaleVolunteerTemplateTest));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                }
                else if (strTypeID == MailUtil.EmailType.BigBookSaleStudentVolunteer.ToString("D")) {
                    BigBookSaleStudentVolunteerDA DA = new BigBookSaleStudentVolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.BigBookSaleVolunteerTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                }
                else if (strTypeID == MailUtil.EmailType.BigBookSaleStudentVolunteerTest.ToString("D"))
                {
                    BigBookSaleStudentVolunteerDA DA = new BigBookSaleStudentVolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.BigBookSaleVolunteerTemplateTest));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                }
                else if (strTypeID == MailUtil.EmailType.BookAndPlantSaleVolunteer.ToString("D"))
                {
                    BookAndPlantSaleVolunteerDA DA = new BookAndPlantSaleVolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.BookAndPlantSaleVolunteerTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                } else if (strTypeID == MailUtil.EmailType.AnniversaryBookSaleVolunteer.ToString("D")) {
                    AnniversaryBookSaleVolunteerDA DA = new AnniversaryBookSaleVolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.AnniversaryBookSaleVolunteerTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                } else if (strTypeID == MailUtil.EmailType.BookDonation.ToString("D")) {
                    BookDonationDA DA = new BookDonationDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.BookDonationTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                } else if (strTypeID == MailUtil.EmailType.SpringBookSaleVolunteer.ToString("D")) {
                    BigBookSaleVolunteerDA DA = new BigBookSaleVolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.SpringBookSaleVolunteerTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                } else if (strTypeID == MailUtil.EmailType.SpringBookSaleStudentVolunteer.ToString("D")) {
                    BigBookSaleStudentVolunteerDA DA = new BigBookSaleStudentVolunteerDA();
                    StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath(MailUtil.SpringBookSaleVolunteerTemplate));
                    litEmailBody.Text += sb.ToString();
                    pageName = "Volunteer_Confirmation_Template";
                }
            } catch (Exception ex) {
                pageName = "";
                litEmailBody.Text = ex.Message;
            } finally {
                masterPage.ComponentName = pageName;
            }
        }