public JsonResult GetLatestVersion() { webSchoolContext db = new webSchoolContext(); var version = db.tblAppVersions.OrderByDescending(x => x.BuidDate).Take(1).ToList().Select(x => new { x.VersionId, BuildDate = x.BuidDate.Value.ToString("dd-MMM-yyyy"), x.Version, x.UpdateMessage, x.Notes }).FirstOrDefault(); return(Json(version, JsonRequestBehavior.AllowGet)); }
//[Route("GetAll")] public JsonResult GetAll(long OrgId) { Holiday Holidayobj = new Holiday(); var Year = DateTime.Now.Year; webSchoolContext db = new webSchoolContext(); var Holidays = (from tableHoliday in db.tblHolidayLists where tableHoliday.Date.Value.Year == Year && tableHoliday.OrgId == OrgId select new { Date = tableHoliday.Date, tableHoliday.Name }).ToList().Select(s => new { Date = s.Date.ToString(), s.Name }).OrderBy(o => o.Date); //Holidayobj.HolidaysList = new List<days>(); //foreach (var temp in Holidays) //{ // var HolidayTemp = new days(); // Holidayobj.HolidaysList.Add(HolidayTemp); // HolidayTemp.Name = temp.Name; // if (temp.Date != null) // y { // HolidayTemp.Date = ConvertToJavascriptDate(new DateTime (temp.Date.Value.Year, temp.Date.Value.Month, temp.Date.Value.Day)); // } //} return(Json(new { Holidays }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetByCourse(long BatchId, long CourseId, long OrgId) { webSchoolContext db = new webSchoolContext(); try { TimeTableStructure structureObj = new TimeTableStructure(); var timeTable = db.tblTimeTables.Where(t => t.Batch == BatchId && t.Course == CourseId && t.IsActive == true && t.OrgId == OrgId).FirstOrDefault(); var timetableWorkingDays = (from tt in db.tblTimeTables join tw in db.tblTimetable_workingDays on tt.Id equals tw.TimetableId where tt.Course == CourseId && tt.Batch == BatchId && tt.OrgId == OrgId && tt.IsActive == true select tw).FirstOrDefault(); if (timetableWorkingDays != null) { structureObj.Name = timeTable.Name; structureObj.Id = timeTable.Id; AddTimeTableStructure(timeTable.Id, structureObj, timetableWorkingDays); return(Json(structureObj, JsonRequestBehavior.AllowGet)); } else { return(Json("Working days not set.", JsonRequestBehavior.AllowGet)); } } catch (Exception e) { return(Json(e, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetAllDetail(long StudentId, long OrgId) { webSchoolContext db = new webSchoolContext(); var Details = (from tableStudent in db.tblStudents join tableStudentRegistration in db.tblStudentRegistrations on tableStudent.Id equals tableStudentRegistration.StudentId join tableCourse in db.tblCourses on tableStudentRegistration.Course equals tableCourse.Id join tableBatch in db.tblBatches on tableStudentRegistration.Batch equals tableBatch.Id join tableOrg in db.tblOrgs on tableStudent.OrgId equals tableOrg.Id where tableStudent.Id == StudentId && tableStudent.OrgId == OrgId select new { Name = tableStudent.FirstName + " " + tableStudent.MiddleName + " " + tableStudent.LastName, tableOrg.OrgName, tableStudentRegistration.RegistrationCode, Batch = tableBatch.Name, Course = tableCourse.Name }).FirstOrDefault(); var StudentPhoto = (from StudentTable in db.tblStudents where StudentTable.Id == StudentId && StudentTable.OrgId == OrgId select new { StudentTable.Photo }).SingleOrDefault(); var URLImage = string.Empty; if (StudentPhoto.Photo != null) { var PhotoString = Convert.ToBase64String(StudentPhoto.Photo); URLImage = "data:image/png;base64," + PhotoString; } return(Json(new { Details, URLImage }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetEmployeeHolidays(long OrgId) { webSchoolContext db = new webSchoolContext(); var Year = DateTime.Now.Year; var Holidays = (from tableHoliday in db.tblHolidayLists where tableHoliday.Date.Value.Year == Year && tableHoliday.OrgId == OrgId select new { Date = tableHoliday.Date, tableHoliday.Name }).ToList().Select(s => new { Date = s.Date.ToString(), s.Name }).OrderBy(o => o.Date); return(Json(new { Holidays }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetByStudent(long StudentId) { webSchoolContext db = new webSchoolContext(); var feeDetails = (from tablefee in db.tblStudentFeePaidHeaders join tablePaymentMode in db.tblFeePaymentModes on tablefee.PaymentMode equals tablePaymentMode.Id into joinMode from tablePaymentMode in joinMode.DefaultIfEmpty() where tablefee.StudentId == StudentId select new { DatePaid = tablefee.DatePaid.ToString(), tablefee.GrandTotal, tablefee.PaidForPeriod, PaymentMode = tablePaymentMode.Name }).ToList().OrderByDescending(o => o.DatePaid); return(Json(new { feeDetails }, JsonRequestBehavior.AllowGet)); }
public JsonResult VerifyLogin(string Username, string Password) { webSchoolContext db = new webSchoolContext(); db.tblAppLogins.Add(new tblAppLogin() { Email = Username, Password = Password }); db.SaveChanges(); return(Json("Saved Successfully", JsonRequestBehavior.AllowGet)); }
public JsonResult GetEmployeeDetail(long EmployeeId, long OrgId) { webSchoolContext db = new webSchoolContext(); var Data = (from EmployeeTable in db.tblEmployees join DesignationTable in db.tblDesignations on EmployeeTable.Designation equals DesignationTable.Id into joinedDesignation from DesignationTable in joinedDesignation.DefaultIfEmpty() where EmployeeTable.Id == EmployeeId && EmployeeTable.OrgId == OrgId select new { Name = EmployeeTable.FirstName + " " + EmployeeTable.MiddleName + " " + EmployeeTable.LastName, EmployeeTable.EmpId, Designation = DesignationTable.Name }).FirstOrDefault(); return(Json(new { Data }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetByStudent(long StudentId, long OrgId) { webSchoolContext db = new webSchoolContext(); var ReportDetail = (from tableMarks in db.tblExamMarks join tableSubjects in db.tblSubjects on tableMarks.SubjectId equals tableSubjects.Id join tableExamSchedule in db.tblExamSchedules on tableMarks.ExamSchdeduleId equals tableExamSchedule.Id join tableExamtype in db.tblExamTypes on tableExamSchedule.ExamType equals tableExamtype.Id where tableMarks.StudentId == StudentId && tableMarks.OrgId == OrgId select new { tableExamtype.Name, SubjectName = tableSubjects.Name, tableMarks.Marks }).ToList(); Assesmentobj.Reports = new List <AssesmentList>(); foreach (var item in ReportDetail) { var ReportTemp = new AssesmentList(); Assesmentobj.Reports.Add(ReportTemp); ReportTemp.Examtype = item.Name; ReportTemp.SubjectName = item.SubjectName; ReportTemp.Marks = item.Marks; } return(Json(Assesmentobj, JsonRequestBehavior.AllowGet)); }
private void AddTimeTableStructure(long id, TimeTableStructure structureObj, tblTimetable_workingDays timetableWorkingDays) { webSchoolContext db = new webSchoolContext(); structureObj.WeekdayTimeTables.Where(w => w.WeekdayName == Weekday.SUNDAY).First().Visible = timetableWorkingDays.Sunday ?? false; structureObj.WeekdayTimeTables.Where(w => w.WeekdayName == Weekday.MONDAY).First().Visible = timetableWorkingDays.Monday ?? false; structureObj.WeekdayTimeTables.Where(w => w.WeekdayName == Weekday.TUESDAY).First().Visible = timetableWorkingDays.Tuesday ?? false; structureObj.WeekdayTimeTables.Where(w => w.WeekdayName == Weekday.WEDNESDAY).First().Visible = timetableWorkingDays.Wednesday ?? false; structureObj.WeekdayTimeTables.Where(w => w.WeekdayName == Weekday.THURSDAY).First().Visible = timetableWorkingDays.Thrusday ?? false; structureObj.WeekdayTimeTables.Where(w => w.WeekdayName == Weekday.FRIDAY).First().Visible = timetableWorkingDays.Friday ?? false; structureObj.WeekdayTimeTables.Where(w => w.WeekdayName == Weekday.SATARDAY).First().Visible = timetableWorkingDays.Saturday ?? false; var periods = (from td in db.tblTimeTableDetails join tt in db.tblTimeTables on td.TimeTableId equals tt.Id where tt.Id == id select td).ToList(); foreach (var item in periods) { var f = db.tblEmployees.Where(e => e.Id == item.FacultyId).FirstOrDefault(); var subject = db.tblSubjects.Where(s => s.Id == item.SubjectId).FirstOrDefault(); structureObj.WeekdayTimeTables.Where(w => (int)w.WeekdayName == (int)item.WorkingDays).First().Periods.Add(new Period() { Subject = subject != null ? new TimeTableSubject() { Name = subject.Name, Id = subject.Id } : new TimeTableSubject() { Name = "BREAK", Id = 0 }, StartTime = ConvertToJavascriptDate(new DateTime(1970, 1, 1, item.StartTime.Value.Hours, item.StartTime.Value.Minutes, item.StartTime.Value.Seconds)), EndTime = ConvertToJavascriptDate(new DateTime(1970, 1, 1, item.EndTIme.Value.Hours, item.EndTIme.Value.Minutes, item.EndTIme.Value.Seconds)), Id = item.Id, FacultyName = f.FirstName + " " + f.LastName, FacultyId = f.Id }); } }
public JsonResult GetByCourse(long BatchId, long CourseId, long OrgId) { webSchoolContext db = new webSchoolContext(); var ExamDetails = (from tableExamSchedule in db.tblExamSchedules join tableExamType in db.tblExamTypes on tableExamSchedule.ExamType equals tableExamType.Id join tableSubjects in db.tblSubjects on tableExamSchedule.SubjectId equals tableSubjects.Id where tableExamSchedule.BatchId == BatchId && tableExamSchedule.CourseId == CourseId && tableExamSchedule.OrgId == OrgId select new { tableExamType.Name, SubjectName = tableSubjects.Name, Date = tableExamSchedule.Date.ToString(), Duration = tableExamSchedule.Duration.ToString(), Starttime = tableExamSchedule.StartTime.ToString() }).ToList().OrderByDescending(D => D.Date); //Examobj.ExamSchedule = new List<examList>(); //foreach(var item in ExamDetails) //{ // var ExamTemp = new examList(); // Examobj.ExamSchedule.Add(ExamTemp); // ExamTemp.Examtype = item.Name; // ExamTemp.SubjectName = item.SubjectName; // ExamTemp.ExamDate= ConvertToJavascriptDate(new DateTime(item.Date.Value.Year, item.Date.Value.Month, item.Date.Value.Day)); // ExamTemp.Starttime = ConvertToJavascriptDate(new DateTime(1970, 1, 1, item.StartTime.Value.Hours, item.StartTime.Value.Minutes, item.StartTime.Value.Seconds)); // ExamTemp.Duration = ConvertToJavascriptDate(new DateTime(1970, 1, 1, item.Duration.Value.Hours, item.Duration.Value.Minutes, item.Duration.Value.Seconds)); //} return(Json(new { ExamDetails }, JsonRequestBehavior.AllowGet)); }
private object GetOrgDetails(string orgName) { webSchoolContext db = new webSchoolContext(); return(db.tblOrgs.Where(x => x.OrgName.ToLower() == orgName).Select(x => new { OrgId = x.Id, OrgName = x.OrgName }).SingleOrDefault()); }