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 frmUpdateUser_Load(object sender, EventArgs e) { try { if (sessions.userType == "A") { manageUsers myU = new manageUsers(); manageUserDetails myD = new manageUserDetails(); myD.getUserDetails(this.userId); myU.getUser(this.userId); MessageBox.Show(myU.userType); this.txtFname.Text = myD.firstName; this.txtLastName.Text = myD.lastName; if (myU.userType == "A") { this.cmbUserTyp.Text = "Admin"; } else if (myU.userType == "T") { this.cmbUserTyp.Text = "Teacher"; } else if (myU.userType == "C") { this.cmbUserTyp.Text = "Clerk"; } else if (myU.userType == "B") { this.cmbUserTyp.Text = "Blocked"; } } else { MessageBox.Show("user type not authorised to perform account management"); this.Close(); } } catch (Exception ex) { MessageBox.Show("failed in frmUpdateUser_Load() " + ex.Message); } }
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"); } }