예제 #1
0
        protected override void InitializeAddTemplate(DbCommand command, Core.Template template)
        {
            command.CommandText = @"INSERT INTO Template
                                   ([Id]
                                   ,[Name]
                                   ,[Comments]
                                   ,[BuiltIn]
                                   ,[Modality]
                                   ,[Created]
                                   ,[Hidden]
                                   ,[AutoMatching]
                                   ,[Availability])
                             VALUES
                                   (@Id
                                   ,@Name
                                   ,@Comments
                                   ,@BuiltIn
                                   ,@Modality
                                   ,CURRENT_TIMESTAMP
                                   ,@Hidden
                                   ,@AutoMatching
                                   ,@Availability)";

            command.AddParameter("@Id", template.Id);
            command.AddParameter("@Name", template.Name);
            command.AddParameter("@Comments", template.Comments == null ? DBNull.Value : (object)template.Comments);
            command.AddParameter("@BuiltIn", template.BuiltIn);
            command.AddParameter("@Modality", template.Modality);
            command.AddParameter("@Hidden", template.Hidden);
            command.AddParameter("@AutoMatching", template.AutoMatching == null ? string.Empty : template.AutoMatching);
            command.AddParameter("@Availability", template.Availability);
        }
예제 #2
0
        protected override void InitializeUpdateTemplate(DbCommand command, Core.Template template)
        {
            command.CommandText = @"UPDATE [dbo].[Template]
                                    SET [Name] = @Name
                                       ,[Comments] = @Comments
                                       ,[BuiltIn] = @BuiltIn
                                       ,[Modality] = @Modality                                       
                                       ,[Hidden] = @Hidden
                                       ,[AutoMatching] = @AutoMatching
                                       ,[Availability] = @Availability
                                    WHERE Id = @Id";

            command.AddParameter("@Id", template.Id);
            command.AddParameter("@Name", template.Name);
            command.AddParameter("@Comments", template.Comments == null ? DBNull.Value : (object)template.Comments);
            command.AddParameter("@BuiltIn", template.BuiltIn);
            command.AddParameter("@Modality", template.Modality);
            command.AddParameter("@Hidden", template.Hidden);
            command.AddParameter("@AutoMatching", template.AutoMatching == null ? string.Empty : template.AutoMatching);
            command.AddParameter("@Availability", template.Availability);
        }