public static void UpdateRepeateResults(string registernumber, int yearsem) { var entities = new MUPRJEntities(); var distictRegisterNumbers = entities.MarksCards.Where(d => d.RegisterNumber == registernumber && d.YearSem == yearsem && d.YearText.Length > 0) .Select(d => d.RegisterNumber).Distinct().ToList(); int i = 0; foreach (var regno in distictRegisterNumbers) { Console.WriteLine((i++) + "|" + regno); entities = new MUPRJEntities(); foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem && d.YearText.Length > 0 )) { items.TheoryNetTotal = "-"; items.TheoryTotal = "-"; items.TheoryIATotal = "-"; items.PracticalNetTotal = "-"; items.PracticalTotal = "-"; items.PracticalIATotal = "-"; items.VivaVoice = "-"; items.Remarks = "-"; items.TotalMarks = "-"; items.SubjectCredits = "-"; items.SubjectGPA = "-"; items.SubjectGPW = "-"; } foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem && d.IsSemesterPass == "0" )) { items.SemesterPercentage = "-"; items.SemesterCredits = "-"; items.SemesterGPA = "-"; items.TotalGP = "-"; items.TotalGPW = "-"; items.SemesterAlphaSign = "-"; } entities.SaveChanges(); } }
public static void AllocateUniqueNumbers(string registernumber, int yearsem) { var entities = new MUPRJEntities(); var distictRegisterNumbers = entities.MarksCards.Where(d => d.RegisterNumber == registernumber && d.YearSem == yearsem) .Select(d => d.RegisterNumber).Distinct(); int i = 0; foreach (var regno in distictRegisterNumbers) { entities = new MUPRJEntities(); string markscard = Guid.NewGuid().ToString(); Console.WriteLine((i++) + "|" + regno + "|" + markscard); foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem)) { items.UniqueNumber = items.CourseCode + "2015" + markscard.Replace("-", "").ToUpper(); } entities.SaveChanges(); } }
public static void UpdateFailResults(string registernumber, int yearsem) { var entities = new MUPRJEntities(); var distictRegisterNumbers = entities.MarksCards.Where(d => d.RegisterNumber == registernumber && d.YearSem == yearsem && d.Remarks == "FAIL") .Select(d => d.RegisterNumber).Distinct(); int i = 0; foreach (var regno in distictRegisterNumbers) { Console.WriteLine((i++) + "|" + regno); foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem && d.Remarks == "FAIL" )) { items.SubjectCredits = "-"; items.SubjectGPA = "-"; items.SubjectGPW = "-"; } foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem )) { items.SemesterPercentage = "-"; items.SemesterCredits = "-"; items.SemesterGPA = "-"; items.TotalGP = "-"; items.TotalGPW = "-"; items.SemesterAlphaSign = "-"; } } entities.SaveChanges(); }
public static void UpdateAbsentes(string registernumber, int yearsem) { var entities = new MUPRJEntities(); var distictRegisterNumbers = entities.MarksCards.Where(d => d.RegisterNumber == registernumber && d.YearSem == yearsem && d.Remarks == "ABSENT") .Select(d => d.RegisterNumber).Distinct(); int i = 0; foreach (var regno in distictRegisterNumbers) { Console.WriteLine((i++) + "|" + regno); entities = new MUPRJEntities(); foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem && d.Remarks == "ABSENT" )) { int subjectMarks = 0; int currentMarks = 0; if (int.TryParse(items.TheoryTotal, out currentMarks)) { subjectMarks += currentMarks; } if (int.TryParse(items.TheoryIATotal, out currentMarks)) { subjectMarks += currentMarks; } if (int.TryParse(items.PracticalTotal, out currentMarks)) { subjectMarks += currentMarks; } if (int.TryParse(items.PracticalIATotal, out currentMarks)) { subjectMarks += currentMarks; } items.SubjectCredits = "-"; items.SubjectGPA = "-"; items.SubjectGPW = "-"; items.TotalMarks = subjectMarks.ToString(); } foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem )) { items.SemesterPercentage = "-"; items.SemesterCredits = "-"; items.SemesterGPA = "-"; items.TotalGP = "-"; items.TotalGPW = "-"; items.SemesterAlphaSign = "-"; } entities.SaveChanges(); } }
public static void UpdateSemesterGPW(string registernumber, int yearsem) { var entities = new MUPRJEntities(); var distictRegisterNumbers = entities.MarksCards.Where(d => d.RegisterNumber == registernumber && d.YearSem == yearsem) .Select(d => d.RegisterNumber).Distinct().ToList(); int i = 0; foreach (var regno in distictRegisterNumbers) { Console.WriteLine((i++) + "|" + regno); entities = new MUPRJEntities(); float totalGPW = 0; float totalGP = 0; float totalSemester = 0; float totalPercentage = 0.0F; float totalCredits = 0.0F; foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem)) { int subjecttotal; float subjectCredits; float subjectGP; float subjectGPW; if (int.TryParse(items.TotalMarks, out subjecttotal)) { totalSemester += subjecttotal; } if (float.TryParse(items.SubjectCredits, out subjectCredits)) { totalCredits += subjectCredits; } if (float.TryParse(items.SubjectGPA, out subjectGP)) { totalGP += subjectGP; } if (float.TryParse(items.SubjectGPW, out subjectGPW)) { totalGPW += subjectGPW; } } foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem)) { items.TotalGPW = totalGPW.ToString(); items.TotalGP = totalGP.ToString(); items.SemesterTotal = (int)totalSemester; items.SemesterCredits = totalCredits.ToString(); items.SemesterMax = semesterTotal; items.SemesterGPA = (totalCredits > 0 ? (totalGPW / totalCredits) : 0.0).ToString(); items.SemesterPercentage = Math.Round(((totalSemester / (float)semesterTotal) * 100), 2).ToString(); float semesterAggragate = ((totalSemester / (float)semesterTotal) * 100); string semesterAlphaSign = "D"; float semesterGPA = 0.0F; if (float.TryParse(items.SemesterGPA, out semesterGPA)) { items.SemesterGPA = Math.Round(semesterGPA, 2).ToString(); } if (semesterAggragate < 35) { semesterAlphaSign = "D"; } if (semesterAggragate >= 35 && semesterAggragate < 50) { semesterAlphaSign = "C"; } if (semesterAggragate >= 50 && semesterAggragate < 55) { semesterAlphaSign = "B"; } if (semesterAggragate >= 55 && semesterAggragate < 60) { semesterAlphaSign = "B+"; } if (semesterAggragate >= 60 && semesterAggragate < 70) { semesterAlphaSign = "A"; } if (semesterAggragate >= 70 && semesterAggragate < 80) { semesterAlphaSign = "A+"; } if (semesterAggragate >= 80 && semesterAggragate < 90) { semesterAlphaSign = "A++"; } if (semesterAggragate >= 90 && semesterAggragate < 100) { semesterAlphaSign = "O"; } items.SemesterAlphaSign = semesterAlphaSign; } entities.SaveChanges(); } }
public static void UpdateSubjectGPA(string registernumber, int yearsem) { var entities = new MUPRJEntities(); var distictRegisterNumbers = entities.MarksCards.Where(d => d.RegisterNumber == registernumber && d.YearSem == yearsem) .Select(d => d.RegisterNumber).Distinct(); int i = 0; foreach (var regno in distictRegisterNumbers) { Console.WriteLine((i++) + "|" + regno); foreach (var items in entities.MarksCards.Where(d => d.RegisterNumber == regno && d.YearSem == yearsem)) { int subjectTotal = 0; if (int.TryParse(items.TotalMarks, out subjectTotal)) { float ap = subjectTotal > 0 ? ((float)subjectTotal / (float)items.SubjectMax) * 100 : 0; string grade = "D"; int GPA = 2; if (ap < 35) { GPA = 2; grade = "D"; } if (ap >= 35 && ap < 50) { GPA = 3; grade = "C"; } if (ap >= 50 && ap < 55) { GPA = 4; grade = "B"; } if (ap >= 55 && ap < 60) { GPA = 5; grade = "B+"; } if (ap >= 60 && ap < 70) { GPA = 6; grade = "A"; } if (ap >= 70 && ap < 80) { GPA = 7; grade = "A+"; } if (ap >= 80 && ap < 90) { GPA = 8; grade = "A++"; } if (ap >= 90 && ap <= 100) { GPA = 9; grade = "O"; } items.SubjectGPA = GPA.ToString(); items.SubjectGPW = (int.Parse(items.SubjectCredits) * GPA).ToString(); //if (!subject) //{ // GPA = 0; // grade = ""; //} } } } entities.SaveChanges(); }