40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using MySql.Data.MySqlClient;
|
|
using System;
|
|
using System.Configuration;
|
|
|
|
namespace HanvonF710XAttendanceService
|
|
{
|
|
internal static class MachineScope
|
|
{
|
|
public const string MachineTypeHanvon = "HANVON";
|
|
|
|
public static string GetDeviceType()
|
|
{
|
|
return ConfigurationManager.AppSettings["DEVICE_TYPE"] ?? "HW_HDCP";
|
|
}
|
|
|
|
public static string GetDeviceUsername()
|
|
{
|
|
return ConfigurationManager.AppSettings["DEVICE_USERNAME"] ?? "admin";
|
|
}
|
|
|
|
public static string GetDevicePassword()
|
|
{
|
|
return ConfigurationManager.AppSettings["DEVICE_PASSWORD"] ?? "12345678";
|
|
}
|
|
|
|
public static bool IsHanvonMachineType(string machineType)
|
|
{
|
|
return !string.IsNullOrWhiteSpace(machineType)
|
|
&& string.Equals(machineType.Trim(), MachineTypeHanvon, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
public static string BuildMachineTypeWhereClause(MySqlCommand cmd, string columnName = "machine_type", string paramPrefix = "mt")
|
|
{
|
|
string p = "@" + paramPrefix;
|
|
cmd.Parameters.AddWithValue(p, MachineTypeHanvon);
|
|
return $"UPPER({columnName}) = {p}";
|
|
}
|
|
}
|
|
}
|