예제 #1
0
        public tblstudenthealthrecord GetStudHealthRecord(int studentHealthRecordId)
        {
            tblstudenthealthrecord studentHealthRecord = (from p in svmContext.tblstudenthealthrecord
                                                          where p.isDeleted == false && p.StudentHealthRecordId == studentHealthRecordId
                                                          select p).FirstOrDefault();

            return(studentHealthRecord);
        }
예제 #2
0
        public void UpdateHealthBackground(int studentId, string childsDoctor, string doctorsContactNo,
                                           string doctorsBusinessNameAndAddress, bool immunization, int healthConcernId, string allergies, string conditionHindrance, string specialCare)
        {
            tblstudenthealthrecord tblStudentHealthRecord = new tblstudenthealthrecord();

            tblStudentHealthRecord.ChildsDoctor     = childsDoctor;
            tblStudentHealthRecord.DoctorsContactNo = doctorsBusinessNameAndAddress;
            tblStudentHealthRecord.DoctorsBusinessNameAndAddress = doctorsBusinessNameAndAddress;
            tblStudentHealthRecord.Immunization       = immunization;
            tblStudentHealthRecord.HealthConcernId    = healthConcernId;
            tblStudentHealthRecord.Allergies          = allergies;
            tblStudentHealthRecord.ConditionHindrance = conditionHindrance;
            tblStudentHealthRecord.SpecialCare        = specialCare;
        }
