tbf/TracingDB/Enums.cs

170 lines
4.0 KiB
C#

using System;
using System.Reflection;
namespace TracingDB
{
/// <summary>
/// Helper class to assign descriptions to enum values
/// </summary>
public class Description : Attribute
{
public string Text;
public Description(string t)
{
Text = t;
}
}
public static class GetDescription
{
/// Extension method for enum-s
public static string ToDescription(this Enum enm)
{
Type type = enm.GetType();
MemberInfo[] memInfo = type.GetMember(enm.ToString());
if (memInfo != null && memInfo.Length > 0)
{
object[] attrs = memInfo[0].GetCustomAttributes(typeof(Description), false);
if (attrs != null && attrs.Length > 0)
return ((Description)attrs[0]).Text;
}
return enm.ToString(); /// Return ToString() value in case there is no description
}
}
public enum CodeType
{
[Description("-")]
UniqueNr,
[Description("PCB")]
FlowtubeNr, /// prvé 3 znaky sa zhodujú s poslednými 3 znakmi názvu
[Description("Flowt.")]
FlowtubeNrLU, /// začiatok kódu sa zhoduje s názvom
[Description("1")]
BatchNr,
[Description("2")]
BatchNrContainingPartName,
[Description("3")]
DateMMYY,
[Description("4")]
QualityCheck,
Count
}
public enum CodeForm
{
Barcode, /// Barcode
QRCode, /// QR code
Keyboard, /// Data entered by a keyboard
OkNok, /// OK/NOK or Yes/No data entered by a keyboard or a mouse
Count
}
public enum CodeLocation
{
OnPart,
OnPallet,
Count
}
public enum LifetimeManagement
{
None,
OneYear,
Count,
}
public enum SubClass
{
[Description("invalid")]
Invalid = 0,
[Description("vodomery")]
Normal = 1, /// Original process type
[Description("vodomery bez PCB")]
NormalWithoutPCB = 2, ///
[Description("flowtuby")]
FlowTube = 4, /// FlowTube
[Description("vodomery odvodene z flowtuby")]
InheritsFlowTube = 8, ///
[Description("vodomery z flowtuby bez PCB")]
InheritsFlowTubeWithoutPCB = 16, ///
}
public enum ReleaseStatus
{
In_preparation, /// Process definition is not completed, cannot be used in production
ToBeApproved, /// Process is completed, protected against changes and waits for an approval
Released, /// Process is ready for production (completed, protected, approved), but it is inactive
ReleasedActive, /// Process is ready for production, it is active = enabled
Deactivated, /// Process was used in production but it was de-activated (should never be deleted as there are references to the process)
Separator, /// 'Process' is only a named separator between other process items
Count,
}
public enum Mode
{
Debug, // Debug mode - no Oracle database used
Test, // Test database used
Production, // Production database used
Count,
}
public enum LoginLevel
{
None,
TeamLeader,
Administrator,
MH,
Count,
}
public enum ItemSpecID
{
RefRecordID = 0,
TimeStamp,
Workstep,
Workplace,
UserName,
Barcode,
PartBarcode,
TimeStamp2,
Workstep2,
Workplace2,
UserName2,
Barcode2,
PartBarcode2,
SerialNr,
PurchaseOrder,
TestResult,
MaxPruefindex,
Process,
}
public enum ItemSpecCaps
{
None = 0,
ReferenceRecord = 1,
AssociatedRecord = 2,
OracleQuery = 4,
}
}