Пример #1
0
        public IActionResult Create()
        {
            Grades model = new Grades();

            return(View(model));
        }
 public NeighborhoodGrade(Grades grade, List <string> cities)
 {
     Grade  = grade;
     Cities = cities;
 }
Пример #3
0
 public void Add(Grades Grades)
 {
 }
        private double calcWeightAchievedSummed()
        {
            /* EXAMPLES */

            /*
             *
             * Bonus (0)
             * =========    points = 0
             *    0/0
             *
             * Bonus (0)
             *  - 2/0       points = 3
             *  - 1/0
             * =========
             *    3/0
             *
             * Bonus (0)
             *  - 1/1       points = 8
             *  - 4/5
             *  - 2/0
             *  - 1/0
             * =========
             *    8/0
             *
             * Participation (5)
             * =========    total = 0
             *   --/5
             *
             * Participation (5)
             *  - 2/0       points = 3
             *  - 1/0       total = 0
             * =========
             *   --/5
             *
             * Participation (5)
             *  - 1/1       points = 4
             *  - 2/0       total = 1
             *  - 1/0
             * =========
             *   20/5
             *
             * Participation (5)
             *  - 1/1 (1)   points = 8
             *  - 4/5 (0.8) total = 6
             *  - 2/0 (2)
             *  - 1/0 (1)
             * =========
             *  6.6/5
             *
             * All Grades (100)
             *  - 1/1       points = 4
             *  - 2/0       total = 1
             *  - 1/0
             * =========
             *  400/100
             *
             * All Grades (100)
             *  - 1/1       points = 8
             *  - 4/5       total = 6
             *  - 2/0
             *  - 1/0
             * =========
             *  133/100
             *
             * */

            //non-dropped graded items (including EC)
            var gradesThatCount = Grades.Where(i => i.DoesCount);

            //sum of GradeReceived
            double points = gradesThatCount.Sum(i => i.GradeReceived);

            //if WeightValue is 0, then we just use the total of the points
            if (WeightValue == 0)
            {
                return(points);
            }

            //sum of GradeTotal
            double total = gradesThatCount.Sum(i => i.GradeTotal);

            //if there wasn't a non-EC item, then it's ungraded
            if (total == 0)
            {
                return(Grade.UNGRADED);
            }

            return(points / total * WeightValue);
        }
Пример #5
0
 public void RemoveGrade(Guid courseId, Guid studentId)
 {
     Grades.Remove(
         Grades.Find(x => x.Student.StudentId == studentId)
         );
 }
Пример #6
0
 public void AddGrade(double grade)
 {
     Grades.Add(grade);
 }
 public Grades Post([FromBody] Grades grades)
 {
     context.Grades.Add(grades);
     context.SaveChanges();
     return(grades);
 }
Пример #8
0
 public ClassResult(string name, Grades grade)
 {
     ClassName = name;
     Grade = (int) grade;
 }
Пример #9
0
        // </stringInterpolationFormat>

        // <stringInterpolationConditional>
        public string GetGradePointPercentages() =>
        $"Name: {LastName}, {FirstName}. G.P.A: {(Grades.Any() ? Grades.Average() : double.NaN):F2}";
Пример #10
0
        // </UsingStaticLinkMethod>

        // <stringInterpolationLinq>
        public string GetAllGrades() =>
        $@"All Grades: {Grades.OrderByDescending(g => g)
            .Select(s => s.ToString("F2")).Aggregate((partial, element) => $"{partial}, {element}")}";
Пример #11
0
        // </stringInterpolationExpression>

        // <stringInterpolationFormat>
        public string GetGradePointPercentage() =>
        $"Name: {LastName}, {FirstName}. G.P.A: {Grades.Average():F2}";
Пример #12
0
        // </ToStringExpressionMember>

        // <stringInterpolationExpression>
        public string GetFormattedGradePoint() =>
        $"Name: {LastName}, {FirstName}. G.P.A: {Grades.Average()}";
Пример #13
0
 public StudentViewModel()
 {
     Student = new StudentModels(); ;
     Grades = new Grades();
     States = new StatesDictionary();
 }
