1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

SelectionReadOnly MERGE to CollectionGroup

This commit is contained in:
Kyle Spearrin
2017-05-11 11:41:13 -04:00
parent f0d7dc8023
commit 2b8db4d1ed
18 changed files with 129 additions and 73 deletions

View File

@ -1,4 +1,6 @@
using Dapper;
using Bit.Core.Models.Data;
using Bit.Core.Models.Table;
using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
@ -65,6 +67,30 @@ namespace Bit.Core.Utilities
return table;
}
public static DataTable ToArrayTVP(this IEnumerable<SelectionReadOnly> values)
{
var table = new DataTable();
table.SetTypeName("[dbo].[SelectionReadOnlyArray]");
var idColumn = new DataColumn("Id", typeof(Guid));
table.Columns.Add(idColumn);
var readOnlyColumn = new DataColumn("ReadOnly", typeof(bool));
table.Columns.Add(readOnlyColumn);
if(values != null)
{
foreach(var value in values)
{
var row = table.NewRow();
row[idColumn] = value.Id;
row[readOnlyColumn] = value.ReadOnly;
table.Rows.Add(row);
}
}
return table;
}
public static X509Certificate2 GetCertificate(string thumbprint)
{
// Clean possible garbage characters from thumbprint copy/paste