Exemplo n.º 1
0
        public JsonResult PeriodAssignmentAjax(string subjectId, string periodId /*, string userPhone*/)
        {
            ResponseResult responseResult = new ResponseResult();
            AssignTeachersSubjectWithPeriodVM assignTeachersVM = new AssignTeachersSubjectWithPeriodVM()
            {
                PeriodId  = Convert.ToInt32(periodId),
                SubjectId = Convert.ToInt32(subjectId),
                //UserPhone = Convert.ToInt64(userPhone)
            };

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

                //if (responseResult.MessageCode == "Y")
                //{
                //    return responseResult.MessageCode;
                //}
                //else(responseResult.MessageCode == "N")
                //{
                //}
            }
            catch (Exception ex)
            {
                TempData["msgAlert"]        = "N";
                TempData["msgAlertDetails"] = ex.Message.ToString();
            }
            return(Json(responseResult.MessageCode, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ResponseResult AssignTeacherSubjectWithPeriodOrtUpdate(AssignTeachersSubjectWithPeriodVM assignTeachersSubjectWithPeriodVM)
        {
            ResponseResult responseResult = new ResponseResult();

            System.Data.Entity.Core.Objects.ObjectParameter MSG_Code =
                new System.Data.Entity.Core.Objects.ObjectParameter("MSG_Code", typeof(string));
            System.Data.Entity.Core.Objects.ObjectParameter MSG =
                new System.Data.Entity.Core.Objects.ObjectParameter("MSG", typeof(string));

            try
            {
                Period periodObj = new Period()
                {
                    PeriodId         = assignTeachersSubjectWithPeriodVM.PeriodId,
                    MaskingSubjectId = GetSubjectMaskingIdBySubjactid(assignTeachersSubjectWithPeriodVM.SubjectId)
                };

                _dbContext.AddOrUpdateRoutineAssignment_SP(periodObj.MaskingSubjectId,
                                                           periodObj.PeriodId,
                                                           MSG_Code, MSG);
                responseResult.MessageCode   = MSG_Code.Value.ToString();
                responseResult.SystemMessage = MSG.Value.ToString();
                responseResult.Content       = null;
            }
            catch (Exception)
            {
                responseResult.MessageCode   = MSG_Code.ToString();
                responseResult.SystemMessage = MSG.Value.ToString();
                responseResult.Content       = null;
            }
            return(responseResult);
        }