Пример #1
0
        public JsonResult SelectInstitute(ChoiceFilling obj)
        {
            ChoiceFillingRepository objRep = new ChoiceFillingRepository();

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

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        ChoiceFilling objChoice = new ChoiceFilling();
                        //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(ChoiceFilling 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;
            ChoiceFillingRepository objRep = new ChoiceFillingRepository();

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

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        ChoiceFilling objChoice = new ChoiceFilling();
                        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 <ChoiceFilling> list = new List <ChoiceFilling>();

            if (search == null)
            {
                list = _list;
            }
            else
            {
                // simulate search
                foreach (ChoiceFilling 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));
        }