Ejemplo n.º 1
0
        private void Search()
        {
            this.Cursor   = Cursors.WaitCursor;
            strSearch     = " (RegNo <> '') ";
            strSearchReg  = string.Empty;
            strSearchName = string.Empty;
            if (txtSearchReg.Text.Length > 0)
            {
                strSearchReg = "AND (RegNo Like '%" + txtSearchReg.Text.Trim() + "%')";
            }
            else
            {
                strSearchReg = string.Empty;
            }
            if (txtSearchName.Text.Length > 0)
            {
                strSearchName = "AND (Names Like '%" + txtSearchName.Text.Trim() + "%') ";
            }
            else
            {
                strSearchName = string.Empty;
            }

            myE = new EnrollmentInfo();

            try
            {
                strSearch += strSearchReg + strSearchName;
                myE.lvEnrollmentSearch(lvEnrollment, strSearch);
            }
            catch
            { }
            myE         = null;
            this.Cursor = Cursors.Default;
        }
        public JsonResult Info([FromQuery] CollegeInfoRequest collegeName)
        {
            var response = new Response {
                Code = 0, Data = null
            };

            try
            {
                var enrollment     = _context.CollegeEnrollments.Include(c => c.Major).Where(c => c.Uname == collegeName.College).ToArrayAsync().Result;
                var enrollmentInfo = new EnrollmentInfo[enrollment.Length];
                for (int i = 0; i < enrollment.Length; i++)
                {
                    enrollmentInfo[i] = new EnrollmentInfo {
                        Key        = i,
                        Profession = enrollment[i].Major.Mname,
                        Batch      = enrollment[i].Bname,
                        Count      = enrollment[i].Menrollment
                    };
                }
                response.Data = enrollmentInfo;
            }
            catch (Exception ex)
            {
                response.Code = 1;
                _logger.LogError(ex, "An error occurred while get college enrollment infomation.");
            }
            return(Json(response));
        }
Ejemplo n.º 3
0
 private void LoadAllEnrollments()
 {
     LiveClear();
     myE = new EnrollmentInfo();
     myE.lvEnrollment(lvEnrollment);
     myE = null;
 }
Ejemplo n.º 4
0
 private void Load500Enrollments()
 {
     LiveClear();
     myE = new EnrollmentInfo();
     myE.lvEnrollmentTop500(lvEnrollment);
     myE = null;
 }
Ejemplo n.º 5
0
 private void LoadEnrollment()
 {
     LiveClear();
     myE = new EnrollmentInfo();
     myE.lvEnrollmentMin(lvEnrollment);
     myE = null;
 }
Ejemplo n.º 6
0
 private void DeleteInfo()
 {
     if ((Interactive.LInfoWarning("Are you sure you want to Delete ?", "Enrollment") == DialogResult.Yes))
     {
         myE = new EnrollmentInfo();
         EnrollmentInfo.RegNo = lblRegNo.Text.Trim();
         if (myE.RemoveEnrollment())
         {
             Load500Enrollments();
         }
         return;
     }
 }
