예제 #1
0
        public virtual ActionResult ListSearch(string sidx, string sord, int page, int rows, string searchBy, string searchText)
        {
            int totalRecords = 0;
            var sups         = _mCustomerRepository.GetPagedCustomerList(sidx, sord, page, rows, ref totalRecords, searchBy, searchText);
            int pageSize     = rows;
            int totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pageSize);
            var jsonData     = new
            {
                total   = totalPages,
                page    = page,
                records = totalRecords,
                rows    = (
                    from sup in sups
                    select new
                {
                    i = sup.Id.ToString(),
                    cell = new string[] {
                        sup.Id,
                        sup.PersonId != null?  sup.PersonId.PersonName : null,
                        sup.PersonId != null?  sup.PersonId.PersonGender : null,
                        sup.CustomerDesc,
                    }
                }).ToArray()
            };


            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public virtual ActionResult ListSearch(string sidx, string sord, int page, int rows, string searchBy, string searchText)
        {
            int totalRecords = 0;
            var sups         = _mCustomerRepository.GetPagedCustomerList(sidx, sord, page, rows, ref totalRecords, searchBy, searchText);
            int pageSize     = rows;
            int totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pageSize);
            var jsonData     = new
            {
                total   = totalPages,
                page    = page,
                records = totalRecords,
                rows    = (
                    from sup in sups
                    select new
                {
                    i = sup.Id.ToString(),
                    cell = new string[] {
                        sup.Id,
                        sup.PersonId != null?  sup.PersonId.PersonName : null,
                        sup.PersonId != null?  sup.PersonId.PersonGender : null,
                        sup.CustomerHealthProblem,
                        sup.CustomerProductDisc.HasValue ? sup.CustomerProductDisc.Value.ToString(Helper.CommonHelper.NumberFormat) : null,
                        sup.CustomerServiceDisc.HasValue ? sup.CustomerServiceDisc.Value.ToString(Helper.CommonHelper.NumberFormat) : null,
                        sup.CustomerMassageStrength,
                        sup.CustomerDesc,
                        sup.AddressId != null?  sup.AddressId.AddressPhone : null
                    }
                }).ToArray()
            };


            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public virtual ActionResult ListSearch(string sidx, string sord, int page, int rows, string searchBy, string searchText)
        {
            int totalRecords = 0;
            var custs        = _mCustomerRepository.GetPagedCustomerList(sidx, sord, page, rows, ref totalRecords, searchBy, searchText);
            int pageSize     = rows;
            int totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pageSize);
            var jsonData     = new
            {
                total   = totalPages,
                page    = page,
                records = totalRecords,
                rows    = (
                    from cust in custs
                    select new
                {
                    i = cust.Id.ToString(),
                    cell = new string[] {
                        string.Empty,
                        cust.Id,
                        cust.PersonId != null?  cust.PersonId.PersonName : null,
                        cust.PersonId != null?  cust.PersonId.PersonGender : null,
                        cust.AddressId != null?  cust.AddressId.AddressLine1 : null,
                        cust.AddressId != null?  cust.AddressId.AddressLine2 : null,
                        cust.AddressId != null?  cust.AddressId.AddressPhone : null,
                        cust.AddressId != null?  cust.AddressId.AddressCity : null,
                        cust.CustomerDesc,
                    }
                }).ToArray()
            };


            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }