コード例 #1
0
        public int AddEdit(StudentsMedical entity)
        {
            int i = 0;

            User objUser = null;
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

            if (entity != null && string.IsNullOrEmpty(entity.SchoolID))
            {
                if (objUser != null && !string.IsNullOrEmpty(objUser.SchoolID))
                    entity.SchoolID = objUser.SchoolID;
            }

            if (string.IsNullOrEmpty(entity.StudentMedicalID))
            {
                entity.StudentMedicalID = Utility.GeneratorUniqueId(ID_PREFIX_CONSTANTS.STUDENTS_MEDICAL_ID_PREFIX);

                if (objUser != null && !string.IsNullOrEmpty(objUser.UserID))
                {
                    entity.CreatedByID = objUser.UserID;
                    entity.ModifiedByID = objUser.UserID;
                }
                else
                {
                    entity.CreatedByID = "1";
                    entity.ModifiedByID = "1";
                }
            }
            else
            {
                if (objUser != null && !string.IsNullOrEmpty(objUser.UserID))
                    entity.ModifiedByID = objUser.UserID;
                else
                    entity.ModifiedByID = "1";
            }

            string[] addParams = { StudentsMedical_Constant.STUDENT_MEDICAL_ID,
                                    StudentsMedical_Constant.STUDENT_ID,
                                    StudentsMedical_Constant.BLOOD_GROUP,
                                    StudentsMedical_Constant.ANY_PHYSICAL_HANDICAP_OR_DISABILITY,
                                    StudentsMedical_Constant.PHYSICAL_HANDICAP_OR_DISABILITY_DESC,
                                    StudentsMedical_Constant.ANY_OTHER_HEALTH_PROBLEMS,
                                    StudentsMedical_Constant.OTHER_HEALTHP_ROBLEMS_DESC,
                                    StudentsMedical_Constant.ALLERGIES_OR_CHRONIC_AILMENTS,
                                    StudentsMedical_Constant.CREATED_BY_ID,
                                    StudentsMedical_Constant.MODIFIED_BY_ID
                                    };

            i = _StudentsMedicalRepository.ExecuteNonQuery(entity, addParams, StudentsMedical_Constant.SPROC_STUDENTSMEDICAL_UPS);

            return i;
        }
