Example #1
0
        /// <summary>
        /// Call this function to get subject list
        /// </summary>
        /// <param name="course_code">course code</param>
        /// <returns>SubjectCols collection</returns>
        public static List <SubjectCols> getSubjectList(string course_code)
        {
            List <SubjectCols> items = null;

            try
            {
                List <Row> rows = null;
                items = new List <SubjectCols>();;

                for (int t = 1; t <= Courses.getSemCount(course_code); t++)
                {
                    rows = Medatabase.fetchRecords("SELECT * FROM subject_master WHERE course_code='" + course_code + "' AND semester=" + t);
                    foreach (Row row in rows)
                    {
                        items.Add(new SubjectCols {
                            subject_code = (string)row.column["sub_code"],
                            subject_name = (string)row.column["name"],
                            semNo        = (semNo)row.column["semester"],
                            credits      = (int)row.column["credits"]
                        });
                    }
                }
            }
            catch (databaseException)
            {
                //do something
            }
            catch (Exception ex)
            {
                //do something
                LogWriter.WriteError("While fetching subject list from database", ex.Message);
            }
            return(items);
        }
Example #2
0
        /// <summary>
        /// fetches all course_codes from database if regular student
        /// else it fetches all course_codes only for which exam has held
        /// </summary>
        /// <param name="stype">Regular or non-regular</param>
        /// <returns>course_code string collection</returns>
        public static List <string> getCourseCodes(StudentType stype)
        {
            List <String> ccodes = new List <String>();

            try
            {
                List <Row> rows;
                if (stype == StudentType.REGULAR)
                {
                    rows = Medatabase.fetchRecords("SELECT course_code FROM course_master");
                }
                else
                {
                    rows = Medatabase.fetchRecords("SELECT DISTINCT course_code FROM exam_master");
                }
                foreach (Row row in rows)
                {
                    ccodes.Add((string)row.column["course_code"]);
                }
            }
            catch (databaseException)
            {
                //Do something
            }
            catch (Exception ex)
            {
                //Do something
                LogWriter.WriteError("Fetching course code list from database", ex.Message);
            }
            return(ccodes);
        }
Example #3
0
        /// <summary>
        /// For filling course data in listview
        /// </summary>
        /// <returns>CourseCols collection</returns>
        public static List <CourseCols> getCourseList()
        {
            List <CourseCols> items = null;

            try
            {
                List <Row> rows = Medatabase.fetchRecords("SELECT * FROM course_master");
                items = new List <CourseCols>();

                foreach (Row row in rows)
                {
                    items.Add(new CourseCols
                    {
                        c_code       = (string)row.column["course_code"],
                        t_semesters  = (int)row.column["total_semesters"],
                        in_semesters = (int)row.column["in_semesters"]
                    });
                }
            }
            catch (databaseException)
            {
                //Do Something
            }
            catch (Exception ex)
            {
                //Do Something
                LogWriter.WriteError("Fetching course list from database", ex.Message);
            }
            return(items);
        }
Example #4
0
        /// <summary>
        /// Returns the number of subject presents in a given course
        /// </summary>
        /// <param name="course_code">course code</param>
        /// <returns>integer</returns>
        public static int getSubjectCount(String course_code)
        {
            int        count = 0;
            List <Row> rows  = Medatabase.fetchRecords("SELECT COUNT(sub_code) AS scount FROM subject_master WHERE course_code='" + course_code + "'");

            if (rows.Count > 0)
            {
                count = Convert.ToInt16(rows[0].column["scount"]);
            }
            return(count);
        }
Example #5
0
        /// <summary>
        /// This method will return the no. of sems(in) in a particular course
        /// </summary>
        /// <param name="course_code">course for which sem count is requested</param>
        /// <returns>Total sems count</returns>
        public static int getInSemCount(string course_code)
        {
            int        scount = 0;
            List <Row> rows   = Medatabase.fetchRecords("SELECT in_semesters FROM course_master WHERE course_code='" + course_code + "'");

            foreach (Row row in rows)
            {
                scount = (int)row.column["in_semesters"];
            }
            return(scount);
        }
Example #6
0
 private void cbxAYear_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cbxAYear.SelectedIndex != -1)
     {
         List <String> months = new List <String>();
         foreach (Row row in Medatabase.fetchRecords("SELECT DISTINCT month FROM exam_master WHERE course_code='" + (String)cbxACourse.SelectedItem + "' AND semester=" + Convert.ToInt16(cbxASem.SelectedItem)))
         {
             months.Add((String)row.column["month"]);
         }
         cbxAMonth.ItemsSource = months;
     }
 }
Example #7
0
 private void cbxASem_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cbxASem.SelectedIndex != -1)
     {
         List <int> years = new List <int>();
         foreach (Row row in Medatabase.fetchRecords("SELECT DISTINCT year FROM exam_master WHERE course_code='" + (String)cbxACourse.SelectedItem + "' AND semester=" + Convert.ToInt16(cbxASem.SelectedItem)))
         {
             years.Add(Convert.ToInt16(row.column["year"]));
         }
         cbxAYear.ItemsSource  = years;
         cbxAYear.Text         = "-- YEAR --";
         cbxAMonth.ItemsSource = null;
         cbxAMonth.Text        = "-- MONTH --";
     }
 }
