示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            idStr = Request["id"];
            if (!String.IsNullOrEmpty(idStr))
            {
                try
                {
                    int id = int.Parse(idStr);
                    LiftDomain.Request pr = new LiftDomain.Request();

                    actionStr = Request["action"];
                    if (!String.IsNullOrEmpty(actionStr))
                    {
                        action = actionStr;
                    }

                    pr["id"] = id;
                    pr.doCommand(action);

                    Response.ContentType = "text/javascript";
                }
                catch (Exception x)
                {
                    Logger.log(idStr, x, "Error deleting request");
                }
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            Organization org = Organization.Current;

            if (org != null)
            {
                customImagePath  = "/custom/";
                customImagePath += org.subdomain;
                customImagePath += "/images";
            }

            PageAuthorized.check(Request, Response);


            if (LiftDomain.User.Current.IsInRole("System Admin"))
            {
                manage_organizations_action_page = "OrganizationList.aspx";
            }
            else if (LiftDomain.User.Current.IsInRole("Organization Admin"))
            {
                manage_organizations_action_page = "EditOrganization.aspx?id=" + Convert.ToString(Organization.Current.id);
            }
            else
            {
                manage_organizations_action_page = "Admin.aspx";
            }
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            DataSet apptSet = new DataSet();
            Appt    a       = new Appt();

            int initialWall = 1;

            if (IsPostBack)
            {
                initialWall = Convert.ToInt32(wallList.SelectedValue);
            }
            else
            {
                if (!string.IsNullOrEmpty(Request["initial"]))
                {
                    initialWall = Convert.ToInt32(Request["initial"]);
                }
            }

            initWalls(initialWall);
            a["wall_id"]         = initialWall;
            a["organization_id"] = Organization.Current.id.Value;
            a["tzoffset"]        = LiftTime.UserTzOffset;

            apptSet = a.doQuery("get_wall_subscribers");

            wallManageRenderer = new WallManageRenderer(apptSet);
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string fileNameToDelete = string.Empty;

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

            PageAuthorized.check(Request, Response);

            fileNameToDelete = Server.UrlDecode(Request["filename"]);

            if (!String.IsNullOrEmpty(fileNameToDelete) && File.Exists(fileNameToDelete))
            {
                try
                {
                    File.Delete(fileNameToDelete);

                    Response.Redirect(Request["redirect_to_page"]);

                    //Response.ContentType = "text/javascript";
                }
                catch (Exception x)
                {
                    Logger.log(fileNameToDelete, x, "Error deleting organization image");
                }
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            idStr = Request["id"];
            if (!String.IsNullOrEmpty(idStr))
            {
                try
                {
                    int             id       = int.Parse(idStr);
                    LiftDomain.User thisUser = new LiftDomain.User();
                    thisUser.id.Value = id;
                    thisUser.doCommand("delete");

                    LiftDomain.RolesUser thisRolesUser = new LiftDomain.RolesUser();
                    thisRolesUser.user_id.Value = thisUser.id.Value;
                    thisRolesUser.doQuery("delete_roles_users_by_user_id");

                    Response.Redirect(Request["redirect_to_page"]);

                    //Response.ContentType = "text/javascript";
                }
                catch (Exception x)
                {
                    Logger.log(idStr, x, "Error deleting user");
                }
            }
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);
            Organization.setCurrent();

            try
            {
                string idStr        = Request["id"];
                string userStateStr = Request["value"];

                int userState = Convert.ToInt32(userStateStr);

                LiftDomain.User u = new LiftDomain.User();
                u.id.Value    = Convert.ToInt32(idStr);
                u.state.Value = userState;

                userStatus = LiftDomain.User.getUserStatusDescription(userState);

                /* TODO - need a new method to change user status */
                u.doCommand("update_status");
            }
            catch
            {
            }
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            LiftDomain.Wall w = new LiftDomain.Wall();
            w.id.Value = Convert.ToInt32(Request["id"]);
            w.doCommand("remove");

            Response.Redirect("WallList.aspx");
        }
示例#8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            LiftDomain.Wall w = new LiftDomain.Wall();

            w.user_id.Value = Convert.ToInt32(Request["user_id"]);
            w.id.Value      = Convert.ToInt32(Request["wall_id"]);

            w.doCommand("update");
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            User u = new User();

            string q = Request["q"];

            u["q"] = q;

            DataSet userSet = u.doQuery("get_users_like");

            userRenderer = new PartialRenderer(HttpContext.Current, userSet, "_WallLeaderAutoComplete.htm", null);
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            string idStr = Request["id"];

            valueStr = Request["value"];

            Encouragement enc = new Encouragement();

            enc.id.Value   = Convert.ToInt32(idStr);
            enc.note.Value = valueStr;

            enc.doCommand("update");
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            string idStr = Request["id"];

            valueStr = Request["value"];

            LiftDomain.Wall w = new LiftDomain.Wall();

            w.id.Value    = Convert.ToInt32(idStr);
            w.title.Value = valueStr;

            w.doCommand("update");
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            string idStr = Request["id"];

            valueStr = Request["value"];

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

            pr.id.Value          = Convert.ToInt32(idStr);
            pr.description.Value = valueStr;

            pr.doCommand("update");
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            isApprovedStr = Request["ap"];

            if (isApprovedStr == "1")
            {
                PageAuthorized.check(Request, Response);
            }

            idStr = Request["id"];


            if (idStr != null)
            {
                try
                {
                    int id = int.Parse(idStr);
                    LiftDomain.Request pr = new LiftDomain.Request();
                    pr.id.Value          = id;
                    pr.is_approved.Value = (isApprovedStr == "1" ? 1 : 0);
                    pr.last_action.Value = LiftDomain.LiftTime.CurrentTime;
                    pr.updated_at.Value  = LiftDomain.LiftTime.CurrentTime;

                    pr.doCommand("approve");

                    LiftDomain.Encouragement enc = new LiftDomain.Encouragement();
                    enc.request_id.Value  = id;
                    enc.is_approved.Value = (isApprovedStr == "1" ? 1 : 0);
                    enc.approved_at.Value = LiftDomain.LiftTime.CurrentTime;
                    enc.doCommand("approve_all");

                    pr.notify(id);

                    Response.ContentType = "text/javascript";
                }
                catch (Exception x)
                {
                    Logger.log(idStr, x, "Error approving request");
                }
            }
        }
示例#14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            addBtn.Text = "Add new Wall";

            if (IsPostBack)
            {
                LiftDomain.Wall newWall = new LiftDomain.Wall();
                newWall.title.Value   = wall_title.Text;
                newWall.user_id.Value = LiftDomain.Organization.Current.user_id.Value;
                newWall.doCommand("insert");
            }

            wall_title.Text = "";
            LiftDomain.Wall w       = new LiftDomain.Wall();
            DataSet         wallSet = w.doQuery("get_walls");

            wallListRenderer = new PartialRenderer(HttpContext.Current, wallSet, "_WallList.htm", new PartialRenderer.RenderHelper(render_helper));
        }
示例#15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }


            PageAuthorized.check(Request, Response);

            Subscription s = new Subscription();

            idStr = Request["id"];
            s.request_id.Value = Convert.ToInt32(idStr);
            s.user_id.Value    = LiftDomain.User.Current.id.Value;

            s.doCommand("unsubscribe");

            Response.ContentType = "text/javascript";
        }
示例#16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            Appt a = new Appt();

            string q = Request["q"];

            a["q"]               = q;
            a["tzoffset"]        = LiftDomain.LiftTime.UserTzOffset;
            a["organization_id"] = Organization.Current.id.Value;
            DataSet userSet = a.doQuery("get_users_like");

            Response.ContentType = "text/plain";

            userRenderer = new WallManageAutoCompleteRenderer(userSet);

            string cell = Request["cell"];

            string[] parts = cell.Split(new char[] { '_' });
            userRenderer.wallId = parts[0];
            userRenderer.dow    = parts[1];
            userRenderer.tod    = parts[2];
        }
示例#17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageAuthorized.check(Request, Response);

            idStr = Request["id"];
            if (!String.IsNullOrEmpty(idStr))
            {
                try
                {
                    int id = int.Parse(idStr);
                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();
                    thisOrganization.id.Value = id;
                    thisOrganization.doCommand("delete");

                    Response.Redirect(Request["redirect_to_page"]);

                    //Response.ContentType = "text/javascript";
                }
                catch (Exception x)
                {
                    Logger.log(idStr, x, "Error deleting organization");
                }
            }
        }
