/// <summary> /// Updates Field Document List step. /// </summary> /// <param name="dto">The DTO object.</param> /// <param name="fieldDocumentListProcessViewSectionStepId">The FieldDocumentListProcessViewSectionStepId</param> /// <exception cref="System.ArgumentException"></exception> public void UpdateFieldDocumentProcessViewSectionStep(SectionViewFieldDocumentDto dto, int fieldDocumentListProcessViewSectionStepId) { 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].[APQPProcessViewFieldDocument] SET [FieldDocumentListProcessViewSectionStepId]=@p_FieldDocumentListProcessViewSectionStepId ,[Field]=@p_Field ,[DocumentId]=@p_DocumentId WHERE id=@p_Id "; using (var command = new SqlCommand(CommandText, connection)) { command.Parameters.AddWithValue("@p_Id", dto.Id); command.Parameters.AddWithValue("@p_FieldDocumentListProcessViewSectionStepId", fieldDocumentListProcessViewSectionStepId); command.Parameters.AddWithValue("@p_Field", dto.Field); command.Parameters.AddWithValue("@p_DocumentId", dto.Document.Id); command.ExecuteNonQuery(); } } }
/// <summary> /// Inserts Field Document List step. /// </summary> /// <param name="dto">The DTO object.</param> /// <param name="fieldDocumentListProcessViewSectionStepId">The FieldDocumentListProcessViewSectionStepId</param> /// <exception cref="System.ArgumentException"></exception> public void InsertFieldDocumentProcessViewSectionStep(SectionViewFieldDocumentDto dto, int fieldDocumentListProcessViewSectionStepId) { 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].[APQPProcessViewFieldDocument] ([FieldDocumentListProcessViewSectionStepId] ,[Field] ,[DocumentId] ) VALUES (@p_FieldDocumentListProcessViewSectionStepId ,@p_Field ,@p_DocumentId) SELECT CAST(SCOPE_IDENTITY() AS INT) "; using (var command = new SqlCommand(CommandText, connection)) { command.Parameters.AddWithValue("@p_FieldDocumentListProcessViewSectionStepId", fieldDocumentListProcessViewSectionStepId); command.Parameters.AddWithValue("@p_Field", dto.Field); command.Parameters.AddWithValue("@p_DocumentId", dto.Document.Id); dto.Id = (int)command.ExecuteScalar(); } } }