public BodiesInputModel(
            DateTime begin, DateTime end,
            string name,
            string number,
            bool emitted,
            bool ascending,
            int page,
            InvoicesOptions options)
        {
            this.Begin = begin == DateTime.MinValue ? new DateTime(DateTime.Now.Year, 1, 1) : begin;
            this.End   = end == DateTime.MinValue ? new DateTime(DateTime.Now.Year + 1, 1, 1) : end;

            this.Name   = name;
            this.Number = number;

            if (page < 1)
            {
                this.Page = 1;
            }
            else
            {
                this.Page = page;
            }

            this.Page   = Math.Max(1, page);
            this.Limit  = options.InvoicesPerPage;
            this.Offset = (this.Page - 1) * this.Limit;

            this.Emitted   = emitted;
            this.Ascending = ascending;
        }
Exemple #2
0
 public CliForsInputModel(
     string partialName,
     int page, bool ascending,
     InvoicesOptions options)
 {
     if (partialName == null)
     {
         this.PartialName = "";
     }
     else
     {
         this.PartialName = partialName.ToLower();
     }
     this.Page      = Math.Max(1, page);
     this.Limit     = options.InvoicesPerPage;
     this.Offset    = (this.Page - 1) * this.Limit;
     this.Ascending = ascending;
 }
 public InvoiceHandler(InvoiceDbContext DbContext, InvoicesOptions InvoicesOptions)
 {
     this.DbContext       = DbContext;
     this.InvoicesOptions = InvoicesOptions;
 }
        public PagamentiInputModel(string name, DateTime?endDate, bool emitted, int page, bool ascending, InvoicesOptions options)
        {
            this.Name    = name;
            this.Emitted = emitted;

            if (endDate == DateTime.MinValue)
            {
                this.EndDate = null;
            }
            else
            {
                this.EndDate = endDate;
            }

            this.Page   = Math.Max(1, page);
            this.Limit  = options.PaymentsPerPage;
            this.Offset = (this.Page - 1) * this.Limit;

            this.Ascending = ascending;
        }