Exemple #1
0
        public ActionResult GetUnPaidCreditSalesList(JQueryDataTableParamModel Param)
        {
            MYJSONTblCustom MYJSON = BL_CreditSales.GetUnPaidCreditSalesList(Param, Request);

            return(Json(MYJSON, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public static MYJSONTblCustom LoadSubscriptionPaymentVoucherTable(JQueryDataTableParamModel Param, HttpRequestBase Request)
        {
            var _rspvoucherlist = LoadSubscriptionPaymentVoucher(Param);//it shoult take startDate, Enddate,VendorId
            IEnumerable <BO_SubscriptoinPayment> filteredCategories;

            if (!string.IsNullOrEmpty(Param.sSearch))
            {
                filteredCategories = _rspvoucherlist
                                     .Where(
                    c => c.invoiceNo.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.paidAmount.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.customerName.ToString().ToLower().Contains(Param.sSearch.ToLower())


                    );
            }
            else
            {
                filteredCategories = _rspvoucherlist;
            }
            Func <BO_SubscriptoinPayment, dynamic> orderingFunction = null;
            int iSortColums = Convert.ToInt32(Param.iSortingCols);

            if (iSortColums > 0)
            {
                //var Sortable0 = Convert.ToBoolean(Request["bSortable_0"]);
                //var Sortable1 = Convert.ToBoolean(Request["bSortable_1"]);
                //var Sortable2 = Convert.ToBoolean(Request["bSortable_2"]);
                //var Sortable3 = Convert.ToBoolean(Request["bSortable_3"]);
                //var Sortable4 = Convert.ToBoolean(Request["bSortable_4"]);
                //var Sortable5 = Convert.ToBoolean(Request["bSortable_5"]);
                //IOrderedEnumerable<BO_ReceiptVoucher> query = null;
                //int[] iSortCol = new int[iSortColums];
                //string[] sSortDir = new string[iSortColums];
                //for (int _i = 0; _i < iSortCol.Length; _i++)
                //{
                //    int i = _i;
                //    iSortCol[i] = Convert.ToInt32(Request["iSortCol_" + i + ""]);
                //    if (iSortCol[i] == 0) { orderingFunction = (c => iSortCol[i] == 0 && Sortable0 ? c.lastName : ""); }
                //    else if (iSortCol[i] == 1) { orderingFunction = (c => iSortCol[i] == 1 && Sortable1 ? c.firstName : ""); }
                //    else if (iSortCol[i] == 2) { orderingFunction = (c => iSortCol[i] == 2 && Sortable2 ? c.phone : ""); }
                //    else if (iSortCol[i] == 3) { orderingFunction = (c => iSortCol[i] == 3 && Sortable3 ? c.email : ""); }
                //    else if (iSortCol[i] == 4) { orderingFunction = (c => iSortCol[i] == 4 && Sortable4 ? c.openingBalance : 0); }
                //    else if (iSortCol[i] == 5) { orderingFunction = (c => iSortCol[i] == 5 && Sortable5 ? c.balance : 0); }
                //    sSortDir[i] = Request["sSortDir_" + i + ""]; // asc or desc

                //    if (sSortDir[i] == "asc")
                //    {
                //        query = (i == 0) ? filteredCategories.OrderBy(orderingFunction) : query.ThenBy(orderingFunction);
                //    }
                //    else
                //    {
                //        query = (i == 0) ? filteredCategories.OrderByDescending(orderingFunction) : query.ThenByDescending(orderingFunction);
                //    }
                //    filteredCategories = query;

                //}
            }

            var displayedOffers = filteredCategories.Skip(Param.iDisplayStart).Take(Param.iDisplayLength);
            var result          = from c in displayedOffers
                                  select new
            {
                InvoiceNo    = c.invoiceNo,
                ActivityDate = c.activityDate,
                CustomerName = c.customerName,
                PaidAmount   = c.paidAmount,
                Totaldues    = c.totalDues
            };

            MYJSONTblCustom _MYJSONTbl = new MYJSONTblCustom();

            _MYJSONTbl.sEcho                = Param.sEcho;
            _MYJSONTbl.iTotalRecords        = _rspvoucherlist.Count();
            _MYJSONTbl.iTotalDisplayRecords = filteredCategories.Count();
            _MYJSONTbl.aaData               = result;
            return(_MYJSONTbl);
        }
Exemple #3
0
        public ActionResult LoadItemTable(JQueryDataTableParamModel Param)
        {
            MYJSONTblCustom MYJSON = BL_Item.LoadItemTable(Param, Request);

            return(Json(MYJSON, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public static MYJSONTblCustom GetSalesList(JQueryDataTableParamModel Param, HttpRequestBase Request)
        {
            var salesList = GetSales(Param);//it shoult take startDate, Enddate,VendorId
            IEnumerable <BO_Sales> filteredCategories;

            if (!string.IsNullOrEmpty(Param.sSearch))
            {
                filteredCategories = salesList
                                     .Where(
                    c => c.invoiceNo.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.customerName.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.paid > 0 && c.paid.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.netAmount > 0 && c.netAmount.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.balance > 0 && c.balance.ToString().ToLower().Contains(Param.sSearch.ToLower())
                    );
            }
            else
            {
                filteredCategories = salesList;
            }
            Func <BO_Sales, dynamic> orderingFunction = null;
            int iSortColums = Convert.ToInt32(Param.iSortingCols);

            if (iSortColums > 0)
            {
                var Sortable0 = Convert.ToBoolean(Request["bSortable_0"]);
                var Sortable1 = Convert.ToBoolean(Request["bSortable_1"]);
                var Sortable2 = Convert.ToBoolean(Request["bSortable_2"]);
                var Sortable3 = Convert.ToBoolean(Request["bSortable_3"]);
                var Sortable4 = Convert.ToBoolean(Request["bSortable_4"]);
                var Sortable5 = Convert.ToBoolean(Request["bSortable_5"]);
                IOrderedEnumerable <BO_Sales> query = null;
                int[]    iSortCol = new int[iSortColums];
                string[] sSortDir = new string[iSortColums];
                for (int _i = 0; _i < iSortCol.Length; _i++)
                {
                    int i = _i;
                    iSortCol[i] = Convert.ToInt32(Request["iSortCol_" + i + ""]);
                    if (iSortCol[i] == 0)
                    {
                        orderingFunction = (c => iSortCol[i] == 0 && Sortable0 ? c.invoiceNo : "");
                    }
                    else if (iSortCol[i] == 1)
                    {
                        orderingFunction = (c => iSortCol[i] == 1 && Sortable1 ? c.sellDate : DateTime.MinValue);
                    }
                    else if (iSortCol[i] == 2)
                    {
                        orderingFunction = (c => iSortCol[i] == 2 && Sortable2 ? c.customerName : "");
                    }
                    else if (iSortCol[i] == 3)
                    {
                        orderingFunction = (c => iSortCol[i] == 3 && Sortable3 ? c.netAmount : 0);
                    }
                    else if (iSortCol[i] == 4)
                    {
                        orderingFunction = (c => iSortCol[i] == 4 && Sortable4 ? c.paid : 0);
                    }
                    else if (iSortCol[i] == 5)
                    {
                        orderingFunction = (c => iSortCol[i] == 5 && Sortable5 ? c.balance : 0);
                    }
                    sSortDir[i] = Request["sSortDir_" + i + ""]; // asc or desc
                    //  var sortDirection = Request["sSortDir_0"];
                    if (sSortDir[i] == "asc")
                    {
                        query = (i == 0) ? filteredCategories.OrderBy(orderingFunction) : query.ThenBy(orderingFunction);
                    }
                    else
                    {
                        query = (i == 0) ? filteredCategories.OrderByDescending(orderingFunction) : query.ThenByDescending(orderingFunction);
                    }
                    filteredCategories = query;
                }
            }

            var displayedOffers = filteredCategories.Skip(Param.iDisplayStart).Take(Param.iDisplayLength);
            var result          = from c in displayedOffers
                                  select new
            {
                invoiceNo        = c.invoiceNo,
                sellDate         = c.sellDate,
                customerName     = c.customerName,
                netAmount        = c.netAmount,
                paid             = (c.paid),
                balance          = c.balance,
                isCustomerActive = c.isCustomerDeleted,
                isSalesCredit    = (c.netAmount - c.paid) != 0,
                cashPaidDate     = ((c.isSalesCredit && c.paid == 0) ? (DateTime?)null : (c.creditPaidDate ?? c.sellDate))
            };

            MYJSONTblCustom _MYJSONTbl = new MYJSONTblCustom();

            _MYJSONTbl.sEcho                = Param.sEcho;
            _MYJSONTbl.iTotalRecords        = salesList.Count();
            _MYJSONTbl.iTotalDisplayRecords = filteredCategories.Count();
            _MYJSONTbl.aaData               = result;
            return(_MYJSONTbl);
        }
        public static MYJSONTblCustom LoadExpenseTable(JQueryDataTableParamModel Param, HttpRequestBase Request)
        {
            Param.iSortingCols = 0;
            var _expenseList = LoadExpense();//it shoult take startDate, Enddate,VendorId
            IEnumerable <BO_Service> filteredCategories;

            if (!string.IsNullOrEmpty(Param.sSearch))
            {
                filteredCategories = _expenseList
                                     .Where(
                    c => c.id.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.name.ToString().ToLower().Contains(Param.sSearch.ToLower())
                    );
            }
            else
            {
                filteredCategories = _expenseList;
            }

            /*Func<BO_Customers, dynamic> orderingFunction = null;
             * int iSortColums = Convert.ToInt32(Param.iSortingCols);
             *
             * if (iSortColums > 0)
             * {
             *  var Sortable0 = Convert.ToBoolean(Request["bSortable_0"]);
             *  var Sortable1 = Convert.ToBoolean(Request["bSortable_1"]);
             *  var Sortable2 = Convert.ToBoolean(Request["bSortable_2"]);
             *  var Sortable3 = Convert.ToBoolean(Request["bSortable_3"]);
             *  var Sortable4 = Convert.ToBoolean(Request["bSortable_4"]);
             *  var Sortable5 = Convert.ToBoolean(Request["bSortable_5"]);
             *  IOrderedEnumerable<BO_Customers> query = null;
             *  int[] iSortCol = new int[iSortColums];
             *  string[] sSortDir = new string[iSortColums];
             *  for (int _i = 0; _i < iSortCol.Length; _i++)
             *  {
             *      int i = _i;
             *      iSortCol[i] = Convert.ToInt32(Request["iSortCol_" + i + ""]);
             *      if (iSortCol[i] == 0) { orderingFunction = (c => iSortCol[i] == 0 && Sortable0 ? c.lastName : ""); }
             *      else if (iSortCol[i] == 1) { orderingFunction = (c => iSortCol[i] == 1 && Sortable1 ? c.firstName : ""); }
             *      else if (iSortCol[i] == 2) { orderingFunction = (c => iSortCol[i] == 2 && Sortable2 ? c.phone : ""); }
             *      else if (iSortCol[i] == 3) { orderingFunction = (c => iSortCol[i] == 3 && Sortable3 ? c.email : ""); }
             *      else if (iSortCol[i] == 4) { orderingFunction = (c => iSortCol[i] == 4 && Sortable4 ? c.openingBalance : 0); }
             *      else if (iSortCol[i] == 5) { orderingFunction = (c => iSortCol[i] == 5 && Sortable5 ? c.balance : 0); }
             *      sSortDir[i] = Request["sSortDir_" + i + ""]; // asc or desc
             *      //  var sortDirection = Request["sSortDir_0"];
             *      if (sSortDir[i] == "asc")
             *      {
             *          query = (i == 0) ? filteredCategories.OrderBy(orderingFunction) : query.ThenBy(orderingFunction);
             *      }
             *      else
             *      {
             *          query = (i == 0) ? filteredCategories.OrderByDescending(orderingFunction) : query.ThenByDescending(orderingFunction);
             *      }
             *      filteredCategories = query;
             *
             *  }
             *
             * }
             */
            var displayedOffers = filteredCategories.Skip(Param.iDisplayStart).Take(Param.iDisplayLength);
            var result          = from c in displayedOffers
                                  select new
            {
                id   = c.id,
                name = c.name
            };

            MYJSONTblCustom _MYJSONTbl = new MYJSONTblCustom();

            _MYJSONTbl.sEcho                = Param.sEcho;
            _MYJSONTbl.iTotalRecords        = _expenseList.Count();
            _MYJSONTbl.iTotalDisplayRecords = filteredCategories.Count();
            _MYJSONTbl.aaData               = result;
            return(_MYJSONTbl);
        }
        public static MYJSONTblCustom GetPaymentHistoryList(JQueryDataTableParamModel Param, HttpRequestBase Request, int userId)
        {
            List <CustomerPaymentHistory> customerPayementHistoryList = GetPaymentHistoryData(Param, userId);
            //var salesList = GetSales(Param);//it shoult take startDate, Enddate,VendorId
            IEnumerable <CustomerPaymentHistory> filteredCategories = customerPayementHistoryList;

            if (!string.IsNullOrEmpty(Param.sSearch))
            {
                filteredCategories = customerPayementHistoryList
                                     .Where(
                    c => c.invoiceNo.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.customerName.ToString().ToLower().Contains(Param.sSearch.ToLower())

                    || c.amount > 0 && c.amount.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.recievedBy.ToString().ToLower().Contains(Param.sSearch.ToLower())
                    );
            }
            else
            {
                filteredCategories = customerPayementHistoryList;
            }
            Func <CustomerPaymentHistory, dynamic> orderingFunction = null;
            int iSortColums = Convert.ToInt32(Param.iSortingCols);

            if (iSortColums > 0)
            {
                var Sortable0 = Convert.ToBoolean(Request["bSortable_0"]);
                var Sortable1 = Convert.ToBoolean(Request["bSortable_1"]);
                var Sortable2 = Convert.ToBoolean(Request["bSortable_2"]);
                var Sortable3 = Convert.ToBoolean(Request["bSortable_3"]);
                var Sortable4 = Convert.ToBoolean(Request["bSortable_4"]);
                var Sortable5 = Convert.ToBoolean(Request["bSortable_5"]);
                IOrderedEnumerable <CustomerPaymentHistory> query = null;
                int[]    iSortCol = new int[iSortColums];
                string[] sSortDir = new string[iSortColums];
                for (int _i = 0; _i < iSortCol.Length; _i++)
                {
                    int i = _i;
                    iSortCol[i] = Convert.ToInt32(Request["iSortCol_" + i + ""]);
                    if (iSortCol[i] == 0)
                    {
                        orderingFunction = (c => iSortCol[i] == 0 && Sortable0 ? c.customerName : "");
                    }
                    else if (iSortCol[i] == 1)
                    {
                        orderingFunction = (c => iSortCol[i] == 1 && Sortable1 ? c.invoiceNo : "");
                    }
                    else if (iSortCol[i] == 2)
                    {
                        orderingFunction = (c => iSortCol[i] == 2 && Sortable2 ? c.customerId : 0);
                    }
                    else if (iSortCol[i] == 3)
                    {
                        orderingFunction = (c => iSortCol[i] == 3 && Sortable3 ? c.userID : 0);
                    }
                    else if (iSortCol[i] == 4)
                    {
                        orderingFunction = (c => iSortCol[i] == 4 && Sortable4 ? c.recievedBy : "");
                    }
                    else if (iSortCol[i] == 5)
                    {
                        orderingFunction = (c => iSortCol[i] == 5 && Sortable5 ? c.amount : 0);
                    }
                    sSortDir[i] = Request["sSortDir_" + i + ""]; // asc or desc
                    //  var sortDirection = Request["sSortDir_0"];
                    if (sSortDir[i] == "asc")
                    {
                        query = (i == 0) ? filteredCategories.OrderBy(orderingFunction) : query.ThenBy(orderingFunction);
                    }
                    else
                    {
                        query = (i == 0) ? filteredCategories.OrderByDescending(orderingFunction) : query.ThenByDescending(orderingFunction);
                    }
                    filteredCategories = query;
                }
            }

            var displayedOffers = filteredCategories.Skip(Param.iDisplayStart).Take(Param.iDisplayLength);
            var result          = from c in displayedOffers
                                  select new
            {
                customerId        = c.customerId,
                customerName      = c.customerName,
                invoiceNo         = c.invoiceNo,
                transactionDate   = c.transactionDate,
                activityTimestamp = c.activityTimestamp,
                amount            = c.amount,
                userID            = c.userID,
                recievedBy        = c.recievedBy,
                glId   = c.glId,
                tranId = c.tranId,
            };

            MYJSONTblCustom _MYJSONTbl = new MYJSONTblCustom();

            _MYJSONTbl.sEcho                = Param.sEcho;
            _MYJSONTbl.iTotalRecords        = customerPayementHistoryList.Count();
            _MYJSONTbl.iTotalDisplayRecords = filteredCategories.Count();
            _MYJSONTbl.aaData               = result;
            return(_MYJSONTbl);
        }
Exemple #7
0
        public static MYJSONTblCustom LoadInventoryTable(JQueryDataTableParamModel Param, HttpRequestBase Request)
        {
            var _inventoryList = LoadInventory(Param);//it shoult take startDate, Enddate,VendorId
            IEnumerable <BO_Inventory> filteredCategories;

            if (!string.IsNullOrEmpty(Param.sSearch))
            {
                filteredCategories = _inventoryList
                                     .Where(
                    c =>
                    !string.IsNullOrEmpty(c.itemCode) && c.itemCode.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    !string.IsNullOrEmpty(c.itemName) && c.itemName.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.itemquantity > 0 && c.itemquantity.ToString().ToLower().Contains(Param.sSearch.ToLower())
                    );
            }
            else
            {
                filteredCategories = _inventoryList;
            }
            //Func<BO_Inventory, dynamic> orderingFunction = null;
            //int iSortColums = Convert.ToInt32(Param.iSortingCols);

            //if (iSortColums > 0)
            //{
            //    var Sortable0 = Convert.ToBoolean(Request["bSortable_0"]);
            //    var Sortable1 = Convert.ToBoolean(Request["bSortable_1"]);
            //    var Sortable2 = Convert.ToBoolean(Request["bSortable_2"]);
            //    var Sortable3 = Convert.ToBoolean(Request["bSortable_3"]);
            //    var Sortable4 = Convert.ToBoolean(Request["bSortable_4"]);
            //    var Sortable5 = Convert.ToBoolean(Request["bSortable_5"]);
            //    IOrderedEnumerable<BO_Inventory> query = null;
            //    int[] iSortCol = new int[iSortColums];
            //    string[] sSortDir = new string[iSortColums];
            //    for (int _i = 0; _i < iSortCol.Length; _i++)
            //    {
            //        int i = _i;
            //        iSortCol[i] = Convert.ToInt32(Request["iSortCol_" + i + ""]);
            //        if (iSortCol[i] == 0) { orderingFunction = (c => iSortCol[i] == 0 && Sortable0 ? c.name : ""); }
            //        else if (iSortCol[i] == 1) { orderingFunction = (c => iSortCol[i] == 1 && Sortable1 ? c.itemCode : ""); }
            //        else if (iSortCol[i] == 2) { orderingFunction = (c => iSortCol[i] == 2 && Sortable2 ? c.unit : ""); }
            //        else if (iSortCol[i] == 3) { orderingFunction = (c => iSortCol[i] == 3 && Sortable3 ? c.taxPercent : 0); }
            //        else if (iSortCol[i] == 4) { orderingFunction = (c => iSortCol[i] == 4 && Sortable4 ? c.purchasePrice : 0); }
            //        else if (iSortCol[i] == 5) { orderingFunction = (c => iSortCol[i] == 5 && Sortable5 ? c.sellPrice : 0); }
            //        sSortDir[i] = Request["sSortDir_" + i + ""]; // asc or desc
            //        //  var sortDirection = Request["sSortDir_0"];
            //        if (sSortDir[i] == "asc")
            //        {
            //            query = (i == 0) ? filteredCategories.OrderBy(orderingFunction) : query.ThenBy(orderingFunction);
            //        }
            //        else
            //        {
            //            query = (i == 0) ? filteredCategories.OrderByDescending(orderingFunction) : query.ThenByDescending(orderingFunction);
            //        }
            //        filteredCategories = query;

            //    }

            //}

            var displayedOffers = filteredCategories.Skip(Param.iDisplayStart).Take(Param.iDisplayLength);
            var result          = from c in displayedOffers
                                  select new
            {
                id           = c.itemId,
                itemCode     = c.itemCode,
                itemName     = c.itemName,
                itemquantity = c.itemquantity
            };

            MYJSONTblCustom _MYJSONTbl = new MYJSONTblCustom();

            _MYJSONTbl.sEcho                = Param.sEcho;
            _MYJSONTbl.iTotalRecords        = _inventoryList.Count();
            _MYJSONTbl.iTotalDisplayRecords = filteredCategories.Count();
            _MYJSONTbl.aaData               = result;
            return(_MYJSONTbl);
        }
        public static MYJSONTblCustom LoadUserTable(JQueryDataTableParamModel Param, HttpRequestBase Request)
        {
            var _userlist = LoadUsers(Param);//it shoult take startDate, Enddate,VendorId
            IEnumerable <BO_Users> filteredCategories;

            if (!string.IsNullOrEmpty(Param.sSearch))
            {
                filteredCategories = _userlist
                                     .Where(
                    c => c.id.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.lastName.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.firstName.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.userId.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.phone.ToString().ToLower().Contains(Param.sSearch.ToLower()) ||
                    c.email.ToString().ToLower().Contains(Param.sSearch.ToLower())
                    );
            }
            else
            {
                filteredCategories = _userlist;
            }
            Func <BO_Users, dynamic> orderingFunction = null;
            int iSortColums = Convert.ToInt32(Param.iSortingCols);

            if (iSortColums > 0)
            {
                var Sortable0 = Convert.ToBoolean(Request["bSortable_0"]);
                var Sortable1 = Convert.ToBoolean(Request["bSortable_1"]);
                var Sortable2 = Convert.ToBoolean(Request["bSortable_2"]);
                var Sortable3 = Convert.ToBoolean(Request["bSortable_3"]);
                var Sortable4 = Convert.ToBoolean(Request["bSortable_4"]);
                var Sortable5 = Convert.ToBoolean(Request["bSortable_5"]);
                IOrderedEnumerable <BO_Users> query = null;
                int[]    iSortCol = new int[iSortColums];
                string[] sSortDir = new string[iSortColums];
                for (int _i = 0; _i < iSortCol.Length; _i++)
                {
                    int i = _i;
                    iSortCol[i] = Convert.ToInt32(Request["iSortCol_" + i + ""]);
                    if (iSortCol[i] == 0)
                    {
                        orderingFunction = (c => iSortCol[i] == 0 && Sortable0 ? c.lastName : "");
                    }
                    else if (iSortCol[i] == 1)
                    {
                        orderingFunction = (c => iSortCol[i] == 1 && Sortable1 ? c.firstName : "");
                    }
                    else if (iSortCol[i] == 2)
                    {
                        orderingFunction = (c => iSortCol[i] == 2 && Sortable2 ? c.userId : "");
                    }
                    else if (iSortCol[i] == 3)
                    {
                        orderingFunction = (c => iSortCol[i] == 3 && Sortable3 ? c.email : "");
                    }
                    else if (iSortCol[i] == 4)
                    {
                        orderingFunction = (c => iSortCol[i] == 4 && Sortable4 ? c.phone : "");
                    }

                    sSortDir[i] = Request["sSortDir_" + i + ""]; // asc or desc
                    //  var sortDirection = Request["sSortDir_0"];
                    if (sSortDir[i] == "asc")
                    {
                        query = (i == 0) ? filteredCategories.OrderBy(orderingFunction) : query.ThenBy(orderingFunction);
                    }
                    else
                    {
                        query = (i == 0) ? filteredCategories.OrderByDescending(orderingFunction) : query.ThenByDescending(orderingFunction);
                    }
                    filteredCategories = query;
                }
            }

            var displayedOffers = filteredCategories.Skip(Param.iDisplayStart).Take(Param.iDisplayLength);
            var result          = from c in displayedOffers
                                  select new
            {
                id        = c.id,
                lastName  = c.lastName,
                firstName = c.firstName,
                userId    = c.userId,
                password  = c.password,
                email     = c.email,
                phone     = c.phone
            };

            MYJSONTblCustom _MYJSONTbl = new MYJSONTblCustom();

            _MYJSONTbl.sEcho                = Param.sEcho;
            _MYJSONTbl.iTotalRecords        = _userlist.Count();
            _MYJSONTbl.iTotalDisplayRecords = filteredCategories.Count();
            _MYJSONTbl.aaData               = result;
            return(_MYJSONTbl);
        }