Пример #14
0
        /// <summary>
        /// Creates new bank account.
        /// </summary>
        /// <param name="firstName">First name</param>
        /// <param name="surname">Surname</param>
        /// <param name="balance">Balance</param>
        /// <param name="bonus">Bonus</param>
        /// <param name="grade">Card grade</param>
        /// <returns>Id of account created.</returns>
        public int CreateAccount(string firstName, string surname, double balance, int bonus, Grades grade)
        {
            bool isAccountUnique = true;

            var newAccount = new BankAccount
            {
                Id        = bankStorage.AllAccounts.Count + 1,
                FirstName = firstName,
                Surname   = surname,
                Balance   = balance,
                Bonus     = bonus,
                Grade     = grade,
            };

            foreach (var existingAccount in bankStorage.AllAccounts)
            {
                if (newAccount == existingAccount)
                {
                    isAccountUnique = false;
                    throw new Exception("Account already exists!");
                }
            }

            if (isAccountUnique)
            {
                bankStorage.AllAccounts.Add(newAccount);

                bankStorage.Synchronize();
            }

            return(newAccount.Id);
        }
Пример #15
0
 public double GetAvgGrade()
 {
     return((double)Grades.Sum() / Grades.Length);
 }
Пример #16
0
        /// <summary>
        /// 
        /// </summary>
        public void LoadData()
        {
            this.WriteStatusInfo(this.start);

            #region 登录方式。
            this.ddlLoginMethod.BeginUpdate();
            this.ddlLoginMethod.DataSource = EnumLoginMethodOperaTools.BindSource();
            this.ddlLoginMethod.DisplayMember = "Name";
            this.ddlLoginMethod.ValueMember = "Value";
            this.ddlLoginMethod.EndUpdate();
            #endregion

            UserInfo userInfo = this.CoreService["userinfo"] as UserInfo;
            if (userInfo != null)
            {
                this.lbUserInfo.Text = string.Format("任课教师:{0}[{1}]", userInfo.UserName, userInfo.UserCode);
                this.OnToolTipEvent(this.lbUserInfo, string.Format("教师代码:{0}\r\n任课教师:{1}\r\n教师ID:{2}", userInfo.UserCode, userInfo.UserName, userInfo.UserID));
            }
            TeaSyncData teaSyncData = this.CoreService["teasyncdata"] as TeaSyncData;
            if (teaSyncData != null && teaSyncData.School != null)
            {
                School sch = teaSyncData.School;
                this.lbSchoolName.Text = string.Format("{0}", sch.SchoolName);
                this.OnToolTipEvent(this.lbSchoolName, string.Format("学校代码:{0}\r\n学校名称:{1}\r\n学校类型:{2}\r\n学校ID:{3}",
                                                                     sch.SchoolCode, sch.SchoolName, EnumSchoolTypeOperaTools.GetCHName(sch.SchoolType), sch.SchoolID));
                if (sch.Teacher != null)
                {
                    Teacher tea = sch.Teacher;
                    if (tea != null && (tea.TeacherID == userInfo.UserID))
                    {
                        this.ddlGrade.BeginUpdate();
                        this.ddlGrade.DataSource = this.grades = tea.Grades;
                        this.ddlGrade.DisplayMember = "GradeName";
                        this.ddlGrade.ValueMember = "GradeID";
                        this.ddlGrade.EndUpdate();
                    }
                    else
                    {
                        this.OnMessageEvent(MessageType.Normal | MessageType.PopupWarn, "任课数据不存在或者任课教师与用户不一致!");
                    }
                }
            }
        }
        public ActionResult Grades_View()
        {
            SzkolaEntities db     = new SzkolaEntities();
            Grades         Grades = new Grades();


            var Klasy = (from table1 in db.School_Class
                         select new Grades
            {
                ClassID = table1.ClassID,
                Nazwa_Klasy = table1.Nazwa
            });

            ViewBag.Klasy = Klasy;

            var Oceny = (from table1 in db.School_Class
                         join table2 in db.Student on table1.ClassID equals table2.ClassID
                         join table3 in db.School_Grades on table2.StudentID equals table3.StudentID
                         join table4 in db.Teacher on table3.TeacherID equals table4.TeacherID
                         select new Grades
            {
                Nazwa_Klasy = table1.Nazwa,
                ClassID = table1.ClassID,
                Ocena = table3.Ocena,
                Przedmiot = table4.Przedmiot
            });

            var Zmienna_Klasy = Klasy.ToList();


            List <double> Ls_Matematyka = new List <double>();
            List <double> Ls_Angielski  = new List <double>();
            List <double> Ls_Polski     = new List <double>();
            List <double> Ls_Chemia     = new List <double>();


            int count = 0;

            for (var i = 1; i < Zmienna_Klasy.Count + 1; i++)
            {
                var Klasa = Oceny.Where(xx => xx.ClassID == i);

                count++;


                foreach (var item in Klasa.Select(xx => xx.Przedmiot).Distinct())
                {
                    double suma  = 0;
                    int    ilosc = 0;
                    double wynik = 0;


                    if (item.Trim() == "Matematyka")
                    {
                        foreach (var item2 in Klasa.Where(xx => xx.Przedmiot.Trim() == "Matematyka"))
                        {
                            suma  = item2.Ocena + suma;
                            ilosc = ilosc + 1;
                        }
                        wynik = Math.Round(suma / ilosc, 2);
                        Ls_Matematyka.Add(wynik);
                    }
                    else if (item.Trim() == "Język Angielski")
                    {
                        foreach (var item2 in Klasa.Where(xx => xx.Przedmiot.Trim() == "Język Angielski"))
                        {
                            suma  = item2.Ocena + suma;
                            ilosc = ilosc + 1;
                        }
                        wynik = Math.Round(suma / ilosc, 2);
                        Ls_Angielski.Add(wynik);
                    }
                    else if (item.Trim() == "Język Polski")
                    {
                        foreach (var item2 in Klasa.Where(xx => xx.Przedmiot.Trim() == "Język Polski"))
                        {
                            suma  = item2.Ocena + suma;
                            ilosc = ilosc + 1;
                        }
                        wynik = Math.Round(suma / ilosc, 2);
                        Ls_Polski.Add(wynik);
                    }
                    else if (item.Trim() == "Chemia")
                    {
                        foreach (var item2 in Klasa.Where(xx => xx.Przedmiot.Trim() == "Chemia"))
                        {
                            suma  = item2.Ocena + suma;
                            ilosc = ilosc + 1;
                        }
                        wynik = Math.Round(suma / ilosc, 2);
                        Ls_Chemia.Add(wynik);
                    }
                    else
                    {
                        continue;
                    }
                }
                var wynik2 = 0;

                if (Ls_Matematyka.Count != count)
                {
                    Ls_Matematyka.Add(wynik2);
                }


                if (Ls_Angielski.Count != count)
                {
                    Ls_Angielski.Add(wynik2);
                }

                if (Ls_Polski.Count != count)
                {
                    Ls_Polski.Add(wynik2);
                }

                if (Ls_Chemia.Count != count)
                {
                    Ls_Chemia.Add(wynik2);
                }
            }

            ViewBag.Lista  = Ls_Matematyka;
            ViewBag.Lista2 = Ls_Angielski;

            ViewBag.Lista3 = Ls_Polski;
            ViewBag.Lista4 = Ls_Chemia;

            List <string> Ls_Matma = new List <string>();

            foreach (var test in ViewBag.Lista)
            {
                var test2 = test.ToString().Replace(",", ".");
                Ls_Matma.Add(test2);
            }

            var Matma = string.Join(",", Ls_Matma);

            ViewBag.Matma = Matma;


            List <string> Ls_Ang = new List <string>();

            foreach (var test in ViewBag.Lista2)
            {
                var test2 = test.ToString().Replace(",", ".");
                Ls_Ang.Add(test2);
            }

            var Ang = string.Join(",", Ls_Ang);

            ViewBag.Ang = Ang;



            List <string> Ls_Pol = new List <string>();

            foreach (var test in ViewBag.Lista3)
            {
                var test2 = test.ToString().Replace(",", ".");
                Ls_Pol.Add(test2);
            }

            var Pol = string.Join(",", Ls_Pol);

            ViewBag.Pol = Pol;



            List <string> Ls_Chem = new List <string>();

            foreach (var test in ViewBag.Lista4)
            {
                var test2 = test.ToString().Replace(",", ".");
                Ls_Chem.Add(test2);
            }

            var Chem = string.Join(",", Ls_Chem);

            ViewBag.Chem = Chem;



            var Klasy_II = (from table1 in db.School_Class
                            select new Grades
            {
                ClassID = table1.ClassID,
                Nazwa_Klasy = table1.Nazwa,
            }).Distinct().ToList();

            ViewBag.Klasy_II = Klasy_II;


            return(View("~/Views/Teacher/Grades_View.cshtml", "~/Views/Main_Layout.cshtml", Klasy_II));
        }
