예제 #1
0
        public JsonResult SelectStdCh()
        {
            mStudent_Ch_Choice_Filling_Save _obj = new mStudent_Ch_Choice_Filling_Save();
            string Code = string.Empty, Message = string.Empty;

            if (Session["ApplicationNo"] != null)
            {
                if (Session["ApplicationNo"].ToString() != "")
                {
                    _obj.ApplicationNo = Session["ApplicationNo"].ToString();
                }
            }
            _obj.studentid = Session["studentid"].ToString();
            List <mStudent_Ch_Choice_Filling_Saved_List> _list = new List <mStudent_Ch_Choice_Filling_Saved_List>();

            try
            {
                ChoiceFillingRepository _objRepository = new ChoiceFillingRepository();
                DataSet _ds = _objRepository.SELECT_tbl_Student_Ch_Choice_Filling(_obj);
                if (_ds != null)
                {
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow _dr in _ds.Tables[0].Rows)
                        {
                            _list.Add(new mStudent_Ch_Choice_Filling_Saved_List
                            {
                                id                  = _dr["ID"].ToString(),
                                InstituteName       = _dr["InstituteName"].ToString(),
                                InstituteCourseName = _dr["Coursename"].ToString(),
                                InstituteType       = _dr["InstituteType"].ToString(),
                                Discipline          = _dr["Discipline"].ToString(),
                                ProgramLevel        = _dr["ProgramLevel"].ToString(),
                                Coursename          = _dr["Coursename"].ToString(),
                                Specialization      = _dr["Specialization"].ToString(),
                                SequenceNumber      = _dr["SequenceNumber"].ToString()
                            });
                        }
                    }
                }
            }
            catch (NullReferenceException)
            {
                Code    = "error";
                Message = "Your session has been expired. Kindly refresh and try again.";
            }
            catch (Exception)
            {
                Code    = "error";
                Message = "Error from server side. Kindly refresh and try again.";
            }
            return(Json(new
            {
                List = _list,
                c = Code,
                m = Message
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }