ow
This commit is contained in:
1 parent
31fbe199c1
commit
1c0c83af5f
469 files changed
+62544
-5
No files matched your search
@@ -0,0 +1,192 @@
|
||||
using CloudBuilder.Core.DependencyInjection.Policy;
|
||||
using CloudBuilder.Core.DependencyInjection.Request;
|
||||
using CloudBuilder.Core.Policy;
|
||||
using CloudBuilder.Core.Service;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System
|
||||
{
|
||||
public class AbstractPolicy : IPolicy
|
||||
{
|
||||
public ResourceManager rm = null;
|
||||
|
||||
public AbstractPolicy(IContext context)
|
||||
{
|
||||
this.context = context;
|
||||
|
||||
string[] res = Assembly.GetAssembly(this.GetType()).GetManifestResourceNames();
|
||||
|
||||
if (res != null && res.Length > 0)
|
||||
{
|
||||
string baseName = this.GetType().Name + "_" + context.GetCulture();
|
||||
if (res.Where(x => x.Contains(baseName)).FirstOrDefault() != null)
|
||||
rm = new ResourceManager(Path.GetFileNameWithoutExtension(res.Where(x => x.Contains(baseName)).FirstOrDefault()), Assembly.GetAssembly(this.GetType()));
|
||||
else
|
||||
rm = new ResourceManager(Path.GetFileNameWithoutExtension(res.Where(x => x.Contains(this.GetType().Name)).FirstOrDefault()), Assembly.GetAssembly(this.GetType()));
|
||||
}
|
||||
}
|
||||
protected string[] values = null;
|
||||
private readonly IContext context;
|
||||
|
||||
public string[] GetValues() { return this.values; }
|
||||
|
||||
public string[] GetMessages()
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
|
||||
List<string> messages = new List<string>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
messages.Add(ComposeMessage(v));
|
||||
}
|
||||
|
||||
return messages.ToArray();
|
||||
}
|
||||
|
||||
public BindOption[] GetBindOptions()
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
|
||||
List<BindOption> messages = new List<BindOption>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
messages.Add(new BindOption() { BindValue = v, DisplayName = ComposeMessage(v) });
|
||||
}
|
||||
|
||||
return messages.ToArray();
|
||||
}
|
||||
|
||||
public SelectOption[] GetSelectOptions()
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
|
||||
List<SelectOption> messages = new List<SelectOption>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
messages.Add(new SelectOption() { BindValue = v, DisplayName = ComposeMessage(v) });
|
||||
}
|
||||
|
||||
return messages.ToArray();
|
||||
}
|
||||
|
||||
public string ComposeMessage(string msgId, params object[] p)
|
||||
{
|
||||
return ComposeMessage(msgId, context.GetCulture(), p);
|
||||
}
|
||||
|
||||
public string ComposeMessage(string msgId)
|
||||
{
|
||||
return ComposeMessage(msgId, context.GetCulture());
|
||||
}
|
||||
|
||||
public string ComposeMessage(string msgId, string locale, params object[] p)
|
||||
{
|
||||
if (string.IsNullOrEmpty(msgId)) return null;
|
||||
if (rm == null) return null;
|
||||
|
||||
string[] res = Assembly.GetAssembly(this.GetType()).GetManifestResourceNames();
|
||||
string baseName = this.GetType().Name + "_" + locale;
|
||||
if (res.Where(x => x.Contains(baseName)).FirstOrDefault() != null)
|
||||
rm = new ResourceManager(Path.GetFileNameWithoutExtension(res.Where(x => x.Contains(baseName)).FirstOrDefault()), Assembly.GetAssembly(this.GetType()));
|
||||
|
||||
return string.Format((string)rm.GetString(msgId), p);
|
||||
}
|
||||
|
||||
public string ComposeMessage(string msgId, string locale)
|
||||
{
|
||||
if (string.IsNullOrEmpty(msgId)) return null;
|
||||
if (rm == null) return null;
|
||||
|
||||
string[] res = Assembly.GetAssembly(this.GetType()).GetManifestResourceNames();
|
||||
string baseName = this.GetType().Name + "_" + locale;
|
||||
if (res.Where(x => x.Contains(baseName)).FirstOrDefault() != null)
|
||||
rm = new ResourceManager(Path.GetFileNameWithoutExtension(res.Where(x => x.Contains(baseName)).FirstOrDefault()), Assembly.GetAssembly(this.GetType()));
|
||||
|
||||
if (rm == null) return null;
|
||||
|
||||
return string.Format((string)rm.GetString(msgId));
|
||||
}
|
||||
|
||||
public TableName<T>[] GetTableName<T>(T[] values)
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
TableName<T> tb = null;
|
||||
List<TableName<T>> list = new List<TableName<T>>();
|
||||
foreach (T v in values)
|
||||
{
|
||||
tb = new TableName<T>();
|
||||
tb.DisplayName = ComposeMessage(v.ToString(), context.GetCulture());
|
||||
tb.Value = v;
|
||||
list.Add(tb);
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetDictionary()
|
||||
{
|
||||
Dictionary<string, object> keyValues= new Dictionary<string, object>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
keyValues.Add(v, ComposeMessage(v, context.GetCulture()));
|
||||
}
|
||||
|
||||
return keyValues;
|
||||
}
|
||||
|
||||
public TableName<string>[] GetComposeMessages(string[] values)
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
TableName<string> tb = null;
|
||||
List<TableName<string>> list = new List<TableName<string>>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
tb = new TableName<string>();
|
||||
tb.DisplayName = ComposeMessage(v, context.GetCulture());
|
||||
tb.Value = v;
|
||||
list.Add(tb);
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public TableName<string>[] GetComposeMessages(string[] values, string locale)
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
TableName<string> tb = null;
|
||||
List<TableName<string>> list = new List<TableName<string>>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
tb = new TableName<string>();
|
||||
tb.DisplayName = ComposeMessage(v, locale);
|
||||
tb.Value = v;
|
||||
list.Add(tb);
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public TableName<string>[] GetComposeMessages()
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
TableName<string> tb = null;
|
||||
List<TableName<string>> list = new List<TableName<string>>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
tb = new TableName<string>();
|
||||
tb.DisplayName = ComposeMessage(v, context.GetCulture());
|
||||
tb.Value = v;
|
||||
list.Add(tb);
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Policy
|
||||
{
|
||||
public class AuthorizePolicy
|
||||
{
|
||||
public const string PERMISSION = "PERMISSION";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
using Azure.Core;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.IdentityModel.JsonWebTokens;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Policy
|
||||
{
|
||||
public class ClaimPolicy
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户Id
|
||||
/// </summary>
|
||||
public const string CLAINM_USERID = "UserId";
|
||||
|
||||
/// <summary>
|
||||
/// 账号
|
||||
/// </summary>
|
||||
public const string CLAINM_ACCOUNT = "Account";
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public const string CLAINM_NAME = "Name";
|
||||
|
||||
/// <summary>
|
||||
/// 语言
|
||||
/// </summary>
|
||||
public const string CLAINM_LOCALE = "zh-cn";
|
||||
|
||||
public const string ROLE = "Role";
|
||||
|
||||
public const string BEARER = "Bearer";
|
||||
|
||||
public const string HEADER_LOCALE = "locale";
|
||||
/// <summary>
|
||||
/// 是否超级管理
|
||||
/// </summary>
|
||||
public const string CLAINM_SUPERADMIN = "SuperAdmin";
|
||||
|
||||
/// <summary>
|
||||
/// 租户Id
|
||||
/// </summary>
|
||||
public const string TENANT_ID = "TenantId";
|
||||
|
||||
public static string GetClaimValue(IHttpContextAccessor httpContextAccessor, string claimType)
|
||||
{
|
||||
string value = string.Empty;
|
||||
string token = GetJwtBearerToken(httpContextAccessor.HttpContext);
|
||||
return GetClaimValue(token, claimType);
|
||||
}
|
||||
|
||||
public static string GetHeaderKeyValue(IHttpContextAccessor httpContextAccessor, string headerKey)
|
||||
{
|
||||
if (httpContextAccessor.HttpContext.Request.Headers.Keys.Contains(headerKey))
|
||||
{
|
||||
return httpContextAccessor.HttpContext.Request.Headers[headerKey].ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public static string GetClaimValue(string token, string claimType)
|
||||
{
|
||||
string value = string.Empty;
|
||||
if (!string.IsNullOrEmpty(token) && token.Length > 30)
|
||||
{
|
||||
JsonWebToken tk = new JsonWebTokenHandler().ReadJsonWebToken(token);
|
||||
|
||||
if (tk == null) { return null; }
|
||||
|
||||
Claim claim = tk.GetClaim(claimType);
|
||||
if (claim != null)
|
||||
value = claim.Value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static string GetJwtBearerToken(HttpContext httpContext, string headerKey = "Authorization", string tokenPrefix = "Bearer ")
|
||||
{
|
||||
// 判断请求报文头中是否有 "Authorization" 报文头
|
||||
var bearerToken = httpContext.Request.Headers[headerKey].ToString();
|
||||
if (string.IsNullOrWhiteSpace(bearerToken)) return default;
|
||||
|
||||
var prefixLenght = tokenPrefix.Length;
|
||||
return bearerToken.StartsWith(tokenPrefix, true, null) && bearerToken.Length > prefixLenght ? bearerToken[prefixLenght..] : default;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using CloudBuilder.Core.DependencyInjection.Form;
|
||||
using CloudBuilder.Core.DependencyInjection.Policy;
|
||||
using CloudBuilder.Core.DependencyInjection.Request;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Policy
|
||||
{
|
||||
public class CoreMessagePolicy : AbstractPolicy, IPolicy
|
||||
{
|
||||
public const string THE_DATA_HAS_BEEN_MODIFIED = "the_data_has_been_modified";
|
||||
|
||||
public static CoreMessagePolicy instance = null;
|
||||
|
||||
public CoreMessagePolicy(IContext context) : base(context)
|
||||
{
|
||||
this.values = new string[] { THE_DATA_HAS_BEEN_MODIFIED};
|
||||
}
|
||||
|
||||
public static CoreMessagePolicy GetInstance()
|
||||
{
|
||||
instance = ApplicationServiceContext.ServiceProvider.GetKeyedService<CoreMessagePolicy>(typeof(CoreMessagePolicy).Name);
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="the_data_has_been_modified" xml:space="preserve">
|
||||
<value>The data has been modified by another user. Please refresh and try again.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="the_data_has_been_modified" xml:space="preserve">
|
||||
<value>数据已被其他用户修改,请刷新后重试.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,18 @@
|
||||
using CloudBuilder.Core.DependencyInjection.Request;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Policy
|
||||
{
|
||||
public interface ILocaleMessageManager
|
||||
{
|
||||
void InitLocale();
|
||||
|
||||
string ComposeMessage(string groupName, string name);
|
||||
TableName<string>[] GetDataSource(string groupName);
|
||||
TableName<T>[] GetComposeMessages<T>(string groupName, T[] values);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Policy
|
||||
{
|
||||
public interface ISecurityMasterManager
|
||||
{
|
||||
void InitSecurityMaster();
|
||||
|
||||
string GetValue(string category, string subcategory, string codeItem);
|
||||
|
||||
dynamic GetSecurityMaster(string category, string subcategory, string codeItem);
|
||||
|
||||
void SetSecurityMaster(string category, string subcategory, string codeItem, string value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
using CloudBuilder.Core.DependencyInjection.Policy;
|
||||
using CloudBuilder.Core.DependencyInjection.Request;
|
||||
using CloudBuilder.Core.Service;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Core.Policy
|
||||
{
|
||||
public class LocalePolicy : IPolicy
|
||||
{
|
||||
public const string ZH_CN = "zh-cn";
|
||||
public const string EN = "en";
|
||||
|
||||
public LocalePolicy(IContext context, ILocaleMessageManager localeMessageManager)
|
||||
{
|
||||
this.context = context;
|
||||
this.localeMessageManager = localeMessageManager;
|
||||
}
|
||||
|
||||
protected object[] values = null;
|
||||
private readonly IContext context;
|
||||
private readonly ILocaleMessageManager localeMessageManager;
|
||||
|
||||
public string Name { get; set; } = typeof(LocalePolicy).Name;
|
||||
|
||||
public string[] GetValues() { return this.values?.Select(x => x.ToString()).ToArray(); }
|
||||
|
||||
public string[] GetMessages()
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
|
||||
List<string> messages = new List<string>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
messages.Add(ComposeMessage(Name, v));
|
||||
}
|
||||
|
||||
return messages.ToArray();
|
||||
}
|
||||
|
||||
public BindOption[] GetBindOptions()
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
|
||||
List<BindOption> messages = new List<BindOption>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
messages.Add(new BindOption() { BindValue = v, DisplayName = ComposeMessage(v) });
|
||||
}
|
||||
|
||||
return messages.ToArray();
|
||||
}
|
||||
|
||||
public SelectOption[] GetSelectOptions()
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
|
||||
List<SelectOption> messages = new List<SelectOption>();
|
||||
foreach (string v in values)
|
||||
{
|
||||
messages.Add(new SelectOption() { BindValue = v, DisplayName = ComposeMessage(v) });
|
||||
}
|
||||
|
||||
return messages.ToArray();
|
||||
}
|
||||
|
||||
public string ComposeMessage(string msgId, params object[] p)
|
||||
{
|
||||
if (string.IsNullOrEmpty(msgId)) return null;
|
||||
|
||||
string template = localeMessageManager.ComposeMessage(Name, msgId);
|
||||
|
||||
if (string.IsNullOrEmpty(template)) throw new ValidatedException(string.Format("locale:{0}-{1}", Name, msgId));
|
||||
|
||||
return string.Format(template, p);
|
||||
}
|
||||
|
||||
public TableName<string>[] GetDataSource()
|
||||
{
|
||||
return localeMessageManager.GetDataSource(this.Name);
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetDictionary()
|
||||
{
|
||||
Dictionary<string, object> keyValues = new Dictionary<string, object>();
|
||||
TableName<string>[] tables = localeMessageManager.GetDataSource(this.Name);
|
||||
foreach (TableName<string> v in tables)
|
||||
{
|
||||
keyValues.Add(v.Value, v.DisplayName);
|
||||
}
|
||||
|
||||
return keyValues;
|
||||
}
|
||||
|
||||
public TableName<string>[] GetDataSource(Action<TableName<string>[]> action)
|
||||
{
|
||||
TableName<string>[] tables = localeMessageManager.GetDataSource(this.Name);
|
||||
if (action != null)
|
||||
{
|
||||
action(tables);
|
||||
}
|
||||
return tables;
|
||||
}
|
||||
|
||||
public TableName<T>[] GetComposeMessages<T>()
|
||||
{
|
||||
if (values == null || values.Length == 0) return null;
|
||||
TableName<T> tb = null;
|
||||
List<TableName<T>> list = new List<TableName<T>>();
|
||||
foreach (T v in values)
|
||||
{
|
||||
tb = new TableName<T>();
|
||||
tb.DisplayName = ComposeMessage(v.ToString(), context.GetCulture());
|
||||
tb.Value = v;
|
||||
list.Add(tb);
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using CloudBuilder.Core.DependencyInjection.Form;
|
||||
using CloudBuilder.Core.DependencyInjection.Request;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System
|
||||
{
|
||||
public class SearchFilterOperatorPolicy : AbstractPolicy
|
||||
{
|
||||
public const string EQUAL_TO = "equal_to";//='value'
|
||||
public const string CONTAIN = "contain";//like '%value%'
|
||||
public const string START_CONTAIN = "start_contain";//like 'value%'
|
||||
public const string END_CONTAIN = "end_contain";//like '%value'
|
||||
public const string CN_CONTAIN = "cn_contain";//like N'%value%'
|
||||
public const string CN_START_CONTAIN = "cn_start_contain";//like 'value%'
|
||||
public const string CN_END_CONTAIN = "cn_end_contain";//like '%value'
|
||||
public const string IN_RANGE = "in_range";//in(values)
|
||||
public const string NOT_IN_RANGE = "not_in_range";//not in(values)
|
||||
public const string NUMBER_GREATER_THAN = "number_greater_than";//>value
|
||||
public const string NUMBER_GREATER_THAN_OR_EQUAL_TO = "number_greater_than_or_equal_to";//>=value
|
||||
public const string NUMBER_LESS_THAN = "number_less_than";//<value
|
||||
public const string NUMBER_LESS_THAN_OR_EQUAL_TO = "number_less_than_or_equal_to";//<=value
|
||||
public const string NUMBER_EQUAL_TO = "number_equal_to";//='value'
|
||||
public const string BETWEEN = "between";//between >=value && <=value
|
||||
public const string DATE_BETWEEN = "date_between";//between >=value && <=value
|
||||
public const string DATETIME_BETWEEN = "datetime_between";//between >=value && <=value
|
||||
public const string DATE_GREATER_THAN = "date_greater_than";//>value
|
||||
public const string DATE_GREATER_THAN_OR_EQUAL_TO = "date_greater_than_or_equal_to";//>=value
|
||||
public const string DATE_LESS_THAN = "date_less_than";//<value
|
||||
public const string DATE_LESS_THAN_OR_EQUAL_TO = "date_less_than_or_equal_to";//<=value
|
||||
public const string DATE_EQUAL_TO = "date_equal_to";//='value'
|
||||
public const string CN_MULTIPLE = "cn_multiple";//in(values)
|
||||
public const string CN_IN_RANGE = "cn_in_range";//='value'
|
||||
public const string MULTIPLE = "multiple";//in(values)
|
||||
public const string SINGLE = "single";//='value'
|
||||
|
||||
public static SearchFilterOperatorPolicy instance = null;
|
||||
|
||||
public SearchFilterOperatorPolicy(IContext context) : base(context)
|
||||
{
|
||||
this.values = new string[] {
|
||||
EQUAL_TO,
|
||||
CONTAIN,
|
||||
START_CONTAIN,
|
||||
END_CONTAIN,
|
||||
CN_CONTAIN,
|
||||
CN_START_CONTAIN,
|
||||
CN_END_CONTAIN,
|
||||
IN_RANGE,
|
||||
NOT_IN_RANGE,
|
||||
NUMBER_GREATER_THAN,
|
||||
NUMBER_GREATER_THAN_OR_EQUAL_TO,
|
||||
NUMBER_LESS_THAN,
|
||||
NUMBER_LESS_THAN_OR_EQUAL_TO,
|
||||
NUMBER_EQUAL_TO,
|
||||
BETWEEN,
|
||||
DATE_BETWEEN,
|
||||
DATE_GREATER_THAN,
|
||||
DATE_GREATER_THAN_OR_EQUAL_TO,
|
||||
DATE_LESS_THAN,
|
||||
DATE_LESS_THAN_OR_EQUAL_TO,
|
||||
DATE_EQUAL_TO,
|
||||
CN_MULTIPLE,
|
||||
CN_IN_RANGE,
|
||||
MULTIPLE,
|
||||
SINGLE
|
||||
};
|
||||
}
|
||||
|
||||
public static SearchFilterOperatorPolicy GetInstance()
|
||||
{
|
||||
instance = ApplicationServiceContext.ServiceProvider.GetKeyedService<SearchFilterOperatorPolicy>(typeof(SearchFilterOperatorPolicy).Name);
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="between" xml:space="preserve">
|
||||
<value>数值范围</value>
|
||||
</data>
|
||||
<data name="cn_contain" xml:space="preserve">
|
||||
<value>包含</value>
|
||||
</data>
|
||||
<data name="cn_end_contain" xml:space="preserve">
|
||||
<value>结尾</value>
|
||||
</data>
|
||||
<data name="cn_in_range" xml:space="preserve">
|
||||
<value>包含</value>
|
||||
</data>
|
||||
<data name="cn_multiple" xml:space="preserve">
|
||||
<value>多选</value>
|
||||
</data>
|
||||
<data name="cn_start_contain" xml:space="preserve">
|
||||
<value>开始</value>
|
||||
</data>
|
||||
<data name="contain" xml:space="preserve">
|
||||
<value>包含</value>
|
||||
</data>
|
||||
<data name="date_between" xml:space="preserve">
|
||||
<value>日期范围</value>
|
||||
</data>
|
||||
<data name="date_equal_to" xml:space="preserve">
|
||||
<value>等于</value>
|
||||
</data>
|
||||
<data name="date_greater_than" xml:space="preserve">
|
||||
<value>大于</value>
|
||||
</data>
|
||||
<data name="date_greater_than_or_equal_to" xml:space="preserve">
|
||||
<value>大于等于</value>
|
||||
</data>
|
||||
<data name="date_less_than" xml:space="preserve">
|
||||
<value>小于</value>
|
||||
</data>
|
||||
<data name="date_less_than_or_equal_to" xml:space="preserve">
|
||||
<value>小于等于</value>
|
||||
</data>
|
||||
<data name="end_contain" xml:space="preserve">
|
||||
<value>结尾</value>
|
||||
</data>
|
||||
<data name="equal_to" xml:space="preserve">
|
||||
<value>等于</value>
|
||||
</data>
|
||||
<data name="in_range" xml:space="preserve">
|
||||
<value>包含</value>
|
||||
</data>
|
||||
<data name="multiple" xml:space="preserve">
|
||||
<value>多选</value>
|
||||
</data>
|
||||
<data name="not_in_range" xml:space="preserve">
|
||||
<value>不包含</value>
|
||||
</data>
|
||||
<data name="number_equal_to" xml:space="preserve">
|
||||
<value>等于</value>
|
||||
</data>
|
||||
<data name="number_greater_than" xml:space="preserve">
|
||||
<value>大于</value>
|
||||
</data>
|
||||
<data name="number_greater_than_or_equal_to" xml:space="preserve">
|
||||
<value>大于等于</value>
|
||||
</data>
|
||||
<data name="number_less_than" xml:space="preserve">
|
||||
<value>小于</value>
|
||||
</data>
|
||||
<data name="number_less_than_or_equal_to" xml:space="preserve">
|
||||
<value>小于等于</value>
|
||||
</data>
|
||||
<data name="single" xml:space="preserve">
|
||||
<value>单选</value>
|
||||
</data>
|
||||
<data name="start_contain" xml:space="preserve">
|
||||
<value>开始</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="between" xml:space="preserve">
|
||||
<value>数值范围</value>
|
||||
</data>
|
||||
<data name="cn_contain" xml:space="preserve">
|
||||
<value>包含</value>
|
||||
</data>
|
||||
<data name="cn_end_contain" xml:space="preserve">
|
||||
<value>结尾</value>
|
||||
</data>
|
||||
<data name="cn_in_range" xml:space="preserve">
|
||||
<value>包含</value>
|
||||
</data>
|
||||
<data name="cn_multiple" xml:space="preserve">
|
||||
<value>多选</value>
|
||||
</data>
|
||||
<data name="cn_start_contain" xml:space="preserve">
|
||||
<value>开始</value>
|
||||
</data>
|
||||
<data name="contain" xml:space="preserve">
|
||||
<value>包含</value>
|
||||
</data>
|
||||
<data name="date_between" xml:space="preserve">
|
||||
<value>日期范围</value>
|
||||
</data>
|
||||
<data name="date_equal_to" xml:space="preserve">
|
||||
<value>等于</value>
|
||||
</data>
|
||||
<data name="date_greater_than" xml:space="preserve">
|
||||
<value>大于</value>
|
||||
</data>
|
||||
<data name="date_greater_than_or_equal_to" xml:space="preserve">
|
||||
<value>大于等于</value>
|
||||
</data>
|
||||
<data name="date_less_than" xml:space="preserve">
|
||||
<value>小于</value>
|
||||
</data>
|
||||
<data name="date_less_than_or_equal_to" xml:space="preserve">
|
||||
<value>小于等于</value>
|
||||
</data>
|
||||
<data name="end_contain" xml:space="preserve">
|
||||
<value>结尾</value>
|
||||
</data>
|
||||
<data name="equal_to" xml:space="preserve">
|
||||
<value>等于</value>
|
||||
</data>
|
||||
<data name="in_range" xml:space="preserve">
|
||||
<value>包含</value>
|
||||
</data>
|
||||
<data name="multiple" xml:space="preserve">
|
||||
<value>多选</value>
|
||||
</data>
|
||||
<data name="not_in_range" xml:space="preserve">
|
||||
<value>不包含</value>
|
||||
</data>
|
||||
<data name="number_equal_to" xml:space="preserve">
|
||||
<value>等于</value>
|
||||
</data>
|
||||
<data name="number_greater_than" xml:space="preserve">
|
||||
<value>大于</value>
|
||||
</data>
|
||||
<data name="number_greater_than_or_equal_to" xml:space="preserve">
|
||||
<value>大于等于</value>
|
||||
</data>
|
||||
<data name="number_less_than" xml:space="preserve">
|
||||
<value>小于</value>
|
||||
</data>
|
||||
<data name="number_less_than_or_equal_to" xml:space="preserve">
|
||||
<value>小于等于</value>
|
||||
</data>
|
||||
<data name="single" xml:space="preserve">
|
||||
<value>单选</value>
|
||||
</data>
|
||||
<data name="start_contain" xml:space="preserve">
|
||||
<value>开始</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,40 @@
|
||||
using CloudBuilder.Core.DependencyInjection.Form;
|
||||
using CloudBuilder.Core.DependencyInjection.Request;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System
|
||||
{
|
||||
public class SearchFilterTypePolicy : AbstractPolicy
|
||||
{
|
||||
public const string TEXT = "Text";
|
||||
public const string TEXT_CONTAIN = "TextContain";
|
||||
public const string NUMBER = "Number";
|
||||
public const string DATE = "Date";
|
||||
public const string DATETIME = "DateTime";
|
||||
public const string MULTIPLE_SELECTION = "MultipleSelection";
|
||||
public const string SINGLE_SELECTION = "SingleSelection";
|
||||
public const string SEARCH_SINGLE_SELECTION = "SearchSingleSelection";
|
||||
public const string MENU_SINGLE_SELECTION = "MenuSingleSelection";
|
||||
public const string CHECKBOX = "Checkbox";
|
||||
public const string CHECKBOX_GROUP = "CheckboxGroup";
|
||||
public const string RADIO_GROUP = "RadioGroup";
|
||||
|
||||
public static SearchFilterTypePolicy instance = null;
|
||||
|
||||
public SearchFilterTypePolicy(IContext context) : base(context)
|
||||
{
|
||||
this.values = new string[] { TEXT, TEXT_CONTAIN, NUMBER, DATE, DATETIME, MULTIPLE_SELECTION, SINGLE_SELECTION };
|
||||
}
|
||||
|
||||
public static SearchFilterTypePolicy GetInstance()
|
||||
{
|
||||
instance = ApplicationServiceContext.ServiceProvider.GetKeyedService<SearchFilterTypePolicy>(typeof(SearchFilterTypePolicy).Name);
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Checkbox" xml:space="preserve">
|
||||
<value>单复选</value>
|
||||
</data>
|
||||
<data name="CheckboxGroup" xml:space="preserve">
|
||||
<value>多组复选</value>
|
||||
</data>
|
||||
<data name="Date" xml:space="preserve">
|
||||
<value>日期范围</value>
|
||||
</data>
|
||||
<data name="DateTime" xml:space="preserve">
|
||||
<value>时间范围</value>
|
||||
</data>
|
||||
<data name="MenuSingleSelection" xml:space="preserve">
|
||||
<value>单选(可填)</value>
|
||||
</data>
|
||||
<data name="MultipleSelection" xml:space="preserve">
|
||||
<value>多选</value>
|
||||
</data>
|
||||
<data name="Number" xml:space="preserve">
|
||||
<value>数字</value>
|
||||
</data>
|
||||
<data name="RadioGroup" xml:space="preserve">
|
||||
<value>单选框</value>
|
||||
</data>
|
||||
<data name="SearchSingleSelection" xml:space="preserve">
|
||||
<value>单选(过滤)</value>
|
||||
</data>
|
||||
<data name="SingleSelection" xml:space="preserve">
|
||||
<value>单选</value>
|
||||
</data>
|
||||
<data name="Text" xml:space="preserve">
|
||||
<value>文本</value>
|
||||
</data>
|
||||
<data name="TextContain" xml:space="preserve">
|
||||
<value>文本(包含)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Checkbox" xml:space="preserve">
|
||||
<value>单复选</value>
|
||||
</data>
|
||||
<data name="CheckboxGroup" xml:space="preserve">
|
||||
<value>多组复选</value>
|
||||
</data>
|
||||
<data name="Date" xml:space="preserve">
|
||||
<value>日期范围</value>
|
||||
</data>
|
||||
<data name="DateTime" xml:space="preserve">
|
||||
<value>时间范围</value>
|
||||
</data>
|
||||
<data name="MenuSingleSelection" xml:space="preserve">
|
||||
<value>单选(可填)</value>
|
||||
</data>
|
||||
<data name="MultipleSelection" xml:space="preserve">
|
||||
<value>多选</value>
|
||||
</data>
|
||||
<data name="Number" xml:space="preserve">
|
||||
<value>数字</value>
|
||||
</data>
|
||||
<data name="RadioGroup" xml:space="preserve">
|
||||
<value>单选框</value>
|
||||
</data>
|
||||
<data name="SearchSingleSelection" xml:space="preserve">
|
||||
<value>单选(过滤)</value>
|
||||
</data>
|
||||
<data name="SingleSelection" xml:space="preserve">
|
||||
<value>单选</value>
|
||||
</data>
|
||||
<data name="Text" xml:space="preserve">
|
||||
<value>文本</value>
|
||||
</data>
|
||||
<data name="TextContain" xml:space="preserve">
|
||||
<value>文本(包含)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,58 @@
|
||||
using CloudBuilder.Core.DependencyInjection.Policy;
|
||||
using CloudBuilder.Core.DependencyInjection.Request;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace CloudBuilder.Core.Policy
|
||||
{
|
||||
public class SecurityMasterPolicy : IPolicy
|
||||
{
|
||||
public string Namespace { get; set; } = typeof(SecurityMasterPolicy).Namespace;
|
||||
|
||||
public string Name { get; set; } = typeof(SecurityMasterPolicy).Name;
|
||||
|
||||
private readonly IContext context;
|
||||
private readonly ISecurityMasterManager securityMasterManager;
|
||||
public SecurityMasterPolicy(IContext context, ISecurityMasterManager securityMasterManager)
|
||||
{
|
||||
this.context = context;
|
||||
this.securityMasterManager = securityMasterManager;
|
||||
}
|
||||
|
||||
public dynamic GetSecurityMaster(string codeItem)
|
||||
{
|
||||
return securityMasterManager.GetSecurityMaster(Namespace, Name, codeItem);
|
||||
}
|
||||
|
||||
public string GetValue(string codeItem)
|
||||
{
|
||||
return securityMasterManager.GetValue(Namespace, Name, codeItem);
|
||||
}
|
||||
|
||||
public dynamic GetDefaultValue<T>(string codeItem, T t)
|
||||
{
|
||||
string value = securityMasterManager.GetValue(Namespace, Name, codeItem);
|
||||
if (value == null)
|
||||
{
|
||||
securityMasterManager.SetSecurityMaster(Namespace, Name, codeItem, t.ToString());
|
||||
securityMasterManager.InitSecurityMaster();
|
||||
return t;
|
||||
}
|
||||
|
||||
if (t is string) return value;
|
||||
|
||||
else if (t is int) return Convert.ToInt32(value);
|
||||
|
||||
else if (t is decimal) return Convert.ToDecimal(value);
|
||||
|
||||
else if (t is DateTime) return Convert.ToDateTime(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="N" xml:space="preserve">
|
||||
<value>No</value>
|
||||
</data>
|
||||
<data name="Y" xml:space="preserve">
|
||||
<value>Yes</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="N" xml:space="preserve">
|
||||
<value>否</value>
|
||||
</data>
|
||||
<data name="Y" xml:space="preserve">
|
||||
<value>是</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in new issue
Block a user