Ejemplo n.º 1
0
        public static void AddGrade(int zlaggableId, GradingSystem gradingSystem, ZlaggableCategoryEnum category)
        {
            HashSet <int> grades;

            if (category == ZlaggableCategoryEnum.Sportclimbing)
            {
                if (routeGrades.ContainsKey(zlaggableId))
                {
                    grades = routeGrades[zlaggableId];
                }
                else
                {
                    grades = new HashSet <int>();
                    routeGrades.Add(zlaggableId, grades);
                }
            }
            else
            {
                if (boulderGrades.ContainsKey(zlaggableId))
                {
                    grades = boulderGrades[zlaggableId];
                }
                else
                {
                    grades = new HashSet <int>();
                    boulderGrades.Add(zlaggableId, grades);
                }
            }

            grades.Add(gradingSystem.VLGradeIndex);
        }
Ejemplo n.º 2
0
        public bool Save(GradingSystem GradingSystem)
        {
            int status = 0;

            using (connection = Database.GetConnection())
            {
                try
                {
                    using (command = new MySqlCommand(Procedures.SaveGradingSystem, connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.Add(new MySqlParameter("@SystemName", GradingSystem.SystemName));
                        command.Parameters.Add(new MySqlParameter("@EntryById", GradingSystem.EntryInformation.EntryById));
                        command.Parameters.Add(new MySqlParameter("@EntryDate", GradingSystem.EntryInformation.EntryDate));

                        connection.Open();
                        status = command.ExecuteNonQuery();
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                }
            }
            return((status > 0) ? true : false);
        }
Ejemplo n.º 3
0
 public ActionResult Edit(int id)
 {
     if (id > 0)
     {
         GradingSystem GradingSystem = GradingSystemService.FindById(id, User.Identity.Name);
         return(View(GradingSystem));
     }
     return(View());
 }
Ejemplo n.º 4
0
 public ActionResult Details(int id)
 {
     if (id > 0)
     {
         GradingSystem GradingSystem = GradingSystemService.FindById(id, User.Identity.Name);
         return(PartialView("Details", GradingSystem));
     }
     return(View());
 }
Ejemplo n.º 5
0
        public IActionResult PromoteAll()
        {
            var classId       = HttpContext.Session.Get <int>("Class_FK_Promotion");
            var currentTermId = _dataBaseQueries.GetCurrentSessionTerm().Id;

            var studentToPromote = _dataBaseQueries.GetAllNonPromotedStudentsInClass(classId);

            foreach (var student in studentToPromote)
            {
                var studentCurrentResults = _dataBaseQueries.GetStudentResultsByClassBySessionTerm(
                    student.Id, classId, currentTermId);

                //If student is in Final Class (i.e Jss3, for the current Project Scope)
                //No need to promote, graduate Student if pass criteria is met
                if (classId == Constant.JuniorFinalClassId)
                {
                    if (GradingSystem.DoStudentMeetPassCriteria(studentCurrentResults))
                    {
                        TempData["AllStudentsPromoted"] = Constant.Graduated;
                        student.Promoted         = true;
                        student.Graduated        = true;
                        student.YearOfGraduation = DateTime.Now.Year.ToString();
                    }

                    else
                    {
                        TempData["AllStudentsPromoted"] = Constant.NotGraduated;
                    }
                }

                else
                {
                    //else (student not in Final class), Check if student fulfil promotion criteria, if yes, promote
                    if (GradingSystem.DoStudentMeetPassCriteria(studentCurrentResults))
                    {
                        student.CurrentClassId++;
                        student.Promoted = true;

                        TempData["AllStudentsPromoted"] = Constant.Promoted;
                    }

                    else
                    {
                        student.Promoted = false;
                        TempData["AllStudentsPromoted"] = Constant.NotPromoted;
                    }
                }
            }

            _context.SaveChangesAsync().GetAwaiter().GetResult();

            TempData.Keep();

            return(RedirectToAction("AllStudents", new { id = classId }));
        }
Ejemplo n.º 6
0
 public string Update(GradingSystem GradingSystem, string CurrentUsername)
 {
     if (FindById(GradingSystem.Id, CurrentUsername) != null)
     {
         return(GradingSystemRepository.Update(GradingSystem) ? null : Messages.IssueInDatabase);
     }
     else
     {
         return(Messages.NotFound);
     }
 }
Ejemplo n.º 7
0
 public string Save(GradingSystem GradingSystem, string CurrentUsername)
 {
     if (FindById(GradingSystem.Id, CurrentUsername) == null)
     {
         return(GradingSystemRepository.Save(GradingSystem) ? null : Messages.IssueInDatabase);
     }
     else
     {
         return(Messages.Exist);
     }
 }
Ejemplo n.º 8
0
        public string Delete(int Id, string CurrentUsername)
        {
            GradingSystem GradingSystem = FindById(Id, CurrentUsername);

            if (GradingSystem != null)
            {
                return(GradingSystemRepository.Delete(Id) ? null : Messages.IssueInDatabase);
            }
            else
            {
                return(Messages.NotFound);
            }
        }
Ejemplo n.º 9
0
        private void ReadGradingSystemData()
        {
            foreach (var v in AssociatedPerson.Subjects)
            {
                var    gs      = new GradingSystem();
                var    reader3 = new StreamReader(Path.Combine(Directory.GetCurrentDirectory(), "Data", AssociatedPerson.Username, "Subject Data", v.Name + " Grading System.txt"));
                string line3;
                var    counter = 0;
                while ((line3 = reader3.ReadLine()) != null)
                {
                    switch (counter)
                    //1st line : Base
                    //2nd line : Grading periods
                    //3rd line : Test types
                    {
                    case 0:
                        gs.Base = int.Parse(line3);
                        break;

                    case 1:
                        var array2 = line3.Split(',');
                        for (int s = 0; s < array2.Length - 1; s += 2)
                        {
                            gs.GradingPeriods.Add(new _GradingPeriod()
                            {
                                Name = array2[s], Percentage = int.Parse(array2[s + 1])
                            });
                        }

                        break;

                    case 2:
                        var array3 = line3.Split(',');
                        for (int s = 0; s < array3.Length - 1; s += 2)
                        {
                            gs.TestTypes.Add(new TestType()
                            {
                                Name = array3[s], Percentage = int.Parse(array3[s + 1])
                            });
                        }
                        break;
                    }
                    counter++;
                }
                if (gs.GradingPeriods.Count > 0 && gs.TestTypes.Count > 0)
                {
                    gs.isSet = true;
                }
                v.GradingSystem = gs;
            }
        }
Ejemplo n.º 10
0
 public ActionResult Create(GradingSystem GradingSystemList)
 {
     if (ModelState.IsValid)
     {
         string message = GradingSystemService.Save(GradingSystemList, User.Identity.Name);
         TempData["Success"] = message;
         return(RedirectToAction("Index"));
     }
     else
     {
         ViewData["Error"] = Messages.InvalidField;
     }
     return(View());
 }
Ejemplo n.º 11
0
        public ActionResult Edit(GradingSystem GradingSystem)
        {
            string message;

            if (ModelState.IsValid)
            {
                message             = GradingSystemService.Update(GradingSystem, User.Identity.Name);
                TempData["Success"] = message;
                return(RedirectToAction("Index"));
            }
            else
            {
                ViewData["Warning"] = Messages.InvalidField;
            }
            return(View());
        }
Ejemplo n.º 12
0
        private void ShowSettingsProc()
        {
            if (SelectedSubject == null)
            {
                MessageBox.Show("No subject selected");
                return;
            }
            if (SelectedSubject.GradingSystem == null || !SelectedSubject.GradingSystem.isSet)
            {
                EditGradingSystemWindow = new EditGradingSystemWindow();
                //SelectedSubject.Tests.Clear();
                EditGradingSystemWindow.Show();
                //GradingSystemModel = SelectedSubject.GradingSystem;
                GradingSystemModel = new GradingSystem();
                return;
            }


            if (SelectedSubject.GradingSystem.isSet)
            {
                var dialogBox =
                    MessageBox.Show(
                        "Grading system already exists, adding a new one will erase all test data, continue?",
                        "Warning!",
                        MessageBoxButton.YesNo);
                if (dialogBox == MessageBoxResult.Yes)
                {
                    EditGradingSystemWindow = new EditGradingSystemWindow();
                    EditGradingSystemWindow.ShowDialog();
                    GradingSystemModel = SelectedSubject.GradingSystem; //need shallow copy
                    //GradingSystemModel = new GradingSystem();
                }
                else
                {
                    return;
                }
            }
            else
            {
                MessageBox.Show("asd");
            }
        }
Ejemplo n.º 13
0
        private GradingSystem getGradingSystem(byte oldGradeId, int cat)
        {
            // let's change zero grade to 1 ...
            if (oldGradeId == 0)
            {
                oldGradeId = 5;
            }

            var oldGrade = getOldGrade(oldGradeId, cat);

            if (_gradingSystems == null)
            {
                _gradingSystems = new Dictionary <string, GradingSystem>();
                var temp = SeedStore.GradingSystems.Where(gs => gs.Type == "8a_french").ToList();

                temp.ForEach(g =>
                {
                    var newkey = string.Join("-", new object[] { g.Category == SeedStore.CATEGORY_SPORTSCLIMBING ? 0 : 1, g.Grade.ToLower() });
                    if (!_gradingSystems.ContainsKey(newkey))
                    {
                        _gradingSystems.Add(newkey, g);
                    }
                });
            }

            var           key    = string.Join("-", new object[] { cat, oldGrade });
            GradingSystem system = null;

            if (_gradingSystems.ContainsKey(key))
            {
                system = _gradingSystems[key];
            }

            if (system == null)
            {
                throw new Exception("gradingystem is null for oldGradeId: " + oldGradeId.ToString());
            }
            return(system);
        }
Ejemplo n.º 14
0
        public List <GradingSystem> FindAll()
        {
            List <GradingSystem> GradingSystemList = new List <GradingSystem>();

            try
            {
                using (connection = Database.GetConnection())
                {
                    using (command = new MySqlCommand(Views.ALLGradingSystem, connection))
                    {
                        connection.Open();
                        command.CommandType = CommandType.Text;
                        using (reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                GradingSystem GradingSystem = new GradingSystem
                                {
                                    Id               = reader.GetInt32("id"),
                                    SystemName       = reader.GetString("SystemName"),
                                    EntryInformation = new EntryInformation()
                                    {
                                        EntryById = reader.GetInt32("EntryBy_id"),
                                        EntryDate = reader.GetDateTime("EntryDate")
                                    }
                                };
                                GradingSystemList.Add(GradingSystem);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
            return(GradingSystemList);
        }
Ejemplo n.º 15
0
        public ActionResult InsertSyll(Syll data)
        {
            List <Syllab> kita     = new List <Syllab>();
            Syllab        res      = new Syllab();
            Syllab        syllabus = new Syllab();



            syllabus.User_ID   = logID;
            syllabus.Course_ID = 1;
            //IList<Syllab> syllablist = new List<Syllab>();
            db.Syllabs.Add(syllabus);


            kita = db.Syllabs.ToList();

            foreach (var sud in kita)
            {
                if (sud.Course_ID == syllabus.Course_ID)
                {
                    res = sud;
                    break;
                }
            }

            foreach (PEO p in data.Lpeo)
            {
                if (p.Peo_CODE != null && p.Peo_CVA != null && p.Peo_DESC != null)
                {
                    PEO peo = new PEO();
                    peo.Peo_CODE    = p.Peo_CODE;
                    peo.Peo_DESC    = p.Peo_DESC;
                    peo.Peo_CVA     = p.Peo_CVA;
                    peo.Syllabus_ID = res.Syllabus_ID;

                    db.PEOs.Add(peo);

                    db.SaveChanges();
                }
            }

            foreach (ClassroomAndLabPolicy p in data.Lclp)
            {
                if (p.CLP_desc != null)
                {
                    ClassroomAndLabPolicy classroomAndLabPolicies = new ClassroomAndLabPolicy();
                    classroomAndLabPolicies.CLP_desc    = p.CLP_desc;
                    classroomAndLabPolicies.Syllabus_ID = res.Syllabus_ID;
                    db.ClassroomAndLabPolicies.Add(classroomAndLabPolicies);
                    db.SaveChanges();
                }
            }

            foreach (CourseDeliverableOutputsAndRequirement p in data.Lcodor)
            {
                if (p.OutputReq != null && p.OutputReqDesc != null && p.ToA != null && p.Cilo_Add != null)
                {
                    CourseDeliverableOutputsAndRequirement courseDeliverableOutputsAndRequirements = new CourseDeliverableOutputsAndRequirement();
                    courseDeliverableOutputsAndRequirements.OutputReq     = p.OutputReq;
                    courseDeliverableOutputsAndRequirements.OutputReqDesc = p.OutputReqDesc;
                    courseDeliverableOutputsAndRequirements.Cilo_Add      = p.Cilo_Add;
                    courseDeliverableOutputsAndRequirements.ToA           = p.ToA;
                    courseDeliverableOutputsAndRequirements.Syllabus_ID   = res.Syllabus_ID;
                    db.CourseDeliverableOutputsAndRequirements.Add(courseDeliverableOutputsAndRequirements);
                    db.SaveChanges();
                }
            }
            foreach (CourseOutcome p in data.Lco)
            {
                if (p.CO_Code != null && p.CO_CVA != null && p.CO_DESC != null && p.CO_DOLLevel != null & p.CO_POactivated != null)
                {
                    CourseOutcome courseOutcomes = new CourseOutcome();

                    courseOutcomes.CO_Code        = p.CO_Code;
                    courseOutcomes.CO_DESC        = p.CO_DESC;
                    courseOutcomes.CO_CVA         = p.CO_CVA;
                    courseOutcomes.CO_POactivated = p.CO_POactivated;
                    courseOutcomes.CO_DOLLevel    = p.CO_DOLLevel;
                    courseOutcomes.Syllabus_ID    = res.Syllabus_ID;

                    db.CourseOutcomes.Add(courseOutcomes);

                    db.SaveChanges();
                }
            }
            foreach (GradingSystem p in data.Lgs)
            {
                if (p.GRD_outputs != null && p.GRD_type != null && p.GRD_weight != null)
                {
                    GradingSystem gradingSystem = new GradingSystem();

                    gradingSystem.GRD_outputs = p.GRD_outputs;
                    gradingSystem.GRD_type    = p.GRD_type;
                    gradingSystem.GRD_weight  = p.GRD_weight;

                    gradingSystem.Syllabus_ID = res.Syllabus_ID;

                    db.GradingSystems.Add(gradingSystem);

                    db.SaveChanges();
                }
            }
            foreach (LearningPlan p in data.Llplan)
            {
                if (p.activityL != null && p.activityT != null & p.LPlan_Asses != null && p.LPlan_No_hours != 0 && p.LPlan_Outcome != null && p.LPlan_Topics != null)
                {
                    LearningPlan learningPlan = new LearningPlan();
                    learningPlan.LPlan_Outcome  = p.LPlan_Outcome;
                    learningPlan.LPlan_No_hours = p.LPlan_No_hours;
                    learningPlan.LPlan_Topics   = p.LPlan_Topics;
                    learningPlan.LPlan_Asses    = p.LPlan_Asses;
                    learningPlan.activityL      = p.activityL;
                    learningPlan.activityT      = p.activityT;
                    learningPlan.Syllabus_ID    = res.Syllabus_ID;

                    db.LearningPlans.Add(learningPlan);

                    db.SaveChanges();
                }
            }

            foreach (ProgramOutcome p in data.Lpo)
            {
                if (p.PO_Code != null && p.PO_attr != null & p.PO_CVA != null && p.PO_Desc != null)
                {
                    ProgramOutcome programOutcome = new ProgramOutcome();
                    programOutcome.PO_Code     = p.PO_Code;
                    programOutcome.PO_attr     = p.PO_attr;
                    programOutcome.PO_Desc     = p.PO_Desc;
                    programOutcome.PO_CVA      = p.PO_CVA;
                    programOutcome.Syllabus_ID = res.Syllabus_ID;

                    db.ProgramOutcomes.Add(programOutcome);

                    db.SaveChanges();
                }
            }
            foreach (Rubric p in data.Lr)
            {
                if (p.marginal != null && p.notAcceptable != null & p.outstanding != null && p.competent != null && p.criteria != null)
                {
                    Rubric rubric = new Rubric();
                    rubric.competent     = p.competent;
                    rubric.criteria      = p.criteria;
                    rubric.marginal      = p.marginal;
                    rubric.notAcceptable = p.notAcceptable;
                    rubric.outstanding   = p.outstanding;
                    rubric.Syllabus_ID   = res.Syllabus_ID;

                    db.Rubrics.Add(rubric);

                    db.SaveChanges();
                }
            }



            return(View());
        }
Ejemplo n.º 16
0
        public GradingSystem FindById(int id, string CurrentUsername)
        {
            GradingSystem FoundedGradingSystem = FindAll(CurrentUsername).Find(GradingSystem => GradingSystem.Id == id);

            return(FoundedGradingSystem);
        }