修改挂单功能
This commit is contained in:
34
web/App_Code/StatusTransitionManager.cs
Normal file
34
web/App_Code/StatusTransitionManager.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public static class StatusTransitionManager
|
||||
{
|
||||
private static readonly Dictionary<string, List<string>> transitions =
|
||||
new Dictionary<string, List<string>>
|
||||
{
|
||||
// 掛單狀態
|
||||
{ "401", new List<string> { "402", "404" } },
|
||||
{ "402", new List<string> { "403" } },
|
||||
{ "403", new List<string>() },
|
||||
{ "404", new List<string>() },
|
||||
|
||||
// 床位狀態
|
||||
{ "101", new List<string> {"101", "102","103"} },
|
||||
{ "102", new List<string> { "101" } },
|
||||
{ "103", new List<string> { "101" } },
|
||||
};
|
||||
|
||||
public static bool CanTransition(string currentCode, string targetCode)
|
||||
{
|
||||
if (string.IsNullOrEmpty(currentCode))
|
||||
{
|
||||
return targetCode == "401" || targetCode == "402" || targetCode == "101";
|
||||
}
|
||||
if(string.IsNullOrEmpty(targetCode))
|
||||
{ return false; }
|
||||
return transitions.ContainsKey(currentCode) &&
|
||||
transitions[currentCode].Contains(targetCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user