public IHttpActionResult PostMarks([FromBody] Tbl_MidResult pro, [FromUri] string id) { pro.TeacherID = id; context.Tbl_MidResult.Add(pro); context.SaveChanges(); return(Created(Url.Link("GetMarksByTeacher", new { id = pro.TeacherID }), pro)); }
public IHttpActionResult GetMarksByStudentID([FromUri] string id, int id1) { var list = context.Tbl_MidResult.Where(p => p.StudentID == id && p.ResultID == id1); if (list.FirstOrDefault() == null) { return(StatusCode(HttpStatusCode.NoContent)); } else { List <Tbl_MidResult> comments = new List <Tbl_MidResult>(); foreach (var item in list) { Tbl_MidResult pro = new Tbl_MidResult(); pro.ResultID = item.ResultID; pro.TeacherID = item.TeacherID; pro.StudentID = item.StudentID; pro.SectionID = item.SectionID; pro.SubjectID = item.SubjectID; pro.LabPerformanceMid = item.LabPerformanceMid; pro.PerformanceMid = item.PerformanceMid; pro.MidFinal = item.MidFinal; pro.TotalMarksMid = item.TotalMarksMid; pro.GradeMid = item.GradeMid; pro.AttendanceFinal = item.AttendanceFinal; pro.QuizFinal = item.QuizFinal; pro.PerformanceFinal = item.PerformanceFinal; pro.LabPerformanceFinal = item.LabPerformanceFinal; pro.Quiz1 = item.Quiz1; pro.Quiz2 = item.Quiz2; pro.Quiz3 = item.Quiz3; pro.Quiz4 = item.Quiz4; pro.Quiz5 = item.Quiz5; pro.Quiz6 = item.Quiz6; pro.FinalFinal = item.FinalFinal; pro.TotalMarksFinal = item.TotalMarksFinal; pro.GradeFinal = item.GradeFinal; pro.TotalMarks = item.TotalMarks; pro.Grade = item.Grade; pro.LabFinal = item.LabFinal; pro.links.Add(new Links() { HRef = "http://localhost:57254/api/Students/" + id + "/MarksOfStudents", Method = "GET", Rel = "Self" }); pro.links.Add(new Links() { HRef = "http://localhost:57254/api/Students/" + id + "/MarksOfStudents/" + pro.ResultID, Method = "GET", Rel = "Specific Resource" }); pro.links.Add(new Links() { HRef = "http://localhost:57254/api/Students/" + id + "/MarksOfStudents/" + pro.ResultID, Method = "PUT", Rel = "Resource Edit" }); comments.Add(pro); } return(Ok(comments)); } }
public IHttpActionResult PutComment([FromUri] string id, [FromUri] int id1, [FromBody] Tbl_MidResult item) { var pro = context.Tbl_MidResult.Where(p => p.StudentID == id && p.ResultID == id1).FirstOrDefault(); if (pro == null) { return(StatusCode(HttpStatusCode.NoContent)); } else { pro.ResultID = item.ResultID; pro.TeacherID = item.TeacherID; pro.StudentID = item.StudentID; pro.SectionID = item.SectionID; pro.SubjectID = item.SubjectID; pro.LabPerformanceMid = item.LabPerformanceMid; pro.PerformanceMid = item.PerformanceMid; pro.MidFinal = item.MidFinal; pro.TotalMarksMid = item.TotalMarksMid; pro.GradeMid = item.GradeMid; pro.AttendanceFinal = item.AttendanceFinal; pro.QuizFinal = item.QuizFinal; pro.PerformanceFinal = item.PerformanceFinal; pro.LabPerformanceFinal = item.LabPerformanceFinal; pro.Quiz1 = item.Quiz1; pro.Quiz2 = item.Quiz2; pro.Quiz3 = item.Quiz3; pro.Quiz4 = item.Quiz4; pro.Quiz5 = item.Quiz5; pro.Quiz6 = item.Quiz6; pro.Lab01 = item.Lab01; pro.Lab02 = item.Lab02; pro.Lab03 = item.Lab03; pro.Lab04 = item.Lab04; pro.FinalFinal = item.FinalFinal; pro.TotalMarksFinal = item.TotalMarksFinal; pro.GradeFinal = item.GradeFinal; pro.TotalMarks = item.TotalMarks; pro.Grade = item.Grade; pro.LabFinal = item.LabFinal; context.SaveChanges(); item.Tbl_Student = new Tbl_Student(); return(Ok(item)); } }
public ActionResult UploadLabTask(Tbl_MidResult tbl, HttpPostedFileBase file, HttpPostedFileBase file1, HttpPostedFileBase file2, HttpPostedFileBase file3, HttpPostedFileBase file4) { string lab1 = null; string lab2 = null; string lab3 = null; string lab4 = null; string lab5 = null; if (file != null) { lab1 = System.IO.Path.GetFileName(file.FileName); string path = System.IO.Path.Combine(Server.MapPath("~/LabTask/"), lab1); file.SaveAs(path); } tbl.Lab01 = lab1; if (file1 != null) { lab2 = System.IO.Path.GetFileName(file1.FileName); string path = System.IO.Path.Combine(Server.MapPath("~/LabTask/"), lab2); file1.SaveAs(path); } tbl.Lab02 = lab2; if (file2 != null) { lab3 = System.IO.Path.GetFileName(file2.FileName); string path = System.IO.Path.Combine(Server.MapPath("~/LabTask/"), lab3); file2.SaveAs(path); } tbl.Lab03 = lab3; if (file3 != null) { lab4 = System.IO.Path.GetFileName(file3.FileName); string path = System.IO.Path.Combine(Server.MapPath("~/LabTask/"), lab4); file3.SaveAs(path); } tbl.Lab04 = lab4; if (file4 != null) { lab5 = System.IO.Path.GetFileName(file4.FileName); string path = System.IO.Path.Combine(Server.MapPath("~/LabTask/"), lab5); file4.SaveAs(path); } tbl.LabMid = lab5; _unitOfWork.GetRepositoryInstance <Tbl_MidResult>().Update(tbl); return(RedirectToAction("Index")); }
public IHttpActionResult PostRegistration([FromUri] string id, [FromBody] Tbl_SectionDistribution sec) { var kl = context.Tbl_SectionDistribution.Where(x => x.SectionID == sec.SectionID).FirstOrDefault(); var sectiondouble = context.Tbl_Registration.Where(x => x.StudentID == id && x.SectionID == sec.SectionID).FirstOrDefault(); var cradit = context.Tbl_Registration.Where(x => x.StudentID == id && x.SemesterID == kl.SemesterID).Sum(x => x.Credit); var take = context.Tbl_SectionDistribution.Where(x => x.SectionID == sec.SectionID).FirstOrDefault(); var l = context.Tbl_SubjectDetails.Where(x => x.SubjectID == take.SubjectID).FirstOrDefault(); // var sid = _unitOfWork.GetRepositoryInstance<Tbl_SectionDistribution>().GetAllRecordsIQueryable().Where(x => x.SectionID == id).FirstOrDefault(); var subj = context.Tbl_SubjectDetails.Where(x => x.SubjectID == take.SubjectID).FirstOrDefault(); var m = context.Tbl_Student.Where(x => x.StudentID == id).FirstOrDefault(); var kal = context.Tbl_Registration.Where(p => p.StudentID == id && p.SubjectName == take.Tbl_SubjectDetails.SubjectName).FirstOrDefault(); var cost = context.Tbl_SemesterCost.Where(p => p.StudentID == id && p.SemesterIID == take.SemesterID).FirstOrDefault(); var semestercount = context.Tbl_SemesterCost.Where(p => p.StudentID == id).Count(); if (sectiondouble != null && cradit.Value > 16 && kal != null) { return(StatusCode(HttpStatusCode.NotFound)); } else { Tbl_Registration tbl = new Tbl_Registration(); tbl.StudentID = id; tbl.SectionID = take.SectionID; tbl.SemesterID = take.SemesterID; tbl.Available = take.Available; tbl.Capacity = take.Capacity; tbl.ClassStart = take.ClassStart; tbl.ClassEnd = take.ClassEnd; tbl.Day1 = take.Day1; tbl.Day2 = take.Day2; tbl.IsValid = false; tbl.SubjectName = l.SubjectName; tbl.Credit = take.Credit; tbl.ClassStart2 = take.ClassStart2; tbl.ClassEnd2 = take.ClassEnd2; tbl.SectionName = take.SectionName; tbl.TeacherID = take.TeacherID; Tbl_MidResult mid = new Tbl_MidResult(); mid.TeacherID = take.TeacherID; // mid.TeacherName = take.Tbl_Teacher1.FirstName + " " + take.Tbl_Teacher1.LastName; mid.StudentID = id; //mid.StudentName = m.FirstName + " " + m.LastName; mid.SectionID = take.SectionID; mid.SubjectID = take.SubjectID; mid.SemesterID = take.SemesterID; Tbl_SemesterCost scost = new Tbl_SemesterCost(); decimal lab = 0; if (cost != null) { if (semestercount % 3 == 0) { var kk = context.Tbl_Expense.Where(x => x.ExpenseName == "DevelopmentFee").FirstOrDefault(); var ll = context.Tbl_Expense.Where(x => x.ExpenseName == "Activity").FirstOrDefault(); scost.Development = kk.Cost; scost.Activity = ll.Cost; } else { scost.Development = 0; scost.Activity = 0; } if (subj.IsLabExist == "yes") { var kla = context.Tbl_Expense.Where(x => x.ExpenseName == "ComputerLab").FirstOrDefault(); lab = (decimal)cost.ComputerLab; scost.ComputerLab = lab + kla.Cost; } else { scost.ComputerLab = 0; } var jl = context.Tbl_Expense.Where(x => x.ExpenseName == "Credit").FirstOrDefault(); var jj = context.Tbl_Expense.Where(x => x.ExpenseName == "Miscellaneous").FirstOrDefault(); int credit = (int)cost.CreditTaken; scost.CreditTaken = credit + take.Credit; scost.StudentID = id; scost.SemesterIID = take.SemesterID; scost.LanguageLab = 0; scost.Miscellaneous = jj.Cost; scost.PreviousDue = 0; scost.ScienceLab = 0; scost.AdmissionFee = cost.AdmissionFee; scost.Studio = 0; scost.AmountPaid = 0; decimal prev = (decimal)cost.Total; scost.Total = prev + (scost.CreditTaken - credit) * jl.Cost + scost.Development + scost.Activity + lab; scost.Due = scost.Total - scost.AmountPaid; var seme = context.Tbl_SemesterCost.Where(x => x.StudentID == id && x.SemesterIID == take.SemesterID).FirstOrDefault(); context.Tbl_SemesterCost.Remove(seme); context.Tbl_SemesterCost.Add(scost); context.SaveChanges(); } else { var jj = context.Tbl_Expense.Where(x => x.ExpenseName == "Miscellaneous").FirstOrDefault(); var uj = context.Tbl_Expense.Where(x => x.ExpenseName == "Admission").FirstOrDefault(); var kk = context.Tbl_Expense.Where(x => x.ExpenseID == 7).FirstOrDefault(); var ll = context.Tbl_Expense.Where(x => x.ExpenseName == "Activity").FirstOrDefault(); scost.SemesterIID = take.SemesterID; scost.StudentID = id; scost.LanguageLab = 0; scost.Miscellaneous = jj.Cost; scost.PreviousDue = 0; scost.ScienceLab = 0; scost.Studio = 0; scost.AmountPaid = 0; scost.AdmissionFee = uj.Cost; scost.CreditTaken = take.Credit; if (semestercount % 3 == 0) { scost.Development = kk.Cost; scost.Activity = ll.Cost; } else { scost.Development = 0; scost.Activity = 0; } if (subj.IsLabExist == "yes") { var kla = context.Tbl_Expense.Where(x => x.ExpenseName == "ComputerLab").FirstOrDefault(); lab = (decimal)cost.ComputerLab; scost.ComputerLab = kla.Cost; } else { scost.ComputerLab = 0; } var jl = context.Tbl_Expense.Where(x => x.ExpenseName == "Credit").FirstOrDefault(); scost.Total = (scost.CreditTaken) * jl.Cost + scost.Development + scost.Activity + lab; context.Tbl_SemesterCost.Add(scost); context.SaveChanges(); } context.Tbl_Registration.Add(tbl); context.Tbl_MidResult.Add(mid); context.SaveChanges(); return(Created(Url.Link("GetRegistrationByStudentID", new { id = tbl.StudentID, id1 = tbl.RegID }), tbl)); } }
public ActionResult MarkUploadMid(Tbl_MidResult tbl) { _unitOfWork.GetRepositoryInstance <Tbl_MidResult>().Update(tbl); return(RedirectToAction("Marks")); }
public ActionResult RegistrationConfirm(Tbl_Registration tbl, int id, int did, Tbl_SectionDistribution tbl1, Tbl_AttandanceMid atm, Tbl_AttandanceFinal atm1, Tbl_MidResult mid, Tbl_SemesterCost scost) { string a = Session["UserID"].ToString(); var sectiondouble = _unitOfWork.GetRepositoryInstance <Tbl_Registration>().GetAllRecordsIQueryable().Where(x => x.StudentID == a && x.SectionID == id).FirstOrDefault(); var cradit = _unitOfWork.GetRepositoryInstance <Tbl_Registration>().GetListParameter(x => x.StudentID == a && x.SemesterID == did).Sum(x => x.Credit); var take = _unitOfWork.GetRepositoryInstance <Tbl_SectionDistribution>().GetAllRecordsIQueryable().Where(x => x.SectionID == id).FirstOrDefault(); var l = _unitOfWork.GetRepositoryInstance <Tbl_SubjectDetails>().GetAllRecordsIQueryable().Where(x => x.SubjectID == take.SubjectID).FirstOrDefault(); // var sid = _unitOfWork.GetRepositoryInstance<Tbl_SectionDistribution>().GetAllRecordsIQueryable().Where(x => x.SectionID == id).FirstOrDefault(); var subj = _unitOfWork.GetRepositoryInstance <Tbl_SubjectDetails>().GetAllRecordsIQueryable().Where(x => x.SubjectID == take.SubjectID).FirstOrDefault(); var m = _unitOfWork.GetRepositoryInstance <Tbl_Student>().GetAllRecordsIQueryable().Where(x => x.StudentID == a).FirstOrDefault(); var kal = _unitOfWork.GetRepositoryInstance <Tbl_Registration>().GetAllRecordsIQueryable().Where(p => p.StudentID == a && p.SubjectName == take.Tbl_SubjectDetails.SubjectName).FirstOrDefault(); var cost = _unitOfWork.GetRepositoryInstance <Tbl_SemesterCost>().GetAllRecordsIQueryable().Where(p => p.StudentID == a && p.SemesterIID == take.SemesterID).FirstOrDefault(); var semestercount = _unitOfWork.GetRepositoryInstance <Tbl_SemesterCost>().GetAllRecordsIQueryable().Where(p => p.StudentID == a).Count(); if (sectiondouble != null && cradit.Value > 16 && kal != null) { Response.Write("<script>alert('Sorry! u have already taken this subject')</script>"); } else { tbl.StudentID = a; tbl.SectionID = id; tbl.SemesterID = did; tbl.Available = take.Available; tbl.Capacity = take.Capacity; tbl.ClassStart = take.ClassStart; tbl.ClassEnd = take.ClassEnd; tbl.Day1 = take.Day1; tbl.Day2 = take.Day2; tbl.IsValid = false; tbl.SubjectName = l.SubjectName; tbl.Credit = take.Credit; tbl.ClassStart2 = take.ClassStart2; tbl.ClassEnd2 = take.ClassEnd2; tbl.SectionName = take.SectionName; tbl.TeacherID = take.TeacherID; atm.TeacherID = take.TeacherID; atm.SectionID = take.SectionID; atm.SectionName = take.SectionName; atm.SubjectID = take.SubjectID; atm.TeacherName = take.Tbl_Teacher1.FirstName + " " + take.Tbl_Teacher1.LastName; atm.StudentID = a; atm.StudentName = m.FirstName + " " + m.LastName; atm1.TeacherID = take.TeacherID; atm1.SectionID = take.SectionID; atm1.SectionName = take.SectionName; atm1.SubjectID = take.SubjectID; atm1.TeacherName = take.Tbl_Teacher1.FirstName + " " + take.Tbl_Teacher1.LastName; atm1.StudentID = a; atm1.StudentName = m.FirstName + " " + m.LastName; mid.TeacherID = take.TeacherID; // mid.TeacherName = take.Tbl_Teacher1.FirstName + " " + take.Tbl_Teacher1.LastName; mid.StudentID = a; //mid.StudentName = m.FirstName + " " + m.LastName; mid.SectionID = take.SectionID; mid.SubjectID = take.SubjectID; mid.SemesterID = take.SemesterID; decimal lab = 0; if (cost != null) { if (semestercount % 3 == 0) { var kk = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "DevelopmentFee").FirstOrDefault(); var ll = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "Activity").FirstOrDefault(); scost.Development = kk.Cost; scost.Activity = ll.Cost; } else { scost.Development = 0; scost.Activity = 0; } if (subj.IsLabExist == "yes") { var kl = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "ComputerLab").FirstOrDefault(); lab = (decimal)cost.ComputerLab; scost.ComputerLab = lab + kl.Cost; } else { scost.ComputerLab = 0; } var jl = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "Credit").FirstOrDefault(); var jj = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "Miscellaneous").FirstOrDefault(); int credit = (int)cost.CreditTaken; scost.CreditTaken = credit + take.Credit; scost.StudentID = a; scost.SemesterIID = take.SemesterID; scost.LanguageLab = 0; scost.Miscellaneous = jj.Cost; scost.PreviousDue = 0; scost.ScienceLab = 0; scost.AdmissionFee = cost.AdmissionFee; scost.Studio = 0; scost.AmountPaid = 0; decimal prev = (decimal)cost.Total; scost.Total = prev + (scost.CreditTaken - credit) * jl.Cost + scost.Development + scost.Activity + lab; scost.Due = scost.Total - scost.AmountPaid; _unitOfWork.GetRepositoryInstance <Tbl_SemesterCost>().RemovebyWhereClause(x => x.StudentID == a && x.SemesterIID == take.SemesterID); _unitOfWork.GetRepositoryInstance <Tbl_SemesterCost>().Add(scost); } else { var jj = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "Miscellaneous").FirstOrDefault(); var uj = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "Admission").FirstOrDefault(); var kk = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseID == 7).FirstOrDefault(); var ll = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "Activity").FirstOrDefault(); scost.SemesterIID = take.SemesterID; scost.StudentID = a; scost.LanguageLab = 0; scost.Miscellaneous = jj.Cost; scost.PreviousDue = 0; scost.ScienceLab = 0; scost.Studio = 0; scost.AmountPaid = 0; scost.AdmissionFee = uj.Cost; scost.CreditTaken = take.Credit; if (semestercount % 3 == 0) { scost.Development = kk.Cost; scost.Activity = ll.Cost; } else { scost.Development = 0; scost.Activity = 0; } if (subj.IsLabExist == "yes") { var kl = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "ComputerLab").FirstOrDefault(); lab = (decimal)cost.ComputerLab; scost.ComputerLab = kl.Cost; } else { scost.ComputerLab = 0; } var jl = _unitOfWork.GetRepositoryInstance <Tbl_Expense>().GetAllRecordsIQueryable().Where(x => x.ExpenseName == "Credit").FirstOrDefault(); scost.Total = (scost.CreditTaken) * jl.Cost + scost.Development + scost.Activity + lab; _unitOfWork.GetRepositoryInstance <Tbl_SemesterCost>().Add(scost); } _unitOfWork.GetRepositoryInstance <Tbl_Registration>().Add(tbl); _unitOfWork.GetRepositoryInstance <Tbl_AttandanceMid>().Add(atm); _unitOfWork.GetRepositoryInstance <Tbl_AttandanceFinal>().Add(atm1); _unitOfWork.GetRepositoryInstance <Tbl_MidResult>().Add(mid); } return(RedirectToAction("Registration", "Student")); }