Пример #18
0
 public StudentViewModel(StudentModels student)
 {
     Student = student;
     Grades = new Grades();
     States = new StatesDictionary();
 }
        public ActionResult Rank_View()
        {
            SzkolaEntities db     = new SzkolaEntities();
            Grades         Grades = new Grades();


            var Ranking = (from table1 in db.School_Class
                           join table2 in db.Student on table1.ClassID equals table2.ClassID
                           join table3 in db.School_Grades on table2.StudentID equals table3.StudentID
                           join table4 in db.Teacher on table3.TeacherID equals table4.TeacherID
                           join table5 in db.User on table2.UserID equals table5.UserID
                           group new { table5, table3, table1 } by new { table5.Imie, table5.Nazwisko, table1.Nazwa }
                           into grp
                           orderby grp.Average(x => x.table3.Ocena) descending
                           select new Grades
            {
                Imie = grp.Key.Imie,
                Nazwisko = grp.Key.Nazwisko,
                Ocena = Math.Round(grp.Average(x => x.table3.Ocena), 2),
                Nazwa_Klasy = grp.Key.Nazwa
            }).Take(10);


            ViewBag.Ranking = Ranking;

            List <string> Przedmioty = new List <string>(new string[] { "Matematyka", "Język Polski", "Język Angielski", "Chemia" });

            foreach (var Przedmiot in Przedmioty)
            {
                var SmallRanking = (from table1 in db.School_Class
                                    join table2 in db.Student on table1.ClassID equals table2.ClassID
                                    join table3 in db.School_Grades on table2.StudentID equals table3.StudentID
                                    join table4 in db.Teacher on table3.TeacherID equals table4.TeacherID
                                    join table5 in db.User on table2.UserID equals table5.UserID
                                    where table4.Przedmiot.Trim() == Przedmiot
                                    group new { table5, table3, table1 } by new { table5.Imie, table5.Nazwisko, table1.Nazwa }
                                    into grp
                                    orderby grp.Average(x => x.table3.Ocena) descending
                                    select new Grades
                {
                    Imie = grp.Key.Imie,
                    Nazwisko = grp.Key.Nazwisko,
                    Ocena = Math.Round(grp.Average(x => x.table3.Ocena), 2),
                    Nazwa_Klasy = grp.Key.Nazwa
                }).Take(3);


                if (Przedmiot == "Matematyka")
                {
                    ViewBag.Matematyka = SmallRanking;
                }
                else if (Przedmiot == "Język Polski")
                {
                    ViewBag.Polski = SmallRanking;
                }
                else if (Przedmiot == "Język Angielski")
                {
                    ViewBag.Angielski = SmallRanking;
                }
                else if (Przedmiot == "Chemia")
                {
                    ViewBag.Chemia = SmallRanking;
                }
            }


            return(View("~/Views/Teacher/Rank_View.cshtml", "~/Views/Main_Layout.cshtml"));
        }
Пример #20
0
 public List <Grade> GetGrades(Guid studentId)
 {
     return(Grades.FindAll(x => x.Student.StudentId == studentId));
 }
Пример #21
0
 public ClassResult(string name, Grades grade)
 {
     ClassName = name;
     Grade     = (int)grade;
 }
Пример #22
0
 public void RemoveGrade(double grade)
 {
     Grades.Remove(grade);
 }
Пример #23
0
 public bool CreateGrades(Grades bt)
 {
     return(gradesrepor.Create(bt));
 }
Пример #24
0
 public void Update(Grades Grades)
 {
 }
Пример #25
0
 internal bool Create(Grades bt)
 {
     throw new NotImplementedException();
 }
        private double calcWeightAchievedAveraged()
        {
            /* EXAMPLES */

            /*
             *
             * Bonus (0)
             * =========    0 + 0
             *    0/0
             *
             * Bonus (0)
             *  - 2/0       0 + 3
             *  - 1/0
             * =========
             *    3/0
             *
             * Bonus (0)
             *  - 1/1       1.8 + 3
             *  - 4/5
             *  - 2/0
             *  - 1/0
             * =========
             *  4.8/0
             *
             * Participation (5)
             * =========    countOfRegulars = 0, countOfExtras = 0
             *   --/5
             *
             * Participation (5)
             *  - 2/0       countOfRegulars = 0, countOfExtras = 2
             *  - 1/0       extraPercents = 3
             * =========
             *    8/5       1 * 5 + 3
             *
             * Participation (5)
             *  - 1/1       countOfRegulars = 1, countOfExtras = 2
             *  - 2/0       percentTotal = 1, percent = 1, extraPercents = 3
             *  - 1/0
             * =========
             *    8/5       1 * 5 + 3
             *
             * Participation (5)
             *  - 1/1 (1)   countOfRegulars = 2, countOfExtras = 2
             *  - 4/5 (0.8) percentTotal = 1.8, percent = 0.9, extraPercents = 3
             *  - 2/0 (2)
             *  - 1/0 (1)
             * =========
             *  7.5/5       0.9 * 5 + 3
             *
             * All Grades (100)
             *  - 1/1       countOfRegulars = 1, countOfExtras = 2
             *  - 2/0       percentTotal = 1, percent = 1, extraPercents = 3
             *  - 1/0
             * =========
             *  103/100     1 * 100 + 3
             *
             * All Grades (100)
             *  - 1/1       countOfRegulars = 2, countOfExtras = 2
             *  - 4/5       percentTotal = 1.8, percent = 0.9, extraPercents = 3
             *  - 2/0
             *  - 1/0
             * =========
             *  93/100      0.9 * 100 + 3
             *
             * */


            //non-dropped graded items (including EC)
            var gradesThatCount = Grades.Where(i => i.DoesCount);

            double extraPercents = 0;
            int    countOfExtras = 0;

            double percentTotal    = 0;
            int    countOfRegulars = 0;

            foreach (var g in gradesThatCount)
            {
                if (g.IsExtraCredit)
                {
                    extraPercents += g.GradeReceived;
                    countOfExtras += 1;
                }

                else
                {
                    countOfRegulars++;
                    percentTotal += g.GradePercent;
                }
            }

            if (WeightValue == 0)
            {
                return(percentTotal + extraPercents);
            }

            double percent;

            //if they don't have any regular grades
            if (countOfRegulars == 0)
            {
                //if they didn't have any EC grades either, it's ungraded
                if (countOfExtras == 0)
                {
                    return(Grade.UNGRADED);
                }

                //otherwise, we assume their regular grade is 100%.
                percent = 1;
            }

            //otherwise calculate their regular grade
            else
            {
                percent = percentTotal / countOfRegulars;
            }


            return(percent * WeightValue + extraPercents);
        }
