SVN r1193
SVN-Revision: r1193
This commit is contained in:
@@ -451,6 +451,14 @@ namespace Lskj.Model
|
||||
/// 单据终审后可以添加明细
|
||||
/// </summary>
|
||||
public bool BillFinalReviewAdd;
|
||||
/// <summary>
|
||||
/// 单据来源主表推拽到单据主表后,隐藏推拽行
|
||||
/// </summary>
|
||||
public bool SourceMainPushPullHide;
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BillModel"/> class.
|
||||
/// </summary>
|
||||
@@ -547,4 +555,5 @@ namespace Lskj.Model
|
||||
this.TreeTableDragCondition = rowItem.Table.Columns.Contains("TreeTableDragCondition") ? rowItem["TreeTableDragCondition"] + "" : "";
|
||||
this.isReplaceFixed = rowItem.Table.Columns.Contains("isReplaceFixed") ? !"1".Equals(rowItem["isReplaceFixed"] + "") : true;
|
||||
this.SaveRefreshAdditional = rowItem.Table.Columns.Contains("SaveRefreshAdditional") ? "1".Equals(rowItem["SaveRefreshAdditional"] + "") : false;
|
||||
this.CancelCopyAssociation
|
||||
this.CancelCopyAssociation = rowItem.Table.Columns.Contains("CancelCopyAssociation") ? !"1".Equals(rowItem["CancelCopyAssociation"] + "") : true;
|
||||
this.PrintingConditions = row
|
||||
+69
-14
@@ -16,6 +16,8 @@ using System.Management;
|
||||
using DevExpress.XtraTab;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Lskj.Model
|
||||
{
|
||||
@@ -273,35 +275,88 @@ namespace Lskj.Model
|
||||
/// 获取本机MAC地址
|
||||
/// </summary>
|
||||
/// <returns>本机MAC地址</returns>
|
||||
string GetMacAddress()
|
||||
private string GetMacAddress()
|
||||
{
|
||||
try
|
||||
{
|
||||
string strMac = string.Empty;
|
||||
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
|
||||
ManagementObjectCollection moc = mc.GetInstances();
|
||||
foreach (ManagementObject mo in moc)
|
||||
string fallbackMac = string.Empty;
|
||||
|
||||
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
|
||||
|
||||
foreach (NetworkInterface ni in interfaces)
|
||||
{
|
||||
if ((bool)mo["IPEnabled"])
|
||||
if (ni == null)
|
||||
{
|
||||
strMac = mo["MacAddress"].ToString();
|
||||
string[] IPAddress = (string[])mo["IPAddress"];
|
||||
if (IPAddress.Length > 0 && IPAddress[0].Equals(LoginIPV4))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ni.OperationalStatus != OperationalStatus.Up)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ni.NetworkInterfaceType == NetworkInterfaceType.Loopback ||
|
||||
ni.NetworkInterfaceType == NetworkInterfaceType.Tunnel)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
PhysicalAddress physicalAddress = ni.GetPhysicalAddress();
|
||||
if (physicalAddress == null || physicalAddress.GetAddressBytes().Length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string mac = FormatMacAddress(physicalAddress);
|
||||
if (string.IsNullOrEmpty(fallbackMac))
|
||||
{
|
||||
fallbackMac = mac;
|
||||
}
|
||||
|
||||
IPInterfaceProperties properties = ni.GetIPProperties();
|
||||
foreach (UnicastIPAddressInformation ipInfo in properties.UnicastAddresses)
|
||||
{
|
||||
if (ipInfo.Address.AddressFamily != AddressFamily.InterNetwork)
|
||||
{
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(LoginIPV4) &&
|
||||
ipInfo.Address.ToString() == LoginIPV4)
|
||||
{
|
||||
RecordMAC = mac;
|
||||
return mac;
|
||||
}
|
||||
}
|
||||
}
|
||||
moc = null;
|
||||
mc = null;
|
||||
RecordMAC= strMac.Replace(":", "-");
|
||||
return strMac.Replace(":", "-");
|
||||
|
||||
RecordMAC = fallbackMac;
|
||||
return fallbackMac;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private string FormatMacAddress(PhysicalAddress physicalAddress)
|
||||
{
|
||||
byte[] bytes = physicalAddress.GetAddressBytes();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
sb.Append("-");
|
||||
}
|
||||
|
||||
sb.Append(bytes[i].ToString("X2"));
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加密狗id
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user