Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
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");
     }
 }
Ejemplo n.º 5
0
 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;
     }
 }