Exemplo n.º 1
0
        public CaseStudyGenViewModel GenCaseStudySelectPaged(long SubComponentID, int PageNo, int PageSize, string sTerm)
        {
            CaseStudyGenViewModel model = new CaseStudyGenViewModel();
            var parStart = new SqlParameter("@Start", (PageNo - 1) * PageSize);
            var parEnd   = new SqlParameter("@PageSize", PageSize);
            //return result;
            var parSubCompID = new SqlParameter("@SubComponentID", DBNull.Value);

            if (SubComponentID != 0)
            {
                parSubCompID = new SqlParameter("@SubComponentID", SubComponentID);
            }

            var parSearchTerm = new SqlParameter("@SearchTerm", DBNull.Value);

            if (!(sTerm == null || sTerm == ""))
            {
                parSearchTerm.Value = sTerm;
            }
            var spOutput = new SqlParameter
            {
                ParameterName = "@TotalCount",
                SqlDbType     = System.Data.SqlDbType.BigInt,
                Direction     = System.Data.ParameterDirection.Output
            };

            model.CaseStudyList = db.Database.SqlQuery <GenCaseStudyView>("GenCaseStudiesSelectAll @Start, @PageSize,@SearchTerm,@SubComponentID, @TotalCount out",
                                                                          parStart, parEnd, parSearchTerm, parSubCompID, spOutput).ToList();
            model.TotalRecords = int.Parse(spOutput.Value.ToString());

            return(model);
        }
        // GET: CaseStudies
        public ActionResult Index(long SCID = 0, int PageNo = 1, int PageSize = 5, string searchTerm = "")
        {
            CaseStudyManageModel  model    = new CaseStudyManageModel();
            CaseStudyGenViewModel _csmodel = new CaseStudyGenViewModel();

            _csmodel                    = ObjCaseStudies.GenCaseStudySelectPaged(SCID, PageNo, PageSize, searchTerm);
            model.GenCaseStudies        = _csmodel;
            model.Components            = ObjComp.GetComponentList("");
            model.GenComponentModelList = ObjComp.GetGenComponentList();//Component List
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_pvCaseStudiesList", model));
            }
            return(View(model));
        }