示例#18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            Organization org = Organization.Current;

            if (org != null)
            {
                customPath  = "/custom/";
                customPath += org.subdomain;
            }

            try
            {
                string    search = string.Empty;
                UserState state  = UserState.unknown;

                searchBtn.Text = LiftDomain.Language.Current.SHARED_SEARCH;

                LiftDomain.User thisUserList = new LiftDomain.User();

                if (IsPostBack)
                {
                    search = liveSearchBox.Text;
                    state  = (UserState)Convert.ToInt32(user_status_list.SelectedValue);
                    if (search.Length == 0)
                    {
                        search = "%";
                    }
                }
                else
                {
                    if (Session["last_user_list_search"] != null)
                    {
                        search = Session["last_user_list_search"].ToString();
                    }
                    else
                    {
                        search = string.Empty;
                    }

                    if (Session["last_user_list_state"] != null)
                    {
                        state = (UserState)Convert.ToInt32(Session["last_user_list_state"]);
                    }
                    else
                    {
                        state = UserState.unknown;
                    }
                }

                initUserStatusList(state);

                //-------------------------------------------------------------------------
                //-- !!!KLUDGE ALERT:  if first time on this page -or- search string is blank,
                //-- !!!KLUDGE ALERT:  then use a dummy search value which will return no records
                //-------------------------------------------------------------------------
                if (String.IsNullOrEmpty(search))
                {
                    search = "%";
                }



                Session["last_user_list_search"] = search;
                Session["last_user_list_state"]  = (int)state;

                string searchAction = "SearchUsersByFirstOrLast";

                thisUserList["search"] = search;
                thisUserList["state"]  = (int)state;

                if (LiftDomain.User.Current.IsInRole(Role.SYS_ADMIN))
                {
                    thisUserList.OverrideAutoOrgAssignment = true;
                    searchAction = "SearchUsersByFirstOrLastSysAdmin";
                }

                userListSet = thisUserList.doQuery(searchAction);

                if (userListSet.Tables[0].Rows.Count > 0)
                {
                    userListSearchResultsLabel.Visible = false;
                    userListTablePanel.Visible         = true;
                    userListRenderer = // new PartialRenderer(HttpContext.Current, userListSet, "_UserList.htm", newPartialRenderer.RenderHelper(thisUserList.user_list_helper));
                                       userListRenderer = new UserRenderer(userListSet);
                }
                else
                {
                    if (IsPostBack)
                    {
                        userListSearchResultsLabel.Text = LiftDomain.Language.Current.USER_LIST_NO_MATCHING_RECORDS + ".";
                    }
                    else
                    {
                        userListSearchResultsLabel.Text = LiftDomain.Language.Current.USER_LIST_ENTER_VALUE_TO_MATCH + ".";
                    }
                    userListSearchResultsLabel.Visible = true;

                    userListTablePanel.Visible = false;
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN UserList.aspx.cs::Page_Load(): " + m);
                Logger.log("UserList.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN UserList.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language setting for the SUBMIT button here
                //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT.Value;

                if (!IsPostBack)
                {
                    string idStr = Request["id"];

                    if (String.IsNullOrEmpty(idStr))
                    {
                        //TODO: ??? HOW DO WE NOTIFY THE USER
                        Logger.log(Logger.Level.ERROR, this, "Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                        throw new ApplicationException("Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                    }
                    else
                    {
                        id.Value = idStr;
                    }

                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();
                    thisOrganization.id.Value = Convert.ToInt32(id.Value);

                    //-------------------------------------------------------------------------
                    //-- query database for data for this organization
                    //-------------------------------------------------------------------------
                    thisOrganization     = thisOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");
                    title_label.Text     = LiftDomain.Language.Current.ORGANIZATION_EDITING_ORGANIZATION.Value + " " + thisOrganization.title;
                    this.subdomain.Value = thisOrganization.subdomain;

                    string serverFileLocation = Server.MapPath("/custom/" + this.subdomain.Value + "/stylesheets/lift_custom.css");

                    if (File.Exists(serverFileLocation))
                    {
                        StreamReader sr;
                        sr = File.OpenText(serverFileLocation);
                        this.lift_custom_css.Text = sr.ReadToEnd();
                        sr.Close();
                    }
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationAppearance.aspx.cs::Page_Load(): " + m);
                Logger.log("EditOrganizationAppearance.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationAppearance.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
示例#20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            string initialTimeZone        = "Central Standard Time";
            int    initialLanguageId      = 1; //-- 1 = English
            int    initialStatusId        = 0; //-- 0 = Unapproved; 1 = Approved
            string saltValue              = string.Empty;
            bool   sendOrgIsApprovedEmail = false;

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language setting for the SUBMIT button here
                //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT.Value;

                //-------------------------------------------------------------------------
                //-- do other language settings
                //-------------------------------------------------------------------------
                edit_organization_fieldset_legend = LiftDomain.Language.Current.ORGANIZATION_EDIT_ORGANIZATION.Value;

                LiftDomain.Organization thisOrganization = new LiftDomain.Organization();

                if (IsPostBack)
                {
                    //-------------------------------------------------------------------------
                    //-- get the object ID from the hidden id field on the page;
                    //-- if there is a object ID value, then we are editing an EXISTING object
                    //-------------------------------------------------------------------------
                    if (!String.IsNullOrEmpty(id.Value) && (id.Value != "0"))
                    {
                        thisOrganization.id.Value = int.Parse(id.Value);
                    }
                    else
                    {
                        //-------------------------------------------------------------------------
                        //-- if the object ID is blank or zero (0), then set some NEW object values (NOT id)
                        //-------------------------------------------------------------------------
                        thisOrganization.created_at.Value = LiftTime.CurrentTime;
                    }

                    //-------------------------------------------------------------------------
                    //-- transfer screen values to the object
                    //-------------------------------------------------------------------------
                    //TODO: ???what if data field validation fails??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???what if org title already exists??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???what if org subdomain already exists??? // TO BE DONE IN JAVASCRIPT
                    thisOrganization.title.Value          = organization_title.Text;
                    thisOrganization.user_id.Value        = 0; // LiftDomain.User.Current.id.Value;
                    thisOrganization.address.Value        = organization_address.Text;
                    thisOrganization.city.Value           = organization_city.Text;
                    thisOrganization.state_province.Value = organization_state.Text;
                    thisOrganization.postal_code.Value    = organization_postal_code.Text;
                    thisOrganization.phone.Value          = organization_phone.Text;
                    thisOrganization.subdomain.Value      = organization_subdomain.Text;
                    thisOrganization.time_zone.Value      = timezone_list.SelectedItem.Value;
                    thisOrganization.language_id.Value    = Convert.ToInt32(language_list.SelectedItem.Value);
                    thisOrganization.footer.Value         = organization_footer.Text;

                    thisOrganization.default_approval.Value = (default_approved.Checked ? 1 : 0);

                    thisOrganization.default_signup_mode.Value = (new_users_require_approval.Checked ? 1 : 0);


                    //-------------------------------------------------------------------------
                    //-- if the status changes from "Unapproved" to "Approved,"
                    //-- then we want to notify the organization's webmaster
                    //-------------------------------------------------------------------------
                    if (thisOrganization.id.Value != 0)
                    {
                        LiftDomain.Organization tempOrganization = new LiftDomain.Organization();
                        tempOrganization.id.Value = thisOrganization.id.Value;
                        tempOrganization          = tempOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");

                        if ((tempOrganization.status == 0) && (Convert.ToInt32(language_list.SelectedItem.Value) == 1))
                        {
                            sendOrgIsApprovedEmail = true;
                        }
                    }
                    thisOrganization.status.Value = Convert.ToInt32(organization_status_list.SelectedItem.Value);

                    //-------------------------------------------------------------------------
                    //-- persist the object data to the database
                    //-------------------------------------------------------------------------
                    thisOrganization.id.Value = Convert.ToInt32(thisOrganization.doCommand("save"));

                    //id.Value = thisOrganization.id.Value.ToString();

                    //-------------------------------------------------------------------------
                    //-- send the approval email to the organization's webmaster
                    //-------------------------------------------------------------------------
                    if (sendOrgIsApprovedEmail)
                    {
                        LiftCommon.Email    emailHelper  = new LiftCommon.Email();
                        LiftDomain.OrgEmail thisOrgEmail = new LiftDomain.OrgEmail();
                        thisOrgEmail.organization_id.Value = thisOrganization.id.Value;
                        thisOrgEmail = thisOrgEmail.doSingleObjectQuery <LiftDomain.OrgEmail>("select");

                        //email.replyTo = thisOrgEmail.emailReplyTo;  // not supported yet

                        emailHelper.from = "*****@*****.**";

                        //TODO: ??? THIS NEEDS TO BE A VALID E-MAIL ADDRESS
                        if (LiftCommon.Email.IsValidEmailAddress(thisOrgEmail.webmaster_email_to.Value))
                        {
                            emailHelper.addTo(thisOrgEmail.webmaster_email_to.Value);
                        }
                        else
                        {
                            //TODO: ??? HOW DO WE NOTIFY THE USER
                            Logger.log(Logger.Level.ERROR, this, "E-mail address '" + thisOrgEmail.webmaster_email_to.Value + "' is not in a correct format [SignupOrganization.aspx].");
                            throw new ApplicationException("E-mail address '" + thisOrgEmail.webmaster_email_to.Value + "' is not in a correct format [SignupOrganization.aspx].");
                        }

                        emailHelper.subject = LiftDomain.Language.Current.SIGNUP_ORGANIZATION_APPROVAL_RESPONSE_SUBJECT.Value;
                        emailHelper.Body    = LiftDomain.Language.Current.SIGNUP_ORGANIZATION_APPROVAL_RESPONSE_MESSAGE.Value + "  " + thisOrganization.title.Value;

                        //email.MIME = MIME.Text | MIME.HTML;  // just supposing that it supports multiple formats. May not be necessary

                        emailHelper.send();
                    }

                    if (LiftDomain.User.Current.isSysAdmin)
                    {
                        //-------------------------------------------------------------------------
                        //-- return to the Organization List page
                        //-------------------------------------------------------------------------
                        if (Session["last_org_list_search"] != null)
                        {
                            Response.Redirect("OrganizationList.aspx?" + Session["last_org_list_search"]);
                        }
                        else
                        {
                            Response.Redirect("OrganizationList.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("Admin.aspx");
                    }
                }
                else
                {
                    //-------------------------------------------------------------------------
                    //-- first time on this page, so get the organization ID from the ASP Request cache
                    //-------------------------------------------------------------------------
                    string idStr = Request["id"];

                    if (String.IsNullOrEmpty(idStr))
                    {
                        id.Value = "0";
                    }
                    else
                    {
                        id.Value = idStr;
                    }

                    thisOrganization.id.Value = Convert.ToInt32(id.Value);

                    //-------------------------------------------------------------------------
                    //-- if this is a NEW organization...
                    //-------------------------------------------------------------------------
                    if (id.Value == "0")
                    {
                        //-------------------------------------------------------------------------
                        //-- set default values
                        //-------------------------------------------------------------------------
                        initialTimeZone   = LiftDomain.Organization.Current.time_zone.Value;
                        initialLanguageId = LiftDomain.Organization.Current.language_id.Value;
                        initialStatusId   = 0; //-- 0 = Unapproved; 1 = Approved

                        title_label.Visible = false;
                        edit_organization_fieldset_legend = LiftDomain.Language.Current.ORGANIZATION_CREATE_A_NEW_ORGANIZATION.Value;

                        delete_organization_id        = string.Empty;
                        redirect_after_delete_to_page = string.Empty;
                    }

                    //-------------------------------------------------------------------------
                    //-- else, if this is an EXISTING organization...
                    //-------------------------------------------------------------------------
                    else
                    {
                        //-------------------------------------------------------------------------
                        //-- query database for data for this organization
                        //-------------------------------------------------------------------------
                        thisOrganization = thisOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");

                        initialTimeZone   = thisOrganization.time_zone;
                        initialLanguageId = thisOrganization.language_id;
                        initialStatusId   = thisOrganization.status;

                        title_label.Text = LiftDomain.Language.Current.ORGANIZATION_EDITING_ORGANIZATION.Value + " " + thisOrganization.title;
                        edit_organization_fieldset_legend = LiftDomain.Language.Current.ORGANIZATION_EDIT_ORGANIZATION.Value;

                        delete_organization_id = id.Value;

                        if (Session["last_org_list_search"] != null)
                        {
                            redirect_after_delete_to_page = "OrganizationList.aspx?" + Session["last_org_list_search"];
                        }
                        else
                        {
                            redirect_after_delete_to_page = "OrganizationList.aspx";
                        }
                    }

                    //-------------------------------------------------------------------------
                    //-- populate the screen controls
                    //-------------------------------------------------------------------------
                    organization_title.Text       = thisOrganization.title;
                    organization_address.Text     = thisOrganization.address;
                    organization_city.Text        = thisOrganization.city;
                    organization_state.Text       = thisOrganization.state_province;
                    organization_postal_code.Text = thisOrganization.postal_code;
                    organization_phone.Text       = thisOrganization.phone;
                    organization_subdomain.Text   = thisOrganization.subdomain;
                    organization_footer.Text      = thisOrganization.footer;
                    if (thisOrganization.default_approval.Value == 1)
                    {
                        this.default_approved.Checked     = true;
                        this.default_not_approved.Checked = false;
                    }
                    else
                    {
                        this.default_approved.Checked     = false;
                        this.default_not_approved.Checked = true;
                    }

                    if (thisOrganization.default_signup_mode.Value == (int)UserSignupMode.user_create_account)
                    {
                        this.new_users_create_accounts.Checked  = true;
                        this.new_users_require_approval.Checked = false;
                    }
                    else
                    {
                        this.new_users_create_accounts.Checked  = false;
                        this.new_users_require_approval.Checked = true;
                    }

                    initTimeZoneList(initialTimeZone);
                    initLanguageList(initialLanguageId);
                    initOrganizationStatusList(initialStatusId);
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganization.aspx.cs::Page_Load(): " + m);
                Logger.log("EditOrganization.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganization.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
示例#21
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);

            L = LiftDomain.Language.Current;
            LiftDomain.User U = LiftDomain.User.Current;

            submitBtn.Text = L.SHARED_SUBMIT;

            string idStr = Request.Params["id"];

            if (idStr != null)
            {
                if (idStr.Length > 0)
                {
                    request_id.Value = idStr;
                }
            }


            int active = 1;

            LiftDomain.Request prayerRequest = new LiftDomain.Request();
            prayerRequest.id.Value = Convert.ToInt32(request_id.Value);

            // TODO - turn off links to updates and subscriptions here
            // prayerRequest["mode"] = "update_request";
            requestSet                = prayerRequest.doQuery("get_request");
            requestRenderer           = new RequestRenderer(requestSet);
            requestRenderer.ShowLinks = false;

            LiftDomain.Encouragement enc = new LiftDomain.Encouragement();
            enc.request_id.Value      = Convert.ToInt32(request_id.Value);
            enc["listed_threshold"]   = (U.canSeePrivateRequests ? 0 : 1);
            enc["approval_threshold"] = (U.canApproveRequests ? 0 : 1);
            encSet = enc.doQuery("get_updates");

            encRenderer = new EncouragementRenderer(encSet);

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

                    LiftDomain.Encouragement en = new LiftDomain.Encouragement();
                    en.note.Value = note.Text;
                    int t = Convert.ToInt32(encouragement_type.SelectedValue);
                    en.encouragement_type.Value = t;
                    en.from.Value       = from.Text;
                    en.from_email.Value = from_email.Text;

                    if (request_is_public.Checked)
                    {
                        en.listed.Value = 1;
                    }
                    else
                    {
                        en.listed.Value = 0;
                    }

                    en.is_approved.Value = 1;
                    en.created_at.Value  = LiftDomain.LiftTime.CurrentTime;
                    en.post_date.Value   = LiftDomain.LiftTime.CurrentTime;
                    en.updated_at.Value  = LiftDomain.LiftTime.CurrentTime;
                    en.user_id.Value     = LiftDomain.User.Current.id;
                    en.request_id.Value  = Convert.ToInt32(request_id.Value);

                    en.doCommand("save_encouragement");

                    LiftDomain.Request savedRequest = new Request();
                    savedRequest.id.Value = en.request_id.Value;
                    savedRequest          = savedRequest.doSingleObjectQuery <Request>("getobject");
                    active = savedRequest.active.Value;

                    Response.Redirect("Requests.aspx?active=" + active.ToString());
                }
                else
                {
                    errMsg.Text = LiftDomain.Language.Current.REQUEST_UPDATE_NOT_SUCCESSFUL;
                }
            }
            else
            {
                initEncTypes(0);

                from.Text       = LiftDomain.User.Current.FullName;
                from_email.Text = LiftDomain.User.Current.email;
            }

            note.Focus();
        }
示例#22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            Organization org = Organization.Current;

            if (org != null)
            {
                customImagePath  = "/custom/";
                customImagePath += org.subdomain;
                customImagePath += "/images";
            }

            string search = string.Empty;

            searchBtn.Text = LiftDomain.Language.Current.SHARED_SEARCH;

            LiftDomain.Organization thisOrganizationList = new LiftDomain.Organization();

            if (IsPostBack)
            {
                search = liveSearchBox.Text;
            }
            else
            {
                if (Session["last_organization_list_search"] != null)
                {
                    search = Session["last_organization_list_search"].ToString();
                }
                else
                {
                    search = string.Empty;
                }
            }

            //-------------------------------------------------------------------------
            //-- !!!KLUDGE ALERT:  if first time on this page -or- search string is blank,
            //-- !!!KLUDGE ALERT:  then use a dummy search value which will return no records
            //-------------------------------------------------------------------------
            if (String.IsNullOrEmpty(search))
            {
                search = "!l0v3TURTL3S";
            }

            Session["last_organization_list_search"] = search;

            thisOrganizationList["search"] = search;
            organizationListSet            = thisOrganizationList.doQuery("SearchOrganizationsByTitleOrSubdomain");

            if (organizationListSet.Tables[0].Rows.Count > 0)
            {
                organizationListSearchResultsLabel.Visible = false;
                organizationListTablePanel.Visible         = true;
                organizationListRenderer = new PartialRenderer(HttpContext.Current, organizationListSet, "_OrganizationList.htm", new PartialRenderer.RenderHelper(thisOrganizationList.organization_list_helper));
            }
            else
            {
                if (IsPostBack)
                {
                    organizationListSearchResultsLabel.Text = LiftDomain.Language.Current.ORGANIZATION_LIST_NO_MATCHING_RECORDS + ".";
                }
                else
                {
                    organizationListSearchResultsLabel.Text = LiftDomain.Language.Current.ORGANIZATION_LIST_ENTER_VALUE_TO_MATCH + ".";
                }
                organizationListSearchResultsLabel.Visible = true;

                organizationListTablePanel.Visible = false;
            }
        }
示例#23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PasswordRequired.Enabled       = false;
            EmailValidator.ErrorMessage    = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;
            PasswordValidator.ErrorMessage = LiftDomain.Language.Current.SHARED_PASSWORDS_DO_NOT_MATCH;

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

            PageAuthorized.check(Request, Response);

            int    initialUserStatus = 1; //-- 1 = unconfirmed
            string initialTimeZone   = "Central Standard Time";
            int    initialLanguageId = 1; //-- 1 = English
            int    initialOrgId      = 0;
            string saltValue         = string.Empty;

            LiftDomain.RolesUser thisRolesUser;

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language setting for the SUBMIT button here
                //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT.Value;

                //-------------------------------------------------------------------------
                //-- do other language settings
                //-------------------------------------------------------------------------
                edit_user_fieldset_legend = LiftDomain.Language.Current.USER_EDIT_USER.Value;
                //this.user_roles_2.Text = LiftDomain.Language.Current.ROLES_ADMIN.Value;
                this.user_roles_7.Text  = LiftDomain.Language.Current.ROLES_MODERATOR.Value;
                this.user_roles_8.Text  = LiftDomain.Language.Current.ROLES_WALL_LEADER.Value;
                this.user_roles_10.Text = LiftDomain.Language.Current.ROLES_WATCHMAN.Value;
                this.user_roles_13.Text = LiftDomain.Language.Current.ROLES_SYSTEM_ADMIN.Value;
                this.user_roles_14.Text = LiftDomain.Language.Current.ROLES_ORGANIZATION_ADMIN.Value;
                //this.user_roles_11.Text = LiftDomain.Language.Current.ROLES_TESTADMIN.Value;
                //this.user_roles_12.Text = LiftDomain.Language.Current.ROLES_ADMINTEST.Value;

                LiftDomain.User thisUser = new LiftDomain.User();

                if (IsPostBack)
                {
                    //-------------------------------------------------------------------------
                    //-- get the object ID from the hidden id field on the page;
                    //-- if there is a object ID value, then we are editing an EXISTING object
                    //-------------------------------------------------------------------------
                    if (!String.IsNullOrEmpty(id.Value) && (id.Value != "0"))
                    {
                        thisUser.id.Value = int.Parse(id.Value);

                        if (!String.IsNullOrEmpty(password.Text.Trim()))
                        {
                            //TODO: ???what if passwords do not match??? // TO BE DONE IN JAVASCRIPT
                            //(user_password.Text != password_confirmation.Text)

                            thisUser.password_hash_type.Value = "md5";
                            saltValue = LiftDomain.User.generateRandomSalt();
                            thisUser.password_salt.Value = saltValue;

                            thisUser.crypted_password.Value           = LiftDomain.User.hash(password.Text, saltValue);
                            thisUser.last_password_changed_date.Value = LiftTime.CurrentTime;
                        }
                    }
                    else
                    {
                        //-------------------------------------------------------------------------
                        //-- if the object ID is blank or zero (0), then set some NEW object values (NOT id)
                        //-------------------------------------------------------------------------
                        thisUser.created_at.Value          = LiftTime.CurrentTime;
                        thisUser.last_logged_in_at.Value   = new DateTime(2000, 1, 1, 0, 0, 0); //-- DateTime.MinValue;
                        thisUser.login_failure_count.Value = 0;
                        //thisUser.total_comments.Value = 0;
                        //thisUser.total_comments_needing_approval.Value = 0;
                        //thisUser.total_private_comments.Value = 0;

                        //TODO: ???what if password is blank??? // TO BE DONE IN JAVASCRIPT
                        if (String.IsNullOrEmpty(password.Text.Trim()))
                        {
                        }
                        else
                        {
                            //TODO: ???what if passwords do not match??? // TO BE DONE IN JAVASCRIPT
                            //(user_password.Text != password_confirmation.Text)

                            thisUser.password_hash_type.Value = "md5";
                            saltValue = LiftDomain.User.generateRandomSalt();
                            thisUser.password_salt.Value = saltValue;

                            thisUser.crypted_password.Value           = LiftDomain.User.hash(password.Text, saltValue);
                            thisUser.last_password_changed_date.Value = LiftTime.CurrentTime;
                        }
                    }

                    //-------------------------------------------------------------------------
                    //-- transfer screen values to the object
                    //-------------------------------------------------------------------------
                    //TODO: ???what if data field validation fails??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???what if user login already exists??? // TO BE DONE IN JAVASCRIPT
                    thisUser.login.Value = user_login.Text;
                    thisUser.email.Value = user_email.Text;

                    thisUser.first_name.Value     = user_first_name.Text;
                    thisUser.last_name.Value      = user_last_name.Text;
                    thisUser.address.Value        = user_address.Text;
                    thisUser.city.Value           = user_city.Text;
                    thisUser.state_province.Value = user_state.Text;
                    thisUser.postal_code.Value    = user_postal_code.Text;
                    thisUser.phone.Value          = user_phone.Text;

                    thisUser.state.Value           = Convert.ToInt32(user_status_list.SelectedItem.Value);
                    thisUser.time_zone.Value       = timezone_list.SelectedItem.Value;
                    thisUser.language_id.Value     = Convert.ToInt32(language_list.SelectedItem.Value);
                    thisUser.organization_id.Value = Convert.ToInt32(org_list.SelectedItem.Value);

                    thisUser.previous_increment_id.Value = 0;
                    thisUser.updated_at.Value            = LiftTime.CurrentTime;

                    //thisUser.isapproved.Value = true; //TODO: ???need to fix when moderator user available

                    //-------------------------------------------------------------------------
                    //-- persist the object data to the database
                    //-------------------------------------------------------------------------
                    thisUser.OverrideAutoOrgAssignment = true;
                    thisUser.id.Value = Convert.ToInt32(thisUser.doCommand("save"));

                    //id.Value = thisUser.id.Value.ToString();

                    //-------------------------------------------------------------------------
                    //-- persist the RolesUser object data to the database
                    //-- first, delete all for this user...then insert in the selected roles
                    //-------------------------------------------------------------------------
                    thisRolesUser = new LiftDomain.RolesUser();
                    thisRolesUser.user_id.Value = thisUser.id.Value;
                    thisRolesUser.doQuery("delete_roles_users_by_user_id");

                    /*
                     * if (user_roles_2.Checked)
                     * {
                     *  thisRolesUser = new LiftDomain.RolesUser();
                     *  thisRolesUser.user_id.Value = thisUser.id.Value;
                     *  thisRolesUser.role_id.Value = 2;
                     *  thisRolesUser.created_at.Value = LiftTime.CurrentTime;
                     *  thisRolesUser.doCommand("save");
                     * }
                     */


                    if (user_roles_7.Checked)
                    {
                        thisRolesUser = new LiftDomain.RolesUser();
                        thisRolesUser.user_id.Value    = thisUser.id.Value;
                        thisRolesUser.role_id.Value    = 7;
                        thisRolesUser.created_at.Value = LiftTime.CurrentTime;
                        thisRolesUser.doCommand("save");
                    }

                    if (user_roles_8.Checked)
                    {
                        thisRolesUser = new LiftDomain.RolesUser();
                        thisRolesUser.user_id.Value    = thisUser.id.Value;
                        thisRolesUser.role_id.Value    = 8;
                        thisRolesUser.created_at.Value = LiftTime.CurrentTime;
                        thisRolesUser.doCommand("save");
                    }

                    if (user_roles_10.Checked)
                    {
                        thisRolesUser = new LiftDomain.RolesUser();
                        thisRolesUser.user_id.Value    = thisUser.id.Value;
                        thisRolesUser.role_id.Value    = 10;
                        thisRolesUser.created_at.Value = LiftTime.CurrentTime;
                        thisRolesUser.doCommand("save");
                    }

                    if (user_roles_13.Checked)
                    {
                        thisRolesUser = new LiftDomain.RolesUser();
                        thisRolesUser.user_id.Value    = thisUser.id.Value;
                        thisRolesUser.role_id.Value    = 13;
                        thisRolesUser.created_at.Value = LiftTime.CurrentTime;
                        thisRolesUser.doCommand("save");
                    }

                    if (user_roles_14.Checked)
                    {
                        thisRolesUser = new LiftDomain.RolesUser();
                        thisRolesUser.user_id.Value    = thisUser.id.Value;
                        thisRolesUser.role_id.Value    = 14;
                        thisRolesUser.created_at.Value = LiftTime.CurrentTime;
                        thisRolesUser.doCommand("save");
                    }

                    //if (user_roles_11.Checked)
                    //{
                    //    thisRolesUser = new LiftDomain.RolesUser();
                    //    thisRolesUser.user_id.Value = thisUser.id.Value;
                    //    thisRolesUser.role_id.Value = 11;
                    //    thisRolesUser.created_at.Value = LiftTime.CurrentTime;
                    //    thisRolesUser.doCommand("save");
                    //}

                    //if (user_roles_12.Checked)
                    //{
                    //    thisRolesUser = new LiftDomain.RolesUser();
                    //    thisRolesUser.user_id.Value = thisUser.id.Value;
                    //    thisRolesUser.role_id.Value = 12;
                    //    thisRolesUser.created_at.Value = LiftTime.CurrentTime;
                    //    thisRolesUser.doCommand("save");
                    //}

                    //-------------------------------------------------------------------------
                    //-- return to the User List page
                    //-------------------------------------------------------------------------
                    if (Session["last_user_list_search"] != null)
                    {
                        Response.Redirect("UserList.aspx?" + Session["last_user_list_search"]);
                    }
                    else
                    {
                        Response.Redirect("UserList.aspx");
                    }
                }
                else
                {
                    //-------------------------------------------------------------------------
                    //-- first time on this page, so get the object ID from the ASP Request cache
                    //-------------------------------------------------------------------------
                    string idStr = Request["id"];

                    if (String.IsNullOrEmpty(idStr))
                    {
                        id.Value = "0";
                    }
                    else
                    {
                        id.Value = idStr;
                    }

                    thisUser.id.Value = Convert.ToInt32(id.Value);

                    //-------------------------------------------------------------------------
                    //-- if this is a NEW user...
                    //-------------------------------------------------------------------------
                    if (id.Value == "0")
                    {
                        //-------------------------------------------------------------------------
                        //-- set default values
                        //-------------------------------------------------------------------------
                        initialUserStatus = 1;  //-- 1 = unconfirmed
                        initialTimeZone   = LiftDomain.Organization.Current.time_zone.Value;
                        initialLanguageId = LiftDomain.Organization.Current.language_id.Value;
                        initialOrgId      = LiftDomain.Organization.Current.id.Value;

                        login_label.Visible       = false;
                        edit_user_fieldset_legend = LiftDomain.Language.Current.USER_CREATE_A_NEW_USER.Value;

                        bottomNavTableCellDelete.Visible = false;
                        delete_user_id = string.Empty;
                        redirect_after_delete_to_page = string.Empty;
                        PasswordRequired.Enabled      = true;
                    }

                    //-------------------------------------------------------------------------
                    //-- else, if this is an EXISTING user...
                    //-------------------------------------------------------------------------
                    else
                    {
                        //-------------------------------------------------------------------------
                        //-- query database for data for this user
                        //-------------------------------------------------------------------------

                        if (LiftDomain.User.Current.IsInRole(Role.SYS_ADMIN))
                        {
                            thisUser.OverrideAutoOrgAssignment = true;
                        }

                        thisUser = thisUser.doSingleObjectQuery <LiftDomain.User>("select");

                        initialUserStatus = thisUser.state;
                        initialTimeZone   = thisUser.time_zone;
                        initialLanguageId = thisUser.language_id;
                        initialOrgId      = thisUser.organization_id;

                        login_label.Text          = LiftDomain.Language.Current.USER_EDITING_USER.Value + " " + thisUser.login;
                        edit_user_fieldset_legend = LiftDomain.Language.Current.USER_EDIT_USER.Value;

                        bottomNavTableCellDelete.Visible = true;
                        delete_user_id = id.Value;

                        if (Session["last_user_list_search"] != null)
                        {
                            redirect_after_delete_to_page = "UserList.aspx?" + Session["last_user_list_search"];
                        }
                        else
                        {
                            redirect_after_delete_to_page = "UserList.aspx";
                        }
                    }

                    //-------------------------------------------------------------------------
                    //-- populate the screen controls
                    //-------------------------------------------------------------------------
                    user_login.Text       = thisUser.login;
                    user_email.Text       = thisUser.email;
                    user_first_name.Text  = thisUser.first_name;
                    user_last_name.Text   = thisUser.last_name;
                    user_address.Text     = thisUser.address;
                    user_city.Text        = thisUser.city;
                    user_state.Text       = thisUser.state_province;
                    user_postal_code.Text = thisUser.postal_code;
                    user_phone.Text       = thisUser.phone;

                    /*
                     * thisRolesUser = new LiftDomain.RolesUser();
                     * thisRolesUser.user_id.Value = thisUser.id.Value;
                     * thisRolesUser.role_id.Value = 2;
                     * thisRolesUser = thisRolesUser.doSingleObjectQuery<LiftDomain.RolesUser>("select");
                     * user_roles_2.Checked = (thisRolesUser.id.Value > 0);
                     * */

                    thisRolesUser = new LiftDomain.RolesUser();
                    thisRolesUser.user_id.Value = thisUser.id.Value;
                    thisRolesUser.role_id.Value = 7;
                    thisRolesUser        = thisRolesUser.doSingleObjectQuery <LiftDomain.RolesUser>("select");
                    user_roles_7.Checked = (thisRolesUser.id.Value > 0);

                    thisRolesUser = new LiftDomain.RolesUser();
                    thisRolesUser.user_id.Value = thisUser.id.Value;
                    thisRolesUser.role_id.Value = 8;
                    thisRolesUser        = thisRolesUser.doSingleObjectQuery <LiftDomain.RolesUser>("select");
                    user_roles_8.Checked = (thisRolesUser.id.Value > 0);

                    thisRolesUser = new LiftDomain.RolesUser();
                    thisRolesUser.user_id.Value = thisUser.id.Value;
                    thisRolesUser.role_id.Value = 10;
                    thisRolesUser         = thisRolesUser.doSingleObjectQuery <LiftDomain.RolesUser>("select");
                    user_roles_10.Checked = (thisRolesUser.id.Value > 0);

                    thisRolesUser = new LiftDomain.RolesUser();
                    thisRolesUser.user_id.Value = thisUser.id.Value;
                    thisRolesUser.role_id.Value = 13;
                    thisRolesUser         = thisRolesUser.doSingleObjectQuery <LiftDomain.RolesUser>("select");
                    user_roles_13.Checked = (thisRolesUser.id.Value > 0);

                    thisRolesUser = new LiftDomain.RolesUser();
                    thisRolesUser.user_id.Value = thisUser.id.Value;
                    thisRolesUser.role_id.Value = 14;
                    thisRolesUser         = thisRolesUser.doSingleObjectQuery <LiftDomain.RolesUser>("select");
                    user_roles_14.Checked = (thisRolesUser.id.Value > 0);

                    //thisRolesUser = new LiftDomain.RolesUser();
                    //thisRolesUser.user_id.Value = thisUser.id.Value;
                    //thisRolesUser.role_id.Value = 11;
                    //thisRolesUser = thisRolesUser.doSingleObjectQuery<LiftDomain.RolesUser>("select");
                    //user_roles_11.Checked = (thisRolesUser.id.Value > 0);

                    //thisRolesUser = new LiftDomain.RolesUser();
                    //thisRolesUser.user_id.Value = thisUser.id.Value;
                    //thisRolesUser.role_id.Value = 12;
                    //thisRolesUser = thisRolesUser.doSingleObjectQuery<LiftDomain.RolesUser>("select");
                    //user_roles_12.Checked = (thisRolesUser.id.Value > 0);

                    initUserStatusList(initialUserStatus);
                    initTimeZoneList(initialTimeZone);
                    initLanguageList(initialLanguageId);
                    initOrgList(initialOrgId);

                    enforceRoleSettings();
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN EditUser.aspx.cs::Page_Load(): " + m);
                Logger.log("EditUser.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN EditUser.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
示例#24
0
        //-------------------------------------------------------------------------
        //-- 1) Create new org from scratch. There should be a placeholder for a terms of use agreement.
        //-- 2) Signup user as org admin for new org. This new user's email address will be copied to the webmaster email role in the org_emails table.
        //-- 3) Create email accounts using the HostingProvider interface
        //-- 4) Create org_emails records
        //-- 5) Create the /custom/org/images and /custom/org/stylesheets folders
        //-- 6) There will be a new org status - approved and unapproved. The org will initially be created in the unapproved state.
        //-- 7) The system will send an email to [email protected] to notify of org requesting approval.
        //-- 8) The org list page will show the approval status of orgs.
        //-- 9) The org edit page will enable the sys admin to approve an org.
        //-- 10) The system will generate an email to the org webmaster indicating that the new org has been approved.
        //-------------------------------------------------------------------------

        protected void Page_Load(object sender, EventArgs e)
        {
            EmailValidator.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;

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

            PageAuthorized.check(Request, Response);

            string initialTimeZone   = "Central Standard Time";
            int    initialLanguageId = 1; //-- 1 = English
            string saltValue         = string.Empty;
            string thisDirectory     = string.Empty;

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language setting for the SUBMIT button here
                //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT.Value;

                if (IsPostBack)
                {
                    //-------------------------------------------------------------------------
                    //-- instantiate the object
                    //-------------------------------------------------------------------------
                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();

                    //-------------------------------------------------------------------------
                    //-- transfer screen values to the object
                    //-------------------------------------------------------------------------
                    //TODO: ???what if data field validation fails??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???what if org title already exists??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???what if org subdomain already exists??? // TO BE DONE IN JAVASCRIPT
                    //TODO: ???should this be wrapped in a transaction???

                    //thisOrganization.id.Value = 0; //-- id of "0" means "new"
                    thisOrganization.title.Value          = organization_title.Text;
                    thisOrganization.user_id.Value        = 0; // LiftDomain.User.Current.id.Value;
                    thisOrganization.address.Value        = organization_address.Text;
                    thisOrganization.city.Value           = organization_city.Text;
                    thisOrganization.state_province.Value = organization_state.Text;
                    thisOrganization.postal_code.Value    = organization_postal_code.Text;
                    thisOrganization.phone.Value          = organization_phone.Text;
                    thisOrganization.subdomain.Value      = organization_subdomain.Text;
                    thisOrganization.time_zone.Value      = initialTimeZone;
                    thisOrganization.language_id.Value    = initialLanguageId;
                    thisOrganization.status.Value         = 0; //-- 0 = unapproved; 1 = approved
                    thisOrganization.created_at.Value     = LiftTime.CurrentTime;

                    //-------------------------------------------------------------------------
                    //-- persist the object data to the database
                    //-------------------------------------------------------------------------
                    thisOrganization.id.Value = Convert.ToInt32(thisOrganization.doCommand("save"));

                    if (thisOrganization.id.Value != 0)
                    {
                        //-------------------------------------------------------------------------
                        //-- instantiate the child object
                        //-------------------------------------------------------------------------
                        //TODO: ???what if data field validation fails??? // TO BE DONE IN JAVASCRIPT
                        LiftDomain.OrgEmail thisOrgEmail = new LiftDomain.OrgEmail();

                        //thisOrgEmail.id.Value = 0; //-- id of "0" means "new"
                        thisOrgEmail.organization_id.Value = thisOrganization.id.Value;
                        thisOrgEmail.smtp_server.Value     = "smtp.liftprayer.cc";
                        thisOrgEmail.smtp_username.Value   = thisOrganization.subdomain.Value + "*****@*****.**";
                        //thisOrgEmail.smtp_username.Value = "*****@*****.**";
                        thisOrgEmail.smtp_password.Value = "liftprayer";
                        thisOrgEmail.smtp_port.Value     = 25;
                        thisOrgEmail.email_from.Value    = thisOrganization.subdomain.Value + "*****@*****.**";
                        //thisOrgEmail.email_from.Value = "*****@*****.**";
                        thisOrgEmail.email_to.Value           = organization_email_to_webmaster.Text;
                        thisOrgEmail.webmaster_email_to.Value = organization_email_to_webmaster.Text;

                        //-------------------------------------------------------------------------
                        //-- persist the child object data to the database
                        //-------------------------------------------------------------------------
                        thisOrgEmail.doCommand("save");

                        //*************************************************************************
                        //TODO: ???create email accounts using the HostingProvider interface???
                        //*************************************************************************

                        //-------------------------------------------------------------------------
                        //-- create organization-specific file system directories
                        //-------------------------------------------------------------------------
                        thisDirectory = Server.MapPath(".");

                        if (!Directory.Exists(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\images"))
                        {
                            Directory.CreateDirectory(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\images");
                        }

                        if (!File.Exists(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\images\\logo.gif"))
                        {
                            //File.Copy(thisDirectory + "\\..\\custom\\standard\\images\\logo.gif", thisDirectory + "\\custom\\" + thisOrganization.subdomain.Value + "\\images\\logo.gif");
                            copyDirectory(thisDirectory + "\\..\\custom\\standard\\images", thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\images");
                        }

                        if (!Directory.Exists(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets"))
                        {
                            Directory.CreateDirectory(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets");
                        }

                        if (!File.Exists(thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets\\lift_custom.css"))
                        {
                            //File.Copy(thisDirectory + "\\..\\custom\\standard\\stylesheets\\lift_base.css", thisDirectory + "\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets\\lift_custom.css");
                            createStylesheet(thisDirectory + "\\..\\custom\\standard\\stylesheets", thisDirectory + "\\..\\custom\\" + thisOrganization.subdomain.Value + "\\stylesheets");
                        }

                        //-------------------------------------------------------------------------
                        //-- email a request for approval to the system administrator
                        //-------------------------------------------------------------------------

                        /*
                         * LiftCommon.Email emailHelper = new LiftCommon.Email();
                         *
                         * emailHelper.server = ConfigReader.getString("smtp_server", ""); // thisOrgEmail.smtp_server;
                         * // emailHelper.username = ConfigReader.getString("smtp_username", ""); // thisOrgEmail.smtp_username;
                         * emailHelper.password = ConfigReader.getString("smtp_password", ""); // thisOrgEmail.smtp_password;
                         * emailHelper.port = ConfigReader.getInt("smtp_port", 25); // thisOrgEmail.smtp_port;
                         *
                         * //email.replyTo = thisOrgEmail.emailReplyTo;  // not supported yet
                         *
                         * emailHelper.from = thisOrganization.getFromEmail();
                         *
                         * //TODO: ??? THIS NEEDS TO BE A VALID E-MAIL ADDRESS
                         * if (LiftCommon.Email.IsValidEmailAddress(thisOrgEmail.webmaster_email_to.Value))
                         * {
                         *
                         * }
                         * else
                         * {
                         *  //TODO: ??? HOW DO WE NOTIFY THE USER
                         *  Logger.log(Logger.Level.ERROR, this, "E-mail address '" + thisOrgEmail.webmaster_email_to.Value + "' is not in a correct format [SignupOrganization.aspx].");
                         *  throw new ApplicationException("E-mail address '" + thisOrgEmail.webmaster_email_to.Value + "' is not in a correct format [SignupOrganization.aspx].");
                         * }
                         *
                         * emailHelper.addTo("*****@*****.**");
                         * //emailHelper.addTo("*****@*****.**");
                         *
                         * emailHelper.subject = LiftDomain.Language.Current.SIGNUP_ORGANIZATION_APPROVAL_REQUEST_SUBJECT.Value;
                         * emailHelper.Body = LiftDomain.Language.Current.SIGNUP_ORGANIZATION_APPROVAL_REQUEST_MESSAGE.Value + "  " + thisOrganization.title.Value;
                         *
                         * //email.MIME = MIME.Text | MIME.HTML;  // just supposing that it supports multiple formats. May not be necessary
                         *
                         * emailHelper.send();
                         *
                         */
                    }
                    else
                    {
                        //else, org ID is zero, but try-catch did not handle it for some reason???
                    }

                    //-------------------------------------------------------------------------
                    //-- navigate to the Organization edit screen
                    //-------------------------------------------------------------------------
                    Response.Redirect("EditOrganization.aspx?id=" + thisOrganization.id.Value.ToString());
                }
                else
                {
                    organization_email_to_webmaster.Text = LiftDomain.User.Current.email.Value;
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN SignupOrganization.aspx.cs::Page_Load(): " + m);
                Logger.log("SignupOrganization.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN SignupOrganization.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
示例#25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            Organization org = Organization.Current;

            if (org != null)
            {
                customPath  = "/custom/";
                customPath += org.subdomain;
                if (org.subdomain == "upward")
                {
                    initialTimeframe      = -100;
                    duringTheLast         = "&nbsp;";
                    requesttype.Visible   = false;
                    timeframe.Visible     = false;
                    searchBtn.Visible     = false;
                    liveSearchBox.Visible = false;
                    viewingRequestsFor    = string.Empty;
                }
                else
                {
                    initialTimeframe   = -7;
                    duringTheLast      = LiftDomain.Language.Current.REQUESTS_DURING_THE_LAST;
                    viewingRequestsFor = LiftDomain.Language.Current.REQUESTS_VISUALIZE_PRAYER_REQUESTS;
                }
            }

            PageAuthorized.check(Request, Response);

            User U = LiftDomain.User.Current;

            searchBtn.Text = LiftDomain.Language.Current.SHARED_SEARCH;

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

            prayerRequest["listed_threshold"] = (U.canSeePrivateRequests ? 0 : 1);

            prayerRequest["approval_threshold"] = (U.canApproveRequests ? 0 : 1);

            string strActive = Request["active"];

            if (!string.IsNullOrEmpty(strActive))
            {
                try
                {
                    active = int.Parse(strActive);
                }
                catch
                {
                    active = 1;
                }
            }

            active = (U.canApproveRequests ? active : 1);

            prayerRequest["active"] = active;

            if (IsPostBack)
            {
                int    tf     = Convert.ToInt32(timeframe.SelectedItem.Value);
                int    rt     = Convert.ToInt32(requesttype.SelectedItem.Value);
                string search = liveSearchBox.Text;
                prayerRequest["timeframe"]   = tf;
                prayerRequest["requesttype"] = rt;
                prayerRequest["search"]      = search;
                initTimeframe(tf);
                initRequestTypes(rt);
            }
            else
            {
                initRequestTypes(initialRequestType);
                initTimeframe(initialTimeframe);
                prayerRequest["search"]      = "";
                prayerRequest["timeframe"]   = initialTimeframe;
                prayerRequest["requesttype"] = initialRequestType;
            }

            requestSet                  = prayerRequest.doQuery("get_requests");
            requestRenderer             = new RequestRenderer(requestSet);
            requestRenderer.ShowUpdates = true;
            requestRenderer.ShowActive  = (active == 1);
        }
示例#26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            string foo = LiftDomain.Language.Current.REQUEST_FIELDS_OPTIONAL;



            PageAuthorized.check(Request, Response);

            L = LiftDomain.Language.Current;
            LiftDomain.User U = LiftDomain.User.Current;

            submitBtn.Text = L.SHARED_SUBMIT;

            string idStr = Request.Params["id"];

            if (idStr != null)
            {
                if (idStr.Length > 0)
                {
                    request_id.Value = idStr;
                }
            }

            LiftDomain.Request prayerRequest = new LiftDomain.Request();
            prayerRequest.id.Value = Convert.ToInt32(request_id.Value);

            // TODO - turn off links to updates and subscriptions here
            // prayerRequest["mode"] = "update_request";
            requestSet                = prayerRequest.doQuery("get_request");
            requestRenderer           = new RequestRenderer(requestSet);
            requestRenderer.ShowLinks = false;

            LiftDomain.Encouragement enc = new LiftDomain.Encouragement();
            enc.request_id.Value      = Convert.ToInt32(request_id.Value);
            enc["listed_threshold"]   = (U.canSeePrivateRequests ? 0 : 1);
            enc["approval_threshold"] = (U.canApproveRequests ? 0 : 1);
            encSet = enc.doQuery("get_updates");

            encRenderer = new EncouragementRenderer(encSet);

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

                    LiftDomain.Encouragement en = new LiftDomain.Encouragement();
                    en.note.Value = note.Text;

                    en.encouragement_type.Value = (int)Encouragement.Report;
                    en.from.Value       = from.Text;
                    en.from_email.Value = from_email.Text;


                    en.listed.Value = 0;  // always make reports private


                    en.is_approved.Value = 0;
                    en.created_at.Value  = LiftDomain.LiftTime.CurrentTime;
                    en.post_date.Value   = LiftDomain.LiftTime.CurrentTime;
                    en.updated_at.Value  = LiftDomain.LiftTime.CurrentTime;
                    en.user_id.Value     = LiftDomain.User.Current.id;
                    en.request_id.Value  = Convert.ToInt32(request_id.Value);

                    en.doCommand("save_encouragement");

                    LiftDomain.Request pr = new LiftDomain.Request();
                    pr.id.Value          = Convert.ToInt32(request_id.Value);
                    pr.is_approved.Value = 0;
                    pr.last_action.Value = LiftDomain.LiftTime.CurrentTime;
                    pr.updated_at.Value  = LiftDomain.LiftTime.CurrentTime;

                    pr.doCommand("approve");

                    LiftDomain.Encouragement allEnc = new LiftDomain.Encouragement();
                    allEnc.request_id.Value  = Convert.ToInt32(request_id.Value);
                    allEnc.is_approved.Value = 0;
                    allEnc.approved_at.Value = LiftDomain.LiftTime.CurrentTime;
                    allEnc.doCommand("approve_all");

                    Response.Redirect("Requests.aspx");
                }
                else
                {
                    errMsg.Text = LiftDomain.Language.Current.REQUEST_UPDATE_NOT_SUCCESSFUL;
                }
            }
            else
            {
                from.Text       = "";
                from_email.Text = "";
            }

            this.note.Focus();
        }
示例#27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EmailValidator.ErrorMessage    = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;
            PasswordValidator.ErrorMessage = LiftDomain.Language.Current.SHARED_PASSWORDS_DO_NOT_MATCH;

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

            PageAuthorized.check(Request, Response);

            int      initialLanguageId = 1; //-- 1 = English
            string   initialTimeZone   = string.Empty;
            string   saltValue         = string.Empty;
            int      sumTotalRequests  = 0;
            TimeSpan sumPrayerSessionsDurationTimeSpan = new TimeSpan();

            //-------------------------------------------------------------------------
            //-- do the language setting for the SUBMIT button here
            //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
            //-------------------------------------------------------------------------
            this.submitBtn.Text         = LiftDomain.Language.Current.SHARED_SUBMIT;
            this.submitBtnPassword.Text = LiftDomain.Language.Current.SHARED_CHANGE;
            this.submitBtnTimeZone.Text = LiftDomain.Language.Current.SHARED_CHANGE;

            LiftDomain.User thisUser = new LiftDomain.User();

            if (IsPostBack)
            {
                //-------------------------------------------------------------------------
                //-- transfer screen values to the object
                //-------------------------------------------------------------------------
                thisUser.id.Value = int.Parse(id.Value);

                thisUser.login.Value          = login.Text;
                thisUser.first_name.Value     = first_name.Text;
                thisUser.last_name.Value      = last_name.Text;
                thisUser.email.Value          = email.Text;
                thisUser.address.Value        = address.Text;
                thisUser.city.Value           = city.Text;
                thisUser.state_province.Value = state_province.Text;
                thisUser.postal_code.Value    = postal_code.Text;
                thisUser.phone.Value          = phone.Text;

                thisUser.language_id.Value = Convert.ToInt32(language_list.SelectedItem.Value);

                //TODO: ???what if passwords do not match??? // TO BE DONE IN JAVASCRIPT
                //(user_password.Text != user_password_confirmation.Text)

                if (!String.IsNullOrEmpty(user_password.Text.Trim()))
                {
                    thisUser.password_hash_type.Value = "md5";
                    saltValue = LiftDomain.User.generateRandomSalt();
                    thisUser.password_salt.Value    = saltValue;
                    thisUser.crypted_password.Value = LiftDomain.User.hash(user_password.Text, saltValue);
                }

                thisUser.updated_at.Value            = LiftTime.CurrentTime;
                thisUser.time_zone.Value             = timezone_list.SelectedItem.Value;
                thisUser.previous_increment_id.Value = 0;

                //-------------------------------------------------------------------------
                //-- persist the User object data to the database
                //-------------------------------------------------------------------------
                thisUser.doCommand("save_current");

                Response.Redirect("MyAccount.aspx");
            }
            else
            {
                //-------------------------------------------------------------------------
                //-- query database for data for the current user
                //-------------------------------------------------------------------------
                id.Value          = LiftDomain.User.Current.id.Value.ToString();
                thisUser.id.Value = LiftDomain.User.Current.id.Value;
                thisUser          = thisUser.doSingleObjectQuery <LiftDomain.User>("select");
            }

            //-------------------------------------------------------------------------
            //-- populate the screen controls
            //-------------------------------------------------------------------------
            first_name_label.Text = thisUser.first_name;
            last_name_label.Text  = thisUser.last_name;
            login.Text            = thisUser.login;
            created_at.Text       = thisUser.created_at.Value.ToString("dddd MMMM dd, yyyy");

            first_name.Text     = thisUser.first_name;
            last_name.Text      = thisUser.last_name;
            email.Text          = thisUser.email;
            address.Text        = thisUser.address;
            city.Text           = thisUser.city;
            state_province.Text = thisUser.state_province;
            postal_code.Text    = thisUser.postal_code;
            phone.Text          = thisUser.phone;

            initialLanguageId = thisUser.language_id;
            initLanguageList(initialLanguageId);

            initialTimeZone = thisUser.time_zone;
            initTimeZoneList(initialTimeZone);

            //-------------------------------------------------------------------------
            //-- MY PRAYER REQUESTS
            //-------------------------------------------------------------------------

            LiftDomain.Request prayerRequest = new LiftDomain.Request();
            prayerRequest.user_id.Value = thisUser.id;
            prayerRequestSet            = prayerRequest.doQuery("get_my_account_requests");

            if (prayerRequestSet.Tables[0].Rows.Count > 0)
            {
                prayerRequestRenderer       = new PartialRenderer(HttpContext.Current, prayerRequestSet, "_MyAccountRequest.htm", new PartialRenderer.RenderHelper(prayerRequest.my_account_request_helper));
                prayerRequestRendererResult = prayerRequestRenderer;
            }
            else
            {
                prayerRequestRendererResult = "<p>" + LiftDomain.Language.Current.MY_ACCOUNT_YOU_HAVE_NO_REQUESTS.Value + ".</p>";
            }

            //-------------------------------------------------------------------------
            //-- MY PRAYER REQUEST SUBSCRIPTIONS
            //-------------------------------------------------------------------------
            LiftDomain.Subscription prayerRequestSubscription = new LiftDomain.Subscription();
            prayerRequestSubscription.user_id.Value = thisUser.id;
            prayerRequestSubscriptionSet            = prayerRequestSubscription.doQuery("get_subscription_by_user");

            if (prayerRequestSubscriptionSet.Tables[0].Rows.Count > 0)
            {
                prayerRequestSubscriptionRenderer       = new PartialRenderer(HttpContext.Current, prayerRequestSubscriptionSet, "_MyAccountPrayerRequestSubscription.htm", new PartialRenderer.RenderHelper(prayerRequestSubscription.my_account_prayer_request_subscription_helper));
                prayerRequestSubscriptionRendererResult = prayerRequestSubscriptionRenderer;
            }
            else
            {
                prayerRequestSubscriptionRendererResult = "<p>" + LiftDomain.Language.Current.MY_ACCOUNT_YOU_HAVE_NO_SUBSCRIPTIONS.Value + ".</p>";
            }

            //-------------------------------------------------------------------------
            //-- MY PRAYER SESSIONS
            //-------------------------------------------------------------------------
            LiftDomain.Prayersession prayerSessionObject = new LiftDomain.Prayersession();
            prayerSessionObject.user_id.Value = thisUser.id;
            prayerSessionSet = prayerSessionObject.doQuery("get_prayer_sessions_by_user_start_time_desc");

            if (prayerSessionSet.Tables[0].Rows.Count > 0)
            {
                prayerSessionRenderer       = new PartialRenderer(HttpContext.Current, prayerSessionSet, "_MyAccountPrayerSession.htm", new PartialRenderer.RenderHelper(prayerSessionObject.my_account_prayer_session_helper));
                prayerSessionRendererResult = prayerSessionRenderer;

                foreach (DataRow thisDataRow in prayerSessionSet.Tables[0].Rows)
                {
                    sumTotalRequests += Convert.ToInt32(thisDataRow["total_requests"]);
                    sumPrayerSessionsDurationTimeSpan = sumPrayerSessionsDurationTimeSpan.Add(Convert.ToDateTime(thisDataRow["end_time"]) - Convert.ToDateTime(thisDataRow["start_time"]));
                }

                prayer_requests_sum_label          = Convert.ToString(sumTotalRequests);
                prayer_sessions_duration_sum_label = Convert.ToString(sumPrayerSessionsDurationTimeSpan.Hours) + "." + (((float)((float)sumPrayerSessionsDurationTimeSpan.Minutes / (float)60)) * 10).ToString("0");
            }
            else
            {
                prayerSessionRendererResult = "<tr id='request0'><td valign='top' colspan='4' align='center'>" + LiftDomain.Language.Current.MY_ACCOUNT_YOU_HAVE_NO_SESSIONS.Value + ".</td></tr>";
            }
        }
示例#28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Organization.setCurrent())
            {
                Response.Redirect(LiftContext.Redirect);
            }

            PageAuthorized.check(Request, Response);

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language settings for the buttons here
                //-- (e.g., unable to place <%=LiftDomain.Language.Current.SHARED_UPLOAD %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.addBtn.Text    = LiftDomain.Language.Current.ORGANIZATION_IMAGES_ADD_TO_LIST.Value;
                this.removeBtn.Text = LiftDomain.Language.Current.ORGANIZATION_IMAGES_REMOVE_FROM_LIST.Value;
                this.uploadBtn.Text = LiftDomain.Language.Current.ORGANIZATION_IMAGES_UPLOAD_TO_SERVER.Value;

                if (!IsPostBack)
                {
                    string idStr = Request["id"];

                    if (String.IsNullOrEmpty(idStr))
                    {
                        //TODO: ??? HOW DO WE NOTIFY THE USER
                        Logger.log(Logger.Level.ERROR, this, "Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                        throw new ApplicationException("Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                    }
                    else
                    {
                        id.Value = idStr;
                    }

                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();
                    thisOrganization.id.Value = Convert.ToInt32(id.Value);

                    //-------------------------------------------------------------------------
                    //-- query database for data for this organization
                    //-------------------------------------------------------------------------
                    thisOrganization     = thisOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");
                    title_label.Text     = LiftDomain.Language.Current.ORGANIZATION_EDITING_ORGANIZATION.Value + " " + thisOrganization.title;
                    this.subdomain.Value = thisOrganization.subdomain;
                }

                //-------------------------------------------------------------------------
                //-- display list of server-side image files for this organization
                //-------------------------------------------------------------------------
                DisplayOrganizationImageList();
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationImages.aspx.cs::Page_Load(): " + m);
                Logger.log("EditOrganizationImages.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationImages.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
示例#29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EmailValidator1.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;
            EmailValidator2.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;
            EmailValidator3.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;
            EmailValidator4.ErrorMessage = LiftDomain.Language.Current.SHARED_MUST_BE_A_VALID_EMAIL_ADDRESS;

            PageAuthorized.check(Request, Response);


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

            try
            {
                //-------------------------------------------------------------------------
                //-- do the language setting for the SUBMIT button here
                //-- (unable to place <%=LiftDomain.Language.Current.SHARED_SUBMIT %> in asp:Button Text field)
                //-------------------------------------------------------------------------
                this.submitBtn.Text = LiftDomain.Language.Current.SHARED_SUBMIT.Value;

                //-------------------------------------------------------------------------
                //-- instantiate object
                //-------------------------------------------------------------------------
                LiftDomain.OrgEmail thisOrgEmail = new LiftDomain.OrgEmail();
                organization_from_email_address.ReadOnly = true;

                if (IsPostBack)
                {
                    //-------------------------------------------------------------------------
                    //-- get the object ID from the hidden id field on the page;
                    //-- if there is a object ID value, then we are editing an EXISTING object
                    //-------------------------------------------------------------------------
                    if (!String.IsNullOrEmpty(id.Value) && (id.Value != "0"))
                    {
                        thisOrgEmail.id.Value = int.Parse(id.Value);
                    }

                    //-------------------------------------------------------------------------
                    //-- transfer screen values to the object
                    //-------------------------------------------------------------------------
                    //TODO: ???what if data field validation fails??? // TO BE DONE IN JAVASCRIPT
                    thisOrgEmail.webmaster_email_to.Value  = organization_email_to_webmaster.Text;
                    thisOrgEmail.contact_us_email_to.Value = organization_email_to_contact_us.Text;
                    thisOrgEmail.encourager_email_to.Value = organization_email_to_encourager.Text;
                    //thisOrgEmail.email_from.Value = organization_from_email_address.Text;

                    //-------------------------------------------------------------------------
                    //-- persist the object data to the database
                    //-------------------------------------------------------------------------
                    thisOrgEmail.id.Value = Convert.ToInt32(thisOrgEmail.doCommand("save"));

                    //-------------------------------------------------------------------------
                    //-- return to ???
                    //-------------------------------------------------------------------------
                    //TODO: ???where to redirect after editing this page???
                    //Response.Redirect("???");
                }
                else
                {
                    //-------------------------------------------------------------------------
                    //-- first time on this page, so get the organization ID from the ASP Request cache
                    //-------------------------------------------------------------------------
                    string orgIdStr = Request["o"];

                    if (String.IsNullOrEmpty(orgIdStr))
                    {
                        //TODO: ??? HOW DO WE NOTIFY THE USER
                        Logger.log(Logger.Level.ERROR, this, "Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                        throw new ApplicationException("Organization ID must be passed in the request string [EditOrganizationEmails.aspx].");
                    }

                    else
                    {
                        orgId.Value = orgIdStr;
                    }


                    LiftDomain.Organization thisOrganization = new LiftDomain.Organization();
                    thisOrganization.id.Value = Convert.ToInt32(orgIdStr);

                    //-------------------------------------------------------------------------
                    //-- query database for data for this organization
                    //-------------------------------------------------------------------------
                    thisOrganization = thisOrganization.doSingleObjectQuery <LiftDomain.Organization>("select");
                    title_label.Text = LiftDomain.Language.Current.ORGANIZATION_EDITING_ORGANIZATION.Value + " " + thisOrganization.title;

                    //-------------------------------------------------------------------------
                    //-- query database for data for this organization's emails
                    //-------------------------------------------------------------------------
                    thisOrgEmail.organization_id.Value = thisOrganization.id.Value;
                    try
                    {
                        thisOrgEmail = thisOrgEmail.doSingleObjectQuery <LiftDomain.OrgEmail>("select");
                        id.Value     = thisOrgEmail.id.Value.ToString();
                        //-------------------------------------------------------------------------
                        //-- populate the screen controls
                        //-------------------------------------------------------------------------
                        organization_email_to_webmaster.Text  = thisOrgEmail.webmaster_email_to;
                        organization_email_to_contact_us.Text = thisOrgEmail.contact_us_email_to;
                        organization_email_to_encourager.Text = thisOrgEmail.encourager_email_to;
                    }
                    catch
                    {
                        id.Value = "0";
                    }

                    organization_from_email_address.Text     = Organization.Current.getFromEmail();
                    organization_from_email_address.ReadOnly = true;
                }
            }
            catch (Exception x)
            {
                //TODO: ??? WHAT DO WE DO IF THERE IS AN ERROR ???
                string m = x.Message;
                System.Diagnostics.Debug.Print("[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationEmails.aspx.cs::Page_Load(): " + m);
                Logger.log("EditOrganizationEmails.aspx.cs", x, "[" + DateTime.Now.ToString() + "] *** ERROR IN EditOrganizationEmails.aspx.cs::Page_Load(): " + m);
            }
            finally
            {
            }
        }
示例#30
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();
        }