ow
This commit is contained in:
1 parent
31fbe199c1
commit
1c0c83af5f
469 files changed
+62544
-5
No files matched your search
@@ -0,0 +1,38 @@
|
||||
|
||||
using CloudBuilder.Core.DependencyInjection.Form;
|
||||
using CloudBuilder.Core.DependencyInjection.Request;
|
||||
using CloudBuilder.Core.Policy;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace System
|
||||
{
|
||||
public class YesNoPolicy : AbstractPolicy
|
||||
{
|
||||
public const string YES = "Y";
|
||||
public const string NO = "N";
|
||||
|
||||
public static YesNoPolicy instance = null;
|
||||
|
||||
public YesNoPolicy(IContext context) : base(context)
|
||||
{
|
||||
this.values = new string[] { YES, NO };
|
||||
}
|
||||
|
||||
public static YesNoPolicy GetInstance()
|
||||
{
|
||||
instance = ApplicationServiceContext.ServiceProvider.GetKeyedService<YesNoPolicy>(typeof(YesNoPolicy).Name);
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static bool IsYes(string value)
|
||||
{
|
||||
return value == YES;
|
||||
}
|
||||
|
||||
public static string IsChecked(string value)
|
||||
{
|
||||
if (value == YES) return "checked";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user