Ejemplo n.º 1
0
        protected bool SaveRequest()
        {
            bool saved = false;

            if (IsPageValid())
            {
                StringBuilder referrals = new StringBuilder(string.Empty);
                PrayerReq pr = new PrayerReq();

                pr.Address = txtAddress.Text;
                pr.BestCallTime = ddlBestTimeToCall.Text;
                pr.City = txtCity.Text;
                pr.DateReceived = DateTime.Now;
                pr.DoHospitalVisit = rbVisitYes.Checked;
                pr.Email = txtEmail.Text;
                pr.FirstName = txtFirstName.Text;
                pr.HospitalName = txtHospitalName.Text;
                pr.HospitalRoomNo = txtHospitalRoom.Text;

                pr.IsConfidential = cbIsConfidential.Checked;
                pr.IsInDanger = rbInDangerYes.Checked;
                pr.IsInHospital = rbInHospitalYes.Checked;
                pr.LastName = txtLastName.Text;
                pr.MiddleName = string.Empty;
                pr.Phone = txtPhone.Text.Replace("-",string.Empty).Replace(".","").Replace(" ","");
                pr.PleaseCall = false;
                pr.PrayerNeeds = txtPrayerNeeds.Text.Trim();
                pr.SpecialInstructions = txtSpecialInstructions.Text;
                pr.State = ucStates.StateCode;
                pr.ZipCode = txtZIP.Text;
                pr.WasProcessed = false;
                pr.ProcessedBy = string.Empty;

                // put the referral list together
                foreach (ListItem item in cblReferrals.Items)
                {
                    if (item.Selected)
                    {
                        referrals.Append(item.Text + "|");
                    }
                }

                pr.Referrals = (referrals.Length > 0) ? referrals.ToString().Substring(0, referrals.Length - 1) : string.Empty;

                try
                {
                    // save it off
                    saved = pr.Save();

                    if (saved)
                    {
                        // build details
                        StringBuilder dtls = new StringBuilder(litMailMsg.Text);
                        dtls.Replace("%name%", string.Concat(pr.FirstName, " ", pr.LastName));
                        dtls.Replace("%email%", pr.Email);
                        dtls.Replace("%phone%", pr.Phone);

                        // send off an e-mail
                        if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["PrayerRequestEmailList"]))
                        {
                            General.SendMail(
                                ConfigurationManager.AppSettings["SMTPServer"],
                                ConfigurationManager.AppSettings["SiteEmail"],
                                new List<string>(ConfigurationManager.AppSettings["PrayerRequestEmailList"].Split(new char[] { ',' })),
                                "New Prayer Request on Shiloh2000.com",
                                General.ToHTMLMailMsg(dtls.ToString()),
                                ICS.Utils.Enum.eMailMessageType.HTML);
                        }
                    }
                }
                catch (Exception ex)
                {
                    saved = false;
                    _ErrorMsg = ex.Message;
                }
            }

            return saved;
        }
Ejemplo n.º 2
0
        protected bool SaveRequest()
        {
            bool saved = false;

            try
            {
                PrayerReq pr = new PrayerReq(_RequestId);

                pr.ProcessedBy = txtProcessedBy.Text;
                pr.WasProcessed = true;

                saved = pr.Save();
            }
            catch (Exception ex)
            {
                _ErrorMsg = ex.Message;
                saved = false;
            }

            return saved;
        }