初始化CRICS
This commit is contained in:
60
RCUHost/Protocols/HostNumber.cs
Normal file
60
RCUHost/Protocols/HostNumber.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace RCUHost.Protocols
|
||||
{
|
||||
/// <summary>
|
||||
/// 主机编号(房号)
|
||||
/// </summary>
|
||||
[StructLayoutAttribute(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct HostNumber
|
||||
{
|
||||
/// <summary>
|
||||
/// 栋
|
||||
/// </summary>
|
||||
public byte NBuild;
|
||||
|
||||
/// <summary>
|
||||
/// 单元
|
||||
/// </summary>
|
||||
public byte NUnit;
|
||||
|
||||
/// <summary>
|
||||
/// 层
|
||||
/// </summary>
|
||||
public byte NFloor;
|
||||
|
||||
/// <summary>
|
||||
/// 房
|
||||
/// </summary>
|
||||
public byte NRoom;
|
||||
|
||||
/// <summary>
|
||||
/// 主机编码
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return NBuild.ToString("000") + NUnit.ToString("000") + NFloor.ToString("000") + NRoom.ToString("000");
|
||||
}
|
||||
/// <summary>
|
||||
/// 对应房号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string ToRoomNumber()
|
||||
{
|
||||
return NFloor.ToString("000") + NRoom.ToString("000");
|
||||
}
|
||||
/// <summary>
|
||||
/// 酒店编码
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Int64 ToHotelCode()
|
||||
{
|
||||
return Convert.ToInt64(Convert.ToInt16(NBuild.ToString("000")) + Convert.ToInt16(NUnit.ToString("000")) * 256);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user