Esempio n. 1
0
 private void btnPrev_Click(object sender, EventArgs e)
 {
     try
     {
         if (page < 0)
         {
             page = 0;
         }
         this.lbCounter.Text = page.ToString() + "/" + classTotal.ToString();
         manageStudent myS = new manageStudent();
         string        sql = "SELECT * FROM wizstudents WHERE classId = " + this.classId + " ORDER BY systemId ASC LIMIT 1 OFFSET " + this.page;
         myS.getStudentByQuery(sql);
         //SELECT * FROM fi_posts WHERE wall = ? AND agent = ? ORDER BY postId DESC LIMIT $page ,$per_pa
         this.txtEnId.Text  = myS.enrolmentId;
         this.txtFname.Text = myS.firstName;
         this.txtLname.Text = myS.lastName;
         //get Attendance information
         manageAttendence myA = new manageAttendence();
         myA.getAttendence(sessions.currTerm, myS.enrolmentId);
         this.txtAbsent.Text  = myA.absentdays.ToString();
         this.txtPresent.Text = myA.presentdays.ToString();
         this.txtTotal.Text   = myA.totaldays.ToString();
         this.page           -= 1;
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in btnPrev_Click()" + ex);
     }
 }
Esempio n. 2
0
 private void btnNext_Click(object sender, EventArgs e)
 {
     try
     {
         if (page < classTotal)
         {
             this.lbCounter.Text = page.ToString() + "/" + classTotal.ToString();
             manageStudent myS = new manageStudent();
             string        sql = "SELECT * FROM wizstudents WHERE classId = " + this.classId + " ORDER BY systemId ASC LIMIT 1 OFFSET " + this.page;
             myS.getStudentByQuery(sql);
             this.txtEnId.Text  = myS.enrolmentId;
             this.txtFname.Text = myS.firstName;
             this.txtLname.Text = myS.lastName;
             manageAttendence myA = new manageAttendence();
             myA.getAttendence(sessions.currTerm, myS.enrolmentId);
             this.txtAbsent.Text  = myA.absentdays.ToString();
             this.txtPresent.Text = myA.presentdays.ToString();
             this.txtTotal.Text   = myA.totaldays.ToString();
             this.page           += 1;
         }
         else
         {
             MessageBox.Show("class total exceeded", "system notification", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in btnNext_Click()" + ex);
     }
 }
Esempio n. 3
0
 private void btnPresent_Click(object sender, EventArgs e)
 {
     try
     {
         var student            = this.txtEnId.Text;
         var attendDate         = this.txtDate.Value.ToShortDateString();
         manageAttendence  myA  = new manageAttendence();
         manageattendsheet myAs = new manageattendsheet();
         myAs.checkEntered(student, attendDate);
         if (myAs.dacFound == false)
         {
             myA.getAttendence(sessions.currTerm, student);
             if (myA.addPresent(sessions.currTerm, student) == true)
             {
                 if (myAs.setAttend(student, attendDate, this.classId, "P", sessions.currTerm) == true)
                 {
                     MessageBox.Show(this.txtFname.Text + " " + this.txtLname.Text + " marked present", "system info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.txtAbsent.Text  = myA.absentdays.ToString();
                     this.txtPresent.Text = myA.presentdays.ToString();
                     this.txtTotal.Text   = myA.totaldays.ToString();
                 }
                 else
                 {
                     MessageBox.Show("add atend failed");
                 }
             }
             else
             {
                 DialogResult dialogResult = MessageBox.Show("this tudent has already been marked do you want to modifly", "Confirm Option", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (dialogResult == DialogResult.Yes)
                 {
                     //get the attence enter
                     //update totals
                     //updade attendancee sheet
                 }
             }
         }
         else
         {
             MessageBox.Show("already marked");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in btnNext_Click()" + ex);
     }
 }
Esempio n. 4
0
 private void btnAbsent_Click(object sender, EventArgs e)
 {
     try
     {
         var student            = this.txtEnId.Text;
         var attendDate         = this.txtDate.Value.ToShortDateString();
         manageAttendence  myA  = new manageAttendence();
         manageattendsheet myAs = new manageattendsheet();
         myAs.checkEntered(student, attendDate);
         if (myAs.dacFound == false)
         {
             myA.getAttendence(sessions.currTerm, student);
             if (myA.addAbsent(sessions.currTerm, student) == true)
             {
                 if (myAs.setAttend(student, attendDate, this.classId, "A", sessions.currTerm) == true)
                 {
                     MessageBox.Show(this.txtFname.Text + " " + this.txtLname.Text + " marked absent", "system info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.txtAbsent.Text   = myA.absentdays.ToString();
                     this.txtPresent.Text  = myA.presentdays.ToString();
                     this.txtTotal.Text    = myA.totaldays.ToString();
                     this.lblShowList.Text = "List of students not marked in register";
                     string sql = "SELECT * FROM wizstudents WHERE classId = '" + this.classId + "' AND enrolmentId NOT IN (SELECT enrolmentId FROM wizattendsheet WHERE entryData = '" + attendDate + "' ) ";
                     this.fillStudents(sql);
                 }
                 else
                 {
                     MessageBox.Show("add atend failed");
                 }
             }
             else
             {
                 MessageBox.Show("failed tp add present in sumation file");
             }
         }
         else
         {
             DialogResult dialogResult = MessageBox.Show("this student has already been marked do you want to modifly", "Confirm Option", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (dialogResult == DialogResult.Yes)
             {
                 //get the attence enter
                 myAs.getAttend(student, attendDate);
                 //update totals
                 if (myAs.status == "A")
                 {
                     MessageBox.Show(this.txtFname.Text + " " + this.txtLname.Text + " already marked Absent", "system info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 }
                 else
                 {
                     myAs.getAttend(student, attendDate);
                     myA.getAttendence(sessions.currTerm, student);
                     myA.updateEntry(sessions.currTerm, student, "undo_present");
                     if (myAs.updateStatus(student, attendDate, "A") == true)
                     {
                         this.txtAbsent.Text  = myA.absentdays.ToString();
                         this.txtPresent.Text = myA.presentdays.ToString();
                         this.txtTotal.Text   = myA.totaldays.ToString();
                         MessageBox.Show(this.txtFname.Text + " " + this.txtLname.Text + " updated marked absent", "system info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                         this.lblShowList.Text = "List of students not marked in register";
                         string sql = "SELECT * FROM wizstudents WHERE classId = '" + this.classId + "' AND enrolmentId NOT IN (SELECT enrolmentId FROM wizattendsheet WHERE entryData = '" + attendDate + "' ) ";
                         this.fillStudents(sql);
                     }
                     else
                     {
                         MessageBox.Show("failed to update", "system info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
                 //updade attendancee sheet
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in btnNext_Click()" + ex);
     }
 }