当前位置: 首页>>代码示例>>C#>>正文


C# Common类代码示例

本文整理汇总了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;
        }
开发者ID:NodineLegal,项目名称:OpenLawOffice.Data,代码行数:28,代码来源:EventMatter.cs

示例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;
        }
开发者ID:ysminnpu,项目名称:OpenLawOffice,代码行数:28,代码来源:DocumentTask.cs

示例3: SendNotification

        protected override void SendNotification(Common.Notification notification)
        {
            var bbn = notification as BlackberryNotification;

            if (bbn != null)
                push(bbn);
        }
开发者ID:rajwilkhu,项目名称:PushSharp,代码行数:7,代码来源:BlackberryPushChannel.cs

示例4: Update

        public int Update(Common.DataContext ctx, IModel.BaseTable baseTable)
        {
            int rel = 0;
            rel = dal.Update(ctx, baseTable);

            return rel;
        }
开发者ID:jxzly229190,项目名称:YrealWeb_Online,代码行数:7,代码来源:BLLBase.cs

示例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.");
			}
		}
开发者ID:WinShooter,项目名称:WinShooter-Legacy,代码行数:33,代码来源:FResults.cs

示例6: SymbolEvent

 public SymbolEvent(Common.SafeBitArray bitset, int samplesPerSymbol, bool decision, Shift shift)
 {
     mBitset = bitset;
     mSamplesPerSymbol = samplesPerSymbol;
     mDecision = decision;
     mShift = shift;
 }
开发者ID:JoeGilkey,项目名称:RadioLog,代码行数:7,代码来源:SymbolEvent.cs

示例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;
        }
开发者ID:NodineLegal,项目名称:OpenLawOffice.Data,代码行数:31,代码来源:EventNote.cs

示例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;
            }
        }
开发者ID:pceftpos,项目名称:pay-at-table,代码行数:27,代码来源:CommonLoggingExtensions.cs

示例9: IncStat

 public void IncStat(string stat, Common.DebugLevel minLevel)
 {
     if (DebuggingLevel >= minLevel)
     {
         IncStat(stat);
     }
 }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:7,代码来源:StatBin.cs

示例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();
 }
开发者ID:ramyothman,项目名称:PAMSMigration,代码行数:34,代码来源:SQLServerDatabaseExtractor.cs

示例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;
        }
开发者ID:thiagopa,项目名称:PlaystationNetworkAPI,代码行数:7,代码来源:GameDetails.cs

示例12: Create

 public void Create(Common.Models.Meal meal)
 {
     using (var client = GetClient())
     {
         client.CreateDocumentAsync(GetCollection().DocumentsLink, meal).Wait();
     }
 }
开发者ID:kbaley,项目名称:AzureCodeCamp,代码行数:7,代码来源:MealRepository.cs

示例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;
        }
开发者ID:ysminnpu,项目名称:OpenLawOffice,代码行数:30,代码来源:NoteNotification.cs

示例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();
 }
开发者ID:Angliy,项目名称:Common,代码行数:7,代码来源:MBindUI.cs

示例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;
            }
        }
开发者ID:gbadhan,项目名称:.net-workshops,代码行数:25,代码来源:Rover.cs


注:本文中的Common类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。