コード例 #1
0
 public async Task PutReconciliationItem(int id, ReconciliationItem ReconciliationItem)
 {
     try
     {
         await repoReconciliationItem.Update(ReconciliationItem);
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
 }
コード例 #2
0
        private void AddToList(string completeFileName, List <ReconciliationItem> reconciliationItems)
        {
            string errorMessage = string.Empty;

            FileInfo file = new FileInfo(completeFileName);

            using (ExcelPackage package = new ExcelPackage(file))
            {
                if (package.Workbook.Worksheets.Count == 0)
                {
                    throw new Exception("Fejl ved indlæsning af excel ark. Prøv igen forfra");
                }

                ExcelWorksheet worksheet = package.Workbook.Worksheets[1];

                int rowCount = worksheet.Dimension.Rows;
                int ColCount = worksheet.Dimension.Columns;
                for (int row = 1; row <= rowCount; row++)
                {
                    errorMessage = ValidateCells(worksheet.Cells, row);

                    if (string.IsNullOrEmpty(errorMessage) == false)
                    {
                        throw new Exception("Fejl i excel arket: " + errorMessage);
                    }

                    ReconciliationItem item = new ReconciliationItem()
                    {
                        BankDay  = Convert.ToDateTime(worksheet.Cells[row, 1].Value.ToString()),
                        ItemInfo = worksheet.Cells[row, 2].Value.ToString(),
                        Amount   = Convert.ToDecimal(worksheet.Cells[row, 3].Value.ToString())
                    };

                    if (row == 1)
                    {
                        _fromDate = item.BankDay;
                    }
                    if (row == rowCount)
                    {
                        _toDate = item.BankDay;
                    }
                    reconciliationItems.Add(item);
                }
            }
        }
コード例 #3
0
 public async Task PostReconciliationItem(ReconciliationItem ReconciliationItem)
 {
     await repoReconciliationItem.Add(ReconciliationItem);
 }