Ejemplo n.º 7
0
        private void SaveInfo()
        {
            if (FormIsValid())
            {
                myE = new EnrollmentInfo();
                EnrollmentInfo.RegNo     = txtRegNo.Text;
                EnrollmentInfo.Names     = txtName.Text;
                EnrollmentInfo.Age       = Convert.ToInt32(txtAge.Value);
                EnrollmentInfo.AgeUnit   = rbYr.Checked ? "Y" : "m";
                EnrollmentInfo.Sex       = rbM.Checked ? "M" : "F";
                EnrollmentInfo.RegDate   = dtpRegDate.Value;
                EnrollmentInfo.Residence = txtResidence.Text;

                try { EnrollmentInfo.ReferredBy = cmbReferredBy.SelectedValue.ToString(); }
                catch { };
                try { EnrollmentInfo.ReferredTo = cmbReferredTo.SelectedValue.ToString(); }
                catch { };

                EnrollmentInfo.Fcode = strFcode;

                try { EnrollmentInfo.Category = cmbCategory.SelectedValue.ToString(); }
                catch { };
                EnrollmentInfo.ContactInfo = txtContact.Text;
                try { EnrollmentInfo.Outcome = cmbOutcome.SelectedValue.ToString(); }
                catch { };
                if (EditFlag)
                {
                    EnrollmentInfo.RegNo    = lblRegNo.Text;
                    EnrollmentInfo.NewRegNo = txtRegNo.Text;
                    if ((Interactive.LInfoConfirm("Are you sure you want to Edit ?", "Enrollment") == DialogResult.Yes))
                    {
                        if (myE.EditEnrollment())
                        {
                            Load500Enrollments();
                        }
                    }
                }
                else
                {
                    if (myE.NewEnrollment())
                    {
                        Load500Enrollments();
                    }
                }
            }
            else
            {
                Interactive.LInfoError(err, "Enrollment");
            }
        }
        public IActionResult Manage(string courseCode)
        {
            if (courseCode == null)
            {
                TempData["errorMessage"] = "You have to select a course to add student!";
                return(RedirectToAction(nameof(Display)));
            }
            Course course = courseDB.Courses.FirstOrDefault(c => c.Code.ToUpper() == courseCode.ToUpper());

            if (course == null)
            {
                TempData["errorMessage"] = "Please select a valid course";
                return(RedirectToAction(nameof(Display)));
            }
            EnrollmentInfo enrollInfo = CreateEnrollInfo(course);

            return(View("User", enrollInfo));
        }
        public IActionResult Manage(string courseCode)
        {
            if (courseCode == null)
            {
                TempData["errorMessage"] = "Please select a course to manage enrollment.";
                return(RedirectToAction(nameof(List)));
            }
            Course course = courseDB.Courses.FirstOrDefault(c => c.Code.ToUpper() == courseCode.ToUpper());

            if (course == null)
            {
                TempData["errorMessage"] = "Please select a valid course to manage enrollment.";
                return(RedirectToAction(nameof(List)));
            }
            EnrollmentInfo enrollInfo = CreateEnrollInfo(course);

            return(View("Enrollment", enrollInfo));
        }
Ejemplo n.º 10
0
        public IActionResult Manage(EnrollmentList list)
        {
            Course course = courseDB.Courses.FirstOrDefault(c => c.CourseId == list.CourseID);

            if (course != null)
            {
                if (ModelState.IsValid)
                {
                    foreach (long i in list.EnrollQueue)
                    {
                        Student student = studentDB.Students.FirstOrDefault(s => s.StudentNumber == i);
                        if (!course.Students.Contains(student))
                        {
                            CourseStudent csdb = course.AddStudent(student);
                            studentDB.SaveStudent(student);
                            csDB.AddCourseStudents(csdb);
                        }
                    }
                    foreach (long i in list.UnEnrollQueue)
                    {
                        Student student = studentDB.Students.FirstOrDefault(s => s.StudentNumber == i);
                        if (course.Students.Contains(student))
                        {
                            CourseStudent csdb = course.DeleteStudent(student);
                            studentDB.SaveStudent(student);
                            csDB.DeleteCourseStudents(csdb);
                        }
                    }
                    courseDB.SaveCourse(course);
                    TempData["successMessage"] = $"Enrollment changes successfully saved.";
                    return(RedirectToAction(nameof(List)));
                }
                else
                {
                    EnrollmentInfo enrollInfo = CreateEnrollInfo(course);
                    return(View("Enrollment", enrollInfo));
                }
            }
            else
            {
                TempData["errorMessage"] = "Please select a valid course to manage enrollment.";
                return(RedirectToAction(nameof(List)));
            }
        }
