public BudgetManager(EFCDbContext context, UserManager <ApplicationUser> userManager, IDateHelper dateHelper, IDocumentNumberingManager documentNumberingManager)
 {
     Context = context;
     DocumentNumberingManager = documentNumberingManager;
     UserManager = userManager;
     DateHelper  = dateHelper;
 }
示例#2
0
 public InvoiceManager(EFCDbContext context, UserManager <ApplicationUser> userManager, IDateHelper dateHelper, ICustomerManager customerManager, IBudgetManager budgetManager, IDocumentNumberingManager documentNumberingManager)
 {
     Context     = context;
     UserManager = userManager;
     DateHelper  = dateHelper;
     DocumentNumberingManager = documentNumberingManager;
     CustomerManager          = customerManager;
     BudgetManager            = budgetManager;
 }
示例#3
0
 public AttachmentManager(EFCDbContext context, IHostingEnvironment environment, UserManager <ApplicationUser> userManager, IInvoiceManager invoiceManager, IBudgetManager budgetManager, IDateHelper dateHelper, IFileHelper fileHelper)
 {
     Context            = context;
     HostingEnvironment = environment;
     UserManager        = userManager;
     InvoiceManager     = invoiceManager;
     BudgetManager      = budgetManager;
     DateHelper         = dateHelper;
     FileHelper         = fileHelper;
 }
示例#4
0
        /// <summary>
        /// Get DocumentNumber model for given document type and date
        /// </summary>
        /// <param name="context"></param>
        /// <param name="dateHelper"></param>
        /// <param name="type">type of document</param>
        /// <param name="forDate">date for which document number should be taken</param>
        /// <param name="modifiedBy">ApplicationUser that is getting document number</param>
        /// <returns>DocumentNumber model for given document type and date</returns>
        public DocumentNumber GetDocumentNumberModel(EFCDbContext context, IDateHelper dateHelper, DocumentType type, DateTime forDate, ApplicationUser modifiedBy)
        {
            if (context == null || dateHelper == null || modifiedBy == null)
            {
                throw new ArgumentNullException(nameof(modifiedBy), "Nieprawidłowe parametry");
            }

            lock (_lock)
            {
                var documentNumberingRecord = context.DocumentNumbers
                                              .Include(x => x.DocumentSequence)
                                              .SingleOrDefault(x => x.DocumentType == type && x.DocumentSequence.EffectiveFrom <= forDate && x.DocumentSequence.EffectiveTo > forDate);

                if (documentNumberingRecord == null)
                {
                    throw new ArgumentException($"Brak numeratora dla {type.ToString()} dla daty {forDate.ToShortDateString()}", nameof(documentNumberingRecord));
                }

                var nextSequence = documentNumberingRecord.DocumentSequence.NextNumber;

                if (nextSequence > documentNumberingRecord.DocumentSequence.MaxNumber)
                {
                    throw new ArgumentException($"Osiągnięto maksymalną wartość dla numeratora dla {type.ToString()}", nameof(documentNumberingRecord));
                }

                var now = dateHelper.GetCurrentDatetime();

                documentNumberingRecord.DocumentSequence.NextNumber++;
                documentNumberingRecord.DocumentSequence.LastModifiedById = modifiedBy.Id;
                documentNumberingRecord.DocumentSequence.LastModifiedDate = now;

                context.DocumentSequences.Update(documentNumberingRecord.DocumentSequence);
                context.SaveChanges();

                context.Entry(documentNumberingRecord).State        = EntityState.Detached;
                documentNumberingRecord.DocumentSequence.NextNumber = nextSequence;

                return(documentNumberingRecord);
            }
        }
示例#5
0
 public CustomerManager(EFCDbContext context, UserManager <ApplicationUser> userManager, IDateHelper dateHelper)
 {
     Context     = context;
     UserManager = userManager;
     DateHelper  = dateHelper;
 }
示例#6
0
 public ItemController(EFCDbContext context)
 {
     _context = context;
 }
 public PostManager(EFCDbContext context)
 {
     _context = context;
 }
示例#8
0
 public NewsController(EFCDbContext context)
 {
     _context = context;
 }
示例#9
0
 public ConsultationController(EFCDbContext context)
 {
     this.Context = context;
 }
示例#10
0
 public CustomerController(EFCDbContext context)
 {
     _context = context;
 }
 public ProductModelsController(EFCDbContext context)
 {
     _context = context;
 }
 public DocumentNumberingManager(EFCDbContext context, IDateHelper dateHelper, IDocumentNumberModelManager documentNumberModelManager)
 {
     Context    = context;
     DateHelper = dateHelper;
     DocumentNumberModelManager = documentNumberModelManager;
 }
示例#13
0
 public RentController(EFCDbContext context)
 {
     _context = context;
 }
示例#14
0
 public CategoryController(EFCDbContext context)
 {
     _context = context;
 }
示例#15
0
 public MenuController(EFCDbContext context)
 {
     _context = context;
 }