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); } }
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); } }
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 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 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); } }
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); } }