Beispiel #1
0
        public ResponseResult GetRoutineByClassSectionShift(WeeklyRoutinebyClassSectionShiftDayVM weeklyRoutinebyClassSectionShiftDayVM)
        {
            ResponseResult responseResult = new ResponseResult();

            try
            {
                var periodList = _dbContext.GetPeriodsByClassSectionShift_SP(weeklyRoutinebyClassSectionShiftDayVM.ClassId,
                                                                             weeklyRoutinebyClassSectionShiftDayVM.SectionId,
                                                                             weeklyRoutinebyClassSectionShiftDayVM.Shift);
                if (periodList != null)
                {
                    responseResult.Content       = periodList;
                    responseResult.MessageCode   = MessageCode.Y.ToString();
                    responseResult.SystemMessage = "Data found!";
                }
                else
                {
                    responseResult.Content       = null;
                    responseResult.MessageCode   = MessageCode.N.ToString();
                    responseResult.SystemMessage = "Data not found!";
                }
            }
            catch (Exception ex)
            {
                responseResult.Content       = null;
                responseResult.MessageCode   = MessageCode.N.ToString();
                responseResult.SystemMessage = ex.Message;
            }
            return(responseResult);
        }
Beispiel #2
0
        public ActionResult GetRoutine(string classId, string sectionid, string shift)
        {
            ResponseResult responseResult = new ResponseResult();
            List <GetPeriodsByClassSectionShift_SP_Result> routineList = new List <GetPeriodsByClassSectionShift_SP_Result>();

            Dictionary <string, List <GetPeriodsByClassSectionShift_SP_Result> > pairs =
                new Dictionary <string, List <GetPeriodsByClassSectionShift_SP_Result> >();

            WeeklyRoutinebyClassSectionShiftDayVM vm = new WeeklyRoutinebyClassSectionShiftDayVM()
            {
                ClassId   = Convert.ToInt32(classId),
                SectionId = Convert.ToInt32(sectionid),
                Shift     = shift
            };

            try
            {
                var    res         = _apiRequest.HttpPostRequest(vm, "api/Period/RoutineByClassSectionShift");
                string apiResponse = res.ToString();
                responseResult = JsonConvert.DeserializeObject <ResponseResult>(apiResponse);

                if (responseResult.MessageCode == "Y")
                {
                    routineList = JsonConvert.DeserializeObject <List <GetPeriodsByClassSectionShift_SP_Result> >(responseResult.Content.ToString());
                    pairs       = FormattingClassRoutine(routineList);

                    //TempData["msgAlert"] = "Y";
                    //TempData["msgAlertDetails"] = responseResult.SystemMessage;
                }
                else if (responseResult.MessageCode == "N")
                {
                    TempData["msgAlert"]        = "N";
                    TempData["msgAlertDetails"] = responseResult.SystemMessage;
                }
            }
            catch (Exception ex)
            {
                TempData["msgAlert"]        = "N";
                TempData["msgAlertDetails"] = ex.Message.ToString();
            }
            ViewData["ClassList"]   = new SelectList(GetClassListForDropDown(), "ClassId", "ClassWithShift");
            ViewData["SectionList"] = new SelectList(GetSectionListForDropDown(), "SectionId", "SectionName");
            return(View(pairs));
        }