public virtual OrderNumbers InsertOrderNumbers(OrderNumbers entity)
        {
            OrderNumbers other = new OrderNumbers();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into OrderNumbers ( [OrderNumberGUID]
				,[CreatedOn] )
				Values
				( @OrderNumberGUID
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@OrderNumber", entity.OrderNumber)
                    , new SqlParameter("@OrderNumberGUID", entity.OrderNumberGuid)
                    , new SqlParameter("@CreatedOn", entity.CreatedOn)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetOrderNumbers(Convert.ToInt32(identity)));
            }
            return(entity);
        }
Ejemplo n.º 2
0
 public ExternOrderNumberToDb(OrderNumbers numbers)
     : base(s_metadata)
 {
     SetSqlString(0, numbers.OrderNumber);
     SetSqlString(1, numbers.SerialNumber);
     SetSqlString(2, numbers.ExternOrderNumber);
 }
        public virtual OrderNumbers OrderNumbersFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            OrderNumbers entity = new OrderNumbers();

            entity.OrderNumber     = (System.Int32)dr["OrderNumber"];
            entity.OrderNumberGuid = (System.Guid)dr["OrderNumberGUID"];
            entity.CreatedOn       = (System.DateTime)dr["CreatedOn"];
            return(entity);
        }
        public virtual OrderNumbers UpdateOrderNumbers(OrderNumbers entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            OrderNumbers other = GetOrderNumbers(entity.OrderNumber);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update OrderNumbers set  [OrderNumberGUID]=@OrderNumberGUID
							, [CreatedOn]=@CreatedOn 
							 where OrderNumber=@OrderNumber"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@OrderNumber", entity.OrderNumber)
                , new SqlParameter("@OrderNumberGUID", entity.OrderNumberGuid)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetOrderNumbers(entity.OrderNumber));
        }
 public virtual OrderNumbers DeleteOrderNumbers(OrderNumbers entity)
 {
     this.DeleteOrderNumbers(entity.OrderNumber);
     return(entity);
 }
Ejemplo n.º 6
0
 public OrderNumbers InsertOrderNumbers(OrderNumbers entity)
 {
     return(_iOrderNumbersRepository.InsertOrderNumbers(entity));
 }
Ejemplo n.º 7
0
 public OrderNumbers UpdateOrderNumbers(OrderNumbers entity)
 {
     return(_iOrderNumbersRepository.UpdateOrderNumbers(entity));
 }
Ejemplo n.º 8
0
 public void OrderNumbersTest()
 {
     Assert.AreEqual(0, OrderNumbers.DescendingOrder(0));
     Assert.AreEqual(654321, OrderNumbers.DescendingOrder(352461));
 }