private void cmbTeacher_TextChanged(object sender, EventArgs e) { try { if (startIntract == true) { int teacherId = Convert.ToInt32(this.cmbTeacher.SelectedValue); manageClassrooms myC = new manageClassrooms(); myC.getClassByTeacher(teacherId); if (myC.dacFound == true) { this.swapTeacher = true; MessageBox.Show(this.cmbTeacher.Text + "is already assigned to " + myC.className, "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { this.swapTeacher = false; } } } catch (Exception ex) { MessageBox.Show("failed in cmbTeacher_Leave() " + ex.Message); } }
private void dgvClassInfo_SelectionChanged(object sender, EventArgs e) { try { if (this.startIntract == true && this.dgvClassInfo.SelectedRows.Count > 0) { this.swapTeacher = false; this.txtClassName.Enabled = false; this.cmbClassGrade.Enabled = false; this.btnAdd.Enabled = false; this.btnUpdate.Enabled = true; var classId = dgvClassInfo.SelectedRows[0].Cells[0].Value.ToString(); manageClassrooms myC = new manageClassrooms(); myC.getClass(Convert.ToInt32(classId)); this.txtClassDes.Text = myC.classDetails; this.txtClassName.Text = myC.className; this.cmbClassGrade.Text = myC.classGrade.ToString(); manageUserDetails myU = new manageUserDetails(); myU.getUserDetails(myC.teacherId); cmbTeacher.Text = myU.lastName; cmbTeacher.SelectedValue = myC.teacherId; this.classId = myC.classRoomId; this.teacherId = myC.teacherId; } } catch (Exception ex) { MessageBox.Show("Failed on dgvClassInfo_SelectionChange" + ex, "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnAdd_Click(object sender, EventArgs e) { try { var className = this.txtClassName.Text; //var teacher = this.cmbTeacher.ValueMember; var teacher = Convert.ToInt32(cmbTeacher.SelectedValue); var grade = this.cmbClassGrade.Text; var des = this.txtClassDes.Text; if (className == "" || grade == "") { MessageBox.Show("class name requied and grade is required "); } else { manageClassrooms myC = new manageClassrooms(); if (myC.setClass(className, grade, Convert.ToInt32(teacher), des) == true) { MessageBox.Show("Added Class Successfully", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); this.refresh(); } } } catch (Exception ex) { MessageBox.Show("Failed to add class" + ex, "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
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); } }
private void cmbGrade_Leave(object sender, EventArgs e) { try { manageClassrooms myC = new manageClassrooms(); myC.getClass(sessions.classId); if (myC.classGrade.ToString() != this.cmbGrade.Text) { MessageBox.Show("You can only create exams for the grade you teach", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Error); this.cmbGrade.Focus(); } } catch (Exception ex) { MessageBox.Show("failed in cmbGrade_Leave() " + ex.Message); } }
private void Form1_Load(object sender, EventArgs e) { try { manageClassrooms myC = new manageClassrooms(); myC.getClassByTeacher(sessions.userId); sessions.classId = myC.classRoomId; sessions.classGrade = myC.classGrade; manageControl myCntr = new manageControl(); myCntr.getCntrl(); sessions.curPeriod = myCntr.currentPeriod; sessions.currTerm = myCntr.currTerm; } catch (Exception ex) { MessageBox.Show("failed in frmTeacherMainMenu() " + ex.Message); } }
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); } }
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"); } }
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); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { var className = this.txtClassName.Text; var teacher = this.cmbTeacher.Text; var grade = this.cmbClassGrade.Text; var des = this.txtClassDes.Text; if (className == "" || teacher == "" || grade == "") { MessageBox.Show("class name, teacher and grade required "); } else { manageClassrooms myC = new manageClassrooms(); myC.getClass(this.classId); myC.className = className; myC.teacherId = Convert.ToInt32(cmbTeacher.SelectedValue); myC.classGrade = Convert.ToInt32(grade); myC.classDetails = des; if (teacherId != Convert.ToInt32(cmbTeacher.SelectedValue)) { DialogResult dialogResult = MessageBox.Show("Are you sure you want to change the class teacher", "Confirm Option", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { if (swapTeacher == false) { DialogResult dialogResult2 = MessageBox.Show("this teacher was already assigned to a class if you update you the class will remail without a teacher", "Confirm Option", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult2 == DialogResult.Yes) { bool set = myC.updateClass(this.classId); if (set == true) { MessageBox.Show("Updated Class Successfully", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); this.fillClass(); } else { MessageBox.Show("Failed to update class", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { bool set = myC.updateClass(this.classId); if (set == true) { MessageBox.Show("Updated Class Successfully", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); this.fillClass(); } else { MessageBox.Show("Failed to update class", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } else { MessageBox.Show(this.classId.ToString()); bool set = myC.updateClass(this.classId); if (set == true) { MessageBox.Show("Updated Class Successfully", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); this.fillClass(); } else { MessageBox.Show("Failed to update class", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("application error fillTeacher() " + ex); } finally { this.txtClassName.Enabled = true; this.cmbClassGrade.Enabled = true; this.txtClassName.Text = ""; this.txtClassDes.Text = ""; this.btnAdd.Enabled = true; } }