예제 #1
0
        public JsonResult SelectInstitute(ChoiceFillingSecondRound obj)
        {
            ChoiceFillingSecondRoundRepository objRep = new ChoiceFillingSecondRoundRepository();

            obj.Type      = "GridDetails";
            obj.studentid = Session["studentid"].ToString();
            obj.CreatedBy = Session["studentid"].ToString();
            DataSet ds = objRep.Select_InstituteList(obj);
            List <ChoiceFillingSecondRound> _list = new List <ChoiceFillingSecondRound>();

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        ChoiceFillingSecondRound objChoice = new ChoiceFillingSecondRound();
                        //objChoice.ID = row["ID"].ToString();
                        objChoice.tbl_InstituteCourse_ID = row["tbl_InstituteCourse_ID"].ToString();
                        objChoice.InstituteID            = row["InstituteId"].ToString();
                        //objChoice.Discipline = row["Discipline"].ToString();
                        objChoice.Natureofcourse = row["Natureofcourse"].ToString();
                        //objChoice.ProgramLevel = row["ProgramLevel"].ToString();
                        //   objChoice.BranchName = row["BranchName"].ToString();
                        objChoice.InstituteName = row["InstituteName"].ToString();
                        // objChoice.DisplayName = row["DisplayName"].ToString();
                        objChoice.state_name   = row["state_name"].ToString();
                        objChoice.G1SeatWaiver = row["G1SeatWaiver"].ToString();
                        objChoice.G2SeatWaiver = row["G2SeatWaiver"].ToString();
                        objChoice.G3SeatWaiver = row["G3SeatWaiver"].ToString();
                        objChoice.G4SeatWaiver = row["G4SeatWaiver"].ToString();
                        _list.Add(objChoice);
                    }
                }
            }
            return(Json(new
            {
                List = _list
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
예제 #2
0
        public ActionResult SelectInstitutePaging(ChoiceFillingSecondRound obj)
        {
            var    draw   = Request.Form.GetValues("draw").FirstOrDefault();
            var    start  = Request.Form.GetValues("start").FirstOrDefault();
            var    length = Request.Form.GetValues("length").FirstOrDefault();
            string search = Request.Form.GetValues("search[value]").FirstOrDefault();
            // var data="";
            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;
            ChoiceFillingSecondRoundRepository objRep = new ChoiceFillingSecondRoundRepository();

            obj.Type      = "GridDetails";
            obj.studentid = Session["studentid"].ToString();
            obj.CreatedBy = Session["studentid"].ToString();
            List <ChoiceFillingSecondRound> _list = new List <ChoiceFillingSecondRound>();
            DataSet ds = objRep.Select_InstituteList(obj);

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        ChoiceFillingSecondRound objChoice = new ChoiceFillingSecondRound();
                        objChoice.tbl_InstituteCourse_ID = row["tbl_InstituteCourse_ID"].ToString();
                        objChoice.InstituteID            = row["InstituteId"].ToString();
                        objChoice.Natureofcourse         = row["Natureofcourse"].ToString();
                        objChoice.InstituteName          = row["InstituteName"].ToString();
                        objChoice.state_name             = row["state_name"].ToString();
                        objChoice.G1SeatWaiver           = row["G1SeatWaiver"].ToString();
                        objChoice.G2SeatWaiver           = row["G2SeatWaiver"].ToString();
                        objChoice.G3SeatWaiver           = row["G3SeatWaiver"].ToString();
                        objChoice.G4SeatWaiver           = row["G4SeatWaiver"].ToString();
                        _list.Add(objChoice);
                    }
                }
            }
            List <ChoiceFillingSecondRound> list = new List <ChoiceFillingSecondRound>();

            if (search == null)
            {
                list = _list;
            }
            else
            {
                // simulate search
                foreach (ChoiceFillingSecondRound dataItem in _list)
                {
                    if (dataItem.InstituteName.ToUpper().Contains(search.ToUpper()) ||
                        dataItem.Natureofcourse.ToString().Contains(search.ToUpper()))
                    {
                        list.Add(dataItem);
                    }
                }
            }
            var v = list;

            recordsTotal = v.Count();
            var data = v.Skip(skip).Take(pageSize).ToList();

            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }, JsonRequestBehavior.AllowGet));
        }