Example #1
0
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            int weightedGrade = 0;

            if (IsWeighted == true && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
            {
                weightedGrade = 1;
            }

            switch (letterGrade)
            {
            case 'A':
                return(4 + weightedGrade);

            case 'B':
                return(3 + weightedGrade);

            case 'C':
                return(2 + weightedGrade);

            case 'D':
                return(1 + weightedGrade);
            }
            return(0);
        }
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            var addition = 0;

            if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
            {
                addition = 1;
            }
            switch (letterGrade)
            {
            case 'A':
                return(4 + addition);

            case 'B':
                return(3 + addition);

            case 'C':
                return(2 + addition);

            case 'D':
                return(1 + addition);

            case 'F':
                return(0 + addition);
            }
            return(0);
        }
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            bool IsHonoured     = false;
            bool IsDualEnrolled = false;

            if (studentType.ToString().Equals("Honors", StringComparison.InvariantCultureIgnoreCase))
            {
                IsHonoured = true;
            }
            if (studentType.ToString().Equals("DualEnrolled", StringComparison.InvariantCultureIgnoreCase))
            {
                IsDualEnrolled = true;
            }

            switch (letterGrade)
            {
            case 'A':
                return(IsWeighted && (IsHonoured || IsDualEnrolled) ? 5 : 4);

            case 'B':
                return(IsWeighted && (IsHonoured || IsDualEnrolled) ? 4 : 3);

            case 'C':
                return(IsWeighted && (IsHonoured || IsDualEnrolled) ? 3 : 2);

            case 'D':
                return(IsWeighted && (IsHonoured || IsDualEnrolled) ? 2 : 1);

            case 'F':
                return(IsWeighted && (IsHonoured || IsDualEnrolled) ? 1 : 0);
            }
            return(0);
        }
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            var gpa = 0;

            switch (letterGrade)
            {
            case 'A':
                gpa = 4;
                break;

            case 'B':
                gpa = 3;
                break;

            case 'C':
                return(2);

            case 'D':
                return(1);

            case 'F':
                return(0);
            }

            if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
            {
                gpa += 1;
            }
            return(gpa);
        }
Example #5
0
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            double gpa = 0;

            switch (letterGrade)
            {
            case 'A':
                gpa = 4;
                break;

            case 'B':
                gpa = 3;
                break;

            case 'C':
                gpa = 2;
                break;

            case 'D':
                gpa = 1;
                break;

            case 'F':
                gpa = 0;
                break;
            }

            if (IsWeighted == true && (studentType.ToString() == "DualEnrolled" || studentType.ToString() == "Honors"))
            {
                gpa++;
            }
            return(gpa);
        }
Example #6
0
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            double returnval = 0;

            switch (letterGrade)
            {
            case 'A':
                returnval = 4;
                break;

            case 'B':
                returnval = 3;
                break;

            case 'C':
                returnval = 2;
                break;

            case 'D':
                returnval = 1;
                break;

            default:
                returnval = 0;
                break;
            }

            if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
            {
                returnval += 1;
            }

            return(returnval);
        }
Example #7
0
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            var GPA = 0;

            switch (letterGrade)
            {
            case 'A':
                GPA = 4;
                break;

            case 'B':
                GPA = 3;
                break;

            case 'C':
                GPA = 2;
                break;

            case 'D':
                GPA = 1;
                break;

            case 'F':
                GPA = 0;
                break;
            }

            if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
            {
                GPA += 1;
            }

            return(GPA);
        }
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            switch (letterGrade)
            {
            case 'A':
                if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
                {
                    return(5);
                }
                else
                {
                    return(4);
                }

            case 'B':
                if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
                {
                    return(4);
                }
                else
                {
                    return(3);
                }

            case 'C':
                if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
                {
                    return(3);
                }
                else
                {
                    return(2);
                }

            case 'D':
                if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
                {
                    return(2);
                }
                else
                {
                    return(1);
                }

            case 'F':
                if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            return(0);
        }
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            var grade = 0;

            if (IsWeighted && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled"))
            {
                grade++;
            }

            switch (letterGrade)
            {
            case 'A':
                grade += 4;
                break;

            case 'B':

                grade += 3;
                break;

            case 'C':

                grade += 2;
                break;

            case 'D':

                grade += 1;
                break;

            case 'F':

                break;
            }
            return(grade);
        }
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            int increment = 0;

            if (studentType.ToString() != null && (studentType.ToString() == "Honors" || studentType.ToString() == "DualEnrolled") && this.IsWeighted == true)
            {
                increment++;
            }
            switch (letterGrade)
            {
            case 'A':
                return(4 + increment);

            case 'B':
                return(3 + increment);

            case 'C':
                return(2 + increment);

            case 'D':
                return(1 + increment);
            }
            return(0 + increment);
        }
        public virtual double GetGPA(char letterGrade, StudentType studentType)
        {
            if (IsWeighted && studentType.ToString() != "Standard")
            {
                switch (letterGrade)
                {
                case 'A':
                    return(5);

                case 'B':
                    return(4);

                case 'C':
                    return(3);

                case 'D':
                    return(2);

                case 'F':
                    return(1);
                }
                return(0);
            }
            else
            {
                switch (letterGrade)
                {
                case 'A':
                    return(4);

                case 'B':
                    return(3);

                case 'C':
                    return(2);

                case 'D':
                    return(1);

                case 'F':
                    return(0);
                }
                return(0);
            }
        }
Example #12
0
        /// <summary>
        /// Parse the arguments provided or reads from console some filter provided from the user and also parse that input.
        /// If the filter is valid, the current filter is saved, also is set the corresponding sort to apply and the SQL filter.
        /// </summary>
        /// <param name="args">Arguments provided from the call to the program in order to create a filter</param>
        private static void DefineFilter(string[] args = null)
        {
            string[] parts = null;

            if (args == null || args.Length < 2)
            {
                Console.WriteLine("Ways of student's filters supported: ");
                Console.WriteLine("- By name, sorted alphabetically. Example: name=John Dough");
                Console.WriteLine("- By student type (Kinder, Elementary, High, University) sorting by date, most recent to least recent. Example: type=Kinder");
                Console.WriteLine("- By gender (male, female) and type sorting by date, most recent to least recent. Example: gender=male type=High");
                if (!string.IsNullOrEmpty(currentFilter))
                {
                    Console.WriteLine(Environment.NewLine + "CURRENT filter applied is: " + currentFilter);
                }
                else
                {
                    Console.WriteLine(Environment.NewLine + "CURRENT filter is empty.");
                }

                Console.WriteLine("Please introduce a filter following above supported patterns: ");
                string filter = Console.ReadLine();
                parts = filter.Trim().Split(' ');
            }
            else
            {
                if (!string.IsNullOrEmpty(currentFilter))
                {
                    Console.WriteLine(Environment.NewLine + "CURRENT  filter applied is: " + currentFilter);
                }
                else
                {
                    Console.WriteLine(Environment.NewLine + "CURRENT  filter is empty.");
                }

                if (args.Length > 1)
                {
                    parts = new string[args.Length - 1];
                    if (args.Length >= 2)
                    {
                        parts[0] = args[1];
                    }

                    if (args.Length >= 3)
                    {
                        parts[1] = args[2];
                    }
                }
            }

            if (parts.Length == 1)
            {
                string[] subParts = parts[0].Split('=');
                if (subParts.Length == 2 && subParts[0] == "name")
                {
                    currentFilter    = parts[0] + " sorted alphabetically";
                    currentSqlFilter = string.Format("name like '%{0}%'", subParts[1]);
                    currentFieldSort = "name";
                    currentSortDir   = "ASC";
                }
                else
                {
                    if (subParts.Length == 2 && subParts[0] == "type")
                    {
                        StudentType type      = StudentType.Elementary;
                        bool        validType = Enum.TryParse(subParts[1].ToString(), out type);
                        if (validType)
                        {
                            currentFilter    = parts[0] + " sorted by date, most recent to least recent";
                            currentSqlFilter = string.Format("type='{0}'", type.ToString());
                            currentFieldSort = "updated_on";
                            currentSortDir   = "DESC";
                        }
                    }
                    else
                    {
                        ShowContinueMessage("You didn't fill a valid filter, please try again following the given format.");
                    }
                }
            }
            else
            {
                if (parts.Length == 2)
                {
                    string[] subPartsOne = parts[0].Split('=');
                    string[] subPartsTwo = parts[1].Split('=');
                    if (subPartsOne.Length == 2 && subPartsTwo.Length == 2 && subPartsOne[0] == "gender" && subPartsTwo[0] == "type")
                    {
                        StudentType type      = StudentType.Elementary;
                        bool        validType = Enum.TryParse(subPartsTwo[1].ToString(), out type);

                        string gender = string.Empty;
                        if (!string.IsNullOrEmpty(subPartsOne[1]))
                        {
                            gender = subPartsOne[1].Trim()[0].ToString().ToUpper();
                        }

                        if (validType && !string.IsNullOrEmpty(gender) && (gender == "M" || gender == "F"))
                        {
                            currentFilter    = parts[0] + " " + parts[1] + " sorted by date, most recent to least recent";
                            currentSqlFilter = string.Format("gender='{0}' AND type='{1}'", gender, type.ToString());
                            currentFieldSort = "updated_on";
                            currentSortDir   = "DESC";
                        }
                        else
                        {
                            ShowContinueMessage("You didn't fill a valid filter, please try again following the given format.");
                        }
                    }
                }
                else
                {
                    ShowContinueMessage("You didn't fill a valid filter, please try again following the given format.");
                }
            }
        }
Example #13
0
 public override string ToString()
 {
     return(string.Format("{0},{1},{2},{3}", StudentType.ToString(), Name, ConvertHelpers.ConvertEnumGenderToChar(Gender), LastUpdate.ToString("yyyyMMddHHmmss")));
 }