コード例 #1
0
        public IEnumerable <tbl_MCE_GroupLinkAccess> GroupLinkAccessList(GroupLinkAccessSearchPanel groupLinkAccessSearchPanel)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@P_CHRACTION", "GROUPLINKACCESSALLSP");
            if (groupLinkAccessSearchPanel.vchGroupLinkAccessName != null)
            {
                param.Add("@P_vchGroupLinkAccessName", groupLinkAccessSearchPanel.vchGroupLinkAccessName);
            }

            if (groupLinkAccessSearchPanel.vchPLinkName != null)
            {
                param.Add("@P_vchPLinkName", groupLinkAccessSearchPanel.vchPLinkName);
            }
            if (groupLinkAccessSearchPanel.vchDescription != null)
            {
                param.Add("@P_vchRoleDescription", groupLinkAccessSearchPanel.vchDescription);
            }

            return(DapperORM.ReturnList <tbl_MCE_GroupLinkAccess>("SP_MCE_GroupLinkAccess_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 GetGroupLinkAccessForSearchPanel(GroupLinkAccessSearchPanel groupLinkAccessSearchPanel)
        {
            //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 groupLinkAccessList = (from a in _grouplinkaccess.GroupLinkAccessList(groupLinkAccessSearchPanel) select a);

            ////SORT
            //if (!(string.IsNullOrEmpty(sortColumn) && string.IsNullOrEmpty(sortColumnDir)))
            //{
            //    primaryLinkList = primaryLinkList.OrderBy(sortColumn + " " + sortColumnDir);
            //}

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

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