protected void Page_Load(object sender, EventArgs e)
        {
            int sessionId = Convert.ToInt32(Request["s"]);
            int requestId = Convert.ToInt32(Request["r"]);
            int viewed    = Convert.ToInt32(Request["v"]);
            int idx       = Convert.ToInt32(Request["i"]);
            int count     = Convert.ToInt32(Request["c"]);

            prevReqOrdinal    = idx;
            currentReqOrdinal = prevReqOrdinal - 1;

            Prayersession ps = new Prayersession();

            ps["id"] = sessionId;

            ps.doCommand("update_end_time");

            pr["id"] = requestId;

            pr = pr.doSingleObjectQuery <LiftDomain.Request>("get_request");

            pr.get_summary_info(ref title, ref description, ref from, ref requestType, ref aboutTime);

            currentRequestLabel  = Language.Current.PS_CURRENTLY_VIEWING_REQUEST;
            currentRequestLabel += " ";
            currentRequestLabel += idx.ToString();
            currentRequestLabel += " ";
            currentRequestLabel += Language.Current.PS_OF;
            currentRequestLabel += " ";
            currentRequestLabel += count.ToString();

            Response.ContentType = "text/plain";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int sessionId = Convert.ToInt32(Request["s"]);
            int n         = 0;
            int count     = 0;

            string r = Request["r"];

            if (r == "undefined")
            {
                r = null;
            }

            if (!string.IsNullOrEmpty(r))
            {
                int requestId = Convert.ToInt32(r);
                int viewed    = Convert.ToInt32(Request["v"]);
                int idx       = Convert.ToInt32(Request["i"]);
                count = Convert.ToInt32(Request["c"]);

                n = idx + 1;

                prevReqOrdinal    = idx;
                currentReqOrdinal = prevReqOrdinal + 1;

                Prayersession ps = new Prayersession();
                ps["id"] = sessionId;

                if (viewed == 0)
                {
                    ps.doCommand("incr_total_requests");
                }

                ps.doCommand("update_end_time");

                pr["id"] = requestId;

                pr = pr.doSingleObjectQuery <LiftDomain.Request>("get_request");

                pr.doCommand("update_total");

                pr.get_summary_info(ref title, ref description, ref from, ref requestType, ref aboutTime);
            }
            else
            {
                description = LiftDomain.Language.Current.REQUEST_PRAYER_SESSION_COMPLETE;
                n           = 60;
                count       = 60;
            }
            currentRequestLabel  = Language.Current.PS_CURRENTLY_VIEWING_REQUEST;
            currentRequestLabel += " ";
            currentRequestLabel += n.ToString();
            currentRequestLabel += " ";
            currentRequestLabel += Language.Current.PS_OF;
            currentRequestLabel += " ";
            currentRequestLabel += count.ToString();

            Response.ContentType = "text/plain";
        }
