/// <summary> /// Updates display list field. /// </summary> /// <param name="dto">The DTO object.</param> /// <exception cref="System.ArgumentNullException">The input DTO is null.</exception> public void UpdateDisplayListField(DisplayListDisplayFieldDto dto) { if (dto == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto")); const string CmdText = @" UPDATE [dbo].[DisplayListStepFields] SET [DisplayListStepId] = @stepId ,[FieldName] = @fieldName ,[FullPath] = @fullPath ,[Order] = @order ,[Guid] = @guid ,[Width] = @width ,[IsFieldNameHidden] = @isFieldNameHidden WHERE [Id] = @id; "; using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { using (var cmd = new SqlCommand(CmdText, ctx.Connection)) { cmd.Parameters.AddWithValue("@id", dto.Id); cmd.Parameters.AddWithValue("@stepId", dto.StepId); cmd.Parameters.AddWithValue("@fieldName", dto.DisplayName); cmd.Parameters.AddWithValue("@fullPath", dto.FullPath); cmd.Parameters.AddWithValue("@order", dto.Order); cmd.Parameters.AddWithValue("@guid", dto.Guid); cmd.Parameters.AddWithValue("@width", dto.Width); cmd.Parameters.AddWithValue("@isFieldNameHidden", dto.IsFieldNameHidden); cmd.ExecuteNonQuery(); } } }
/// <summary> /// Inserts display list field. /// </summary> /// <param name="dto">The DTO object.</param> /// <exception cref="System.ArgumentNullException">The input DTO is null.</exception> public void InsertDisplayListField(DisplayListDisplayFieldDto dto) { if (dto == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto")); const string CmdText = @" INSERT INTO [dbo].[DisplayListStepFields] ( [DisplayListStepId] ,[FieldName] ,[FullPath] ,[Order] ,[Guid] ,[Width] ,[IsFieldNameHidden] ) VALUES ( @stepId ,@fieldName ,@fullPath ,@order ,@guid ,@width ,@isFieldNameHidden ); SELECT [Id] FROM [dbo].[DisplayListStepFields] WHERE [Id] = SCOPE_IDENTITY()"; using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { using (var cmd = new SqlCommand(CmdText, ctx.Connection)) { cmd.Parameters.AddWithValue("@stepId", dto.StepId); cmd.Parameters.AddWithValue("@fieldName", dto.DisplayName); cmd.Parameters.AddWithValue("@fullPath", dto.FullPath); cmd.Parameters.AddWithValue("@order", dto.Order); cmd.Parameters.AddWithValue("@guid", dto.Guid); cmd.Parameters.AddWithValue("@width", dto.Width); cmd.Parameters.AddWithValue("@isFieldNameHidden", dto.IsFieldNameHidden); dto.Id = (int)cmd.ExecuteScalar(); } } }