56 lines
2.0 KiB
C#
56 lines
2.0 KiB
C#
///
|
|
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Common
|
|
{
|
|
/// <summary>
|
|
/// Contains a procedure name and procedure selection source specification
|
|
/// (local/shared/order from Oracle/order from tracing DB)
|
|
/// </summary>
|
|
public class ProcedureInfo
|
|
{
|
|
public readonly ProcedureSelection Source;
|
|
public readonly string Signature;
|
|
public readonly int ItemNr;
|
|
public readonly string Name;
|
|
public ProcedureSelection ResolvedSource; /// ProcedureSelection.FromLocalDB or ProcedureSelection.FromSharedDB when Resolved==true
|
|
public string ResolvedName;
|
|
public string Variant;
|
|
|
|
public ProcedureInfo(ProcedureSelection source, int itemNr, string name, string signature = null, string variant = null)
|
|
{
|
|
Source = source;
|
|
Signature = (signature == null) ? string.Empty : signature;
|
|
ItemNr = itemNr;
|
|
Name = name;
|
|
if (source == ProcedureSelection.FromLocalDB || source == ProcedureSelection.FromSharedDB)
|
|
{
|
|
ResolvedSource = source;
|
|
ResolvedName = name;
|
|
}
|
|
else
|
|
{
|
|
ResolvedSource = ProcedureSelection.None;
|
|
ResolvedName = string.Empty;
|
|
}
|
|
Variant = (variant == null) ? string.Empty : variant;
|
|
}
|
|
|
|
public static string GetSignature(ProcedureSelection source, ICollection<ProcedureSelection> allSources)
|
|
{
|
|
return (source == ProcedureSelection.OrderNrFromOracleDB) ? "O"
|
|
: (source == ProcedureSelection.OrderNrFromTracingDB) ? "T"
|
|
: (source == ProcedureSelection.FromSharedDB) ? "R"
|
|
: (allSources != null && allSources.Contains(ProcedureSelection.FromSharedDB)) ? "L" : "";
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0}{1} {2}", Signature, ItemNr, Name);
|
|
}
|
|
}
|
|
}
|