本文整理汇总了C#中Common类的典型用法代码示例。如果您正苦于以下问题:C# Common类的具体用法?C# Common怎么用?C# Common使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Common类属于命名空间,在下文中一共展示了Common类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static Common.Models.Events.EventMatter Create(Common.Models.Events.EventMatter model,
Common.Models.Account.Users creator,
IDbConnection conn = null, bool closeConnection = true)
{
DBOs.Events.EventMatter dbo;
Common.Models.Events.EventMatter currentModel;
if (!model.Id.HasValue) model.Id = Guid.NewGuid();
model.Created = model.Modified = DateTime.UtcNow;
model.CreatedBy = model.ModifiedBy = creator;
currentModel = Get(model.Event.Id.Value, model.Matter.Id.Value);
if (currentModel != null)
return currentModel;
dbo = Mapper.Map<DBOs.Events.EventMatter>(model);
conn = DataHelper.OpenIfNeeded(conn);
throw new Exception("this is broke");
conn.Execute("UPDATE \"event_assigned_conttter\" (\"id\", \"event_id\", \"matter_id\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
"VALUES (@Id, @EventId, @MatterId, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
dbo);
DataHelper.Close(conn, closeConnection);
return model;
}
示例2: Create
public static Common.Models.Documents.DocumentTask Create(Common.Models.Documents.DocumentTask model,
Common.Models.Account.Users creator)
{
model.Created = model.Modified = DateTime.UtcNow;
model.CreatedBy = model.ModifiedBy = creator;
DBOs.Documents.DocumentTask dbo = Mapper.Map<DBOs.Documents.DocumentTask>(model);
using (IDbConnection conn = Database.Instance.GetConnection())
{
Common.Models.Documents.DocumentTask currentModel = Get(model.Task.Id.Value, model.Document.Id.Value);
if (currentModel != null)
{ // Update
conn.Execute("UPDATE \"document_task\" SET \"utc_modified\"[email protected], \"modified_by_user_pid\"[email protected] " +
"\"utc_disabled\"=null, \"disabled_by_user_pid\"=null WHERE \"id\"[email protected]", dbo);
model.Created = currentModel.Created;
model.CreatedBy = currentModel.CreatedBy;
}
else
{ // Create
conn.Execute("INSERT INTO \"document_task\" (\"id\", \"document_id\", \"task_id\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
"VALUES (@Id, @DocumentId, @TaskId, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
dbo);
}
}
return model;
}
示例3: SendNotification
protected override void SendNotification(Common.Notification notification)
{
var bbn = notification as BlackberryNotification;
if (bbn != null)
push(bbn);
}
示例4: Update
public int Update(Common.DataContext ctx, IModel.BaseTable baseTable)
{
int rel = 0;
rel = dal.Update(ctx, baseTable);
return rel;
}
示例5: FResults
internal FResults(ref Common.Interface newCommon)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
CommonCode = newCommon;
Trace.WriteLine("FResults: Creating");
try
{
this.Resize += new EventHandler(FStations_Resize);
// Databinding
ddPatrols.DataSource = patrolsDs.Patrols;
ddPatrols.DisplayMember = "DisplayName";
ddPatrols.ValueMember = "Id";
ddCompetitors.DataSource = this.competitorsDs.Shooters;
ddCompetitors.DisplayMember = "Name";
ddCompetitors.ValueMember = "Id";
}
catch(Exception exc)
{
Trace.WriteLine("FResults: Exception" + exc.ToString());
throw;
}
finally
{
Trace.WriteLine("FResults: Created.");
}
}
示例6: SymbolEvent
public SymbolEvent(Common.SafeBitArray bitset, int samplesPerSymbol, bool decision, Shift shift)
{
mBitset = bitset;
mSamplesPerSymbol = samplesPerSymbol;
mDecision = decision;
mShift = shift;
}
示例7: Create
public static Common.Models.Events.EventNote Create(Common.Models.Events.EventNote model,
Common.Models.Account.Users creator,
IDbConnection conn = null, bool closeConnection = true)
{
model.Created = model.Modified = DateTime.UtcNow;
model.CreatedBy = model.ModifiedBy = creator;
DBOs.Events.EventNote dbo = Mapper.Map<DBOs.Events.EventNote>(model);
conn = DataHelper.OpenIfNeeded(conn);
Common.Models.Events.EventNote currentModel = Get(model.Event.Id.Value, model.Note.Id.Value, conn, false);
if (currentModel != null)
{ // Update
conn.Execute("UPDATE \"event_note\" SET \"utc_modified\"[email protected], \"modified_by_user_pid\"[email protected] " +
"\"utc_disabled\"=null, \"disabled_by_user_pid\"=null WHERE \"id\"[email protected]", dbo);
model.Created = currentModel.Created;
model.CreatedBy = currentModel.CreatedBy;
}
else
{ // Create
if (conn.Execute("INSERT INTO \"event_note\" (\"id\", \"note_id\", \"event_id\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
"VALUES (@Id, @NoteId, @EventId, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
dbo) > 0)
model.Id = conn.Query<DBOs.Events.EventNote>("SELECT currval(pg_get_serial_sequence('event_note', 'id')) AS \"id\"").Single().Id;
}
DataHelper.Close(conn, closeConnection);
return model;
}
示例8: LogEx
public static void LogEx(this Common.Logging.ILog log, Common.Logging.LogLevel level, Action<TraceRecord> traceAction, [CallerMemberName] string member = "", [CallerLineNumber] int line = 0)
{
// Check if this log level is enabled
if (level == LogLevel.Trace && log.IsTraceEnabled == false ||
level == LogLevel.Debug && log.IsDebugEnabled == false ||
level == LogLevel.Info && (log.IsInfoEnabled == false) ||
level == LogLevel.Warn && (log.IsWarnEnabled == false) ||
level == LogLevel.Error && (log.IsErrorEnabled == false) ||
level == LogLevel.Fatal && (log.IsFatalEnabled == false))
{
return;
}
TraceRecord tr = new TraceRecord() { Level = level };
traceAction(tr);
string message = String.Format("{0}() line {1}: {2}.{3}", member, line, tr.Message, (tr.Data != null) ? Newtonsoft.Json.JsonConvert.SerializeObject(tr.Data) : "");
switch (level)
{
case LogLevel.Trace: log.Trace(message, tr.Exception); break;
case LogLevel.Debug: log.Debug(message, tr.Exception); break;
case LogLevel.Error: log.Error(message, tr.Exception); break;
case LogLevel.Fatal: log.Fatal(message, tr.Exception); break;
case LogLevel.Info: log.Info(message, tr.Exception); break;
case LogLevel.Warn: log.Warn(message, tr.Exception); break;
}
}
示例9: IncStat
public void IncStat(string stat, Common.DebugLevel minLevel)
{
if (DebuggingLevel >= minLevel)
{
IncStat(stat);
}
}
示例10: GetTables
public override void GetTables(Common.Entities.MetaDataSchema.Project project)
{
foreach (Entities.MetaDataSchema.Database dbase in project.Databases)
{
System.Data.DataTable tables = new DataTable();
System.Data.DataTable sqlServerTable = new DataTable();
tables.Load(project.ExtractorManager.SelectStatement("Select * From " + dbase.Name + ".INFORMATION_SCHEMA.TABLES Where Table_Type = '" + Resources.DataStructure.TableType + "'"), LoadOption.OverwriteChanges);
sqlServerTable.Load(project.ExtractorManager.SelectStatement("Select * From " + dbase.Name + ".sys.all_objects Where Type_Desc = 'user_table'"), LoadOption.OverwriteChanges);
OnStartLoading(new Common.Events.LoadingEventArgs(dbase.Name,"Tables","Database"));
dbase.Tables.Clear();
foreach (DataRow row in tables.Rows)
{
Entities.MetaDataSchema.Table tbl = new Common.Entities.MetaDataSchema.Table();
tbl.ParentDatabase = dbase;
tbl.Schema = row["Table_Schema"].ToString();
tbl.Name = row["Table_Name"].ToString();
DataRow[] sqlRows = sqlServerTable.Select("[name] = '" + tbl.Name + "'");
if (sqlRows.Length > 0)
{
tbl.TableID = sqlRows[0]["object_id"].ToString();
}
if (project.CheckHasData)
{
tbl.DataCount = CountRecordsInTable(tbl);
tbl.HasData = tbl.DataCount > 0;
}
dbase.Tables.Add(tbl);
}
OnEndLoading(new Common.Events.LoadingEventArgs(dbase.Name, "Tables","Database"));
tables.Dispose();
}
GC.Collect();
}
示例11: GetUSGameDetails
private static GameDetails GetUSGameDetails(string psnId, string gameId, Common.Login login)
{
Core.US.Collector collector = new US.Collector(psnId);
collector.GetGameDetails(gameId, login);
return null;
}
示例12: Create
public void Create(Common.Models.Meal meal)
{
using (var client = GetClient())
{
client.CreateDocumentAsync(GetCollection().DocumentsLink, meal).Wait();
}
}
示例13: Create
public static Common.Models.Notes.NoteNotification Create(Common.Models.Notes.NoteNotification model,
Common.Models.Account.Users creator)
{
if (!model.Id.HasValue) model.Id = Guid.NewGuid();
model.Created = model.Modified = DateTime.UtcNow;
model.CreatedBy = model.ModifiedBy = creator;
DBOs.Notes.NoteNotification dbo = Mapper.Map<DBOs.Notes.NoteNotification>(model);
using (IDbConnection conn = Database.Instance.GetConnection())
{
Common.Models.Notes.NoteNotification currentModel = Get(model.Note.Id.Value, model.Contact.Id.Value);
if (currentModel != null)
{ // Update
dbo = Mapper.Map<DBOs.Notes.NoteNotification>(currentModel);
conn.Execute("UPDATE \"note_notification\" SET \"utc_modified\"[email protected], \"modified_by_user_pid\"[email protected], " +
"\"utc_disabled\"=null, \"disabled_by_user_pid\"=null, \"cleared\"=null WHERE \"id\"[email protected]", dbo);
model.Created = currentModel.Created;
model.CreatedBy = currentModel.CreatedBy;
}
else
{ // Create
conn.Execute("INSERT INTO \"note_notification\" (\"id\", \"note_id\", \"contact_id\", \"cleared\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
"VALUES (@Id, @NoteId, @ContactId, @Cleared, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
dbo);
}
}
return model;
}
示例14: BindList
private static void BindList(ListControl listControl, Common.Data.Table.MDataTable source)
{
listControl.DataSource = source;
listControl.DataTextField = source.Columns[0].ColumnName;
listControl.DataValueField = source.Columns[1].ColumnName;
listControl.DataBind();
}
示例15: Turn
public void Turn(Common.TurnDirection direction)
{
int newDirection = 0;
if (direction == Common.TurnDirection.L)
{
newDirection = (int)this.RoverDirection + 1;
}
else
{
newDirection = (int)this.RoverDirection - 1;
}
if (newDirection < 0)
{
this.RoverDirection = Common.Direction.S;
}
else if (newDirection > 3)
{
this.RoverDirection = Common.Direction.E;
}
else
{
this.RoverDirection = (Common.Direction)newDirection;
}
}