コード例 #1
0
        private void loadUserList()
        {
            lblPageTitle.Text = "User Administration";

            GridView1.RowDataBound += new GridViewRowEventHandler(handleDataBind_UserListing);
            string sqlCmd = "spAdminUserList";

            m_data.bindToGrid(sqlCmd, GridView1);

            pnlGrid.Visible       = true;
            cmdAddNewUser.Visible = true;
        }
コード例 #2
0
        private void loadSurveyList()
        {
            string pageTitle       = "";
            string locationIdParam = "null";    // see audits for all locations
            string statusIdParam1  = string.Empty;
            string statusIdParam2  = string.Empty;
            string userIdParam     = string.Empty;

            // show the list of pending surveys on the home page..
            if (webUser.isadmin || webUser.issuperadmin)        // admins
            {
                pageTitle      = "Current Audits";
                statusIdParam1 = "null"; //admins see all jobs regardless of status
                statusIdParam2 = "null";
                userIdParam    = "null"; // null = see all audits for all locations (admin-only)
            }
            else if (webUser.isnewhire)  // contractors
            {
                pageTitle      = "Audits in Progress";
                statusIdParam1 = cConstants.statusDraft.ToString();
                statusIdParam2 = cConstants.statusDraft.ToString();
                userIdParam    = webUser.userid.ToString();
            }
            else if (webUser.isleader)                          // clients
            {
                pageTitle      = "Audits for Review";
                statusIdParam1 = cConstants.statusForClientReview.ToString();
                statusIdParam2 = cConstants.statusReleased.ToString();
                userIdParam    = webUser.userid.ToString();
            }
            else
            {
                // this could be if the user who's logged in doesn't have a role associated with them..
                pageTitle   = "xxxxxxxx";
                userIdParam = "-1";        // null = see all audits for all locations (admin-only)
            }

            lblGridTitle.Text      = pageTitle;
            lblGridTitle.Font.Bold = true;

            // load up the list of surveys for this location
            GridView1.RowDataBound += new GridViewRowEventHandler(handleDataBind_SurveyListing);
            string sqlCmd = "spGetSurveyList " + locationIdParam + ", " + userIdParam + ", " + statusIdParam1 + ", " + statusIdParam2;

            cTools.log(sqlCmd);
            m_data.bindToGrid(sqlCmd, GridView1);
            pnlGrid.Visible = true;

            if (GridView1.Rows.Count == 0)
            {
                lblGridFooter.Text     = "    - No records found -";
                lblGridFooter.CssClass = "text-warning";
            }
        }
コード例 #3
0
        private void runReport()
        {
            string sqlCmd = "";
            string startDate, endDate;

            // remember the settings for next time..
            Session["Reports-ClientId"]   = cboClient.SelectedValue;
            Session["Reports-LocationId"] = cboLocation.SelectedValue;
            Session["Reports-SurveyId"]   = cboSurvey.SelectedValue;
            Session["Reports-StartDate"]  = txtDateFrom.Text;
            Session["Reports-EndDate"]    = txtDateTo.Text;

            int clientId   = cTools.cIntExt(cboClient.SelectedValue);
            int locationId = cTools.cIntExt(cboLocation.SelectedValue);
            int surveyId   = cTools.cIntExt(cboSurvey.SelectedValue);

            startDate = cTools.cDateOnly(txtDateFrom.Text);    // helps us to set a standard date format for the db
            endDate   = cTools.cDateOnly(txtDateTo.Text);

            // set up our row handler..
            GridView1.RowDataBound += new GridViewRowEventHandler(GridView1_DataBinding);

            switch (_selectedReport)
            {
            case "audittrail":        // date range..
                // don't run the report unless I've everything I need
                if (surveyId == 0)
                {
                    msgBox("Please select an audit for this report");
                    return;
                }

                sqlCmd = "spReport_AuditTrail " + surveyId;
                break;

            case "classificationssummary":
                int userId = _webUser.userid;       // pass the user so we can restrict the report to their access only
                if (_webUser.isadmin || _webUser.issuperadmin)
                {
                    userId = 0;     //open up to all locations when you're an admin
                }
                sqlCmd = "spReport_ClassificationsSummary " + userId + ", " + clientId + ", " + locationId + ",'" + startDate + "', '" + endDate + "'";
                break;

            default:        // nothing selected..or an unsupport report
                return;
            }

            // now run the report + show details on screen..
            m_data.bindToGrid(sqlCmd, GridView1);
            GridView1.Visible = true;       //show the grid now that we've run the report

            pnlReportResults.Visible = (GridView1.Rows.Count > 0);
            btnExportReport.Visible  = (GridView1.Rows.Count > 0);

            if (GridView1.Rows.Count == 0)
            {
                lblReportStatus.Text = "No data for report";
            }
            else
            {
                lblReportStatus.Text = "";
            }
        }