protected bool DeleteRequest() { bool deleted = true; if (_RequestId > 0) { try { PrayerReq pr = new PrayerReq(_RequestId); if (pr.Responses.Count > 0) { foreach (Shiloh.BL.PrayerResponse resp in pr.Responses) { resp.Delete(); } } deleted = pr.Delete(); } catch (Exception ex) { _ErrorMsg = ex.Message; deleted = false; } } return deleted; }
protected void BindList(int Month, int Year) { DateTime start = DateTime.Now.AddDays(-30.0); DateTime end = DateTime.Now.AddDays(1.0); PrayerReq reqs = new PrayerReq(); _dtRequests = reqs.GetByDateRange(start.Date, end.Date); dlRequests.DataSource = _dtRequests.Select("IsConfidential = 0 and wasProcessed = 1"); dlRequests.DataBind(); }
protected void GetPrayerRequest() { if (_RequestId > 0) { PrayerReq pr = new PrayerReq(_RequestId); if (!string.IsNullOrEmpty(pr.PrayerNeeds.Trim())) { divPrayer.InnerText = pr.PrayerNeeds; txtProcessedBy.Text = pr.ProcessedBy; lblConfidential.Visible = pr.IsConfidential; lblFrom.Text = string.Concat(pr.FirstName, " ", pr.LastName); if (pr.Responses.Count > 0) { txtResponse.Text = pr.Responses[0].ResponseText; hdnResponseId.Value = pr.Responses[0].Id.ToString(); } } } }
public void GetRequest() { if (Request.QueryString["rid"] != null) { int reqId = 0; if (Int32.TryParse(Request.QueryString["rid"].ToString(), out reqId)) { PrayerReq req = new PrayerReq(reqId); if (req.PleaseCall) { lblCall.Text = "Yes - "; if (!string.IsNullOrEmpty(req.Phone)) { lblCall.Text = string.Concat(lblCall.Text, "Please call ", FormatPhone(req.Phone)); if (!req.BestCallTime.StartsWith("No")) lblCall.Text = string.Concat(lblCall.Text, req.BestCallTime, " is the best time to call."); } else lblCall.Text = string.Concat(lblCall.Text, "No phone number was listed."); } else lblCall.Text = "No"; lblConfidential.Text = (req.IsConfidential) ? "Yes" : "No"; lblEmail.Text = (!string.IsNullOrEmpty(req.Email)) ? req.Email : string.Empty; lblDatePrinted.Text = DateTime.Now.ToShortDateString(); lblDateReceived.Text = req.DateReceived.ToShortDateString(); if (req.IsInHospital) { if (req.DoHospitalVisit) { if (!string.IsNullOrEmpty(req.HospitalName)) { if (!string.IsNullOrEmpty(req.HospitalRoomNo)) lblHostpital.Text = string.Concat("Yes, please visit them at ", req.HospitalName, " hospital in room# ", req.HospitalRoomNo); else lblHostpital.Text = string.Concat("Yes, please visit them at ", req.HospitalName, " hospital."); } else { lblHostpital.Text = string.Concat("Yes, please visit but contact family for hospital information. "); } } else { lblHostpital.Text = "Yes, but do not visit."; } } else { lblHostpital.Text = "No"; } lblInDager.Text = (req.IsInDanger) ? "Yes" : "No"; lblName.Text = string.Concat(req.FirstName, " ", req.LastName); lblPrayerRequest.Text = req.PrayerNeeds; lblReferrals.Text = req.Referrals.Replace("|", " ,"); lblSpecialInstructions.Text = (!string.IsNullOrEmpty(req.SpecialInstructions)) ? req.SpecialInstructions : "None"; lblHandledBy.Text = req.ProcessedBy; } } }
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; }
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; }