/// <summary> /// Updates Document List step. /// </summary> /// <param name="dto">The DTO object.</param> /// <param name="documentListProcessViewSectionStepId">The DocumentListProcessViewSectionStepId</param> /// <exception cref="System.ArgumentException"></exception> /// <exception cref="System.Data.DBConcurrencyException"></exception> public void UpdateDocumentProcessViewSectionStep(SectionViewDocumentDto dto, int documentListProcessViewSectionStepId) { if (dto == null) throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto")); using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var connection = ctx.Connection; var CommandText = @" UPDATE [dbo].[APQPProcessViewDocument] SET [DocumentListProcessViewSectionStepId]=@p_DocumentListProcessViewSectionStepId ,[Guid]=@p_Guid ,[Name]=@p_Name ,[HeaderObject]=@p_HeaderObject ,[HeaderFields]=@p_HeaderFields ,[DetailObject]=@p_DetailObject WHERE id=@p_Id "; using (var command = new SqlCommand(CommandText, connection)) { command.Parameters.AddWithValue("@p_Id", dto.Id); command.Parameters.AddWithValue("@p_DocumentListProcessViewSectionStepId", documentListProcessViewSectionStepId); command.Parameters.AddWithValue("@p_Guid", dto.Guid); command.Parameters.AddWithValue("@p_Name", dto.Name); command.Parameters.AddWithValue("@p_HeaderObject", dto.HeaderObject); command.Parameters.AddWithValue("@p_HeaderFields", dto.HeaderFields); command.Parameters.AddWithValue("@p_DetailObject", dto.DetailObject); if (command.ExecuteNonQuery() == 0) { throw new DBConcurrencyException(Resources.StaleDataException); } } } }
/// <summary> /// Inserts Document List step. /// </summary> /// <param name="dto">The DTO object.</param> /// <param name="documentListProcessViewSectionStepId">The DocumentListProcessViewSectionStepId</param> /// <exception cref="System.ArgumentException"></exception> public void InsertDocumentProcessViewSectionStep(SectionViewDocumentDto dto, int documentListProcessViewSectionStepId) { if (dto == null) throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto")); using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var connection = ctx.Connection; var CommandText = @" INSERT INTO [dbo].[APQPProcessViewDocument] ([DocumentListProcessViewSectionStepId] ,[Guid] ,[Name] ,[HeaderObject] ,[HeaderFields] ,[DetailObject] ) VALUES (@p_DocumentListProcessViewSectionStepId ,@p_Guid ,@p_Name ,@p_HeaderObject ,@p_HeaderFields ,@p_DetailObject) SELECT CAST(SCOPE_IDENTITY() AS INT) "; using (var command = new SqlCommand(CommandText, connection)) { command.Parameters.AddWithValue("@p_DocumentListProcessViewSectionStepId", documentListProcessViewSectionStepId); command.Parameters.AddWithValue("@p_Guid", dto.Guid); command.Parameters.AddWithValue("@p_Name", dto.Name); command.Parameters.AddWithValue("@p_HeaderObject", dto.HeaderObject); command.Parameters.AddWithValue("@p_HeaderFields", dto.HeaderFields); command.Parameters.AddWithValue("@p_DetailObject", dto.DetailObject); dto.Id = (int)command.ExecuteScalar(); } } }