Ejemplo n.º 11
0
        private void Display()
        {
            LoadDefaults();
            EnrollmentInfo.RegNo = txtRegNo.Text = lblRegNo.Text = lvEnrollment.SelectedItems[0].Text;
            txtName.Text         = lvEnrollment.SelectedItems[0].SubItems[1].Text;
            DisplayAgeUnit(lvEnrollment.SelectedItems[0].SubItems[3].Text);
            txtAge.Value = Convert.ToDecimal(lvEnrollment.SelectedItems[0].SubItems[2].Text);
            DisplaySex(lvEnrollment.SelectedItems[0].SubItems[4].Text);
            dtpRegDate.Value   = Convert.ToDateTime(lvEnrollment.SelectedItems[0].SubItems[5].Text);
            dtpRegDate.Checked = true;
            EnrollmentInfo En = new EnrollmentInfo();

            En.ShowEnrollment();
            cmbReferredBy.SelectedValue = EnrollmentInfo.ReferredBy;
            cmbReferredTo.SelectedValue = EnrollmentInfo.ReferredTo;
            cmbOutcome.SelectedValue    = EnrollmentInfo.Outcome;
            txtResidence.Text           = EnrollmentInfo.Residence;
            txtContact.Text             = EnrollmentInfo.ContactInfo;
            btnEdit.Enabled             = true;
            btnDelete.Enabled           = true;
        }
        public JsonResult ApprovalGet()
        {
            var response = new Response {
                Code = 1, Data = null
            };
            DateTime now = DateTime.Now;

            if (_context.Batches.SingleOrDefault(b => b.Bname == "提前批").ApplicationBeginTime < now)//若志愿填报工作已经开始
            {
                return(Json(response));
            }
            try
            {
                var universities      = _context.Universities.Include(u => u.Majors).ThenInclude(m => m.Major).ToList();
                EnrollmentInfo[] info = new EnrollmentInfo[universities.Count];
                for (int i = 0; i < universities.Count; i++)
                {
                    info[i]             = new EnrollmentInfo();
                    info[i].School      = universities[i].Uname;
                    info[i].Population  = universities[i].Enrollment;
                    info[i].Professions = new CollegeMajorEnrollment[universities[i].Majors.Count];
                    var majors = universities[i].Majors.ToList();
                    for (int j = 0; j < universities[i].Majors.Count; j++)
                    {
                        info[i].Professions[j]            = new CollegeMajorEnrollment();
                        info[i].Professions[j].Profession = majors[j].Major.Mname;
                        info[i].Professions[j].Population = majors[j].Menrollment;
                    }
                }
                response.Code = 0;
                response.Data = info.ToArray();
            }
            catch (Exception ex)
            {
                _logger.LogInformation(ex, "An error occured while getting college enrollment info");
            }

            return(Json(response));
        }
Ejemplo n.º 13
0
        public IActionResult Manage(EnrollmentList list)
        {
            Course course = courseDB.Courses.FirstOrDefault(c => c.CourseId == list.CourseID);

            if (course != null)
            {
                if (ModelState.IsValid)
                {
                    if (list.EnrollQueue == null)
                    {
                        TempData["errorMessage"] = "Please select a valid student.";
                        EnrollmentInfo enrollInfo = CreateEnrollInfo(course);
                        return(View("User", enrollInfo));
                    }
                    foreach (long i in list.EnrollQueue)
                    {
                        Student       student = studentDB.Students.FirstOrDefault(s => s.StudentNumber == i);
                        CourseStudent csdb    = course.AddStudent(student);
                        studentDB.SaveStudent(student);
                        csDB.AddCourseStudents(csdb);
                    }
                    courseDB.SaveCourse(course);
                    TempData["successMessage"] = $"Student(s) successfully added to the course {course.Name}";
                    return(RedirectToAction(nameof(Display)));
                }
                else
                {
                    EnrollmentInfo enrollInfo = CreateEnrollInfo(course);
                    return(View("User", enrollInfo));
                }
            }
            else
            {
                TempData["errorMessage"] = "Please select a valid course!";
                return(RedirectToAction(nameof(Display)));
            }
        }
Ejemplo n.º 14
0
        private void lvEnrollment_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            Search();
            myE = new EnrollmentInfo();
            switch (e.Column)
            {
            case 0:
                if (SortAsc)
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "RegNo", "ASC");
                    SortAsc = false;
                }
                else
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "RegNo", "DESC");
                    SortAsc = true;
                }
                break;

            case 1:
                if (SortAsc)
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "Names", "ASC");
                    SortAsc = false;
                }
                else
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "Names", "DESC");
                    SortAsc = true;
                }
                break;

            case 2:
                if (SortAsc)
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "Age", "ASC");
                    SortAsc = false;
                }
                else
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "Age", "DESC");
                    SortAsc = true;
                }
                break;

            case 3:
                if (SortAsc)
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "AgeUnit", "ASC");
                    SortAsc = false;
                }
                else
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "AgeUnit", "DESC");
                    SortAsc = true;
                }
                break;

            case 4:
                if (SortAsc)
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "Sex", "ASC");
                    SortAsc = false;
                }
                else
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "Sex", "DESC");
                    SortAsc = true;
                }
                break;

            case 5:
                if (SortAsc)
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "RegDate", "ASC");
                    SortAsc = false;
                }
                else
                {
                    myE.lvEnrollmentSearchSort(lvEnrollment, strSearch, "RegDate", "DESC");
                    SortAsc = true;
                }
                break;
            }
            myE = null;
        }
Ejemplo n.º 15
0
 private void SetLabels()
 {
     myE = new EnrollmentInfo();
     lblNumerator.Text   = lvEnrollment.Items.Count.ToString();
     lblDenominator.Text = myE.GetAll().ToString();
 }