示例#1
0
        public JsonResult SaveSDicipline(mStudent_Ch_Basic _obj)
        {
            string Message = string.Empty, Code = string.Empty;

            try
            {
                ChoiceFillingRepository _objRepository = new ChoiceFillingRepository();
                string localIP = "?";
                localIP        = Request.ServerVariables["REMOTE_ADDR"].ToString();
                _obj.CreatedIP = localIP;
                if (Session["ApplicationNo"] != null)
                {
                    if (Session["ApplicationNo"].ToString() != "")
                    {
                        _obj.ApplicationNo = Session["ApplicationNo"].ToString();
                    }
                }
                _obj.studentid = Session["studentid"].ToString();
                DataSet _ds = _objRepository.INSERT_UPDATE_tbl_Student_Ch_SelectDiscipline(_obj);
                if (_ds != null)
                {
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        Message = "Disciplines(s) have been saved successfully!";
                        Code    = "success";
                    }
                    else
                    {
                        Message = "Error from server side. Kindly refresh the page and try again.";
                        Code    = "servererror";
                    }
                }
            }
            catch (NullReferenceException)
            {
                Message = "Your session has been expired. Kindly login again.";
                Code    = "sessionexpired";
            }
            catch (Exception)
            {
                Message = "Error from server side. Kindly refresh the page and try again.";
                Code    = "servererror";
            }
            return(Json(new
            {
                m = Message,
                c = Code
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }