Ejemplo n.º 1
0
        private BatchDataEntry CreateBatchDataEntry(int globalBatchID)
        {
            BatchDataEntry bde = new BatchDataEntry()
            {
                GlobalBatchID             = globalBatchID,
                ChecksStorageBoxNumber    = null,
                DocumentsStorageBoxNumber = null,
                IronMountainBoxNumber     = null
            };

            return(bde);
        }
Ejemplo n.º 2
0
        private void CreateTransOnDB(List <IEnumerable <BankTran> > List)
        {
            //try
            //{
            using (ItemDBContext dbContext = new ItemDBContext())
            {
                foreach (var subList in List)
                {
                    //Batch batch = CreateBatch(subList);
                    Batch batch = BatchFactory.GetBatch("recovery", subList);

                    BatchDataEntry bde = CreateBatchDataEntry(batch.GlobalBatchID);

                    IEnumerable <Checks>          checks   = CreateChecks(subList, batch);
                    IEnumerable <ChecksDataEntry> checksDE = CreateChecksDataEntry(checks, batch, subList.ToList());
                    IEnumerable <Transactions>    trans    = CreateTransactions(checks, batch);

                    dbContext.Batch.Add((Batch)batch);
                    dbContext.BatchDataEntry.Add(bde);

                    foreach (var tran in trans)
                    {
                        dbContext.Transactions.Add(tran);
                    }

                    foreach (var check in checks)
                    {
                        dbContext.Checks.Add(check);
                    }

                    foreach (var cde in checksDE)
                    {
                        dbContext.ChecksDataEntry.Add(cde);
                    }

                    dbContext.SaveChanges();
                    //lblTrans.Text = dbContext.Database.Log.ToString();
                }
            }
            //}
            //catch
            //{
            //    throw;
            //}
        }