コード例 #2
0
        public bool UploadFromExcelFile(Student entity)
        {
            OleDbConnection cnn = null;
            try
            {
                if (!string.IsNullOrEmpty(entity.StudentExcelFilePath))
                {
                    cnn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + entity.StudentExcelFilePath + "; Extended Properties=Excel 12.0;");
                    OleDbCommand oconn = new OleDbCommand("select * from [Students$]", cnn);
                    cnn.Open();
                    OleDbDataAdapter adp = new OleDbDataAdapter(oconn);
                    DataTable dt = new DataTable();
                    adp.Fill(dt);
                    cnn.Close();

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        DataColumnCollection columns = dt.Columns;

                        Student objStudent = null;
                        StudentsParent objStudentsParent = null;
                        StudentsMedical objStudentsMedical = null;
                        StudentsTransport objStudentsTransport = null;

                        int i = 0;

                        foreach (DataRow row in dt.Rows)
                        {
                            objStudent = new Student();
                            objStudentsParent = new StudentsParent();
                            objStudentsMedical = new StudentsMedical();
                            objStudentsTransport = new StudentsTransport();

                            #region Students Information

                            if (columns.Contains("Form No") && !string.IsNullOrEmpty(Convert.ToString(row["Form No"])))
                                objStudent.FormNo = Convert.ToString(row["Form No"]).Trim();

                            if (columns.Contains("Temp Student ID") && !string.IsNullOrEmpty(Convert.ToString(row["Temp Student ID"])))
                                objStudent.TempStudentID = Convert.ToString(row["Temp Student ID"]).Trim();

                            if (columns.Contains("GR No") && !string.IsNullOrEmpty(Convert.ToString(row["GR No"])))
                                objStudent.GRNo = Convert.ToString(row["GR No"]).Trim();

                            if (columns.Contains("Admission Type") && !string.IsNullOrEmpty(Convert.ToString(row["Admission Type"])))
                                objStudent.AdmissionType = Convert.ToString(row["Admission Type"]).Trim();

                            if (columns.Contains("Academic Year") && !string.IsNullOrEmpty(Convert.ToString(row["Academic Year"])))
                            {
                                AcademicYear obj = new AcademicYear();
                                obj.AcademicName = Convert.ToString(row["Academic Year"]);

                                obj = _AcademicYearService.GetByName(obj);

                                if (obj != null && !string.IsNullOrEmpty(obj.AcademicYearID))
                                    objStudent.CurrentAcademicYearID = obj.AcademicYearID;
                            }

                            if (columns.Contains("Class") && !string.IsNullOrEmpty(Convert.ToString(row["Class"])))
                            {
                                Class obj = new Class();
                                obj.ClassName = Convert.ToString(row["Class"]);

                                obj = _ClassService.GetByName(obj);

                                if (obj != null && !string.IsNullOrEmpty(obj.ClassID))
                                    objStudent.CurrentClassID = obj.ClassID;
                            }

                            if (columns.Contains("Section") && !string.IsNullOrEmpty(Convert.ToString(row["Section"])))
                            {
                                Section obj = new Section();
                                obj.SectionName = Convert.ToString(row["Section"]);

                                obj = _SectionService.GetByName(obj);

                                if (obj != null && !string.IsNullOrEmpty(obj.SectionID))
                                    objStudent.CurrentSectionID = obj.SectionID;
                            }

                            if (columns.Contains("Admission Date") && !string.IsNullOrEmpty(Convert.ToString(row["Admission Date"])))
                                objStudent.AdmissionDate = Convert.ToDateTime(row["Admission Date"]);

                            if (columns.Contains("First Name") && !string.IsNullOrEmpty(Convert.ToString(row["First Name"])))
                                objStudent.FirstName = Convert.ToString(row["First Name"]).Trim();

                            if (columns.Contains("Middle Name") && !string.IsNullOrEmpty(Convert.ToString(row["Middle Name"])))
                                objStudent.MiddleName = Convert.ToString(row["Middle Name"]).Trim();

                            if (columns.Contains("Last Name") && !string.IsNullOrEmpty(Convert.ToString(row["Last Name"])))
                                objStudent.LastName = Convert.ToString(row["Last Name"]).Trim();

                            if (columns.Contains("Gender") && !string.IsNullOrEmpty(Convert.ToString(row["Gender"])))
                                objStudent.Gender = Convert.ToString(row["Gender"]).Trim();

                            if (columns.Contains("DOB") && !string.IsNullOrEmpty(Convert.ToString(row["DOB"])))
                                objStudent.DOB = Convert.ToDateTime(row["DOB"]);

                            if (columns.Contains("Age As On") && !string.IsNullOrEmpty(Convert.ToString(row["Age As On"])))
                                objStudent.AgeAsOn = Convert.ToDateTime(row["Age As On"]);

                            if (columns.Contains("Place Of Birth Taluka") && !string.IsNullOrEmpty(Convert.ToString(row["Place Of Birth Taluka"])))
                                objStudent.PlaceOfBirthTaluka = Convert.ToString(row["Place Of Birth Taluka"]).Trim();

                            if (columns.Contains("Place Of Birth District") && !string.IsNullOrEmpty(Convert.ToString(row["Place Of Birth District"])))
                                objStudent.PlaceOfBirthDistrict = Convert.ToString(row["Place Of Birth District"]).Trim();

                            if (columns.Contains("Mother Tongue") && !string.IsNullOrEmpty(Convert.ToString(row["Mother Tongue"])))
                                objStudent.MotherTongue = Convert.ToString(row["Mother Tongue"]).Trim();

                            if (columns.Contains("Nationality") && !string.IsNullOrEmpty(Convert.ToString(row["Nationality"])))
                                objStudent.Nationality = Convert.ToString(row["Nationality"]).Trim();

                            if (columns.Contains("Permanant Address") && !string.IsNullOrEmpty(Convert.ToString(row["Permanant Address"])))
                                objStudent.PermanantAddress = Convert.ToString(row["Permanant Address"]).Trim();

                            if (columns.Contains("Local Address") && !string.IsNullOrEmpty(Convert.ToString(row["Local Address"])))
                                objStudent.LocalAddress = Convert.ToString(row["Local Address"]).Trim();

                            if (columns.Contains("Native State") && !string.IsNullOrEmpty(Convert.ToString(row["Native State"])))
                                objStudent.NativeState = Convert.ToString(row["Native State"]).Trim();

                            if (columns.Contains("Category") && !string.IsNullOrEmpty(Convert.ToString(row["Category"])))
                                objStudent.Category = Convert.ToString(row["Category"]).Trim();

                            if (columns.Contains("Religion") && !string.IsNullOrEmpty(Convert.ToString(row["Religion"])))
                                objStudent.Religion = Convert.ToString(row["Religion"]).Trim();

                            if (columns.Contains("Caste") && !string.IsNullOrEmpty(Convert.ToString(row["Caste"])))
                                objStudent.Caste = Convert.ToString(row["Caste"]).Trim();

                            if (columns.Contains("Sub Caste") && !string.IsNullOrEmpty(Convert.ToString(row["Sub Caste"])))
                                objStudent.SubCaste = Convert.ToString(row["Sub Caste"]).Trim();

                            if (columns.Contains("Last School Attended") && !string.IsNullOrEmpty(Convert.ToString(row["Last School Attended"])))
                                objStudent.LastSchoolAttended = Convert.ToString(row["Last School Attended"]).Trim();

                            if (columns.Contains("Phone No") && !string.IsNullOrEmpty(Convert.ToString(row["Phone No"])))
                                objStudent.PhoneNo = Convert.ToInt32(row["Phone No"]);

                            if (columns.Contains("Reason For Transfer") && !string.IsNullOrEmpty(Convert.ToString(row["Reason For Transfer"])))
                                objStudent.ReasonForTransfer = Convert.ToString(row["Reason For Transfer"]).Trim();

                            if (columns.Contains("Date Of Leaving School") && !string.IsNullOrEmpty(Convert.ToString(row["Date Of Leaving School"])))
                                objStudent.DateOfLeavingSchool = Convert.ToDateTime(row["Date Of Leaving School"]);

                            if (columns.Contains("Remark") && !string.IsNullOrEmpty(Convert.ToString(row["Remark"])))
                                objStudent.Remark = Convert.ToString(row["Remark"]).Trim();

                            if (columns.Contains("TC Date") && !string.IsNullOrEmpty(Convert.ToString(row["TC Date"])))
                                objStudent.TCDate = Convert.ToDateTime(row["TC Date"]);

                            if (columns.Contains("TC Number") && !string.IsNullOrEmpty(Convert.ToString(row["TC Number"])))
                                objStudent.TCNumber = Convert.ToString(row["TC Number"]).Trim();

                            i = AddEdit(objStudent);

                            #endregion

                            #region Parents Information

                            if (i > 0 && !string.IsNullOrEmpty(objStudent.StudentID))
                            {
                                objStudentsParent.StudentID = objStudent.StudentID;

                                if (columns.Contains("Fathers Name") && !string.IsNullOrEmpty(Convert.ToString(row["Fathers Name"])))
                                    objStudentsParent.FathersName = Convert.ToString(row["Fathers Name"]).Trim();

                                if (columns.Contains("Mothers Name") && !string.IsNullOrEmpty(Convert.ToString(row["Mothers Name"])))
                                    objStudentsParent.MothersName = Convert.ToString(row["Mothers Name"]).Trim();

                                if (columns.Contains("Ph No Resident") && !string.IsNullOrEmpty(Convert.ToString(row["Ph No Resident"])))
                                    objStudentsParent.PhNoResident = Convert.ToInt32(row["Ph No Resident"]);

                                if (columns.Contains("Ph No Office") && !string.IsNullOrEmpty(Convert.ToString(row["Ph No Office"])))
                                    objStudentsParent.PhNoOffice = Convert.ToInt32(row["Ph No Office"]);

                                if (columns.Contains("Mobile No") && !string.IsNullOrEmpty(Convert.ToString(row["Mobile No"])))
                                    objStudentsParent.MobileNo = Convert.ToInt32(row["Mobile No"]);

                                if (columns.Contains("Email Address") && !string.IsNullOrEmpty(Convert.ToString(row["Email Address"])))
                                    objStudentsParent.EmailAddress = Convert.ToString(row["Email Address"]).Trim();

                                if (columns.Contains("Qualification") && !string.IsNullOrEmpty(Convert.ToString(row["Qualification"])))
                                    objStudentsParent.Qualification = Convert.ToString(row["Qualification"]).Trim();

                                if (columns.Contains("Fathers Occupation") && !string.IsNullOrEmpty(Convert.ToString(row["Fathers Occupation"])))
                                    objStudentsParent.FathersOccupation = Convert.ToString(row["Fathers Occupation"]).Trim();

                                if (columns.Contains("Mothers Occupation") && !string.IsNullOrEmpty(Convert.ToString(row["Mothers Occupation"])))
                                    objStudentsParent.MothersOccupation = Convert.ToString(row["Mothers Occupation"]).Trim();

                                if (columns.Contains("Fathers Annual Income") && !string.IsNullOrEmpty(Convert.ToString(row["Fathers Annual Income"])))
                                    objStudentsParent.FathersAnnualIncome = Convert.ToString(row["Fathers Annual Income"]).Trim();

                                if (columns.Contains("Mothers Annual Income") && !string.IsNullOrEmpty(Convert.ToString(row["Mothers Annual Income"])))
                                    objStudentsParent.MothersAnnualIncome = Convert.ToString(row["Mothers Annual Income"]).Trim();

                                if (columns.Contains("Total Annual Income") && !string.IsNullOrEmpty(Convert.ToString(row["Total Annual Income"])))
                                    objStudentsParent.TotalAnnualIncome = Convert.ToString(row["Total Annual Income"]).Trim();

                                if (columns.Contains("Total Family Members") && !string.IsNullOrEmpty(Convert.ToString(row["Total Family Members"])))
                                    objStudentsParent.TotalFamilyMembers = Convert.ToInt32(row["Total Family Members"]);

                                if (columns.Contains("Guardian") && !string.IsNullOrEmpty(Convert.ToString(row["Guardian"])))
                                    objStudentsParent.Guardian = Convert.ToString(row["Guardian"]).Trim();

                                if (columns.Contains("Guardian Address") && !string.IsNullOrEmpty(Convert.ToString(row["Guardian Address"])))
                                    objStudentsParent.GuardianAddress = Convert.ToString(row["Guardian Address"]).Trim();

                                if (columns.Contains("Guardian Mobile") && !string.IsNullOrEmpty(Convert.ToString(row["Guardian Mobile"])))
                                    objStudentsParent.GuardianMobile = Convert.ToInt32(row["Guardian Mobile"]);

                                if (columns.Contains("Guardian Email") && !string.IsNullOrEmpty(Convert.ToString(row["Guardian Email"])))
                                    objStudentsParent.GuardianEmail = Convert.ToString(row["Guardian Email"]).Trim();

                                if (columns.Contains("Guardian Relationship With Student") && !string.IsNullOrEmpty(Convert.ToString(row["Guardian Relationship With Student"])))
                                    objStudentsParent.GuardianRelationshipWithStudent = Convert.ToString(row["Guardian Relationship With Student"]).Trim();

                                _IStudentsParentService.AddEdit(objStudentsParent);
                            }

                            #endregion

                            #region Medical Information

                            if (i > 0 && !string.IsNullOrEmpty(objStudent.StudentID))
                            {
                                objStudentsMedical.StudentID = objStudent.StudentID;

                                if (columns.Contains("Blood Group") && !string.IsNullOrEmpty(Convert.ToString(row["Blood Group"])))
                                    objStudentsMedical.BloodGroup = Convert.ToString(row["Blood Group"]).Trim();

                                if (columns.Contains("Any Physical Handicap Or Disability") && !string.IsNullOrEmpty(Convert.ToString(row["Any Physical Handicap Or Disability"])))
                                {
                                    if (Convert.ToString(row["Any Physical Handicap Or Disability"]).Trim() == "Yes")
                                        objStudentsMedical.AnyPhysicalHandicapOrDisability = true;
                                    else if (Convert.ToString(row["Any Physical Handicap Or Disability"]).Trim() == "No")
                                        objStudentsMedical.AnyPhysicalHandicapOrDisability = false;
                                }

                                if (columns.Contains("Physical Handicap Or Disability Desc") && !string.IsNullOrEmpty(Convert.ToString(row["Physical Handicap Or Disability Desc"])))
                                    objStudentsMedical.PhysicalHandicapOrDisabilityDesc = Convert.ToString(row["Physical Handicap Or Disability Desc"]).Trim();

                                if (columns.Contains("Any Other Health Problems") && !string.IsNullOrEmpty(Convert.ToString(row["Any Other Health Problems"])))
                                {
                                    if (Convert.ToString(row["Any Other Health Problems"]).Trim() == "Yes")
                                        objStudentsMedical.AnyOtherHealthProblems = true;
                                    else if (Convert.ToString(row["Any Other Health Problems"]).Trim() == "No")
                                        objStudentsMedical.AnyOtherHealthProblems = false;
                                }

                                if (columns.Contains("Other Health Problems Desc") && !string.IsNullOrEmpty(Convert.ToString(row["Other Health Problems Desc"])))
                                    objStudentsMedical.OtherHealthProblemsDesc = Convert.ToString(row["Other Health Problems Desc"]).Trim();

                                if (columns.Contains("Allergies Or Chronic Ailments") && !string.IsNullOrEmpty(Convert.ToString(row["Allergies Or Chronic Ailments"])))
                                    objStudentsMedical.AllergiesOrChronicAilments = Convert.ToString(row["Allergies Or Chronic Ailments"]).Trim();

                                _IStudentsMedicalService.AddEdit(objStudentsMedical);
                            }

                            #endregion

                            #region Transport Information

                            if (i > 0 && !string.IsNullOrEmpty(objStudent.StudentID))
                            {
                                objStudentsTransport.StudentID = objStudent.StudentID;

                                if (columns.Contains("School Vehicle Opted") && !string.IsNullOrEmpty(Convert.ToString(row["School Vehicle Opted"])))
                                {
                                    if (Convert.ToString(row["School Vehicle Opted"]).Trim() == "Yes")
                                        objStudentsTransport.SchoolVehicleOpted = true;
                                    else if (Convert.ToString(row["School Vehicle Opted"]).Trim() == "No")
                                        objStudentsTransport.SchoolVehicleOpted = false;
                                }

                                if (columns.Contains("Mode Of Transport") && !string.IsNullOrEmpty(Convert.ToString(row["Mode Of Transport"])))
                                    objStudentsTransport.ModeOfTransport = Convert.ToString(row["Mode Of Transport"]).Trim();

                                if (columns.Contains("Area") && !string.IsNullOrEmpty(Convert.ToString(row["Area"])))
                                {
                                    Area obj = new Area();
                                    obj.AreaName = Convert.ToString(row["Area"]);

                                    obj = _AreaService.GetByName(obj);

                                    if (obj != null && !string.IsNullOrEmpty(obj.AreaID))
                                        objStudentsTransport.AreaID = obj.AreaID;
                                }

                                if (columns.Contains("Bus No") && !string.IsNullOrEmpty(Convert.ToString(row["Bus No"])))
                                    objStudentsTransport.BusNo = Convert.ToString(row["Bus No"]).Trim();

                                if (columns.Contains("In Time Hr") && !string.IsNullOrEmpty(Convert.ToString(row["In Time Hr"])))
                                    objStudentsTransport.BusInTimeHr = Convert.ToInt32(row["In Time Hr"]);

                                if (columns.Contains("In Time Min") && !string.IsNullOrEmpty(Convert.ToString(row["In Time Min"])))
                                    objStudentsTransport.BusInTimeMin = Convert.ToInt32(row["In Time Min"]);

                                if (columns.Contains("In Time AM PM") && !string.IsNullOrEmpty(Convert.ToString(row["In Time AM PM"])))
                                    objStudentsTransport.BusInTimeAMPM = Convert.ToString(row["In Time AM PM"]).Trim();

                                if (columns.Contains("Out Time Hr") && !string.IsNullOrEmpty(Convert.ToString(row["Out Time Hr"])))
                                    objStudentsTransport.BusOutTimeHr = Convert.ToInt32(row["Out Time Hr"]);

                                if (columns.Contains("Out Time Min") && !string.IsNullOrEmpty(Convert.ToString(row["Out Time Min"])))
                                    objStudentsTransport.BusOutTimeMin = Convert.ToInt32(row["Out Time Min"]);

                                if (columns.Contains("Out Time AM PM") && !string.IsNullOrEmpty(Convert.ToString(row["Out Time AM PM"])))
                                    objStudentsTransport.BusOutTimeAMPM = Convert.ToString(row["Out Time AM PM"]).Trim();

                                _IStudentsTransportService.AddEdit(objStudentsTransport);
                            }

                            #endregion

                        }
                    }

                    if (File.Exists(entity.StudentExcelFilePath))
                        File.Delete(entity.StudentExcelFilePath);
                }

            }
            catch (Exception ex)
            {
                eSchoolExceptionManagement logExpection = new eSchoolExceptionManagement();
                logExpection.ManageException(ex, true, eSchoolExceptionManagement.ErrorLogType.Database, "1");
                cnn.Close();
            }
            finally
            {
                cnn.Close();
            }
            return true;
        }
