Ejemplo n.º 1
0
 private static void AddByQueue(CourseAttributes course)
 {
     Storage.Instance.CoursesByQueue.TryAdd(course.Curso + "-" + course.Teoprac, new CoursesByValidness());
     if (course.Cola > 0 || course.CupoApartado > 0)
     {
         Storage.Instance.CoursesByQueue[course.Curso + "-" + course.Teoprac].AddValueToNotValid(course);
         return;
     }
     Storage.Instance.CoursesByQueue[course.Curso + "-" + course.Teoprac].AddValueToValid(course);
 }
Ejemplo n.º 2
0
 private static void AddByRoom(CourseAttributes course)
 {
     Storage.Instance.CoursesByRoom.TryAdd(course.Curso + "-" + course.Teoprac, new CoursesByValidness());
     if (course.Teoprac == "1" && course.TotalInscritos < 22 || course.Teoprac == "0" && course.TotalInscritos < 11)
     {
         Storage.Instance.CoursesByRoom[course.Curso + "-" + course.Teoprac].AddValueToNotValid(course);
         return;
     }
     Storage.Instance.CoursesByRoom[course.Curso + "-" + course.Teoprac].AddValueToValid(course);
 }
Ejemplo n.º 3
0
        public void AddValueToValid(CourseAttributes course)
        {
            var exists = ValidCourses.FirstOrDefault(c => c.Seccion == course.Seccion);

            if (exists != null)
            {
                if (!exists.Horarios.Contains(course.Horarios))
                {
                    exists.Horarios += $"{Environment.NewLine}{course.Horarios}";
                }
                return;
            }
            ValidCourses.Add(course);
        }
Ejemplo n.º 4
0
        public static void ProcessCourses(string selectedSheet, bool CFI)
        {
            var xlWorksheet = Storage.Instance.XLWorkbook.Sheets[selectedSheet]; //llamar variable
            var xlRange     = xlWorksheet.UsedRange;
            var rowCount    = xlRange.Rows.Count;

            Storage.Instance.CoursesByRoom  = new Dictionary <string, CoursesByValidness>();
            Storage.Instance.CoursesByQueue = new Dictionary <string, CoursesByValidness>();

            for (int i = 7; i <= rowCount; i++)
            {
                var newCourse = new CourseAttributes
                {
                    Seccion        = xlWorksheet.Cells[i, 5].value,
                    Jornada        = xlWorksheet.Cells[i, 4].value,
                    Catedratico    = xlWorksheet.Cells[i, 25].value,
                    Salon          = xlWorksheet.Cells[i, 21].value,
                    Horarios       = $"{xlWorksheet.Cells[i, 24].value} → {xlWorksheet.Cells[i, 22].value} - {xlWorksheet.Cells[i, 23].value}",
                    Curso          = xlWorksheet.Cells[i, 10].value,
                    Teoprac        = xlWorksheet.Cells[i, 8].value,
                    TotalInscritos = Convert.ToInt32(xlWorksheet.Cells[i, 7].value) + Convert.ToInt32(xlWorksheet.Cells[i, 16].value),
                    Cola           = Convert.ToInt32(xlWorksheet.Cells[i, 18].value),
                    CupoApartado   = Convert.ToInt32(xlWorksheet.Cells[i, 17].value)
                };
                if (CFI)
                {
                    if (newCourse.Seccion[0].ToString() == "2" || newCourse.Curso == "ESTRATEGIAS DE RAZONAMIENTO (CFI)")
                    {
                        CoursesByValidness.AddCourse(newCourse);
                    }
                }
                else
                {
                    CoursesByValidness.AddCourse(newCourse);
                }
            }
        }
Ejemplo n.º 5
0
 public static void AddCourse(CourseAttributes course)
 {
     AddByRoom(course);
     AddByQueue(course);
 }