コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (currentPosition != null)
            {
                lblDeadline.Text   = currentPosition.Deadline.ToLongDateString();
                lblDepartment.Text = currentPosition.DepartmentList;
                lblPosition.Text   = currentPosition.PositionTitle;
                lblPosNum.Text     = currentPosition.PositionNumber;

                //Get the SexEthnicityCount for the current position
                SexEthnicityCount SexEthnicityList = new SexEthnicityCount();

                gviewSexEthnicity.DataSource = SexEthnicityList.GetSexEthnicityList(currentPosition, null);
                gviewSexEthnicity.DataBind();

                gviewApplicants.DataSource = this.GetSubmittedApplicants(false); //Get the applicants who are not selected for interview
                gviewApplicants.DataBind();

                rptInterviewApplicants.DataSource = this.GetSubmittedApplicants(true); //List the applicants selected for interview
                rptInterviewApplicants.DataBind();

                gviewInterviewSexEthnicity.DataSource = SexEthnicityList.GetSexEthnicityList(currentPosition, true);
                gviewInterviewSexEthnicity.DataBind();
            }
        }
コード例 #2
0
        /// <summary>
        /// Increments the ethnicity count for the given ethnicity
        /// </summary>
        private void AddEthnicity(Ethnicity ethnicity, SexEthnicityCount currentSex)
        {
            if (ethnicity == null) //If there is no specified ethnicity, increment the unidentified count
            {
                currentSex.UnidentifiedCount++;
            }
            else
            {
                switch (ethnicity.EthnicityCategory)
                {
                case "American Indian":
                    currentSex.AmericanIndianCount++;
                    break;

                case "Asian/ Asian American":
                    currentSex.AsianCount++;
                    break;

                case "Black/ African American":
                    currentSex.BlackCount++;
                    break;

                case "Chicano/ Latino/ Hispanic":
                    currentSex.ChicanoCount++;
                    break;

                case "White":
                    currentSex.WhiteCount++;
                    break;

                default:
                    currentSex.UnidentifiedCount++;
                    break;
                }
            }

            //No matter which category it falls under, update the total as well
            currentSex.TotalCount++;
        }
コード例 #3
0
        /// <summary>
        /// For each sex and ethnicity category (uncluding unidentifed), add up the application pool composition
        /// </summary>
        /// <param name="selectedForInterview">Indicate if the list should contain people selected for interview or only applicants
        /// not selected for interview. A null parameter means select all applicants</param>
        public List <SexEthnicityCount> GetSexEthnicityList(Position position, bool?selectedForInterview)
        {
            SexEthnicityCount men          = new SexEthnicityCount();
            SexEthnicityCount woman        = new SexEthnicityCount();
            SexEthnicityCount unidentified = new SexEthnicityCount();
            SexEthnicityCount total        = new SexEthnicityCount();

            men.Gender          = "Men";
            woman.Gender        = "Woman";
            unidentified.Gender = "Unidentified";
            total.Gender        = "Total";

            foreach (Application app in position.AssociatedApplications)
            {
                if (app.Submitted == false)
                {
                    continue;                         //Don't count unsubmitted applications.
                }
                if (selectedForInterview.HasValue == true)
                {
                    //If we specify a interview designation, make sure the application fits that designation
                    if (app.InterviewList != selectedForInterview)
                    {
                        continue;
                    }
                }

                //Make sure this application has a survey filled out
                if (app.Surveys != null && app.Surveys.Count > 0)
                {
                    Survey currentSurvey = app.Surveys[0];

                    if (currentSurvey.Gender == null)
                    {
                        //Unidentified
                        this.AddEthnicity(currentSurvey.Ethnicity, unidentified);
                    }
                    else if (currentSurvey.Gender.GenderType == "Male")
                    {
                        this.AddEthnicity(currentSurvey.Ethnicity, men);
                    }
                    else
                    {
                        this.AddEthnicity(currentSurvey.Ethnicity, woman);
                    }

                    //Always update the total as well
                    this.AddEthnicity(currentSurvey.Ethnicity, total);
                }
                else
                {
                    //If the survey is not filled out, place in the unidentified categories
                    this.AddEthnicity(null, unidentified);
                    this.AddEthnicity(null, total);
                }
            }

            List <SexEthnicityCount> result = new List <SexEthnicityCount>();

            result.Add(men);
            result.Add(woman);
            result.Add(unidentified);
            result.Add(total);

            return(result);
        }