本文整理汇总了C#中Table类的典型用法代码示例。如果您正苦于以下问题:C# Table类的具体用法?C# Table怎么用?C# Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Table类属于命名空间,在下文中一共展示了Table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PutAdress
private void PutAdress(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo)
{
//create table to add address of the customer
Table adressTable = new Table();
adressTable.IsFirstParagraph = true;
adressTable.ColumnWidths = "60 180 60 180";
adressTable.DefaultCellTextInfo.FontSize = 10;
adressTable.DefaultCellTextInfo.LineSpacing = 3;
adressTable.DefaultCellPadding.Bottom = 3;
//add this table in the first section/page
Section section = pdf.Sections[0];
section.Paragraphs.Add(adressTable);
//add a new row in the table
Row row1AdressTable = new Row(adressTable);
adressTable.Rows.Add(row1AdressTable);
//add cells and text
Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
tf1.Color = new Aspose.Pdf.Generator.Color(111, 146, 188);
tf1.FontName = "Helvetica-Bold";
row1AdressTable.Cells.Add("Bill To:", tf1);
row1AdressTable.Cells.Add(passengerInfo.Name + "#$NL" +
passengerInfo.Address + "#$NL" + passengerInfo.Email + "#$NL" +
passengerInfo.PhoneNumber);
}
示例2: sqlite3ColumnDefault
/*
** 2001 September 15
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.207 2009/08/08 18:01:08 drh Exp $
**
*************************************************************************
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
** C#-SQLite is an independent reimplementation of the SQLite software library
**
** $Header$
*************************************************************************
*/
//#include "sqliteInt.h"
#if !SQLITE_OMIT_VIRTUALTABLE
/* Forward declaration */
//static void updateVirtualTable(
//Parse pParse, /* The parsing context */
//SrcList pSrc, /* The virtual table to be modified */
//Table pTab, /* The virtual table */
//ExprList pChanges, /* The columns to change in the UPDATE statement */
//Expr pRowidExpr, /* Expression used to recompute the rowid */
//int aXRef, /* Mapping from columns of pTab to entries in pChanges */
//Expr pWhere /* WHERE clause of the UPDATE statement */
//);
#endif // * SQLITE_OMIT_VIRTUALTABLE */
/*
** The most recently coded instruction was an OP_Column to retrieve the
** i-th column of table pTab. This routine sets the P4 parameter of the
** OP_Column to the default value, if any.
**
** The default value of a column is specified by a DEFAULT clause in the
** column definition. This was either supplied by the user when the table
** was created, or added later to the table definition by an ALTER TABLE
** command. If the latter, then the row-records in the table btree on disk
** may not contain a value for the column and the default value, taken
** from the P4 parameter of the OP_Column instruction, is returned instead.
** If the former, then all row-records are guaranteed to include a value
** for the column and the P4 value is not required.
**
** Column definitions created by an ALTER TABLE command may only have
** literal default values specified: a number, null or a string. (If a more
** complicated default expression value was provided, it is evaluated
** when the ALTER TABLE is executed and one of the literal values written
** into the sqlite_master table.)
**
** Therefore, the P4 parameter is only required if the default value for
** the column is a literal number, string or null. The sqlite3ValueFromExpr()
** function is capable of transforming these types of expressions into
** sqlite3_value objects.
**
** If parameter iReg is not negative, code an OP_RealAffinity instruction
** on register iReg. This is used when an equivalent integer value is
** stored in place of an 8-byte floating point value in order to save
** space.
*/
static void sqlite3ColumnDefault( Vdbe v, Table pTab, int i, int iReg )
{
Debug.Assert( pTab != null );
if ( null == pTab.pSelect )
{
sqlite3_value pValue = new sqlite3_value();
int enc = ENC( sqlite3VdbeDb( v ) );
Column pCol = pTab.aCol[i];
#if SQLITE_DEBUG
VdbeComment( v, "%s.%s", pTab.zName, pCol.zName );
#endif
Debug.Assert( i < pTab.nCol );
sqlite3ValueFromExpr( sqlite3VdbeDb( v ), pCol.pDflt, enc,
pCol.affinity, ref pValue );
if ( pValue != null )
{
sqlite3VdbeChangeP4( v, -1, pValue, P4_MEM );
}
#if !SQLITE_OMIT_FLOATING_POINT
if ( iReg >= 0 && pTab.aCol[i].affinity == SQLITE_AFF_REAL )
{
sqlite3VdbeAddOp1( v, OP_RealAffinity, iReg );
}
#endif
}
}
示例3: AssertNotModifiedByAnotherTransaction
public static void AssertNotModifiedByAnotherTransaction(TableStorage storage, ITransactionStorageActions transactionStorageActions, string key, Table.ReadResult readResult, TransactionInformation transactionInformation)
{
if (readResult == null)
return;
var txIdAsBytes = readResult.Key.Value<byte[]>("txId");
if (txIdAsBytes == null)
return;
var txId = new Guid(txIdAsBytes);
if (transactionInformation != null && transactionInformation.Id == txId)
{
return;
}
var existingTx = storage.Transactions.Read(new RavenJObject { { "txId", txId.ToByteArray() } });
if (existingTx == null)//probably a bug, ignoring this as not a real tx
return;
var timeout = existingTx.Key.Value<DateTime>("timeout");
if (SystemTime.UtcNow > timeout)
{
transactionStorageActions.RollbackTransaction(txId);
return;
}
throw new ConcurrencyException("Document '" + key + "' is locked by transacton: " + txId);
}
示例4: AttachToTable
private void AttachToTable(Table table,
Widget widget, uint x,
uint y, uint width)
{
// table.Attach(widget, x, x + width, y, y + 1, AttachOptions.Fill, AttachOptions.Fill, 2, 2);
table.Attach (widget, x, x + width, y, y + 1);
}
示例5: LinqInsert_Batch_Test
public void LinqInsert_Batch_Test()
{
Table<Movie> nerdMoviesTable = new Table<Movie>(_session, new MappingConfiguration());
Batch batch = _session.CreateBatch();
Movie movie1 = Movie.GetRandomMovie();
Movie movie2 = Movie.GetRandomMovie();
movie1.Director = "Joss Whedon";
var movies = new List<Movie>
{
movie1,
movie2,
};
batch.Append(from m in movies select nerdMoviesTable.Insert(m));
Task taskSaveMovies = Task.Factory.FromAsync(batch.BeginExecute, batch.EndExecute, null);
taskSaveMovies.Wait();
Task taskSelectStartMovies = Task<IEnumerable<Movie>>.Factory.FromAsync(
nerdMoviesTable.BeginExecute, nerdMoviesTable.EndExecute, null).
ContinueWith(res => Movie.DisplayMovies(res.Result));
taskSelectStartMovies.Wait();
CqlQuery<Movie> selectAllFromWhere = from m in nerdMoviesTable where m.Director == movie1.Director select m;
Task taskselectAllFromWhere =
Task<IEnumerable<Movie>>.Factory.FromAsync(selectAllFromWhere.BeginExecute, selectAllFromWhere.EndExecute, null).
ContinueWith(res => Movie.DisplayMovies(res.Result));
taskselectAllFromWhere.Wait();
Task<List<Movie>> taskselectAllFromWhereWithFuture = Task<IEnumerable<Movie>>.
Factory.FromAsync(selectAllFromWhere.BeginExecute, selectAllFromWhere.EndExecute, null).
ContinueWith(a => a.Result.ToList());
Movie.DisplayMovies(taskselectAllFromWhereWithFuture.Result);
}
示例6: InitDefinitions
public void InitDefinitions()
{
origTable = m_mainForm.Definition;
var def = origTable?.Clone();
if (def == null)
{
DialogResult result = MessageBox.Show(this, string.Format("Table {0} missing definition. Create default definition?", m_mainForm.DBCName),
"Definition Missing!",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1);
if (result != DialogResult.Yes)
return;
def = CreateDefaultDefinition();
if (def == null)
{
MessageBox.Show(string.Format("Can't create default definitions for {0}", m_mainForm.DBCName));
def = new Table();
def.Name = m_mainForm.DBCName;
def.Fields = new List<Field>();
}
}
InitForm(def);
}
示例7: Transaction_Delete
public void Transaction_Delete()
{
using (var context = new Table())
{
int? ID;
// 普通Where
ID = context.User.Desc(o => o.ID).GetValue(o => o.ID); context.User.Where(o => o.ID == ID).Delete(); Assert.IsFalse(context.User.Where(o => o.ID == ID).IsHaving());
// 重载
ID = context.User.Desc(o => o.ID).GetValue(o => o.ID); context.User.Delete(ID); Assert.IsFalse(context.User.Where(o => o.ID == ID).IsHaving());
// 批量
var IDs = context.User.Desc(o => o.ID).ToSelectList(5, o => o.ID);
context.User.Delete(IDs); Assert.IsFalse(context.User.Where(o => IDs.Contains(o.ID)).IsHaving());
// 缓存表
ID = context.UserRole.Cache.OrderByDescending(o => o.ID).GetValue(o => o.ID);
context.UserRole.Where(o => o.ID == ID).Delete();
Assert.IsFalse(context.UserRole.Cache.Where(o => o.ID == ID).IsHaving());
// 不同逻辑方式(主键为GUID)
var ID2 = context.Orders.Desc(o => o.ID).GetValue(o => o.ID); context.Orders.Delete(ID2); Assert.IsFalse(context.Orders.Where(o => o.ID == ID2).IsHaving());
ID2 = context.OrdersAt.Desc(o => o.ID).GetValue(o => o.ID);
context.OrdersAt.Delete(ID2); Assert.IsFalse(context.OrdersAt.Where(o => o.ID == ID2).IsHaving()); Assert.IsTrue(context.Orders.Where(o => o.ID == ID2).IsHaving());
context.OrdersBool.Delete(ID2); Assert.IsFalse(context.OrdersBool.Where(o => o.ID == ID2).IsHaving()); Assert.IsTrue(context.Orders.Where(o => o.ID == ID2).IsHaving());
context.OrdersNum.Delete(ID2); Assert.IsFalse(context.OrdersNum.Where(o => o.ID == ID2).IsHaving()); Assert.IsTrue(context.Orders.Where(o => o.ID == ID2).IsHaving());
context.OrdersBoolCache.Delete(ID2); Assert.IsFalse(context.OrdersBoolCache.Cache.Where(o => o.ID == ID2).IsHaving()); Assert.IsTrue(context.Orders.Where(o => o.ID == ID2).IsHaving());
// 手动SQL
ID = context.User.Desc(o => o.ID).GetValue(o => o.ID);
var table = context; table.ManualSql.Execute("DELETE FROM Members_User WHERE id = @ID", table.DbProvider.CreateDbParam("ID", ID));
Assert.IsFalse(context.User.Where(o => o.ID == ID).IsHaving());
context.SaveChanges();
}
}
示例8: Main
static void Main(string[] args)
{
#region basic config
Dictionary<string, string> server_config = new Dictionary<string,string>();
server_config.Add("ipaddr", "localhost");
server_config.Add("userid", "root");
server_config.Add("password", "root");
server_config.Add("db", "translate");
int count_bits = 64;
int count_blocks = 6;
int num_diff_bits = 3;
#endregion
List<ulong> bit_mask = new List<ulong>();
bit_mask.Add(0xFFE0000000000000);
bit_mask.Add(0x1FFC0000000000);
bit_mask.Add(0x3FF80000000);
bit_mask.Add(0x7FF00000);
bit_mask.Add(0xFFE00);
bit_mask.Add(0x1FF);
foreach (ulong item in bit_mask)
{
Console.WriteLine("{0:x}", item);
}
Table table = new Table(server_config, count_bits, count_blocks, num_diff_bits, bit_mask);
table.reset();
}
示例9: SchemaNameTest
public void SchemaNameTest()
{
var schema = new TableSchema("SchemaNameTest");
Assert.AreEqual(schema.Name, "SchemaNameTest");
var table = new Table("SchemaNameTest 2");
Assert.AreEqual(table.Schema.Name, "SchemaNameTest 2");
}
示例10: luaH_free
public static void luaH_free(lua_State L, Table t)
{
if (t.node[0] != dummynode)
luaM_freearray(L, t.node);
luaM_freearray(L, t.array);
luaM_free(L, t);
}
示例11: CreateInstance_returns_the_object_returned_from_the_func
public void CreateInstance_returns_the_object_returned_from_the_func()
{
var table = new Table("Field", "Value");
var expectedPerson = new Person();
var person = table.CreateInstance(() => expectedPerson);
person.Should().Be(expectedPerson);
}
示例12: NetworkEntry
/// <summary>
/// Erstellt eine Beschreibung.
/// </summary>
/// <param name="table">Die gesamte <i>NIT</i>.</param>
/// <param name="offset">Das erste Byte dieser Beschreibung in den Rohdaten.</param>
/// <param name="length">Die Größe der Rohdaten zu dieser Beschreibung.</param>
private NetworkEntry( Table table, int offset, int length )
: base( table )
{
// Access section
Section section = Section;
// Load
TransportStreamIdentifier = (ushort) Tools.MergeBytesToWord( section[offset + 1], section[offset + 0] );
OriginalNetworkIdentifier = (ushort) Tools.MergeBytesToWord( section[offset + 3], section[offset + 2] );
// Read the length
int descrLength = 0xfff & Tools.MergeBytesToWord( section[offset + 5], section[offset + 4] );
// Caluclate the total length
Length = 6 + descrLength;
// Verify
if (Length > length) return;
// Try to load descriptors
Descriptors = Descriptor.Load( this, offset + 6, descrLength );
// Can use it
IsValid = true;
}
示例13: CoreGetColumnParameters
protected override IEnumerable<DbParameter> CoreGetColumnParameters(Type connectionType, string dataSourceTag, Server server, Database database, Schema schema, Table table)
{
if ((object)connectionType == null)
throw new ArgumentNullException(nameof(connectionType));
if ((object)dataSourceTag == null)
throw new ArgumentNullException(nameof(dataSourceTag));
if ((object)server == null)
throw new ArgumentNullException(nameof(server));
if ((object)database == null)
throw new ArgumentNullException(nameof(database));
if ((object)schema == null)
throw new ArgumentNullException(nameof(schema));
if ((object)table == null)
throw new ArgumentNullException(nameof(table));
if (dataSourceTag.SafeToString().ToLower() == ODBC_SQL_SERVER_DATA_SOURCE_TAG)
{
return new DbParameter[]
{
//DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.ReflectionFascadeLegacyInstance.CreateParameter(connectionType, null,ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P1", server.ServerName),
//DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.ReflectionFascadeLegacyInstance.CreateParameter(connectionType, null,ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P2", database.DatabaseName),
DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.CreateParameter(connectionType, null, ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P3", schema.SchemaName),
DatazoidLegacyInstanceAccessor.AdoNetBufferingLegacyInstance.CreateParameter(connectionType, null, ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@P4", table.TableName)
};
}
throw new ArgumentOutOfRangeException(string.Format("dataSourceTag: '{0}'", dataSourceTag));
}
示例14: Delete
public static Tuple<long,long> Delete(Table Data, Predicate Where)
{
long CurrentCount = 0;
long NewCount = 0;
foreach (RecordSet rs in Data.Extents)
{
// Append the current record count //
CurrentCount += (long)rs.Count;
// Delete //
NewCount += Delete(rs, Where);
// Push //
Data.Push(rs);
}
BinarySerializer.Flush(Data);
// Return the delta //
return new Tuple<long,long>(CurrentCount, NewCount);
}
示例15: sqlite3IsReadOnly
/*
** Check to make sure the given table is writable. If it is not
** writable, generate an error message and return 1. If it is
** writable return 0;
*/
static bool sqlite3IsReadOnly( Parse pParse, Table pTab, int viewOk )
{
/* A table is not writable under the following circumstances:
**
** 1) It is a virtual table and no implementation of the xUpdate method
** has been provided, or
** 2) It is a system table (i.e. sqlite_master), this call is not
** part of a nested parse and writable_schema pragma has not
** been specified.
**
** In either case leave an error message in pParse and return non-zero.
*/
if (
( IsVirtual( pTab )
&& sqlite3GetVTable( pParse.db, pTab ).pMod.pModule.xUpdate == null )
|| ( ( pTab.tabFlags & TF_Readonly ) != 0
&& ( pParse.db.flags & SQLITE_WriteSchema ) == 0
&& pParse.nested == 0 )
)
{
sqlite3ErrorMsg( pParse, "table %s may not be modified", pTab.zName );
return true;
}
#if !SQLITE_OMIT_VIEW
if ( viewOk == 0 && pTab.pSelect != null )
{
sqlite3ErrorMsg( pParse, "cannot modify %s because it is a view", pTab.zName );
return true;
}
#endif
return false;
}