예제 #3
0
        public void LoadStudent()
        {
            int result;


            //if (cmbStudentNo.SelectedValue != null)
            //{



            if (int.TryParse(Global.selectedStudent.ToString(), out result))
            {
                //disable buttons------------
                txtFirstName.Enabled            = false;
                txtMiddleName.Enabled           = false;
                txtLastName.Enabled             = false;
                dpDateOfBirth.Enabled           = false;
                txtPlaceOfBirth.Enabled         = false;
                cmbGender.Enabled               = false;
                txtReligion.Enabled             = false;
                txtCitizenship.Enabled          = false;
                txtPostalCode.Enabled           = false;
                rtbPermanentAddress.Enabled     = false;
                btnUpload.Enabled               = false;
                txtStudentNo.ReadOnly           = true;
                dgEducationalBackground.Enabled = false;
                dgFamilyBackground.Enabled      = false;

                txtChildsDoctor.Enabled     = false;
                txtDoctorsContactNo.Enabled = false;
                txtAllergies.Enabled        = false;
                rtbDoctorBizAddress.Enabled = false;
                cbComplete.Enabled          = false;
                cbIncomplete.Enabled        = false;
                cmbHealthConcern.Enabled    = false;


                rtbSpecialProcedure.Enabled = false;

                btnSave.Hide();
                btnEdit.Show();
                isEdit = true;
                //----------------------------



                student = _studentService.GetStudent(Global.selectedStudent);

                if (student != null)
                {
                    txtStudentNo.Text  = student.StudentId.ToString().PadLeft(4, '0') + " - " + student.AY.ToString();
                    txtFirstName.Text  = student.FirstName;
                    txtMiddleName.Text = student.MiddleName;
                    txtLastName.Text   = student.LastName;
                    dpDateOfBirth.Text = student.DateOfBirth != dpDateOfBirth.MinDate ? student.DateOfBirth.ToString() : string.Empty;

                    txtPlaceOfBirth.Text     = student.PlaceOfBirth;
                    cmbGender.SelectedValue  = student.GenderId;
                    txtReligion.Text         = student.Religion;
                    txtCitizenship.Text      = student.Citizenship;
                    txtPostalCode.Text       = student.PostalCode;
                    rtbPermanentAddress.Text = student.PermanentAddress;
                    pbStudentImage.Image     = !string.IsNullOrEmpty(student.path) ? Image.FromFile(student.path) : Image.FromFile(defaultImage);
                    newPath = student.path;
                    //render family background
                }


                studentEducationalBackground = _studentService.GetEducationalBackground(Global.selectedStudent);
                if (studentEducationalBackground != null)
                {
                    dgEducationalBackground.ClearSelection();
                    dgEducationalBackground.Columns.Clear();
                    dgFamilyBackground.ClearSelection();
                    dgFamilyBackground.Columns.Clear();


                    var educBindingList = new BindingList <tblstudenteducationalbackground>(studentEducationalBackground);
                    var educSource      = new BindingSource(educBindingList, null);

                    dgEducationalBackground.DataSource = educSource;

                    DataGridViewComboBoxColumn lvlCol = new DataGridViewComboBoxColumn();
                    lvlCol.Items.Insert(0, string.Empty);
                    lstEducLevel = _studentService.GetEducationLevel();
                    lstEducLevel.Insert(0, new tbldimeducationlevel {
                        LevelId = 0, Level = string.Empty
                    });
                    lvlCol.DataSource       = lstEducLevel;
                    lvlCol.ValueMember      = "LevelId";
                    lvlCol.DisplayMember    = "Level";
                    lvlCol.DataPropertyName = "EducLevelId";
                    lvlCol.Name             = "Level";

                    dgEducationalBackground.Columns.Insert(0, lvlCol);
                    dgEducationalBackground.Columns["EducLevelId"].HeaderText = "Level";
                    dgEducationalBackground.Columns["StudentId"].Visible      = false;
                    dgEducationalBackground.Columns["IsDeleted"].Visible      = false;
                    //dgEducationalBackground.Columns[7].Visible = false;
                    // dgEducationalBackground.Columns["LevelId"].Visible = false;
                    dgEducationalBackground.Columns["SchoolName"].HeaderText     = "School Name and Address";
                    dgEducationalBackground.Columns["SchoolYear"].HeaderText     = "School Year";
                    dgEducationalBackground.Columns["AwardsReceived"].HeaderText = "Awards Received";


                    studentFamily = _studentService.GetStudentFamily(Global.selectedStudent);
                    if (studentFamily != null)
                    {
                        var famBindingList = new BindingList <tblstudentfamily>(studentFamily);
                        var famcSource     = new BindingSource(famBindingList, null);
                        dgFamilyBackground.DataSource = famcSource;

                        DataGridViewComboBoxColumn cmbRelation = new DataGridViewComboBoxColumn();
                        // DataGridViewColumn cmbLevel = new DataGridViewColumn(bc);
                        //cmbRelation.Items.Insert(0, String.Empty);
                        lstRelationship = _studentService.GetRelationship();
                        lstRelationship.Insert(0, new tblrelationship {
                            RelationshipId = 0, RelationshipName = String.Empty
                        });
                        cmbRelation.DataSource       = lstRelationship;
                        cmbRelation.ValueMember      = "RelationshipId";
                        cmbRelation.DisplayMember    = "RelationshipName";
                        cmbRelation.DataPropertyName = "RelationshipId";


                        dgFamilyBackground.Columns["RelationshipId"].Visible = false;
                        dgFamilyBackground.Columns.Insert(1, cmbRelation);
                        dgFamilyBackground.Columns["name"].HeaderText                  = "Name";
                        dgFamilyBackground.Columns["citizenship"].HeaderText           = "Citizenship";
                        dgFamilyBackground.Columns["Religion"].HeaderText              = "Religion";
                        dgFamilyBackground.Columns["Address"].HeaderText               = "Home Address";
                        dgFamilyBackground.Columns["TelNo"].HeaderText                 = "Tel No";
                        dgFamilyBackground.Columns["MobileNo"].HeaderText              = "Mobile No";
                        dgFamilyBackground.Columns["eMail"].HeaderText                 = "Email";
                        dgFamilyBackground.Columns["occupation"].HeaderText            = "Occupation";
                        dgFamilyBackground.Columns["EmployerBizAddress"].HeaderText    = "Employer Business Name and Address";
                        dgFamilyBackground.Columns["Address"].HeaderText               = "Home Address";
                        dgFamilyBackground.Columns["YearGraduated"].HeaderText         = "Year Graduated";
                        dgFamilyBackground.Columns["EducationalAttainment"].HeaderText = "Educational Attainment";

                        //dgFamilyBackground.Columns.Add(cmbLevel);

                        dgFamilyBackground.Columns["IsDeleted"].Visible = false;
                        dgFamilyBackground.Columns["StudentId"].Visible = false;
                    }


                    studentHealth = _studentService.GetStudentHealthRecord(Global.selectedStudent);
                    if (studentHealth != null)
                    {
                        txtChildsDoctor.Text           = studentHealth.ChildsDoctor;
                        txtDoctorsContactNo.Text       = studentHealth.DoctorsContactNo;
                        txtAllergies.Text              = studentHealth.Allergies;
                        rtbDoctorBizAddress.Text       = studentHealth.DoctorsBusinessNameAndAddress;
                        cbComplete.Checked             = studentHealth.Immunization == true ? true : false;
                        cmbHealthConcern.SelectedValue = studentHealth.HealthConcernId;

                        immunization             = cbComplete.Checked == true ? true : false;
                        rtbSpecialProcedure.Text = studentHealth.SpecialCare;
                    }
                }
            }
            //}
        }