Example #1
0
        public void InserIntoAttendanceInfoTable(AttendanceInputClass attndInputObj)
        {
            connection.Open();
            string insertString = "INSERT INTO Attendance_Info_Table VALUES('" + attndInputObj.StudentID + "', '" + attndInputObj.DeptID + "', '" + attndInputObj.TeacherOneID + "', '" + attndInputObj.TeacherTwoID + "','" + attndInputObj.CourseNo + "','" + attndInputObj.Year + "','" + attndInputObj.Semester + "','" + attndInputObj.InTime + "','" + "" + "','" + attndInputObj.Date + "')";

            SqlCommand command = new SqlCommand(insertString, connection);

            command.ExecuteNonQuery();
            connection.Close();
        }
Example #2
0
        public int CheckStudent(AttendanceInputClass attndInputObj)
        {
            connection.Open();
            string        queryString = "SELECT Student_ID,Out_Time FROM Attendance_Info_Table WHERE Student_ID=('" + attndInputObj.StudentID + "') AND Course_No=('" + attndInputObj.CourseNo + "') AND Date='" + attndInputObj.Date + "'  ";
            SqlCommand    command     = new SqlCommand(queryString, connection);
            SqlDataReader reader      = command.ExecuteReader();

            while (reader.Read())
            {
                tempStID    = Convert.ToInt32(reader["Student_ID"]);
                tempOutTime = reader["Out_Time"].ToString();
            }
            connection.Close();
            if (tempOutTime == "00:00:00")
            {
                return(1);
            }
            else
            {
                return(tempStID);
            }
        }
        private void stIDTextBox_TextChanged(object sender, EventArgs e)
        {
            if (stIDTextBox.TextLength == 6)
            {
                //AutoClosingMessageBox.Show("Welcome Student Attendance System", " ", 1000);
                //MessageBox.Show("Welcome Student Attendance System");
                gateway     = new Gateway();
                attend_ob   = new AttendanceFormClass();
                attndRtnObj = new AttendRoutineClass();

                DateTime now = DateTime.Now;
                systemDay  = now.ToString("dddd");
                systemTime = now.ToString("HH:mm:00");
                systemDate = now.ToShortDateString();

                roll = Convert.ToInt32(stIDTextBox.Text);

                attend_ob = gateway.RetrieveFromStudentInfoTable(roll);
                temp      = attend_ob.StudentId;
                if (temp != 0)
                {
                    year        = (attend_ob.StudentYear).ToString();
                    semester    = (attend_ob.StudentSemester).ToString();
                    attndRtnObj = gateway.RetrieveFromRoutineInfoTable(systemDay, year, semester, systemTime);
                    if (attndRtnObj.DeptID != 0)
                    {
                        int    studentID    = attend_ob.StudentId;
                        int    deptId       = attndRtnObj.DeptID;
                        int    teacherOneID = attndRtnObj.TeacherOneID;
                        int    teacherTwoID = attndRtnObj.TeacherTwoID;
                        string courseNo     = attndRtnObj.CourseNo;
                        year     = attndRtnObj.Year;
                        semester = attndRtnObj.Semester;

                        attndInputObj = new AttendanceInputClass();

                        attndInputObj.StudentID    = studentID;
                        attndInputObj.DeptID       = deptId;
                        attndInputObj.TeacherOneID = teacherOneID;
                        attndInputObj.TeacherTwoID = teacherTwoID;
                        attndInputObj.CourseNo     = courseNo;
                        attndInputObj.Year         = year;
                        attndInputObj.Semester     = semester;
                        attndInputObj.InTime       = systemTime;
                        attndInputObj.Date         = systemDate;

                        int checkStudent = gateway.CheckStudent(attndInputObj);
                        if (checkStudent == 1)
                        {
                            gateway.UpdateOutTime(systemTime, studentID);
                            AutoClosingMessageBox.Show("Good Bye!!!!.", " ", 1500);
                        }
                        else if (checkStudent == studentID)
                        {
                            AutoClosingMessageBox.Show("You Already attended to this Class!!!", " ", 1500);
                        }
                        else
                        {
                            gateway.InserIntoAttendanceInfoTable(attndInputObj);
                            AutoClosingMessageBox.Show("Welcome " + attend_ob.StudentName + " !!!", " ", 1500);
                        }
                    }
                    else
                    {
                        AutoClosingMessageBox.Show("Class is not continue at this time!!!", " ", 1500);
                    }
                }
                else
                {
                    AutoClosingMessageBox.Show("Student not found!!!", " ", 2000);
                }
                stIDTextBox.ResetText();
            }
        }