[ActionName("GetAllLecturerTimeTable")] //All Lecturer public async Task <HttpResponseMessage> GetAllLecturerTimeTable(int batchID, string date = "") { try { TimeTableDAL dal = new TimeTableDAL(); List <LecturerTimeTable> data = await dal.GetAllLecturerTimeTable(batchID, date); if (data != null) { return(Request.CreateResponse <List <LecturerTimeTable> >(HttpStatusCode.OK, data)); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound)); } } catch (DbEntityValidationException ex) { var controllerName = ControllerContext.RouteData.Values["controller"].ToString(); var actionName = ControllerContext.RouteData.Values["action"].ToString(); Logger log = new Logger(); log.ErrorLog(ex, controllerName, actionName); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError)); } }
public async Task <HttpResponseMessage> GetHoliday(string Month, int Year) { try { TimeTableDAL dal = new TimeTableDAL(); HolidayWrap data = await dal.GetHoliday(Month, Year); if (data != null) { return(Request.CreateResponse <HolidayWrap>(HttpStatusCode.OK, data)); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound)); } } catch (DbEntityValidationException ex) { var controllerName = ControllerContext.RouteData.Values["controller"].ToString(); var actionName = ControllerContext.RouteData.Values["action"].ToString(); Logger log = new Logger(); log.ErrorLog(ex, controllerName, actionName); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError)); } }
public void Add(HttpRequestBase req) { TimeTable u_TimeTab; List <TimeTable> list_u_TimeTab = new List <TimeTable>(); for (int i = 0; i < 13; ++i) { u_TimeTab = new TimeTable() { UserID = Convert.ToInt32(req.Cookies[GLB.id].Value), Section = Convert.ToInt16(i + 1), FirstDay = req.Form["row" + i + "cell0"] == "on" ? '1' : '0', SecondDay = req.Form["row" + i + "cell1"] == "on" ? '1' : '0', ThirdDay = req.Form["row" + i + "cell2"] == "on" ? '1' : '0', FourthDay = req.Form["row" + i + "cell3"] == "on" ? '1' : '0', FifthDay = req.Form["row" + i + "cell4"] == "on" ? '1' : '0', SixthDay = req.Form["row" + i + "cell5"] == "on" ? '1' : '0', SeventhDay = req.Form["row" + i + "cell6"] == "on" ? '1' : '0' }; list_u_TimeTab.Add(u_TimeTab); } tmTabDal = new TimeTableDAL(); tmTabDal.Add(list_u_TimeTab); tmTabDal.ReturnUnitToPool(); }
private List <TimeTable> Retrieve(int iSession) { List <TimeTable> myTimeTable = new List <TimeTable>(); TimeTableDAL myTimeTableDAL = new TimeTableDAL(); DataSet Ds = new DataSet(); try { InitializeModule.EnumCampus Campus = InitializeModule.EnumCampus.Females; int iCampus = 0; switch (iSession) { case 1: case 2: case 9: Campus = InitializeModule.EnumCampus.Females; iCampus = 2; break; case 4: case 8: Campus = InitializeModule.EnumCampus.Males; iCampus = 1; break; } int iTerm = 0; int iSem = 0; int iYear = 0; iTerm = LibraryMOD.GetRegTerm(); iYear = LibraryMOD.SeperateTerm(iTerm, out iSem); //if(Session["CurrentMajorCampus"]!=null) //{ // iCampus=Convert.ToInt32(Session["CurrentMajorCampus"]); //} myTimeTable = myTimeTableDAL.GetTimeTable(iYear, iSem, iSession, "", 0, 0, "", "", false, false, iCampus, Campus); } catch (Exception ex) { Console.WriteLine("{0} Exception caught.", ex.Message); } finally { } return(myTimeTable); }
public ResponseStatus IsHaveData(HttpRequestBase req) { int id = Convert.ToInt32(req.Cookies[GLB.id].Value); tmTabDal = new TimeTableDAL(); if (tmTabDal.IsHaveData(id)) { tmTabDal.ReturnUnitToPool(); return(ResponseStatus.HAVE_TIMETABLE); } else { tmTabDal.ReturnUnitToPool(); return(ResponseStatus.HAVE_NO_TIMETABLE); } }
private ResponseStatus GetDetails(int id, Container_TimeTables_UserBases container_list_t) { tmTabDal = new TimeTableDAL(); tmTabDal.GetDetails(id); tmTabDal.ReturnUnitToPool(); container_list_t.list_t = tmTabDal.list_t; if (container_list_t.list_t.Count > 0) { return(ResponseStatus.SUCCESS); } else { tmTabDal.list_t = null; return(ResponseStatus.HAVE_NO_TIMETABLE); } }
public void Select(HttpRequestBase req, Container_List_FreeTime container_list_free) { TmTab_ResearchCon tmTab_RC = new TmTab_ResearchCon(); //1,2,3,4,5,6,7 tmTab_RC.WeekStart = !string.IsNullOrEmpty(req.Form["weekStart"]) ? Convert.ToInt32(req.Form["weekStart"]) : 1; tmTab_RC.WeekEnd = !string.IsNullOrEmpty(req.Form["weekEnd"]) ? Convert.ToInt32(req.Form["weekEnd"]) : 7; //1,3,5,7,9,10,12 tmTab_RC.SectionStart = !string.IsNullOrEmpty(req.Form["sectionStart"]) ? Convert.ToInt32(req.Form["sectionStart"]) : 1; tmTab_RC.SectionEnd = !string.IsNullOrEmpty(req.Form["sectionEnd"]) ? Convert.ToInt32(req.Form["sectionEnd"]) : 12; object value = null; value = req.Form["grdID"]; UserStatus us = new UserStatus(); us.Grd = new Grade() { ID = !string.IsNullOrEmpty(value.ToString()) ? Convert.ToInt32(value) : 0 }; value = req.Form["collageID"]; us.Clg = new Collage() { ID = !string.IsNullOrEmpty(value.ToString()) ? Convert.ToInt32(value) : 0 }; value = req.Form["depID"]; us.Dep = new Department() { ID = !string.IsNullOrEmpty(value.ToString()) ? Convert.ToInt32(value) : 0 }; tmTabDal = new TimeTableDAL(); tmTabDal.Select(us, tmTab_RC); tmTabDal.ReturnUnitToPool(); container_list_free.list_free = tmTabDal.list_free; }
private void Retrieve() { List <TimeTable> myTimeTables = new List <TimeTable>(); TimeTableDAL myTimeTableDAL = new TimeTableDAL(); DataSet Ds = new DataSet(); try { int sem = 0; int Year = LibraryMOD.SeperateTerm(LibraryMOD.GetCurrentTerm(), out sem); int iYear = Year; int iSem = sem; string sSemester = LibraryMOD.GetSemesterString(iSem); string sStudentNumber = this.sNo; int iSemester = Convert.ToInt32("0" + iSem.ToString()); int iRegYear = Convert.ToInt32("0" + iYear.ToString()); lbl_TitleYearSem.Text = " - " + iRegYear.ToString() + " / " + (iRegYear + 1).ToString() + " " + sSemester; lbl_TitleStudent.Text = GetCaption(); lbl_TitleStudent.Text += " - Total Credit Hours: [ " + LibraryMOD.GetStudentRegisteredCredit(iRegYear, iSemester, sNo, Convert.ToInt32((InitializeModule.EnumCampus) this.Campus)).ToString() + " ]"; lbl_TitleMajor.Text = LibraryMOD.GetStudentMajor(this.Campus, sNo); myTimeTables = myTimeTableDAL.GetStudentTimeTable(sStudentNumber, iYear, iSem, this.Campus); Ds = Prepare_TimeTable_Report(myTimeTables); } catch (Exception ex) { Console.WriteLine("{0} Exception caught.", ex.Message); } finally { Session["ReportDS"] = Ds; } }
public TimeTableController() { this.timeTableDAL = new TimeTableDAL(this.context); }