コード例 #1
0
        //To view data of joincategory table based on parameters selected
        public IEnumerable <tbl_MCE_JoinCategory> JoinCategoryList(JoinCategorySearchPanel joincategorySearchPanel)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@P_CHRACTION", "JOINCATEGORYSP");
            if (joincategorySearchPanel.intLevelID != 0 && joincategorySearchPanel.intLevelID != null)
            {
                param.Add("@P_intLevelID", joincategorySearchPanel.intLevelID);
            }

            if (joincategorySearchPanel.vchJoinCategoryType != null)
            {
                param.Add("@P_vchJoinCategoryType", joincategorySearchPanel.vchJoinCategoryType);
            }

            return(DapperORM.ReturnList <tbl_MCE_JoinCategory>("SP_MCE_JoinCategory_Report", param));
        }
コード例 #2
0
        //This post method calls in View page thorough AJax call to bind the data in JQuery Datatable
        //Server side processing concept used to bind the data in JQuery
        public ActionResult GetJoinCategoryForSearchPanel(JoinCategorySearchPanel joincategorySearchPanel)
        {
            //Note: Install "System.Linq.Dynamic" from Nuget Packages

            // after this just include namespace in our Controller "using System.Linq.Dynamic;".

            //Draw counter. This is used by DataTables to ensure that the Ajax returns from server-side processing requests are drawn in sequence by DataTables (Ajax requests are asynchronous and thus can return out of sequence).
            var draw = Request.Form.GetValues("draw").FirstOrDefault();
            //Paging first record indicator. This is the start point in the current data set (0 index based - i.e. 0 is the first record)
            var start = Request.Form.GetValues("start").FirstOrDefault();
            //Number of records that the table can display in the current draw.
            var length = Request.Form.GetValues("length").FirstOrDefault();

            //Find Order Column
            var sortColumn    = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][name]").FirstOrDefault();
            var sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault();


            int pageSize = length != null?Convert.ToInt32(length) : 0;

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

            int recordsTotal = 0;



            var joincategoryList = (from a in _JC.JoinCategoryList(joincategorySearchPanel) select a);

            string search = Request.Form.GetValues("search[value]")[0];

            // Verification.



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

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