public List <SearchDaliyCashSheetReportResultVM> SearchDailyCashSeetReport(SearchDailyCashSheetParameterVM model, string sortColumn, string sortDirection)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter {
                    ParameterName = "@PageNum", Value = model.PageNum
                },
                new SqlParameter {
                    ParameterName = "@PageSize", Value = model.PageSize
                },
                new SqlParameter {
                    ParameterName = "@SortColumn", Value = sortColumn
                },
                new SqlParameter {
                    ParameterName = "@SortDirection", Value = sortDirection
                },
                new SqlParameter {
                    ParameterName = "@CreatedBy", Value = model.UserId
                }
            };

            var dt = DALHelper.GetDataTableWithExtendedTimeOut("GetDailyCashSheetList", parameters);

            var dailycashsheet = new List <SearchDaliyCashSheetReportResultVM>();

            dailycashsheet = DALHelper.CreateListFromTable <SearchDaliyCashSheetReportResultVM>(dt);

            return(dailycashsheet);
        }
        public ActionResult SearchDaliyCashReport(SearchDailyCashSheetParameterVM model)
        {
            try
            {
                object sortColumn    = "";
                object sortDirection = "";

                if (model.order.Count == 0)
                {
                    sortColumn    = "CreatedOn";
                    sortDirection = "desc";
                }
                else
                {
                    sortColumn    = model.columns[Convert.ToInt32(model.order[0].column)].data ?? (object)DBNull.Value;
                    sortDirection = model.order[0].dir ?? (object)DBNull.Value;
                }

                model.PageSize = Constants.PAGESIZE;
                model.UserId   = LogInManager.LoggedInUserId;

                var DailyCashSheet = dailyCashSheetRepository.SearchDailyCashSeetReport(model, Convert.ToString(sortColumn), Convert.ToString(sortDirection));
                var ConvertAmountToUserCurrency = DailyCashSheet.Select(m => new
                {
                    TotalAmount = CurrencyManager.ParseAmountToUserCurrency(m.TotalAmount, LogInManager.CurrencyCode),
                    RowNum      = m.RowNum,
                    CreatedDate = m.CreatedDate,
                    TotalCount  = m.TotalCount
                }).ToList();

                int totalRecords = 0;
                var dbRecords    = DailyCashSheet.Select(m => m.TotalCount).FirstOrDefault();

                if (dbRecords != 0)
                {
                    totalRecords = Convert.ToInt32(dbRecords);
                }

                #region Record Activity Log
                RecordActivityLog.RecordActivity(Pages.DAILY_CASHSHEET_REPORT, "Searched daily cashsheet report.");
                #endregion

                return(Json(new
                {
                    IsSuccess = true,
                    CurrentPage = model.PageNum,
                    PageSize = Constants.PAGESIZE,
                    TotalRecords = totalRecords,
                    data = ConvertAmountToUserCurrency
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "SearchBreakfastReport");
                return(Json(new { IsSuccess = false, errorMessage = e.Message }));
            }
        }