Minimal .NET/C# support for epic #445 (N1-N5): detection of solutions/projects and target frameworks, NuGet SBOM without build or restore (pkg:nuget purls for OSV, unresolved-dependency warning, end-of-support frameworks), own C# semgrep rule pack, .NET configuration and key-file checks, .NET build output and restored packages not counted as own code. Fixture fixtures/dotnet/framework48, docs .NET-Projekte (DE/EN). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using System.Data.SqlClient;
|
|
using System.IO;
|
|
using System.Net;
|
|
using System.Runtime.Serialization.Formatters.Binary;
|
|
using System.Security.Cryptography;
|
|
|
|
namespace Plant.Web
|
|
{
|
|
public class OrderService : IOrderService
|
|
{
|
|
private readonly SqlConnection _conn;
|
|
|
|
public OrderService(SqlConnection conn)
|
|
{
|
|
_conn = conn;
|
|
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, errors) => true;
|
|
}
|
|
|
|
public int CountOrders(string customer)
|
|
{
|
|
var cmd = new SqlCommand("SELECT COUNT(*) FROM Orders WHERE Customer = '" + customer + "'", _conn);
|
|
return (int)cmd.ExecuteScalar();
|
|
}
|
|
|
|
public object ReadState(Stream body)
|
|
{
|
|
var formatter = new BinaryFormatter();
|
|
return formatter.Deserialize(body);
|
|
}
|
|
|
|
public byte[] Checksum(byte[] data)
|
|
{
|
|
using (var md5 = MD5.Create())
|
|
{
|
|
return md5.ComputeHash(data);
|
|
}
|
|
}
|
|
}
|
|
}
|