示例#1
0
 public ActionResult PaymentTransactionIndex(PaymentTransactionIndexModels model, int?page, int?pagesize)
 {
     try
     {
         int     defautPagesize             = pagesize.HasValue ? pagesize.Value : 10;
         int     currentPageIndex           = page.HasValue ? page.Value - 1 : 0;
         int     totalRecords               = 0;
         Company currentCom                 = ((EInvoiceContext)FXContext.Current).CurrentCompany;
         IPaymentTransactionService tranSrv = IoC.Resolve <IPaymentTransactionService>();
         Guid gID = Guid.Empty;
         try
         {
             gID = !string.IsNullOrEmpty(model.key) ? Guid.Parse(model.key.Trim()) : Guid.Empty;
         }
         catch (Exception ex)
         {
             gID = Guid.NewGuid();
             log.Error("Error:" + ex.Message);
             Messages.AddErrorMessage("Vui lòng nhập đúng mã giao dịch!");
         }
         DateTime?DateFrom = null;
         DateTime?DateTo   = null;
         if (!string.IsNullOrWhiteSpace(model.FromDate))
         {
             DateFrom = DateTime.ParseExact(model.FromDate, "dd/MM/yyyy", null);
         }
         if (!string.IsNullOrWhiteSpace(model.ToDate))
         {
             DateTo = DateTime.ParseExact(model.ToDate, "dd/MM/yyyy", null);
         }
         IList <PaymentTransaction> lst = tranSrv.GetByFilter(gID, currentCom.id, model.status, model.accountName, DateFrom, DateTo, currentPageIndex, defautPagesize, out totalRecords);
         model.PagedListTransaction = new PagedList <PaymentTransaction>(lst, currentPageIndex, defautPagesize, totalRecords);
     }
     catch (Exception ex)
     {
         log.Error("Error:" + ex);
         Messages.AddErrorMessage("Không có giao dịch trong hệ thống");
     }
     return(View(model));
 }