예제 #3
0
        protected void notifyEncouragers(LiftContext ctx)
        {
            Organization org = Organization.Current;

            Request r = new Request();

            r.id.Value = ctx.getInt("request_id");
            r          = r.doSingleObjectQuery <Request>("getobject");

            if (r.needs_encouragement.Value == 1)
            {
                OrgEmail oe = new OrgEmail();
                oe.organization_id.Value = org.id.Value;
                oe = oe.doSingleObjectQuery <OrgEmail>("select");

                Email e = new Email();
                e.from = org.getFromEmail();
                e.addTo(oe.encourager_email_to.Value);
                e.subject  = "New Encouragement Request: ";
                e.subject += r.title.Value;

                StringBuilder body = new StringBuilder();
                if (r.listed.Value == 0)
                {
                    body.Append("*** PRIVATE ***\r\n\r\n");
                }
                body.Append("REQUEST ID: "); body.Append(r.id.Value); body.Append("\r\n\r\n");
                body.Append("TITLE\r\n"); body.Append(r.title.Value); body.Append("\r\n\r\n");
                body.Append("DESCRIPTION\r\n"); body.Append(r.description.Value); body.Append("\r\n\r\n");
                body.Append("POST DATE\r\n"); body.Append(r.post_date.Value.ToString("G")); body.Append("\r\n\r\n");
                // body.Append("IS FOR\r\n"); body.Append(r.is_for.Value); body.Append("\r\n");
                // body.Append("IS APPROVED\r\n"); body.Append(r.is_approved.Value.ToString("G")); body.Append("\r\n");
                body.Append("LAST ACTION\r\n"); body.Append(r.last_action.Value.ToString("G")); body.Append("\r\n\r\n");
                body.Append("FROM\r\n"); body.Append(r.from.Value); body.Append("\r\n\r\n");
                body.Append("FROM EMAIL\r\n"); body.Append(r.from_email.Value); body.Append("\r\n\r\n");
                body.Append("ENCOURAGEMENT ADDRESS\r\n"); body.Append(r.encouragement_address.Value); body.Append("\r\n\r\n");
                //body.Append("ENCOURAGEMENT EMAIL\r\n"); body.Append(r.encouragement_email.Value); body.Append("\r\n\r\n");
                body.Append("ENCOURAGEMENT PHONE\r\n"); body.Append(r.encouragement_phone.Value); body.Append("\r\n\r\n");

                e.Body = body.ToString();
                e.send();

                r.Clear();
                r.id.Value = id;
                r.needs_encouragement.Value = 0;
                r.doCommand("update");
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            public_private_selected.ErrorMessage = Language.Current.REQUEST_PUBLIC_OR_PRIVATE;

            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT;
            LiftDomain.User U = LiftDomain.User.Current;
            encouragementRenderer = new EncouragementRenderer();

            int active = 1;

            if (IsPostBack)
            {
                string sessionCaptcha = Session["captchaValue"].ToString();
                string pageCaptcha    = txtCaptcha.Text.ToString().Trim().ToUpper();

                if (txtCaptcha.Text.ToString().Trim().ToUpper() == Session["captchaValue"].ToString().Trim().ToUpper())
                {
                    //Response.Write("CAPTCHA verification succeeded");


                    LiftDomain.Request prayerRequest = new LiftDomain.Request();

                    prayerRequest.title.Value                      = request_title.Text;
                    prayerRequest.description.Value                = request_description.Text;
                    prayerRequest.from.Value                       = request_from.Text;
                    prayerRequest.requesttype_id.Value             = Convert.ToInt32(request_type.SelectedItem.Value);
                    prayerRequest.group_relationship_type_id.Value = Convert.ToInt32(request_group_relationship.SelectedItem.Value);
                    prayerRequest.encouragement_address.Value      = request_encouragement_address.Text;
                    prayerRequest.needs_encouragement.Value        = (request_encouragement_address.Text.Length > 1 ? 1 : 0);

                    prayerRequest.encouragement_phone.Value = request_encouragement_phone.Text;
                    prayerRequest.from_email.Value          = request_from_email.Text;

                    prayerRequest.listed.Value = (request_is_public.Checked ? 1 : 0);

                    prayerRequest.last_action.Value = LiftTime.CurrentTime;
                    prayerRequest.post_date.Value   = LiftTime.CurrentTime;
                    prayerRequest.updated_at.Value  = LiftTime.CurrentTime;

                    prayerRequest.is_approved.Value = Organization.Current.default_approval.Value;

                    prayerRequest.user_id.Value = U.id;

                    if ((id.Value == "0") || (id.Value == ""))
                    {
                        prayerRequest.created_at.Value     = LiftTime.CurrentTime;
                        prayerRequest.total_requests.Value = 0;
                        prayerRequest.total_comments.Value = 0;
                        prayerRequest.total_comments_needing_approval.Value = 0;
                        prayerRequest.total_private_comments.Value          = 0;
                        prayerRequest.active.Value = 1;
                    }
                    else
                    {
                        prayerRequest.id.Value = int.Parse(id.Value);
                        LiftDomain.Request savedRequest = new Request();
                        savedRequest.id.Value = prayerRequest.id.Value;
                        savedRequest          = savedRequest.doSingleObjectQuery <Request>("getobject");
                        active = savedRequest.active.Value;
                    }

                    long ident = prayerRequest.doCommand("save");



                    try
                    {
                        Email ackEmail = new Email();
                        ackEmail.subject = "Thank you for your prayer request";
                        ackEmail.Body    = "Your prayer request has been received.  If you have indicated that your request can be made public, it will appear on the prayer wall as soon as it is approved.";
                        ackEmail.addTo(prayerRequest.from_email.Value);
                        ackEmail.from = Organization.Current.getFromEmail();
                        ackEmail.send();
                    }
                    catch   // ignore any errors
                    { }
                }

                /*
                 * else
                 * {
                 *  // else captcha failed...
                 * }
                 */

                Response.Redirect("Requests.aspx?active=" + active.ToString());
            }
            else
            {
                LiftDomain.Request prayerRequest = new LiftDomain.Request();
                string             idStr         = Request["id"];

                int reqId = 0;
                try
                {
                    if (idStr != null)
                    {
                        if (idStr.Length > 0)
                        {
                            reqId = int.Parse(idStr);
                        }
                    }
                }
                catch
                {
                }

                if (reqId > 0)
                {
                    try
                    {
                        prayerRequest["id"] = reqId;
                        id.Value            = idStr;
                        prayerRequest       = prayerRequest.doSingleObjectQuery <LiftDomain.Request>("getobject");
                        if (!U.canEditRequest(prayerRequest.user_id.Value))
                        {
                            Response.Redirect("Requests.aspx");
                        }

                        request_title.Text                 = prayerRequest.title;
                        request_description.Text           = prayerRequest.description;
                        request_from.Text                  = prayerRequest.from;
                        initialRequestType                 = prayerRequest.requesttype_id;
                        initialGroupType                   = prayerRequest.group_relationship_type_id;
                        request_encouragement_address.Text = prayerRequest.encouragement_address;
                        request_encouragement_phone.Text   = prayerRequest.encouragement_phone;
                        request_from_email.Text            = prayerRequest.from_email;

                        if (prayerRequest.listed == 1)
                        {
                            request_is_private.Checked = false;
                            request_is_public.Checked  = true;
                        }
                        else
                        {
                            request_is_private.Checked = true;
                            request_is_public.Checked  = false;
                        }

                        initUserInfo(prayerRequest.user_id);

                        LiftDomain.Encouragement enc = new LiftDomain.Encouragement();
                        enc.request_id.Value      = reqId;
                        enc["listed_threshold"]   = (U.canApproveRequests ? 0 : 1);
                        enc["approval_threshold"] = (U.canApproveRequests ? 0 : 1);

                        DataSet encDs = enc.doQuery("get_updates");
                        encouragementRenderer.DataSource = encDs;
                        encouragementRenderer.Filename   = "_updateRequest2.htm";
                    }
                    catch (Exception x)
                    {
                        Logger.log(prayerRequest, x, "Error retrieving prayer request.");
                    }
                }
                else
                {
                    initUserInfo(-1);
                }
            }

            initRequestTypes(initialRequestType);
            initGroupRelTypes(1);

            //initTimeZoneList();
            request_title.Focus();
        }