Example #1
0
        public long InsertOrder(OrderEntity entity)
        {
            var dbCommand = DB.GetStoredProcCommand("spA_Order_i");
            AddInParameter(dbCommand, entity, false);
            DB.AddOutParameter(dbCommand, "@OrderId", DbType.Int64, 8);

            DB.ExecuteNonQuery(dbCommand);
            entity.OrderId = DbHelper.ConvertTo<long>(DB.GetParameterValue(dbCommand, "@OrderId"));
            return entity.OrderId;
        }
Example #2
0
        protected void AddInParameter(DbCommand command, OrderEntity entity, bool containsPrimaryKey)
        {
		   			     						     
				    DB.AddInParameter(command, "@UserId", DbType.Int64, entity.UserId);
				 						     
				    DB.AddInParameter(command, "@Name", DbType.String, entity.Name);
				 						     
				    DB.AddInParameter(command, "@Price", DbType.Decimal, entity.Price);
				 						     
				    DB.AddInParameter(command, "@ProductId", DbType.Int64, entity.ProductId);
				 						     
				    DB.AddInParameter(command, "@CreateTime", DbType.DateTime, entity.CreateTime);
				 						     
				    DB.AddInParameter(command, "@UpdateTime", DbType.DateTime, entity.UpdateTime);
				 			 
            if (containsPrimaryKey)
            {
                DB.AddInParameter(command, "@OrderId", DbType.Int64, entity.OrderId);
            }
        }
Example #3
0
 public void DeleteOrder(OrderEntity entity)
 {
     var command = DB.GetStoredProcCommand("spA_Order_d");
     DB.AddInParameter(command, "@OrderId", DbType.Int64, entity.OrderId);
     DB.ExecuteNonQuery(command);
 }
Example #4
0
 public bool UpdateOrder(OrderEntity entity)
 {
     var dbCommand = DB.GetStoredProcCommand("spA_Order_u");
     AddInParameter(dbCommand, entity, true);
     return DbHelper.ConvertTo<int>(DB.ExecuteScalar(dbCommand)) == 0;
 }
Example #5
0
 public void DeleteOrder(OrderEntity entity)
 {
     orderInsertDB.DeleteOrder(entity);
 }
Example #6
0
 public bool UpdateOrder(OrderEntity entity)
 {
     return orderInsertDB.UpdateOrder(entity);
 }
Example #7
0
 public long AddOrder(OrderEntity entity)
 {
     return orderInsertDB.InsertOrder(entity);
 }