コード例 #3
0
 public StudentsMedical Get(StudentsMedical entity)
 {
     string[] addParams = { StudentsMedical_Constant.STUDENT_ID };
     return _StudentsMedicalRepository.Get(entity, addParams, StudentsMedical_Constant.SPROC_STUDENTSMEDICAL_SEL);
 }
コード例 #4
0
        public int Delete(StudentsMedical entity)
        {
            int i = 0;

            string[] addParams = { StudentsMedical_Constant.STUDENT_ID };
            i = _StudentsMedicalRepository.ExecuteNonQuery(entity, addParams, StudentsMedical_Constant.SPROC_STUDENTSMEDICAL_DEL);

            return i;
        }
コード例 #5
0
 public object GetScalar(StudentsMedical entity)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
        public IEnumerable<StudentsMedical> GetAll(StudentsMedical entity)
        {
            User objUser = null;
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

            if (objUser != null && !string.IsNullOrEmpty(objUser.SchoolID))
                entity.SchoolID = objUser.SchoolID;

            string[] addParams = { Constants.PAGEINDEX, Constants.PAGESIZE, Constants.SORTEXP, StudentsMedical_Constant.SCHOOL_ID };
            return _StudentsMedicalRepository.GetAll(entity, addParams, StudentsMedical_Constant.SPROC_STUDENTSMEDICAL_LSTALL);
        }