private int GetSerial(string sNumber) { int iserial = 0; try { ApplicationsDAL myapp = new ApplicationsDAL(); iserial = myapp.GetSerial(CurrentCampus, sNumber); } catch (Exception ex) { } return(iserial); }
/// <summary> /// Actualiza un elemento en la base de datos. (Capa de Negocio) /// </summary> /// <param name=""></param> public static bool UpdateApplications(string ApplicationName, string LoweredApplicationName, Guid ApplicationId, string Description) { ApplicationsDAL applicationsDAL = null; bool bResult = false; try { applicationsDAL = new ApplicationsDAL(); applicationsDAL.Update(ApplicationName, LoweredApplicationName, ApplicationId, Description); bResult = true; } catch (Exception ex) { throw ex; } finally { applicationsDAL = null; } return(bResult); }
/// <summary> /// Obtiene todos los elementos de la tabla (Capa de Negocio) /// </summary> /// <param name=''></param> public static List <ApplicationEntity> GetAllApplications() { ApplicationsDAL applicationsDAL = null; List <ApplicationEntity> listApplications = null; try { applicationsDAL = new ApplicationsDAL(); listApplications = applicationsDAL.SelectAll(); } catch (Exception ex) { listApplications = null; throw ex; } finally { applicationsDAL = null; } return(listApplications); }
/// <summary> /// Obtiene un elemento utilizando la identidad enviada como parámetro (Capa de Negocio) /// </summary> /// <param name=''></param> public static ApplicationEntity GetApplications(Guid ApplicationId) { ApplicationsDAL applicationsDAL = null; ApplicationEntity application = null; try { applicationsDAL = new ApplicationsDAL(); application = applicationsDAL.Select(ApplicationId); } catch (Exception ex) { application = null; throw ex; } finally { applicationsDAL = null; } return(application); }
/// <summary> /// Borrado de un elemento de la base de datos (Capa de Negocio). /// </summary> /// <param name=""></param> public static bool DeleteApplications(Guid ApplicationId) { ApplicationsDAL applicationsDAL = null; bool bResult = false; try { applicationsDAL = new ApplicationsDAL(); applicationsDAL.Delete(ApplicationId); bResult = true; } catch (Exception ex) { throw ex; } finally { applicationsDAL = null; } return(bResult); }
public static List <Application> GetApplications(ApplicationsOptionAll includeOptionAll) { List <Application> allApplications = new List <Application>(); switch (includeOptionAll) { case ApplicationsOptionAll.True: { Application optionSelectApp = new Application(); optionSelectApp.ApplicationName = "---Select Application---"; allApplications.Add(optionSelectApp); Application optionAll = new Application(); optionAll.ApplicationName = "All"; allApplications.Add(optionAll); foreach (Application application in ApplicationsDAL.GetApplications()) { allApplications.Add(application); } break; } case ApplicationsOptionAll.False: { //allApplications = ApplicationsDAL.GetApplications(); Application optionSelectApp = new Application(); optionSelectApp.ApplicationName = "---Select Application---"; allApplications.Add(optionSelectApp); foreach (Application application in ApplicationsDAL.GetApplications()) { allApplications.Add(application); } break; } } return(allApplications); }
private void Export() { ReportDocument myReport = new ReportDocument(); List <Programs_Advisors> myAdvisors = new List <Programs_Advisors>(); Programs_AdvisorsDAL myAdvisorsDAL = new Programs_AdvisorsDAL(); RecommendationDAL myRecommendationDAL = new RecommendationDAL(); try { MirrorCLS myMirror = new MirrorCLS(); MirrorDAL myMirrorDAL = new MirrorDAL(); myMirror = myList[0]; DataSet rptDS = new DataSet(); rptDS = myRecommendationDAL.Prepare_RecommendationReport(myMirror); string reportPath = Server.MapPath("Reports/Recommended_Report3.rpt"); myReport.Load(reportPath); myReport.SetDataSource(rptDS); TextObject txt; int iCount = myMirror.Mirror.Length; if (iCount > 60) { iCount = 60; } for (int i = 0; i < 60; i++) { txt = (TextObject)myReport.ReportDefinition.ReportObjects["h" + (i + 1).ToString()]; txt.Text = ""; txt.Color = Color.White; txt.Color = Color.White; txt.Border.BorderColor = Color.White; txt.Border.BackgroundColor = Color.White; txt = (TextObject)myReport.ReportDefinition.ReportObjects["g" + (i + 1).ToString()]; txt.Text = ""; txt.Color = Color.White; txt.Border.BorderColor = Color.White; txt.Border.BackgroundColor = Color.White; } for (int i = 0; i < iCount; i++) { txt = (TextObject)myReport.ReportDefinition.ReportObjects["h" + (i + 1).ToString()]; txt.Text = myMirror.Mirror[i].sCourse; switch (myMirror.Mirror[i].iClass) { case 9: //MEelect txt.Text = myMirror.Mirror[i].sCourse + "*"; break; case 11: //CEelect txt.Text = myMirror.Mirror[i].sCourse + "#"; break; } txt.Color = Color.Black; txt.Border.BorderColor = Color.Black; txt.Border.BackgroundColor = Color.Silver; txt = (TextObject)myReport.ReportDefinition.ReportObjects["g" + (i + 1).ToString()]; txt.Text = myMirror.Mirror[i].sGrade; txt.Color = Color.Black; txt.Border.BorderColor = Color.Black; txt.Border.BackgroundColor = Color.White; } txt = (TextObject)myReport.ReportDefinition.ReportObjects["Major_txt"]; txt.Text = myMirror.Major; //Previous Semester Campus = (InitializeModule.EnumCampus)Session["CurrentCampus"]; txt = (TextObject)myReport.ReportDefinition.ReportObjects["txtregisteredCourseInPrevSem"]; if (iRegSem == 4) { int iRegCoursesPrevSem = 0; iRegCoursesPrevSem = LibraryMOD.GetRegCoursesPrevSem(myMirror.StudentNumber, iRegYear, iRegSem, Campus); txt.Text = "Previous Semester Courses : " + iRegCoursesPrevSem.ToString(); } else { txt.Text = ""; txt.Width = 0; } txt = (TextObject)myReport.ReportDefinition.ReportObjects["cgpa_txt"]; if (myMirror.CGPA != 101) { txt.Text = string.Format("{0:f}", myMirror.CGPA); } txt = (TextObject)myReport.ReportDefinition.ReportObjects["esl_txt"]; txt.Text = myMirror.Advisor; txt = (TextObject)myReport.ReportDefinition.ReportObjects["eng_txt"]; txt.Text = myMirror.ENG; txt = (TextObject)myReport.ReportDefinition.ReportObjects["score_txt"]; txt.Text = string.Format("{0:f}", myMirror.Score); txt = (TextObject)myReport.ReportDefinition.ReportObjects["Major_Free_Elective_txt"]; string MElective = myMirrorDAL.GetMajorElectiveCourses(myMirror.StudentNumber, Campus); string FElective = myMirrorDAL.GetFreeElectiveCourses(myMirror.StudentNumber, Campus); txt.Text = ""; if (MElective.Length > 0) { txt.Text += "Major Electives: " + "[ " + MElective + " ]"; } if (FElective.Length > 0) { if (MElective.Length > 0) { txt.Text += " --- "; } txt.Text += "Free Electives [" + FElective + " ]"; } txt = (TextObject)myReport.ReportDefinition.ReportObjects["Session_txt"]; txt.Text = myMirror.Period; txt = (TextObject)myReport.ReportDefinition.ReportObjects["Term_txt"]; string sTerm = LibraryMOD.GetTermDesc(iRegYear, iRegSem); txt.Text = sTerm; txt = (TextObject)myReport.ReportDefinition.ReportObjects["Advisor_txt"]; txt.Text = LibraryMOD.GetAdvisorEmail(myMirror.Advisor); txt = (TextObject)myReport.ReportDefinition.ReportObjects["txtTitle"]; txt.Text = myMirror.StudentNumber.Replace(".", "") + " - " + myMirror.Name; txt = (TextObject)myReport.ReportDefinition.ReportObjects["UserTXT"]; string sUserName = Session["CurrentUserName"].ToString(); txt.Text = sUserName; //coordinator_txt //advisors_txt string sCoordinator = ""; string sAdvisors = ""; string sMajor = ""; List <Applications> myStudent = new List <Applications>(); ApplicationsDAL myApplicationsDAL = new ApplicationsDAL(); myStudent = myApplicationsDAL.GetList(Campus, " lngStudentNumber='" + myMirror.StudentNumber + "'", false); if (myStudent.Count > 0) { sMajor = myStudent[0].strSpecialization; } myStudent.Clear(); myAdvisors = myAdvisorsDAL.GetPrograms_Advisors(Campus, sMajor); for (int i = 0; i < myAdvisors.Count; i++) { if (myAdvisors[i].byteCategory == 1) { sCoordinator += LibraryMOD.GetAdvisorEmail(myAdvisors[i].SAdvisor); } else { sAdvisors += LibraryMOD.GetAdvisorEmail(myAdvisors[i].SAdvisor) + ","; } } txt = (TextObject)myReport.ReportDefinition.ReportObjects["coordinator_txt"]; txt.Text = sCoordinator; txt = (TextObject)myReport.ReportDefinition.ReportObjects["advisors_txt"]; txt.Text = sAdvisors; myReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Page.Response, true, "ECTReport"); } catch (Exception exp) { Console.WriteLine("{0} Exception caught.", exp); } finally { myAdvisors.Clear(); myReport.Close(); myReport.Dispose(); } }
public List <MirrorCLS> GetAdvising(string sNo, bool isIncluded, int Year, int Semester, bool isRegisteredPassed, bool isHidden, out Plans Plan, InitializeModule.EnumCampus Campus, string sCSemester1) { List <MirrorCLS> myMirror = new List <MirrorCLS>(); MirrorDAL myMirrorDAL = new MirrorDAL(); //Plans Plan; Plan = new Plans(); try { string sCollege = ""; string sDegree = ""; string sMajor = ""; string sCondition = ""; Connection_StringCLS myConnection_String = new Connection_StringCLS(Campus); SqlConnection Conn = new SqlConnection(myConnection_String.Conn_string); List <Applications> myStudent = new List <Applications>(); ApplicationsDAL myApplicationsDAL = new ApplicationsDAL(); myStudent = myApplicationsDAL.GetList(Campus, " lngStudentNumber='" + sNo + "'", false); if (myStudent.Count > 0) { sCollege = myStudent[0].strCollege; sDegree = myStudent[0].strDegree; sMajor = myStudent[0].strSpecialization; } myMirror = myMirrorDAL.GetMirrorForAdvising(sCollege, sDegree, sMajor, 0, sNo, 0, out Plan, Campus, true); #region "Fill Elective Grades Courses" for (int i = 0; i < myMirror.Count; i++) { ArrayList GradeElect = new ArrayList(); string SqlElect = "SELECT lngSerial,sStudentNumber,sCourse,sGrade,bPassIt,byteOrder "; SqlElect += " FROM Web_Max_Ellective "; SqlElect += " WHERE strCollege='" + sCollege + "' AND strDegree='" + sDegree + "' AND strSpecialization='" + sMajor + "' AND sStudentNumber='" + myMirror[i].StudentNumber + "'"; SqlElect += " AND (intCourseClass =2 or intCourseClass=9)"; SqlElect += " Union "; SqlElect += " SELECT lngSerial,sStudentNumber,sCourse,sGrade,bPassIt,byteOrder"; SqlElect += " FROM Web_Ellective_No_Grades "; SqlElect += " WHERE strCollege='" + sCollege + "' AND strDegree='" + sDegree + "' AND strSpecialization='" + sMajor + "' AND sStudentNumber='" + myMirror[i].StudentNumber + "'"; SqlElect += " AND (intCourseClass =2 or intCourseClass=9)"; SqlElect += " ORDER BY lngSerial, byteOrder"; SqlCommand Cmd = new SqlCommand(SqlElect, Conn); Conn.Open(); SqlDataReader RdElect = Cmd.ExecuteReader(); while (RdElect.Read()) { GradeElect.Add(RdElect["sGrade"].ToString()); } RdElect.Close(); Conn.Close(); if (GradeElect.Count > 0) { for (int j = 0; j < myMirror[i].Mirror.Length; j++) { if (myMirror[i].Mirror[j].sCourse == "ELECT1" || myMirror[i].Mirror[j].sCourse == "MELECT1") { myMirror[i].Mirror[j].sGrade = GradeElect[0].ToString(); } if ((myMirror[i].Mirror[j].sCourse == "ELECT2" || myMirror[i].Mirror[j].sCourse == "MELECT2") && GradeElect.Count > 1) { myMirror[i].Mirror[j].sGrade = GradeElect[1].ToString(); } if ((myMirror[i].Mirror[j].sCourse == "MELECT3") && GradeElect.Count > 2) { myMirror[i].Mirror[j].sGrade = GradeElect[2].ToString(); } } } } #endregion #region "Fill Core Elective Grades Courses" for (int i = 0; i < myMirror.Count; i++) { ArrayList GradeElect = new ArrayList(); string SqlElect = "SELECT lngSerial,sStudentNumber,sCourse,sGrade,bPassIt,byteOrder "; SqlElect += " FROM Web_Max_Ellective "; SqlElect += " WHERE strCollege='" + sCollege + "' AND strDegree='" + sDegree + "' AND strSpecialization='" + sMajor + "' AND sStudentNumber='" + myMirror[i].StudentNumber + "'"; SqlElect += " AND intCourseClass =11"; SqlElect += " Union "; SqlElect += " SELECT lngSerial,sStudentNumber,sCourse,sGrade,bPassIt,byteOrder"; SqlElect += " FROM Web_Ellective_No_Grades "; SqlElect += " WHERE strCollege='" + sCollege + "' AND strDegree='" + sDegree + "' AND strSpecialization='" + sMajor + "' AND sStudentNumber='" + myMirror[i].StudentNumber + "'"; SqlElect += " AND intCourseClass =11"; SqlElect += " ORDER BY lngSerial, byteOrder"; SqlCommand Cmd = new SqlCommand(SqlElect, Conn); Conn.Open(); SqlDataReader RdElect = Cmd.ExecuteReader(); while (RdElect.Read()) { GradeElect.Add(RdElect["sGrade"].ToString()); } RdElect.Close(); Conn.Close(); if (GradeElect.Count > 0) { for (int j = 0; j < myMirror[i].Mirror.Length; j++) { if (myMirror[i].Mirror[j].sCourse == "CELECT1") { myMirror[i].Mirror[j].sGrade = GradeElect[0].ToString(); } if ((myMirror[i].Mirror[j].sCourse == "CELECT2") && GradeElect.Count > 1) { myMirror[i].Mirror[j].sGrade = GradeElect[1].ToString(); } if ((myMirror[i].Mirror[j].sCourse == "CELECT3") && GradeElect.Count > 2) { myMirror[i].Mirror[j].sGrade = GradeElect[2].ToString(); } if ((myMirror[i].Mirror[j].sCourse == "CELECT4") && GradeElect.Count > 3) { myMirror[i].Mirror[j].sGrade = GradeElect[3].ToString(); } if ((myMirror[i].Mirror[j].sCourse == "CELECT5") && GradeElect.Count > 4) { myMirror[i].Mirror[j].sGrade = GradeElect[4].ToString(); } if ((myMirror[i].Mirror[j].sCourse == "CELECT6") && GradeElect.Count > 5) { myMirror[i].Mirror[j].sGrade = GradeElect[5].ToString(); } } } } #endregion decimal CGPA = myMirror[0].CGPA; bool isAccWanted = myMirror[0].IsAccWanted; //bool isHidden = false; myMirror[0].Major = Plan.SDisplay; myMirror[0].SDegree = sDegree; myMirror[0].SMajor = sMajor; //Include Recommended Courses int iPreFounded = 0; int iPre = 0; int iPreIndex = 0; int iHours = 0; int iCredit = 0; bool isPassed = false; int iSemMax = 0; isPassed = LibraryMOD.isENGPassed((float)myMirror[0].Score, myMirror[0].ENG, sDegree, sMajor); iSemMax = LibraryMOD.GetMaxHours(Semester, myMirror[0].IsENGRequired, isPassed, myMirror[0].MaxESL, (float)myMirror[0].CGPA, sDegree, sMajor); ////MCPR Arabic with TOEFL //if (sDegree == "1" && sMajor == "24") //{ // iSemMax = LibraryMOD.GetMaxHours(Semester, myMirror[0].IsENGRequired, isPassed, myMirror[0].MaxESL, (float)myMirror[0].CGPA,sDegree,sMajor); //} ////MCPR Arabic without TOEFL //else if ((sDegree == "1" && sMajor == "25") || (sDegree == "3" && sMajor == "21")) //{ // isPassed = false; // //iSemMax = 12; // iSemMax = LibraryMOD.GetMaxHours(Semester, myMirror[0].IsENGRequired, isPassed, myMirror[0].MaxESL, (float)myMirror[0].CGPA, sDegree, sMajor); //} ////Other Majors //else //{ //} myMirror[0].Recommended = new List <Advised.Courses>(); if (isIncluded) { bool isToeflPassed = LibraryMOD.isENGPassed(float.Parse(myMirror[0].Score.ToString()), myMirror[0].ENG, myMirror[0].SDegree, myMirror[0].SMajor); bool isToeflRequired = myMirror[0].IsENGRequired; Advised.Courses Rec; int iShift = myMirror[0].IPeriod; bool isExempted = false; isExempted = ((myMirror[0].SDegree == "1" && myMirror[0].SMajor == "24") || (myMirror[0].SDegree == "3" && myMirror[0].SMajor == "4") || (myMirror[0].SDegree == "3" && myMirror[0].SMajor == "5") || (myMirror[0].SDegree == "3" && myMirror[0].SMajor == "6") || (myMirror[0].SDegree == "2" && myMirror[0].SMajor == "2")); //Add ESLs--This is what Available execludes the foundation students if (isToeflRequired && !isToeflPassed && isExempted == false) { Rec = new Advised.Courses(); Rec.iOrder = 0; Rec.isOver = false; Rec.isLow = false; Rec.sCourse = "ESL_Gen"; Rec.sDesc = "English as a second language - General"; Rec.iShift = iShift; myMirror[0].Recommended.Add(Rec); } bool isRecommended = false; bool isRegistered = false; isPassed = false; bool isLow = false; int iOrder = 0; bool isAvailable = false; bool isEmpty = false; bool isOver = false; bool isWEW = false; int iAlternativeCourses = 6; if (Semester >= 3) { iAlternativeCourses = 6; } for (int i = 0; i < Plan.Courses.Count; i++) { isRecommended = false; isRegistered = false; isPassed = false; isLow = false; isEmpty = false; isWEW = false; //is Registered Courses Considered as Passed Courses //|| myMirror[0].Mirror[i].sGrade == "@S1" || myMirror[0].Mirror[i].sGrade == "@S2" //Current Semester Reg Cosidered as Passed string sCSemester = sCSemester1; //if reg year semester > current semester switch (Semester) { case 1: sCSemester = "@S2"; break; case 2: sCSemester = "@F"; break; case 3: sCSemester = "@W"; break; case 4: sCSemester = "@S1"; break; } isRegistered = (myMirror[0].Mirror[i].sGrade.Contains(sCSemester) == true); bool isShown = (myMirror[0].Mirror[i].sGrade.Contains("@") == true); if (isRegisteredPassed) { isPassed = (myMirror[0].Mirror[i].isPassed || isRegistered); } else { isPassed = (myMirror[0].Mirror[i].isPassed); } //Must Repeate 6 Credit of F & D at least isLow = ((myMirror[0].Mirror[i].sGrade == "D" || myMirror[0].Mirror[i].sGrade == "F") && CGPA < 2); string sCourse = myMirror[0].Mirror[i].sCourse; isRecommended = ((!isPassed) || (isLow)); isEmpty = (myMirror[0].Mirror[i].sGrade == "."); //Hide mark if there is fainancial problem //if it is EW OR W then should be shown isWEW = (myMirror[0].Mirror[i].sGrade == "W" || myMirror[0].Mirror[i].sGrade == "EW"); if (isAccWanted || isHidden) { //if (!isRegistered && !isRecommended && ! isEmpty) if (!isShown && !isEmpty && !isWEW) { myMirror[0].Mirror[i].sGrade = "*"; } } //Must Tracked Every Year isAvailable = LibraryMOD.isCourseAvailable(Year, Semester, myMirror[0].Mirror[i].sCourse, Campus); //isAvailable = true; iCredit = myMirror[0].Mirror[i].iCredit; isOver = (iHours + iCredit > iSemMax); //Execlude ESL FROM Recomended && myMirror[0].Mirror[i].sCourse.Substring(0,3)!="ESL" if (isRecommended && isAvailable && (iHours + iCredit <= (iSemMax + iAlternativeCourses)))//add 3 course as alternative { //Not Registered iPreFounded = 0; iPre = Plan.Courses[i].iPre.Count; for (int j = 0; j < iPre; j++) { iPreIndex = Plan.Courses[i].iPre[j] - 1; if (isRegisteredPassed) { if ((myMirror[0].Mirror[iPreIndex].isPassed == true) || (myMirror[0].Mirror[iPreIndex].sGrade.Contains(sCSemester) == true)) { iPreFounded++; } } else { if (myMirror[0].Mirror[iPreIndex].isPassed == true) { iPreFounded++; } } } if (iPreFounded == iPre) { //if (iHours + myMirror[0].Mirror[i].iCredit <= iSemMax) //{ iOrder++; myMirror[0].Mirror[i].isRecommended = true; iHours += iCredit; Rec = new Advised.Courses(); Rec.iOrder = iOrder; Rec.isOver = isOver; Rec.isLow = isLow; Rec.sCourse = myMirror[0].Mirror[i].sCourse; Rec.sDesc = Plan.Courses[i].sDesc; Rec.iShift = iShift; myMirror[0].Recommended.Add(Rec); //removed by bahaa 30-01-2020 dont force to recommend corequisiste //if (Plan.Courses[i].sParallel != "-" ) //{ // iOrder++; // Rec = new Advised.Courses(); // Rec.iOrder = iOrder; // Rec.sCourse = Plan.Courses[i].sParallel; // Rec.sDesc = Plan.Courses[i + 1].sDesc; // Rec.iShift = iShift; // Rec.isOver = isOver; // Rec.isLow = isLow; // myMirror[0].Recommended.Add(Rec); //} //} } //if (iHours == iSemMax) //{ // return myMirror; //} } } } } catch (Exception ex) { LibraryMOD.ShowErrorMessage(ex); } finally { } return(myMirror); }