Пример #27
0
 public static Grade GetGradeByName(string name)
 {
     return(Grades.Where(a => a.Name == name).FirstOrDefault());
 }
Пример #28
0
 public IActionResult Details(Grades model)
 {
     return(View(model));
 }
Пример #29
0
        public ActionResult DelGrade(int id)
        {
            Grades grade = _db.Grades.SingleOrDefault(g => g.GradeId == id);

            return(PartialView("DelGrade", grade));
        }
Пример #30
0
 public static bool Passing(this Grades grade)
 {
     return(grade >= minPassing);
 }
Пример #31
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public Student() : base()
 {
     this.studentNumber = 0;
     this.grade         = Grades.F;
 }
Пример #32
0
 public void Add(Grades grades)
 {
     manager.Add(grades);
 }
Пример #33
0
 /// <summary>
 /// Method to set the grade
 /// </summary>
 /// <param name="grade"></param>
 public void TakeExam(Grades grade)
 {
     this.grade = grade;
 }
Пример #34
0
 public Student(string name, Grades[] grades)
 {
     this.name = name;
     this.grades = grades;
 }
Пример #35
0
        private IQueryable <OrganizationMember> GetMembers()
        {
            if (_members == null)
            {
                var glist             = new int[] {};
                var smallGroupList    = new List <string>();
                var matchAllSubgroups = false;
                if (null != SmallGroup)
                {
                    if (SmallGroup.StartsWith("All:", StringComparison.InvariantCultureIgnoreCase))
                    {
                        matchAllSubgroups = true;
                        SmallGroup        = SmallGroup.Substring(4);
                    }
                    if (SmallGroup.Contains(";"))
                    {
                        smallGroupList.AddRange(SmallGroup.Split(';').Select(x => x.Trim()));
                    }
                    else if (SmallGroup.Contains(","))
                    {
                        smallGroupList.AddRange(SmallGroup.Split(';').Select(x => x.Trim()));
                    }
                    else
                    {
                        smallGroupList.Add(SmallGroup);
                    }
                }

                if (Grades.HasValue())
                {
                    glist = (from g in (Grades ?? "").Split(new char[] { ',', ';' })
                             select g.ToInt()).ToArray();
                }
                var q = from om in DbUtil.Db.OrganizationMembers
                        where om.Organization.DivOrgs.Any(di => di.DivId == SourceDivId)
                        where SourceId == 0 || om.OrganizationId == SourceId
                        where glist.Length == 0 || glist.Contains(om.Person.Grade.Value)
                        where !MembersOnly || om.MemberTypeId == MemberTypeCode.Member
                        select om;
                if (smallGroupList.Count() > 0)
                {
                    if (matchAllSubgroups)
                    {
                        foreach (var sg in smallGroupList)
                        {
                            q = from om in q
                                where om.OrgMemMemTags.Any(mm => mm.MemberTag.Name == sg)
                                select om;
                        }
                    }
                    else
                    {
                        q = from om in q
                            where om.OrgMemMemTags.Any(mm => smallGroupList.Contains(mm.MemberTag.Name))
                            select om;
                    }
                }
                if (null != Age && Age.Trim().Length > 0)
                {
                    /*
                     * Enter a single number for a specific age (`50`).
                     * Use a dash to search for a range of ages (`30-40`).
                     * Additionally, use `<=`, `>=`, `<`, and `>` for searching ranges.
                     */

                    var str = Regex.Replace(Age, @"[^0-9\-<>=]", "");
                    if ((new Regex(@"^[0-9]+$")).IsMatch(str))
                    {
                        q = from om in q
                            where om.Person.Age == str.ToInt()
                            select om;
                    }
                    else if ((new Regex(@"^[0-9]+\-[0-9]+$")).IsMatch(str))
                    {
                        var matches = Regex.Matches(str, @"^([0-9]+)\-([0-9]+)$");
                        q = from om in q
                            where om.Person.Age >= matches[0].Groups[1].Value.ToInt()
                            where om.Person.Age <= matches[0].Groups[2].Value.ToInt()
                            select om;
                    }
                    else if ((new Regex(@"^>=[0-9]+$")).IsMatch(str))
                    {
                        var matches = Regex.Matches(str, @"^>=([0-9]+)$");
                        q = from om in q
                            where om.Person.Age >= matches[0].Groups[1].Value.ToInt()
                            select om;
                    }
                    else if ((new Regex(@"^>[0-9]+$")).IsMatch(str))
                    {
                        var matches = Regex.Matches(str, @"^>([0-9]+)$");
                        q = from om in q
                            where om.Person.Age > matches[0].Groups[1].Value.ToInt()
                            select om;
                    }
                    else if ((new Regex(@"^<=[0-9]+$")).IsMatch(str))
                    {
                        var matches = Regex.Matches(str, @"^<=([0-9]+)$");
                        q = from om in q
                            where om.Person.Age <= matches[0].Groups[1].Value.ToInt()
                            select om;
                    }
                    else if ((new Regex(@"^<[0-9]+$")).IsMatch(str))
                    {
                        var matches = Regex.Matches(str, @"^<([0-9]+)$");
                        q = from om in q
                            where om.Person.Age < matches[0].Groups[1].Value.ToInt()
                            select om;
                    }
                }
                _members = q;
            }
            return(_members);
        }
Пример #36
0
 //constructor
 public Student(string fName, string lName, Grades grade)
     : base(fName, lName)
 {
     this.Grade = grade;
 }
Пример #37
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 public Teacher()
 {
     this.grades = new Grades();
 }