コード例 #1
0
        private void ReadBody()
        {
            int i           = (_invoice.IsRub) ? 12 : 11; //первая строка с данными
            int incement    = (_invoice.IsRub) ? 7 : 4;
            int readBlocks  = 0;
            int countBlocks = GetCountBlocks();

            while (readBlocks < countBlocks)
            {
                currentCell = (_invoice.IsRub) ? "Q" + i : "D" + i;
                while (_excelBook.getValue(currentCell, currentCell) != null)
                {
                    DCRow dcRow = new DCRow();

                    currentCell = (_invoice.IsRub) ? "Q" + i : "D" + i; //№ документа
                    dcRow.SetNumber(_excelBook.getValue(currentCell, currentCell));

                    currentCell = (_invoice.IsRub) ? "F" + i : "E" + i; //Счёт дебет
                    dcRow.SetOrdp(_excelBook.getValue(currentCell, currentCell));

                    currentCell = (_invoice.IsRub) ? "J" + i : "G" + i; //Счёт кредит
                    dcRow.SetBenm(_excelBook.getValue(currentCell, currentCell));

                    currentCell = (_invoice.IsRub) ? "AA" + i : "Y" + i; //Назначение платежа
                    dcRow.SetCom(_excelBook.getValue(currentCell, currentCell));

                    currentCell = (_invoice.IsRub) ? "L" + i : "I" + i; //Сумма по дебету
                    if ((_excelBook.getValue(currentCell, currentCell) != null) && (_excelBook.getValue(currentCell, currentCell).ToString() != string.Empty))
                    {
                        dcRow.SetSum(_excelBook.getValue(currentCell, currentCell));

                        if (dcRow.Sum != 0.0)
                        {
                            Debet.Add(dcRow);
                        }
                    }
                    else
                    {
                        currentCell = (_invoice.IsRub) ? "P" + i : "O" + i; //Сумма по кредиту
                        dcRow.SetSum(_excelBook.getValue(currentCell, currentCell));

                        if (dcRow.Sum != 0.0)
                        {
                            Credit.Add(dcRow);
                        }
                    }

                    i++;
                    currentCell = (_invoice.IsRub) ? "Q" + i : "D" + i;
                }

                i += incement;
                readBlocks++;
            }

            ReadTails(i - incement);
        }
コード例 #2
0
 /// <summary>
 /// Добавление записи в таблицу Debet
 /// </summary>
 /// <param name="debet">Данные для добавления</param>
 /// <returns></returns>
 public async Task <int> CreateDebet(Debet debet)
 {
     using (var db = new ChemicalContext())
     {
         db.Debets.AddOrUpdate(debet);
         if (await db.SaveChangesAsync().ConfigureAwait(false) > 0)
         {
             return(debet.Id);
         }
     }
     return(0);
 }