Exemplo n.º 1
0
        public DataSet1 getUnits()
        {
            UnitsDataAccessor    DA             = new UnitsDataAccessor();
            PositionDataAccessor DApos          = new PositionDataAccessor();
            DataSet1             dataSet1       = new DataSet1();
            AbstractConnection   absConnection  = null;
            AbstractTransaction  absTransaction = null;

            try
            {
                absConnection = DBFactory.createConnection();
                absConnection.open();
                absTransaction = absConnection.beginTransaction();
                DA.Read(absConnection, absTransaction, dataSet1);
                DApos.Read(absConnection, absTransaction, dataSet1);
                absTransaction.commit();
            }
            catch (Exception e)
            {
                absTransaction.rollback();
            }
            finally
            {
                absConnection.close();
            }

            return(dataSet1);
        }
Exemplo n.º 2
0
        public void GetAll()
        {
            //Setup();
            PositionDataAccessor daInvoice   = new PositionDataAccessor();
            DataSet1             dataSet1    = new DataSet1();
            AbstractConnection   connection  = null;
            AbstractTransaction  transaction = null;

            try
            {
                connection = DBFactory.createConnection();
                connection.open();
                transaction = connection.beginTransaction();
                daInvoice.Read(connection, transaction, dataSet1);
                transaction.commit();
            }
            catch (Exception e)
            {
                transaction.rollback();
            }
            finally
            {
                connection.close();
            }

            List <DataRow> list = dataSet1.position_in_mat_delivery_note.Select().OfType <DataRow>().ToList();

            list.Sort((x, y) => ((int)x["id_"]).CompareTo((int)y["id_"]));  //сортируем по ид

            Assert.That(1, Is.EqualTo(1));
            Assert.That(list.Count, Is.EqualTo(5));
            Assert.That((int)(list[0]["id_"]), Is.EqualTo(1));
            Assert.That((double)(list[0]["amount"]), Is.EqualTo(10));
            Assert.That((int)(list[0]["invoice_id"]), Is.EqualTo(1));
        }