예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #3
0
 private void dgvStudents_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         this.studentId       = Convert.ToInt32(dgvStudents.SelectedRows[0].Cells[0].Value);
         this.txtComment.Text = "";
         this.txtMark.Text    = "";
         manageStudent myS = new manageStudent();
         myS.getStudentId(this.studentId);
         this.txtFname.Text    = myS.firstName;
         this.txtLastname.Text = myS.lastName;
         manageMarks myM = new manageMarks();
         myM.getMarkByPaper(studentId, paperId);
         if (myM.dacFound == true)
         {
             MessageBox.Show("Marks for this paper already " + myS.firstName + " " + myS.lastName, "system info", MessageBoxButtons.OK, MessageBoxIcon.Question);
             this.txtComment.Text   = myM.remarks;
             this.markId            = myM.markId;
             this.txtMark.Text      = myM.attainedMark.ToString();
             this.btnRecord.Enabled = false;
             this.btnDelete.Enabled = true;
             this.btnUpdate.Enabled = true;
         }
         else
         {
             this.btnDelete.Enabled = false;
             this.btnUpdate.Enabled = false;
             this.btnRecord.Enabled = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in dgvStudents_DoubleClick() " + ex.Message);
     }
 }
예제 #4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         manageStudent        mys  = new manageStudent();
         managestudentdetails mysd = new managestudentdetails();
         mys.getStudentId(this.enId);
         DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete " + mys.firstName + " " + mys.lastName, "Confirm Option", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dialogResult == DialogResult.Yes)
         {
             if (mysd.deleteStudent(this.enId.ToString()) == true)
             {
                 if (mys.deleteStudent(this.enId) == true)
                 {
                     MessageBox.Show("student deleted success", "input error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     string sql = "SELECT enrolmentId,firstName,lastName,gender FROM wizstudents ORDER BY systemId DESC ";
                     this.fillStudents(sql);
                 }
                 else
                 {
                     MessageBox.Show("failed to delete student", "input error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("application error dgvStudents_CellDoubleClick() " + ex);
     }
 }
예제 #5
0
        private void frmStudentDetails_Load(object sender, EventArgs e)
        {
            try
            {
                //this.ta.Focus();
                this.fillClass();
                this.Student.SelectedIndex = 0;
                this.txtFirstName.Focus();
                if (this.update == true)
                {
                    this.btnSave.Enabled     = false;
                    this.btnGenerate.Enabled = false;
                    this.txtEnroiD.Text      = this.enrollmentId.ToString();
                    manageStudent        myS  = new manageStudent();
                    managestudentdetails mySd = new managestudentdetails();
                    manageClassrooms     myC  = new manageClassrooms();
                    myS.getStudentId(this.enrollmentId);
                    mySd.getStudentDetails(Convert.ToString(this.enrollmentId));
                    myC.getClass(myS.classId);
                    this.txtFirstName.Text          = myS.firstName;
                    this.txtMidName.Text            = myS.middleName;
                    this.tXTSurname.Text            = myS.lastName;
                    this.cmbClassRoom.SelectedValue = myS.classId.ToString();
                    string bday = myS.DOB.Replace("/", ".");
                    this.txtDob.Value = Convert.ToDateTime(bday);
                    //this.txtDob.Text = ;
                    // this.cmbClassRoom.Text = myC.className;
                    if (myS.gender == "M")
                    {
                        this.rdbMale.Checked = true;
                    }

                    else if (myS.gender == "F")
                    {
                        this.metroRadioButton2.Checked = true;
                    }
                    this.txtAddress.Text         = mySd.address;
                    this.txtEmail.Text           = mySd.email;
                    this.txtGuardianSurname.Text = mySd.guardianSname;
                    this.txtGuardianFname.Text   = mySd.guardianFname;
                    this.txtRel.Text             = mySd.relationship;
                    this.txtPhone.Text           = mySd.mobileNumber;
                }
                else
                {
                    manageControl myC = new manageControl();
                    myC.getCntrl();
                    this.txtEnroiD.Text = myC.enrollmentId.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("application error frmStudentDetails_Load()" + ex);
            }
        }
예제 #6
0
 private void frmAttendance_Load(object sender, EventArgs e)
 {
     try
     {
         if (sessions.userType == "T")
         {
             manageClassrooms myC = new manageClassrooms();
             manageStudent    myS = new manageStudent();
             myC.getClassByTeacher(sessions.userId);
             this.classId        = myC.classRoomId;
             this.classTotal     = 3;
             this.lbCounter.Text = page.ToString() + "/" + classTotal.ToString();
             this.fillStudents();
         }
     }
     catch (MySqlException ex)
     {
         System.Windows.Forms.MessageBox.Show("frmAttendance_Load()  " + ex);
     }
 }
예제 #7
0
 private void txtEnrolId_Leave(object sender, EventArgs e)
 {
     try
     {
         /*get student information*/
         manageStudent myS = new manageStudent();
         myS.getStudentId(Convert.ToInt32(this.txtEnrolId.Text));
         if (myS.dacFound == true)
         {
             this.txtFname.Text      = myS.firstName;
             this.btnProcess.Enabled = true;
             this.txtLastName.Text   = myS.lastName;
             manageClassrooms myClass = new manageClassrooms();
             myClass.getClass(myS.classId);
             this.txtClass.Text = myClass.className;
             /*get balance information*/
             managefeesBalance myB = new managefeesBalance();
             myB.getBalance(this.txtEnrolId.Text, sessions.currTerm);
             this.txtCurBalance.Text = myB.ClosingBal.ToString();
             this.txtOpenBal.Text    = myB.OpenBal.ToString();
             this.txtPaid.Text       = myB.PaymentIn.ToString();
             /*populate transactions*/
             this.fillTrans(Convert.ToInt32(this.txtEnrolId.Text));
             /*gather invoice information*/
             manageUserDetails myU = new manageUserDetails();
             myU.getUserDetails(sessions.userId);
             //this.dictInvoice.Add("receiptTeller", myU.firstName + " " + myU.lastName);
             //this.dictInvoice.Add("studentName", myS.firstName + " " + myS.lastName);
         }
         else
         {
             MessageBox.Show("Enrolment id not registered in system", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in txtEnrolId_Leave() " + ex, "system error");
     }
 }
예제 #8
0
 private void txtEnId_Leave(object sender, EventArgs e)
 {
     try
     {
         /*get student information*/
         manageStudent myS = new manageStudent();
         myS.getStudentId(Convert.ToInt32(this.txtEnId.Text));
         if (myS.dacFound == true)
         {
             this.txtFname.Text = myS.firstName;
             this.txtSname.Text = myS.lastName;
         }
         else
         {
             MessageBox.Show("Enrolment id not registered in system", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("failed in txtEnId_Leave()" + ex.Message);
     }
 }
예제 #9
0
 private void frmAttendance_Load(object sender, EventArgs e)
 {
     try
     {
         if (sessions.userType == "T")
         {
             manageClassrooms myC = new manageClassrooms();
             manageStudent    myS = new manageStudent();
             myC.getClassByTeacher(sessions.userId);
             this.classId    = myC.classRoomId;
             this.classTotal = 3;
             var attendDate = this.txtDate.Value.ToShortDateString();
             this.lbCounter.Text   = page.ToString() + "/" + classTotal.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);
         }
     }
     catch (MySqlException ex)
     {
         System.Windows.Forms.MessageBox.Show("frmAttendance_Load()  " + ex);
     }
 }
예제 #10
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         var    enrID     = Convert.ToInt32(this.txtEnroiD.Text);
         var    firstName = this.txtFirstName.Text;
         var    mdlName   = this.txtMidName.Text;
         var    lastName  = this.tXTSurname.Text;
         var    DOB       = this.txtDob.Value.ToShortDateString();
         string sex       = "";
         var    classId   = Convert.ToInt32(this.cmbClassRoom.SelectedValue);
         if (this.rdbMale.Checked == true)
         {
             sex = "M";
         }
         if (this.metroRadioButton2.Checked == true)
         {
             sex = "F";
         }
         /*other information*/
         var address   = this.txtAddress.Text;
         var phone     = this.txtPhone.Text;
         var gurdFname = this.txtGuardianFname.Text;
         var gurdSname = this.txtGuardianSurname.Text;
         var gurdPhone = this.txtMobileNumbe.Text;
         var email     = this.txtEmail.Text;
         var rel       = this.txtRel.Text;
         /*validate required field*/
         if (enrID.ToString() == "")
         {
             MessageBox.Show("Enrollmend Id is required", "input error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.txtEnroiD.Focus();
         }
         else if (firstName == "")
         {
             MessageBox.Show("firstName is required", "input error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.txtFirstName.Focus();
         }
         else if (lastName == "")
         {
             MessageBox.Show("lastName is required", "input error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.tXTSurname.Focus();
         }
         else
         {
             manageStudent        myS       = new manageStudent();
             managestudentdetails mydetails = new managestudentdetails();
             if (myS.checkExists(enrID) == 1)
             {
                 if (mydetails.checkExists(enrID) == 1)
                 {
                     myS.getStudentId(enrID);
                     myS.firstName  = firstName;
                     myS.DOB        = DOB;
                     myS.lastName   = lastName;
                     myS.classId    = classId;
                     myS.gender     = sex;
                     myS.middleName = txtMidName.Text;
                     if (myS.updateStudent(enrID) == true)
                     {
                         mydetails.getStudentDetails(enrID.ToString());
                         mydetails.address       = address;
                         mydetails.guardianFname = gurdFname;
                         mydetails.guardianSname = gurdSname;
                         mydetails.relationship  = rel;
                         mydetails.mobileNumber  = phone;
                         if (mydetails.updateStudentDetails(enrID.ToString()) == true)
                         {
                             MessageBox.Show("student updated success ", "System notifification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                     }
                 }
                 else
                 {
                     if (mydetails.setStudentDetails(enrID, address, gurdFname, gurdSname, rel, gurdPhone, email) == true)
                     {
                         myS.getStudentId(enrID);
                         myS.firstName = firstName;
                         myS.DOB       = DOB;
                         myS.lastName  = lastName;
                         myS.classId   = classId;
                         myS.gender    = sex;
                         if (myS.updateStudent(enrID) == true)
                         {
                             MessageBox.Show("student updated success ", "System notifification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                     }
                 }
             }
             else
             {
                 MessageBox.Show("student not in the system", "System notifification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("application error " + ex);
     }
 }
예제 #11
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         var    enrID     = Convert.ToInt32(this.txtEnroiD.Text);
         var    firstName = this.txtFirstName.Text;
         var    mdlName   = this.txtMidName.Text;
         var    lastName  = this.tXTSurname.Text;
         var    DOB       = this.txtDob.Value.ToShortDateString();
         string sex       = "";
         var    classId   = Convert.ToInt32(this.cmbClassRoom.SelectedValue);
         if (this.rdbMale.Checked == true)
         {
             sex = "M";
         }
         if (this.metroRadioButton2.Checked == true)
         {
             sex = "F";
         }
         /*other information*/
         var address   = this.txtAddress.Text;
         var phone     = this.txtPhone.Text;
         var gurdFname = this.txtGuardianFname.Text;
         var gurdSname = this.txtGuardianSurname.Text;
         var gurdPhone = this.txtMobileNumbe.Text;
         var email     = this.txtEmail.Text;
         var rel       = this.txtRel.Text;
         /*validate required field*/
         if (enrID.ToString() == "")
         {
             MessageBox.Show("Enrollmend Id is required", "input error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.txtEnroiD.Focus();
         }
         else if (firstName == "")
         {
             MessageBox.Show("firstName is required", "input error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.txtFirstName.Focus();
         }
         else if (lastName == "")
         {
             MessageBox.Show("lastName is required", "input error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.tXTSurname.Focus();
         }
         else
         {
             manageStudent myS = new manageStudent();
             if (myS.checkExists(enrID) == 0)
             {
                 if (myS.setStudent(enrID, firstName, mdlName, lastName, classId, DOB, sex) == true)
                 {
                     managestudentdetails mydetails = new managestudentdetails();
                     if (mydetails.setStudentDetails(enrID, address, gurdFname, gurdSname, rel, gurdPhone, email) == true)
                     {
                         MessageBox.Show("student enrolled succesifully", "System notifification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     }
                     else
                     {
                         myS.deleteStudent(enrID);
                         MessageBox.Show("failed to add student to system try again ", "System notifification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     }
                 }
             }
             else
             {
                 MessageBox.Show("enrollmentId already in system", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("application error frmStudentDetails_Load()" + ex);
     }
 }