コード例 #1
0
        public AttendanceFormClass RetrieveFromStudentInfoTable(int roll)
        {
            attendobj = new AttendanceFormClass();

            connection.Open();
            string        queryString = "SELECT * FROM Student_Info_Table WHERE Student_ID=('" + roll + "') ";
            SqlCommand    command     = new SqlCommand(queryString, connection);
            SqlDataReader reader      = command.ExecuteReader();

            while (reader.Read())
            {
                attendobj.StudentId       = Convert.ToInt32(reader["Student_ID"]);
                attendobj.StudentName     = reader["St_Name"].ToString();
                attendobj.StudentDept     = Convert.ToInt32(reader["Dept_ID"]);
                attendobj.StudentYear     = reader["Year"].ToString();
                attendobj.StudentSemester = reader["Semester"].ToString();
            }

            connection.Close();
            return(attendobj);
        }
コード例 #2
0
        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();
            }
        }