示例#1
0
        public JsonResult GetAll(int ddrange, string fromdate, string todate, int ddData, string search)
        {
            List <ENT.LedgerReport> lstEntity = new List <ENT.LedgerReport>();
            //jQuery DataTables Param
            var draw = Request.Form.GetValues("draw").FirstOrDefault();
            //Find paging info
            var start  = Request.Form.GetValues("start").FirstOrDefault();
            var length = Request.Form.GetValues("length").FirstOrDefault();
            //Find order columns info
            var sortColumn    = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][data]").FirstOrDefault();
            var sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault();

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

            int skip = start != null?Convert.ToInt16(start) : 1;

            skip = (skip / pageSize) + 1;
            COM.TTPagination.isPageing = true;
            COM.TTPagination.PageSize  = pageSize;
            COM.TTPagination.PageNo    = Convert.ToInt64(skip);

            lstEntity = new BAL.LedgerReport().GetAllSearch(ddrange, fromdate.GetDate(), todate.GetDate(), ddData, search, User.GetUserlevel(), Guid.Parse(User.Identity.GetUserId()));

            return(Json(new
            {
                draw = draw,
                recordsTotal = lstEntity.Count(),
                recordsFiltered = COM.TTPagination.RecordCount,
                data = lstEntity
            }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public HttpResponseMessage LedgerReport(GetLedgerReportModal modal)
        {
            GlobalVarible.Clear();
            List <ENT.LedgerReportApiView> lstEntity = new List <ENT.LedgerReportApiView>();

            try
            {
                //Find paging info
                var start  = modal.PageStart;
                var length = modal.PageSize;

                int pageSize = length != 0 ? length : 0;
                int skip     = start != 0 ? start : 1;
                skip = (skip / pageSize) + 1;

                COM.TTPagination.isPageing = true;
                COM.TTPagination.PageSize  = pageSize;
                COM.TTPagination.PageNo    = Convert.ToInt64(skip);

                using (BAL.LedgerReport objBal = new BAL.LedgerReport())
                {
                    if (modal.ddrange == 1)
                    {
                        //if (string.IsNullOrEmpty(modal.fromdate) || string.IsNullOrEmpty(modal.todate))
                        //{
                        //    GlobalVarible.AddError("For custome date you must have to select form and to date.");
                        //    return ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult });
                        //}
                        lstEntity = objBal.GetAllSearchApi(modal.ddrange, modal.fromdate.GetDate(), modal.todate.GetDate(), modal.ddData, modal.search, User.GetUserlevel(), _LOGINUSERID);
                    }
                    else
                    {
                        lstEntity = objBal.GetAllSearchApi(modal.ddrange, DateTime.Now, DateTime.Now, modal.ddData, modal.search, User.GetUserlevel(), _LOGINUSERID);
                    }
                }

                GlobalVarible.AddMessage("Recharge report get successfully.");
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, lstEntity, COM.TTPagination.RecordCount }));
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
                ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty);
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
        }