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 Employee Insert(DBConnectionWrapper conn, DBTransactionWrapper trans = null)
        {
            Employee obj = new Employee
            {
                EMPLOYEE_ID    = 207,
                FIRST_NAME     = "Kevin",
                LAST_NAME      = "Jin",
                EMAIL          = "kevin.jin",
                PHONE_NUMBER   = "123.456.7890",
                HIRE_DATE      = DateTime.Now,
                JOB_ID         = "AC_ACCOUNT",
                SALARY         = 8300m,
                COMMISSION_PCT = null,
                MANAGER_ID     = 205,
                DEPARTMENT_ID  = 110
            };
            var ret = conn.Insert(ref obj, trans);

            Console.WriteLine(ret + " rows inserted");
            return(obj);
        }