Example #1
0
        static SalesOrderHeader Insert(DBConnectionWrapper conn, DBTransactionWrapper trans = null)
        {
            SalesOrderHeader order = new SalesOrderHeader
            {
                RevisionNumber  = 8,
                OrderDate       = DateTime.Today,
                DueDate         = DateTime.Today.AddDays(7),
                Status          = 1,
                OnlineOrderFlag = true,
                CustomerID      = 25252,
                BillToAddressID = 20850,
                ShipToAddressID = 20850,
                ShipMethodID    = 1,
                SubTotal        = 100m,
                TaxAmt          = 0m,
                Freight         = 0m,
                Comment         = "TEST",
                Rowguid         = Guid.NewGuid(),
                ModifiedDate    = DateTime.Now
            };
            int nor = conn.Insert(ref order, trans);
            var id  = conn.GetSingleValue <int>("SELECT @@IDENTITY", trans);

            order.SalesOrderId = id;
            Console.WriteLine(nor + " record inserted.");
            return(order);
        }
Example #2
0
        static int GetSingleValue(DBConnectionWrapper conn, DBTransactionWrapper trans)
        {
            string sql = "select count(*) from employees";
            var    ret = conn.GetSingleValue <int>(sql, trans);

            Console.WriteLine(ret + " rows in employees table.");
            return(ret);
        }
Example #3
0
        static int GetSingleValue(DBConnectionWrapper conn, DBTransactionWrapper trans = null)
        {
            string sql = "SELECT count(*) FROM [Sales].[SalesOrderHeader]";
            var    ret = conn.GetSingleValue <int>(sql, trans);

            Console.WriteLine("Total " + ret + " records in table.");
            return(ret);
        }