Example #8
0
        /// <summary>
        /// Returns batch years of a course
        /// </summary>
        /// <param name="course_code">course code</param>
        /// <returns>int collection</returns>
        public static List <int> getBatchList(String course_code)
        {
            List <int> list = new List <int>();

            try
            {
                List <Row> rows = Medatabase.fetchRecords("SELECT DISTINCT year FROM student_details WHERE course_code='" + course_code + "'");
                foreach (Row row in rows)
                {
                    list.Add((int)row.column["year"]);
                }
            }
            catch (Exception)
            {
                //Something went wrong
            }
            return(list);
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtUsername.GetLineLength(0) == 0 || txtPassword.Password.Length == 0)
                {
                    MessageBox.Show("Please input all the fields!", "WAIT", MessageBoxButton.OK, MessageBoxImage.Stop);
                    return;
                }

                string     tmp  = null;
                List <Row> rows = Medatabase.fetchRecords("SELECT password FROM admin_login WHERE username='******'");
                foreach (Row row in rows)
                {
                    tmp = (string)row.column["password"];
                }

                if (string.Compare(tmp, txtPassword.Password) != 0 || tmp == null)
                {
                    MessageBox.Show("Invalid username or password!", "Error", MessageBoxButton.OK, MessageBoxImage.Stop);
                    return;
                }
                admin_window obj = new admin_window();
                obj.Show();
                this.Hide();
            }
            catch (databaseException de)
            {
                MessageBox.Show(de.Message, "Error Occured", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong :(", "Error Occured", MessageBoxButton.OK, MessageBoxImage.Error);
                LogWriter.WriteError("Login button clicked", ex.Message);
            }
        }
Example #10
0
        /// <summary>
        /// Returns student details list
        /// </summary>
        /// <param name="course_code">Course code</param>
        /// <param name="year">Batch or year</param>
        /// <returns>Studentcols collection</returns>
        public static List <StudentCols> getStudentList(String course_code, int year)
        {
            List <StudentCols> items = new List <StudentCols>();

            try
            {
                List <Row> rows = Medatabase.fetchRecords("SELECT * FROM student_details WHERE course_code='" + course_code + "' AND year=" + year);

                foreach (Row row in rows)
                {
                    items.Add(new StudentCols
                    {
                        s_reg_id = (long)row.column["registration_id"],
                        s_name   = (string)row.column["name"],
                        s_month  = (string)row.column["month"]
                    });
                }
            }
            catch (Exception ex)
            {
                LogWriter.WriteError("fetching student details", ex.Message);
            }
            return(items);
        }
Example #11
0
        private void btnEvaluate_Click(object sender, RoutedEventArgs e)
        {
            bool isAllOk = true;

            //validation
            String error_message = null;

            if (System.IO.File.Exists(txtIMFile.Text) == false)
            {
                error_message = "Please select internal marksheet file" + Environment.NewLine;
            }
            if (System.IO.File.Exists(txtEMFile.Text) == false)
            {
                error_message += "Please select external marksheet file" + Environment.NewLine;
            }
            if (System.IO.File.Exists(txtCutoffFile.Text) == false)
            {
                error_message += "Please select cut off file" + Environment.NewLine;
            }
            if (cbxECourse.SelectedIndex == -1)
            {
                error_message += "Please select course" + Environment.NewLine;
            }
            if (cbxESem.SelectedIndex == -1)
            {
                error_message += "Please select semester" + Environment.NewLine;
            }
            if (cbxEMonth.SelectedIndex == -1)
            {
                error_message += "Please select month" + Environment.NewLine;
            }
            if (cbxEType.SelectedIndex == -1)
            {
                error_message += "Please select student type" + Environment.NewLine;
            }
            if (cbxEYear.SelectedIndex == -1)
            {
                error_message += "Please select year" + Environment.NewLine;
            }

            if (error_message != null)
            {
                isAllOk = false;
                MessageBox.Show("Please correct the following error(s)!" + Environment.NewLine + Environment.NewLine + error_message, "Invalid inputs", MessageBoxButton.OK, MessageBoxImage.Stop);
            }

            if (isAllOk) //Call for validation and evaluation
            {
                //get values from controls
                int    semester = (int)cbxESem.SelectedItem;
                int    year     = Convert.ToInt16(cbxEYear.SelectedItem);
                string course   = (String)cbxECourse.SelectedItem;

                string month = (cbxEMonth.SelectedItem as ComboBoxItem).Content.ToString(); //As the item is comboboxitem

                try
                {
                    List <Row> rows = Medatabase.fetchRecords("SELECT * FROM exam_master WHERE course_code='" + course + "' AND semester=" + semester + " AND year=" + year + " AND month='" + month + "'");

                    if (cbxEType.SelectedIndex == 0) //check if evaluation has already finished for given course, semester and date
                    {
                        if (rows.Count > 0)
                        {
                            MessageBox.Show("Evaluation has been finished already for semester " + semester + " of " + course + " on " + month + " " + year, "Stop", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                    }
                    else //check if evaluation has been done or not for given course, semester and date
                    {
                        if (rows.Count == 0)
                        {
                            MessageBox.Show("No record of evaluation for semester " + semester + " of " + course + " on " + month + " " + year, "No records of exam for given values", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Something went wrong!");
                    return;
                }

                MessageBox.Show("Your files are going to be validated!", "Evaluator", MessageBoxButton.OK, MessageBoxImage.Information);
                tabControl.IsEnabled = false;
                this.Cursor          = Cursors.Wait;
                txtEvalOutput.Clear();

                StudentType stype = StudentType.REGULAR;
                if (String.Compare("Regular", (cbxEType.SelectedItem as ComboBoxItem).Content.ToString(), true) == 0)
                {
                    stype = StudentType.REGULAR;
                }
                else if (String.Compare("Failed", (cbxEType.SelectedItem as ComboBoxItem).Content.ToString(), true) == 0)
                {
                    stype = StudentType.FAILURE;
                }
                else
                {
                    stype = StudentType.ABSENT;
                }

                (new Evaluator(txtIMFile.Text, txtEMFile.Text, txtCutoffFile.Text)).validateWorksheets(course, semester, year, month, stype);
            }
        }