migrate to new git

This commit is contained in:
2025-08-29 01:27:25 +08:00
parent 946eb9961e
commit af2c152ef6
8623 changed files with 1000453 additions and 1 deletions

View File

@@ -0,0 +1,217 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Model
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.Core.Objects;
using System.Linq;
public partial class ezEntities : DbContext
{
public ezEntities()
: base("name=ezEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<accounting> accountings { get; set; }
public virtual DbSet<accounting_files> accounting_files { get; set; }
public virtual DbSet<accounting_kind> accounting_kind { get; set; }
public virtual DbSet<accounting_kind2> accounting_kind2 { get; set; }
public virtual DbSet<actItem> actItems { get; set; }
public virtual DbSet<actItem_files> actItem_files { get; set; }
public virtual DbSet<actItem_kind> actItem_kind { get; set; }
public virtual DbSet<activity> activities { get; set; }
public virtual DbSet<activity_category_kind> activity_category_kind { get; set; }
public virtual DbSet<activity_check> activity_check { get; set; }
public virtual DbSet<activity_kind> activity_kind { get; set; }
public virtual DbSet<activity_kind_detail> activity_kind_detail { get; set; }
public virtual DbSet<activity_relating> activity_relating { get; set; }
public virtual DbSet<activity_spares> activity_spares { get; set; }
public virtual DbSet<admin> admins { get; set; }
public virtual DbSet<admin_group> admin_group { get; set; }
public virtual DbSet<admin_log> admin_log { get; set; }
public virtual DbSet<appellation> appellations { get; set; }
public virtual DbSet<bed_kind> bed_kind { get; set; }
public virtual DbSet<bed_kind_detail> bed_kind_detail { get; set; }
public virtual DbSet<bed_order> bed_order { get; set; }
public virtual DbSet<bed_order_detail> bed_order_detail { get; set; }
public virtual DbSet<company> companies { get; set; }
public virtual DbSet<country> countries { get; set; }
public virtual DbSet<file> files { get; set; }
public virtual DbSet<follower> followers { get; set; }
public virtual DbSet<followers_tablet> followers_tablet { get; set; }
public virtual DbSet<item> items { get; set; }
public virtual DbSet<member> members { get; set; }
public virtual DbSet<member_check> member_check { get; set; }
public virtual DbSet<member_group> member_group { get; set; }
public virtual DbSet<member_title> member_title { get; set; }
public virtual DbSet<news> news { get; set; }
public virtual DbSet<news_files> news_files { get; set; }
public virtual DbSet<news_kind> news_kind { get; set; }
public virtual DbSet<pro_order> pro_order { get; set; }
public virtual DbSet<pro_order_detail> pro_order_detail { get; set; }
public virtual DbSet<pro_order_record> pro_order_record { get; set; }
public virtual DbSet<project> projects { get; set; }
public virtual DbSet<project_kind> project_kind { get; set; }
public virtual DbSet<project_sub> project_sub { get; set; }
public virtual DbSet<stock> stocks { get; set; }
public virtual DbSet<stock_files> stock_files { get; set; }
public virtual DbSet<stock_kind> stock_kind { get; set; }
public virtual DbSet<stock_reason> stock_reason { get; set; }
public virtual DbSet<supplier> suppliers { get; set; }
public virtual DbSet<supplier_kind> supplier_kind { get; set; }
public virtual DbSet<sysdiagram> sysdiagrams { get; set; }
public virtual DbSet<act_bom> act_bom { get; set; }
public virtual DbSet<family_members> family_members { get; set; }
public virtual DbSet<PostCity> PostCitiy { get; set; }
public virtual DbSet<PostNumber> PostNumber { get; set; }
public virtual DbSet<ShuWen> ShuWens { get; set; }
public virtual DbSet<transfer_register> transfer_register { get; set; }
public virtual int pager_eztrust(Nullable<int> startRowIndex, Nullable<int> pageSize, string tableName, string columnName, string sqlWhere, string orderBy, ObjectParameter rowCount)
{
var startRowIndexParameter = startRowIndex.HasValue ?
new ObjectParameter("StartRowIndex", startRowIndex) :
new ObjectParameter("StartRowIndex", typeof(int));
var pageSizeParameter = pageSize.HasValue ?
new ObjectParameter("PageSize", pageSize) :
new ObjectParameter("PageSize", typeof(int));
var tableNameParameter = tableName != null ?
new ObjectParameter("tableName", tableName) :
new ObjectParameter("tableName", typeof(string));
var columnNameParameter = columnName != null ?
new ObjectParameter("columnName", columnName) :
new ObjectParameter("columnName", typeof(string));
var sqlWhereParameter = sqlWhere != null ?
new ObjectParameter("sqlWhere", sqlWhere) :
new ObjectParameter("sqlWhere", typeof(string));
var orderByParameter = orderBy != null ?
new ObjectParameter("orderBy", orderBy) :
new ObjectParameter("orderBy", typeof(string));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("pager_eztrust", startRowIndexParameter, pageSizeParameter, tableNameParameter, columnNameParameter, sqlWhereParameter, orderByParameter, rowCount);
}
public virtual int sp_alterdiagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
var versionParameter = version.HasValue ?
new ObjectParameter("version", version) :
new ObjectParameter("version", typeof(int));
var definitionParameter = definition != null ?
new ObjectParameter("definition", definition) :
new ObjectParameter("definition", typeof(byte[]));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_alterdiagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
}
public virtual int sp_creatediagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
var versionParameter = version.HasValue ?
new ObjectParameter("version", version) :
new ObjectParameter("version", typeof(int));
var definitionParameter = definition != null ?
new ObjectParameter("definition", definition) :
new ObjectParameter("definition", typeof(byte[]));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_creatediagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
}
public virtual int sp_dropdiagram(string diagramname, Nullable<int> owner_id)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_dropdiagram", diagramnameParameter, owner_idParameter);
}
public virtual ObjectResult<sp_helpdiagramdefinition_Result> sp_helpdiagramdefinition(string diagramname, Nullable<int> owner_id)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagramdefinition_Result>("sp_helpdiagramdefinition", diagramnameParameter, owner_idParameter);
}
public virtual ObjectResult<sp_helpdiagrams_Result> sp_helpdiagrams(string diagramname, Nullable<int> owner_id)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagrams_Result>("sp_helpdiagrams", diagramnameParameter, owner_idParameter);
}
public virtual int sp_renamediagram(string diagramname, Nullable<int> owner_id, string new_diagramname)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
var new_diagramnameParameter = new_diagramname != null ?
new ObjectParameter("new_diagramname", new_diagramname) :
new ObjectParameter("new_diagramname", typeof(string));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_renamediagram", diagramnameParameter, owner_idParameter, new_diagramnameParameter);
}
public virtual int sp_upgraddiagrams()
{
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_upgraddiagrams");
}
}
}

View File

@@ -0,0 +1,636 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"Model.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
var itemCollection = loader.CreateEdmItemCollection(inputFile);
var modelNamespace = loader.GetModelNamespace(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
if (container == null)
{
return string.Empty;
}
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#
PushIndent(" ");
}
#>
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (container.FunctionImports.Any())
{
#>
using System.Data.Entity.Core.Objects;
using System.Linq;
<#
}
#>
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
public <#=code.Escape(container)#>()
: base("name=<#=container.Name#>")
{
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
this.Configuration.LazyLoadingEnabled = false;
<#
}
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
// Note: the DbSet members are defined below such that the getter and
// setter always have the same accessibility as the DbSet definition
if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
{
#>
<#=codeStringGenerator.DbSetInitializer(entitySet)#>
<#
}
}
#>
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
<#
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
#>
<#=codeStringGenerator.DbSet(entitySet)#>
<#
}
foreach (var edmFunction in container.FunctionImports)
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
}
#>
}
<#
if (!String.IsNullOrEmpty(codeNamespace))
{
PopIndent();
#>
}
<#
}
#>
<#+
private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
if (typeMapper.IsComposable(edmFunction))
{
#>
[DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
<#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
}
<#+
}
else
{
#>
<#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
}
<#+
if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
}
}
}
public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
{
#>
var <#=name#> = <#=isNotNull#> ?
<#=notNullInit#> :
<#=nullInit#>;
<#+
}
public const string TemplateId = "CSharp_DbContext_Context_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string DbSetInitializer(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} = Set<{1}>();",
_code.Escape(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

10
web/App_Code/Model/Model.Designer.cs generated Normal file
View File

@@ -0,0 +1,10 @@
// T4 code generation is enabled for model 'D:\dev\ez\17168erp\git_gitea\web\App_Code\Model\Model.edmx'.
// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
// is open in the designer.
// If no context and entity classes have been generated, it may be because you created an empty model but
// have not yet chosen which version of Entity Framework to use. To generate a context class and entity
// classes for your model, open the model in the designer, right-click on the designer surface, and
// select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation
// Item...'.

1536
web/App_Code/Model/Model.cs Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="b267a343dc0c4bf0ae194b775754b108" Name="Diagram1" ZoomLevel="100">
<EntityTypeShape EntityType="Model.accounting" Width="1.5" PointX="22.5" PointY="22.125" IsExpanded="true" />
<EntityTypeShape EntityType="Model.accounting_files" Width="1.5" PointX="15.75" PointY="27.75" IsExpanded="true" />
<EntityTypeShape EntityType="Model.accounting_kind" Width="1.5" PointX="11.25" PointY="27.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.accounting_kind2" Width="1.5" PointX="13.5" PointY="11.25" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem" Width="1.5" PointX="9.25" PointY="7.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem_files" Width="1.5" PointX="16.5" PointY="5.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem_kind" Width="1.5" PointX="6.125" PointY="7.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity" Width="1.5" PointX="3" PointY="8.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_category_kind" Width="1.5" PointX="0.75" PointY="9" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_check" Width="1.5" PointX="5.25" PointY="18.5" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_kind" Width="1.5" PointX="0.75" PointY="11.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_kind_detail" Width="1.5" PointX="13.5" PointY="3.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_relating" Width="1.5" PointX="10.5" PointY="9.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_spares" Width="1.5" PointX="13.5" PointY="7.75" IsExpanded="true" />
<EntityTypeShape EntityType="Model.admin" Width="1.5" PointX="6" PointY="1.375" IsExpanded="true" />
<EntityTypeShape EntityType="Model.admin_group" Width="1.5" PointX="3.75" PointY="3.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.admin_log" Width="1.5" PointX="0.75" PointY="2" IsExpanded="true" />
<EntityTypeShape EntityType="Model.appellation" Width="1.5" PointX="0.75" PointY="19" IsExpanded="true" />
<EntityTypeShape EntityType="Model.bed_kind" Width="1.5" PointX="15.75" PointY="12.375" IsExpanded="true" />
<EntityTypeShape EntityType="Model.bed_kind_detail" Width="1.5" PointX="15.75" PointY="8.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.bed_order" Width="1.5" PointX="12.75" PointY="15.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.bed_order_detail" Width="1.5" PointX="18" PointY="15.75" IsExpanded="true" />
<EntityTypeShape EntityType="Model.company" Width="1.5" PointX="17.75" PointY="10" IsExpanded="true" />
<EntityTypeShape EntityType="Model.country" Width="1.5" PointX="0.75" PointY="15.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.file" Width="1.5" PointX="14.25" PointY="41.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.follower" Width="1.5" PointX="3" PointY="15.5" IsExpanded="true" />
<EntityTypeShape EntityType="Model.followers_tablet" Width="1.5" PointX="5.25" PointY="22.125" IsExpanded="true" />
<EntityTypeShape EntityType="Model.item" Width="1.5" PointX="18.75" PointY="2" IsExpanded="true" />
<EntityTypeShape EntityType="Model.member" Width="1.5" PointX="8.25" PointY="16.125" IsExpanded="true" />
<EntityTypeShape EntityType="Model.member_check" Width="1.5" PointX="10.5" PointY="23.375" IsExpanded="true" />
<EntityTypeShape EntityType="Model.member_group" Width="1.5" PointX="6" PointY="25.5" IsExpanded="true" />
<EntityTypeShape EntityType="Model.member_title" Width="1.5" PointX="6" PointY="28.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.news" Width="1.5" PointX="11.25" PointY="4.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.news_files" Width="1.5" PointX="13.5" PointY="25.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.news_kind" Width="1.5" PointX="9" PointY="3.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.pro_order" Width="1.5" PointX="5.25" PointY="13.75" IsExpanded="true" />
<EntityTypeShape EntityType="Model.pro_order_detail" Width="1.5" PointX="10.5" PointY="15" IsExpanded="true" />
<EntityTypeShape EntityType="Model.pro_order_record" Width="1.5" PointX="15.75" PointY="16.5" IsExpanded="true" />
<EntityTypeShape EntityType="Model.project" Width="1.5" PointX="16.5" PointY="1.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.project_kind" Width="1.5" PointX="14.25" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="Model.project_sub" Width="1.5" PointX="18.75" PointY="6.125" IsExpanded="true" />
<EntityTypeShape EntityType="Model.stock" Width="1.5" PointX="16.5" PointY="21" IsExpanded="true" />
<EntityTypeShape EntityType="Model.stock_files" Width="1.5" PointX="18.75" PointY="22.75" IsExpanded="true" />
<EntityTypeShape EntityType="Model.stock_kind" Width="1.5" PointX="14.25" PointY="30.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.stock_reason" Width="1.5" PointX="14.25" PointY="33.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.supplier" Width="1.5" PointX="14.25" PointY="36.5" IsExpanded="true" />
<EntityTypeShape EntityType="Model.supplier_kind" Width="1.5" PointX="12" PointY="37.5" IsExpanded="true" />
<EntityTypeShape EntityType="Model.sysdiagram" Width="1.5" PointX="0.75" PointY="6" IsExpanded="true" />
<AssociationConnector Association="Model.FK_accounting_accounting_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_accounting_accounting_kind2" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_accounting_activity" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_accounting_files_accounting" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_accounting_member" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_pro_order_record_accounting_kind2" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_actItem_actItem_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_actItem_files_actItem" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_kind_detail_actItem" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_relating_actItem" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_spares_actItem" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_pro_order_detail_actItem" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_project_actItem" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_stock_actItem" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_actItem_files_files" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_activity_category_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_activity_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_check_activity" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_relating_activity" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_spares_activity" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_news_activity" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_pro_order_activity" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_stock_activity" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_check_followers" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_activity_kind_detail_activity_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_admin_admin_group" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_member_admin" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_news_admin" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_followers_appellation" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_bed_kind_detail_bed_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_bed_order_detail_bed_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_bed_order_detail_bed_kind1" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_bed_order_detail_bed_kind_detail" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_bed_order_detail_bed_order" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_bed_order_pro_order" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_bed_order_pro_order_detail" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_followers_country" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_followers_followers" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_followers_tablet_followers" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_member_followers" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_pro_order_detail_followers" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_pro_order_detail_followers1" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_pro_order_followers" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_pro_order_introducer" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_member_check_member" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_member_member_group" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_member_member_title" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_stock_member" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_news_files_news" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_news_news_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_pro_order_detail_pro_order" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_pro_order_record_pro_order_detail" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_project_project_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_project_sub_project" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_stock_files_stock" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_stock_stock_kind" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_stock_stock_reason" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_stock_supplier" ManuallyRouted="false" />
<AssociationConnector Association="Model.FK_supplier_supplier_kind" ManuallyRouted="false" />
<EntityTypeShape EntityType="Model.act_bom" Width="1.5" PointX="6.5" PointY="10" />
<AssociationConnector Association="Model.FK_act_bom_act_bom" />
<AssociationConnector Association="Model.FK_act_bom_actItem1" />
<EntityTypeShape EntityType="Model.family_members" Width="1.5" PointX="5.25" PointY="32.125" />
<AssociationConnector Association="Model.FK_family_members_followers" />
<EntityTypeShape EntityType="Model.PostCity" Width="1.5" PointX="8.375" PointY="0.75" />
<EntityTypeShape EntityType="Model.PostNumber" Width="1.5" PointX="10.375" PointY="0.75" />
<EntityTypeShape EntityType="Model.ShuWen" Width="1.5" PointX="19.375" PointY="19.75" />
<EntityTypeShape EntityType="Model.transfer_register" Width="1.5" PointX="20.75" PointY="11.875" />
<AssociationConnector Association="Model.FK_transfer_register_accountings" />
<AssociationConnector Association="Model.FK_transfer_register_accounting_kind2" />
<AssociationConnector Association="Model.FK_transfer_register_activity" />
<AssociationConnector Association="Model.FK_transfer_register_followers" />
<AssociationConnector Association="Model.FK_transfer_register_followers_match" />
<AssociationConnector Association="Model.FK_transfer_register_member" />
<AssociationConnector Association="Model.FK_accounting_pro_order_detail" />
<AssociationConnector Association="Model.FK_transfer_register_actItem" />
<AssociationConnector Association="Model.FK_transfer_register_pro_order_detail" />
<AssociationConnector Association="Model.FK_pro_order_record_transfer_register" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>

733
web/App_Code/Model/Model.tt Normal file
View File

@@ -0,0 +1,733 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"Model.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
{
return string.Empty;
}
WriteHeader(codeStringGenerator, fileManager);
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
{
fileManager.StartNewFile(entity.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
<#=codeStringGenerator.EntityClassOpening(entity)#>
{
<#
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
var complexProperties = typeMapper.GetComplexProperties(entity);
if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public <#=code.Escape(entity)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var navigationProperty in collectionNavigationProperties)
{
#>
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(entity);
if (simpleProperties.Any())
{
foreach (var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var complexProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(complexProperty)#>
<#
}
}
var navigationProperties = typeMapper.GetNavigationProperties(entity);
if (navigationProperties.Any())
{
#>
<#
foreach (var navigationProperty in navigationProperties)
{
if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
<#
}
#>
<#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
{
fileManager.StartNewFile(complex.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
{
<#
var complexProperties = typeMapper.GetComplexProperties(complex);
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
if (propertiesWithDefaultValues.Any() || complexProperties.Any())
{
#>
public <#=code.Escape(complex)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(complex);
if (simpleProperties.Any())
{
foreach(var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var edmProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
{
fileManager.StartNewFile(enumType.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#
if (typeMapper.EnumIsFlags(enumType))
{
#>
[Flags]
<#
}
#>
<#=codeStringGenerator.EnumOpening(enumType)#>
{
<#
var foundOne = false;
foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
{
foundOne = true;
#>
<#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
<#
}
if (foundOne)
{
this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
}
#>
}
<#
EndNamespace(code);
}
fileManager.Process();
#>
<#+
public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
{
fileManager.StartHeader();
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
<#+
fileManager.EndBlock();
}
public void BeginNamespace(CodeGenerationTools code)
{
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#+
PushIndent(" ");
}
}
public void EndNamespace(CodeGenerationTools code)
{
if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
{
PopIndent();
#>
}
<#+
}
}
public const string TemplateId = "CSharp_DbContext_Types_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
{
var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -0,0 +1,73 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(accountingMetadata))]
public partial class accounting
{
private class accountingMetadata
{
[JsonIgnore]
public virtual accounting_kind accounting_kind { get; set; }
[JsonIgnore]
public virtual accounting_kind2 accounting_kind2 { get; set; }
[JsonIgnore]
public virtual member member { get; set; }
}
public const int KindLevelMax = 3; //收支層數
public const int KindLevelMax2 = 1; //帳戶層數
public const string Dir = "~/upload/accounting"; //圖片上傳位置
public string log;
public enum type : int //收支類別
{
[Description("收入")]
Receipts = 1,
[Description("支出")]
Expenses = 2
}
}
public partial class accounting_kind
{
private class accounting_kindMetadata
{
[JsonIgnore]
public virtual ICollection<accounting> accountings { get; set; }
}
}
public partial class accounting_kind2
{
private class accounting_kind2Metadata
{
[JsonIgnore]
public virtual ICollection<accounting> accountings { get; set; }
[JsonIgnore]
public virtual ICollection<pro_order_record> pro_order_record { get; set; }
}
}
}

View File

@@ -0,0 +1,33 @@
using Newtonsoft.Json;
using System;
using System.Activities;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
using Model;
/// <summary>
/// Summary description for act_bom
/// </summary>
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(act_bomMetadata))]
public class act_bom
{
private class act_bomMetadata
{
[JsonIgnore]
public virtual ICollection<act_bom> act_bom1 { get; set; }
[JsonIgnore]
public virtual act_bom act_bom2 { get; set; }
[JsonIgnore]
public virtual actItem actItem { get; set; }
}
}

View File

@@ -0,0 +1,114 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(activityMetadata))]
public partial class activity
{
private class activityMetadata
{
[JsonIgnore]
public virtual activity_kind activity_kind { get; set; }
[JsonIgnore]
public virtual activity_category_kind activity_category_kind { get; set; }
[JsonIgnore]
public virtual ICollection<activity_relating> activity_relating { get; set; }
[JsonIgnore]
public virtual ICollection<activity_spares> activity_spares { get; set; }
[JsonIgnore]
public virtual ICollection<activity_check> activity_check { get; set; }
[JsonIgnore]
public virtual ICollection<news> news { get; set; }
[JsonIgnore]
public virtual ICollection<pro_order> pro_order { get; set; }
[JsonIgnore]
public virtual ICollection<stock> stocks { get; set; }
[JsonIgnore]
public virtual ICollection<accounting> accountings { get; set; }
[JsonIgnore]
public virtual ICollection<transfer_register> transfer_register { get; set; }
}
public const int KindLevelMax = 3; //活動分類頁面層數
public const int ItemLevelMax = 3; //項目類別頁面層數
public enum category : int
{
[Description("報名項目")]
SignUp = 1,
[Description("掛單項目")]
Order = 2,
[Description("備品項目")]
Spares = 3,
[Description("贊助項目")]
Patronize = 4
}
}
[MetadataType(typeof(actItemMetadata))]
public partial class actItem
{
private class actItemMetadata
{
[JsonIgnore]
public virtual actItem_kind actItem_kind { get; set; }
[JsonIgnore]
public virtual ICollection<actItem_files> actItem_files { get; set; }
[JsonIgnore]
public virtual ICollection<activity_kind_detail> activity_kind_detail { get; set; }
[JsonIgnore]
public virtual ICollection<activity_relating> activity_relating { get; set; }
[JsonIgnore]
public virtual ICollection<activity_spares> activity_spares { get; set; }
[JsonIgnore]
public virtual ICollection<pro_order_detail> pro_order_detail { get; set; }
[JsonIgnore]
public virtual ICollection<project> projects { get; set; }
[JsonIgnore]
public virtual ICollection<stock> stocks { get; set; }
[JsonIgnore]
public virtual ICollection<act_bom> act_bom { get; set; }
[JsonIgnore]
public virtual ICollection<transfer_register> transfer_register { get; set; }
}
}
[MetadataType(typeof(activity_checkMetadata))]
public partial class activity_check
{
private class activity_checkMetadata
{
}
public enum keyin1 : int
{
[Description("報到")]
CheckIn = 1,
[Description("離開")]
CheckOut = 2
}
}
}

View File

@@ -0,0 +1,183 @@
using MyWeb;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.Validation;
using System.Data.OleDb;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(adminMetadata))]
public partial class admin
{
private class adminMetadata
{
}
public static string MyIP
{
get
{
return ip.Get();
}
}
}
[MetadataType(typeof(admin_logMetadata))]
public partial class admin_log
{
private Model.ezEntities _db = new Model.ezEntities();
private class admin_logMetadata
{
}
public enum Systems
{
[Description("公告")]
News = 1,
[Description("信眾")]
Follower = 2,
[Description("活動")]
Activity = 3,
[Description("報名")]
Order = 4,
[Description("專案")]
Project = 5,
[Description("品項")]
Item = 6,
[Description("套表列印")]
Files = 7,
[Description("掛單")]
Bed = 8,
[Description("帳務")]
Accounting = 9,
[Description("庫存")]
Stock = 10,
[Description("人事")]
HR = 11,
[Description("供應商")]
Supplier = 12,
[Description("權限")]
Power = 13,
}
public enum Status
{
[Description("登入")]
Login = 1,
[Description("新增")]
Insert = 2,
[Description("修改")]
Update = 3,
[Description("刪除")]
Delete = 4,
[Description("排序")]
Sort = 5,
[Description("列印")]
Print = 6,
[Description("匯出Excel")]
Excel = 7,
}
public enum Detail
{
[Description("登入成功")]
Success = 1,
[Description("帳號已停用")]
Disable = 2,
[Description("有效期限到期")]
Expire = 3,
[Description("帳號或密碼錯誤")]
Incorrect = 4,
[Description("帳號的群組不存在")]
GroupNotExist = 5,
[Description("未設定使用權限")]
PermissionsNotSet = 6
}
public static string UserAgent
{
get
{
string u = HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"];
Regex b = new Regex(@"android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino", RegexOptions.IgnoreCase | RegexOptions.Multiline);
Regex v = new Regex(@"1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-", RegexOptions.IgnoreCase | RegexOptions.Multiline);
if ((b.IsMatch(u) || v.IsMatch(u.Substring(0, 4))))
return "手機";
else
return "電腦";
}
}
#region Log
public string LogViewBtn(List<string> arr)
{
string html = "<a href=\"javascript:void(0)\" class=\"btn btn-default btn-sm btn-log\" onclick=\"msgbox($(this).parent().find(\'div.d-none\').html())\" >查看清單</a>";
html += $"<div class=\"d-none\">{string.Join("<br>", arr)}</div>";
return html;
}
public bool writeLog(string u_id, int? systems, int status, string word)
{
bool success = true;
try
{
Model.admin_log admin_log = new Model.admin_log();//新增
admin_log.u_id = u_id;
admin_log.login_time = DateTime.Now;
admin_log.login_ip = MyWeb.admin.MyIP.Replace("本機", "127.0.0.1");
admin_log.systems = systems;
admin_log.status = status;
admin_log.word = word;
admin_log.agent = MyWeb.admin.LoginHistory.UserAgent;
_db.admin_log.Add(admin_log);
_db.SaveChanges();
}
catch (DbEntityValidationException e)
{
success = false;
foreach (var eve in e.EntityValidationErrors)
{
Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
eve.Entry.Entity.GetType().Name, eve.Entry.State);
foreach (var ve in eve.ValidationErrors)
{
Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
ve.PropertyName, ve.ErrorMessage);
}
}
throw;
}
catch (Exception ex)
{
success = false;
}
return success;
}
#endregion
}
}

View File

@@ -0,0 +1,99 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
using System.Collections;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(bed_orderMetadata))]
public partial class bed_order
{
private class bed_orderMetadata
{
[JsonIgnore]
public virtual ICollection<bed_order_detail> bed_order_detail { get; set; }
[JsonIgnore]
public virtual pro_order pro_order { get; set; }
[JsonIgnore]
public virtual pro_order_detail pro_order_detail { get; set; }
}
public const int KindLevelMax = 2; //分類頁面層數
#region
public struct keyin
{
public string Text;
public string Value;
public string Color;
}
public ArrayList keyin1_list()
{
ArrayList options = new ArrayList();
keyin keyin;
keyin.Value = "A1"; keyin.Text = "未入住"; keyin.Color = "#990000"; options.Add(keyin);
keyin.Value = "A2"; keyin.Text = "已入住"; keyin.Color = "green"; options.Add(keyin);
return options;
}
public static string keyin1_value_to_text(string v)
{
string tmp = "";
ArrayList keyin1 = new pro_order().keyin1_list();
foreach (keyin k in keyin1)
{
if (k.Value == v)
{
tmp = k.Text;
break;
}
}
return tmp;
}
#endregion
}
[MetadataType(typeof(bed_kindMetadata))]
public partial class bed_kind
{
private class bed_kindMetadata
{
[JsonIgnore]
public virtual ICollection<bed_kind_detail> bed_kind_detail { get; set; }
[JsonIgnore]
public virtual ICollection<bed_order_detail> bed_order_detail { get; set; }
[JsonIgnore]
public virtual ICollection<bed_order_detail> bed_order_detail1 { get; set; }
}
public enum bed_type : int
{
[Description("單人床")]
Single = 1,
[Description("上舖​")]
Double = 2,
[Description("下舖​")]
Bunk= 3,
[Description("通舖​")]
Wide = 4
}
}
}

View File

@@ -0,0 +1,32 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(countryMetadata))]
public partial class country
{
private class countryMetadata
{
[JsonIgnore]
public virtual ICollection<follower> followers { get; set; }
}
}
}

View File

@@ -0,0 +1,29 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(filesMetadata))]
public partial class file
{
private class filesMetadata
{
[JsonIgnore]
public virtual ICollection<actItem_files> actItem_files { get; set; }
}
public static IEnumerable<Model.file> allFiles = new Model.ezEntities().files.AsEnumerable();
}
}

View File

@@ -0,0 +1,210 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(followerMetadata))]
public partial class follower
{
private class followerMetadata
{
[JsonIgnore]
public virtual ICollection<follower> followers1 { get; set; }
[JsonIgnore]
public virtual follower follower1 { get; set; }
[JsonIgnore]
public virtual ICollection<activity_check> activity_check { get; set; }
[JsonIgnore]
public virtual country country1 { get; set; }
[JsonIgnore]
public virtual ICollection<member> members { get; set; }
[JsonIgnore]
public virtual ICollection<pro_order_detail> pro_order_detail { get; set; }
[JsonIgnore]
public virtual ICollection<pro_order_detail> pro_order_detail1 { get; set; }
[JsonIgnore]
public virtual ICollection<pro_order> pro_order { get; set; }
[JsonIgnore]
public virtual ICollection<pro_order> pro_order1 { get; set; }
[JsonIgnore]
public virtual ICollection<followers_tablet> followers_tablet { get; set; }
[JsonIgnore]
public virtual appellation appellation { get; set; }
}
public enum type : int
{
[Description("出家眾")]
Monk = 1,// 4,
[Description("個人")]
Personal = 2, //1,
[Description("法人")]
Legal = 3, //2,
[Description("往生菩薩")]
Bodhisattva = 4, //3,
[Description("蓮友")]
Seeker = 10,
}
public static IEnumerable<Model.follower> allFaollowers = new Model.ezEntities().followers.AsEnumerable();
//public static string identity_type_list()
#region &
public enum chinese
{
= 1, = 2, = 3, = 4, = 5, = 6,
= 7, = 8, = 9, = 10, = 11, = 12
}
enum heavenlyStems
{
= 1, , , , , , , , ,
}
enum earthlyBranches
{
= 1, , , , , , , , , , ,
}
public static string chagenSign(DateTime? date)
{ //可改公用
//生肖
try
{
if (date != null)
{
DateTime d = date ?? DateTime.Now;
int year = d.Year;
int birthpet; //宣告生肖要用的變數
birthpet = year % 12; //西元年除12取餘數
birthpet -= 3;
//餘數-3
if (birthpet <= 0) birthpet += 12;
//判斷餘數是否大於0小於0必須+12
return Enum.GetName(typeof(chinese), birthpet);
//return ((chinese)birthpet).ToString(); //也可以
}
}
catch
{
//return null;
}
return null;
}
public static string sexagenary(DateTime? date)
{
try
{
if (date != null)
{
DateTime d = date ?? DateTime.Now;
//依農曆年計算,故同一年的1月跟6月會得不同結果
//ChineseLunisolarCalendar chineseDate = new ChineseLunisolarCalendar();
//int y = chineseDate.GetYear(d);// 農曆年分
//int a = chineseDate.GetSexagenaryYear(d); // 獲取干支纪年值
//heavenlyStems tg = (heavenlyStems)chineseDate.GetCelestialStem(a);
//earthlyBranches dz = (earthlyBranches)chineseDate.GetTerrestrialBranch(a);
//return $"{tg}{dz}";
int year = d.Year;
if (year > 3)
{
int tgIndex = (year - 4) % 10;
int dzIndex = (year - 4) % 12;
return $"{(heavenlyStems)(tgIndex + 1)}{(earthlyBranches)(dzIndex + 1)}";
}
//throw new ArgumentOutOfRangeException("無效的年份!");
return null;
}
}
catch
{
//return null;
}
return null;
}
public static string ChkNewFollower(Model.follower newFollower)
{
Model.ezEntities _db = new Model.ezEntities();
if (string.IsNullOrWhiteSpace(newFollower.u_name))
{
return "姓名不應為空白";
}
MyWeb.encrypt encrypt = new MyWeb.encrypt();
// 解密並只保留數字
string decryptedNewPhone = !string.IsNullOrWhiteSpace(newFollower.phone)
? new string(encrypt.DecryptAutoKey(newFollower.phone).Where(char.IsDigit).ToArray()) : "";
string decryptedNewCellphone = !string.IsNullOrWhiteSpace(newFollower.cellphone)
? new string(encrypt.DecryptAutoKey(newFollower.cellphone).Where(char.IsDigit).ToArray()) : "";
var existingFollowers = _db.followers.Where(f => f.u_name == newFollower.u_name).ToList();
if (!existingFollowers.Any())
{
return "";
}
foreach (var follower in existingFollowers)
{
string decryptedPhone = !string.IsNullOrWhiteSpace(follower.phone)
? new string(encrypt.DecryptAutoKey(follower.phone).Where(char.IsDigit).ToArray()) : "";
string decryptedCellphone = !string.IsNullOrWhiteSpace(follower.cellphone)
? new string(encrypt.DecryptAutoKey(follower.cellphone).Where(char.IsDigit).ToArray()) : "";
if ((!string.IsNullOrWhiteSpace(decryptedNewPhone) && decryptedNewPhone == decryptedPhone) ||
(!string.IsNullOrWhiteSpace(decryptedNewCellphone) && decryptedNewCellphone == decryptedCellphone))
{
return "姓名重複 + 電話或手機重複";
}
}
return "";
}
#endregion
public static string generate_f_number(string sex = "男眾")
{
string selectedSex = sex;
string f_number = selectedSex == "男眾" ? "M" : "F";
var datePart = DateTime.Now.ToString("yyyyMMdd");
f_number += datePart;
int nextSerial = 1;
lock (GlobalVariables.FNumberLock)
{
nextSerial = (int)HttpContext.Current.Application["FNumberSerial"] + 1;
HttpContext.Current.Application["FNumberSerial"] = nextSerial;
}
f_number += nextSerial.ToString("D5");
return f_number;
}
}
}

View File

@@ -0,0 +1,62 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(memberMetadata))]
public partial class member
{
private class memberMetadata
{
[JsonIgnore]
public virtual follower follower { get; set; }
[JsonIgnore]
public virtual ICollection<member_check> member_check { get; set; }
[JsonIgnore]
public virtual member_group member_group { get; set; }
[JsonIgnore]
public virtual member_title member_title { get; set; }
}
public const int KindLevelMax = 3; //組別頁面層數
public const int TitleLevelMax = 1; //職稱頁面層數
public const string Dir = "~/upload/member"; //圖片上傳位置
public const int picMax = 1; //圖片數量
public class attendances
{
public enum type : int
{
[Description("上班")]
Start = 1,
[Description("下班")]
GetOff = 2
}
public enum login : int
{
[Description("主管補登")]
Enter = 1,
[Description("帳號密碼")]
Account = 2
}
}
}
}

View File

@@ -0,0 +1,37 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(newsMetadata))]
public partial class news
{
private class newsMetadata
{
[JsonIgnore]
public virtual admin admin { get; set; }
[JsonIgnore]
public virtual ICollection<news_files> news_files { get; set; }
[JsonIgnore]
public virtual news_kind news_kind { get; set; }
}
public const int KindLevelMax = 3; //頁面層數
public const string Dir = "~/upload/news"; //圖片上傳位置
public string log;
}
}

View File

@@ -0,0 +1,396 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
using System.Collections;
using System.Text.RegularExpressions;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(pro_orderMetadata))]
public partial class pro_order
{
private class pro_orderMetadata
{
[JsonIgnore]
public virtual activity activity { get; set; }
[JsonIgnore]
public virtual follower follower { get; set; }
[JsonIgnore]
public virtual follower follower1 { get; set; }
[JsonIgnore]
public virtual ICollection<bed_order> bed_order { get; set; }
[JsonIgnore]
public virtual ICollection<pro_order_detail> pro_order_detail { get; set; }
}
public string log;
#region
public struct keyin
{
public string Text;
public string Value;
public string Color;
}
public ArrayList keyin1_list()
{
ArrayList options = new ArrayList();
keyin keyin;
keyin.Value = "A01"; keyin.Text = "報名中"; keyin.Color = "#990000"; options.Add(keyin);
keyin.Value = "A02"; keyin.Text = "已報名"; keyin.Color = "black"; options.Add(keyin);
keyin.Value = "A05"; keyin.Text = "取消報名"; keyin.Color = "green"; options.Add(keyin);
return options;
}
public static string keyin1_value_to_text(string v)
{
string tmp = "";
ArrayList keyin1 = new pro_order(). keyin1_list();
foreach (keyin k in keyin1)
{
if (k.Value == v)
{
tmp = k.Text;
break;
}
}
return tmp;
}
#endregion
public enum detailKeyin1 : int //報名狀態
{
[Description("未收款")]
Unconfirmed = 1,
[Description("分期​")]
Collection = 2,
[Description("已收款")]
Paied = 3,
[Description("呆帳")]
Finish = 4
}
}
[MetadataType(typeof(pro_order_detailMetadata))]
public partial class pro_order_detail
{
private class pro_order_detailMetadata
{
[JsonIgnore]
public virtual actItem actItem { get; set; }
[JsonIgnore]
public virtual ICollection<bed_order> bed_order { get; set; }
[JsonIgnore]
public virtual follower follower { get; set; }
[JsonIgnore]
public virtual follower follower1 { get; set; }
[JsonIgnore]
public virtual pro_order pro_order { get; set; }
[JsonIgnore]
public virtual ICollection<pro_order_record> pro_order_record { get; set; }
[JsonIgnore]
public virtual ICollection<accounting> accountings { get; set; }
[JsonIgnore]
public virtual ICollection<transfer_register> transfer_register { get; set; }
}
/// <summary>
/// 生成序列化IDprint_id的方法處理父項目和子項目的編號生成
/// </summary>
/// <returns>生成的序列化ID</returns>
public string GenerateSequentialId()
{
Model.ezEntities _db = new Model.ezEntities();
string r = this.print_id;
try
{
bool chk = true;
actItem actitem = null;
int? actitem_id = null;
// 處理子項目的ID生成
if (!(this.parent_num == null || this.parent_num == 0))
{
// 1. 查找父項目的資料
var parent_order_item = _db.pro_order_detail.Where(
q => q.num == this.parent_num).FirstOrDefault();
// 2. 確認父項目存在且當前項目還沒有 print_id
if (parent_order_item != null && string.IsNullOrEmpty(this.print_id))
{
actitem_id = parent_order_item.actItem_num;
string parent_print_id = parent_order_item.print_id;
// 1. 獲取當前子項目的品項前綴
var currentActItem = _db.actItems
.Where(q => q.num == this.actItem_num)
.FirstOrDefault();
if (currentActItem != null && !string.IsNullOrEmpty(currentActItem.print_init))
{
var itemPrefix = currentActItem.print_init.Trim();
// 2. 獲取同父項目且同品項的子項目編號
var siblings = _db.pro_order_detail
.Where(q => q.parent_num == this.parent_num) // 找出同一個父項目的子項目
.Where(q => q.actItem_num == this.actItem_num) // 同品項
.Where(q => q.print_id != null) // Ensure print_id is not null
.Select(q => q.print_id) // Just select the print_id
.AsEnumerable() // Switch to in-memory operations
.Where(q => q.StartsWith(parent_print_id)) // Now do string operations in memory
.Where(q => q.Contains(itemPrefix))
.Select(q => q.Trim().Replace("\t", ""))
.Select(q => q.Replace($"{parent_print_id}-{itemPrefix}", ""))
.ToList();
// 3. 將所有序號轉換為數字陣列並過濾無效值
int[] intArray = siblings
.Select(s =>
{
int result;
return int.TryParse(s, out result) ? (int?)result : null;
})
.Where(i => i.HasValue && i.Value != 0)
.Select(i => i.Value)
.ToArray();
// 4. 生成新的序號(最大序號+1並格式化為兩位數
int maxNum = 1 + (intArray.Any() ? intArray.Max() : 0);
string formattedNum = maxNum < 10 ? "0" + maxNum : maxNum.ToString();
// 5. 組合新的 print_id父項目ID-品項前綴序號)
r = $"{parent_print_id}-{itemPrefix}{formattedNum}";
}
}
}
// 處理主項目的ID生成
else
{
actitem_id = this.actItem_num;
actitem = _db.actItems
.Where(q => q.num == actitem_id).FirstOrDefault();
var proorder = _db.pro_order.Where(q => q.order_no == this.order_no).FirstOrDefault();
// 檢查是否需要生成新的 print_id
chk = String.IsNullOrEmpty(r) &&
actitem != null &&
proorder != null &&
!string.IsNullOrEmpty(actitem.print_init);
if (chk)
{
// 1. 組合活動和品項的前綴
var print_init = string.IsNullOrEmpty(proorder?.activity?.print_init) ? "" : proorder?.activity?.print_init.Trim();
var actitem_print_init = actitem.print_init.Trim();
var combinedPrintInit = print_init + actitem_print_init;
// 2. 查找相同活動和品項的已存在編號
var actitems = _db.pro_order_detail
.Where(q => q.pro_order.activity_num == proorder.activity_num)
.Where(q => q.actItem_num == this.actItem_num)
.Where(q => !string.IsNullOrEmpty(q.print_id))
.Where(q => q.print_id.StartsWith(combinedPrintInit))
.Where(q => q.parent_num == 0 || q.parent_num == null)
.Select(q => q.print_id)
.ToList();
// 3. 獲取最大序號
var maxNum = actitems
.Select(item =>
{
var match = Regex.Match(item, @"\d+");
return match.Success ? (int?)int.Parse(match.Value.TrimStart('0')) : null;
})
.Where(num => num.HasValue)
.DefaultIfEmpty(0)
.Max() ?? 0;
// 4. 生成新的序號(四位數格式)
int newNum = maxNum + 1;
string formattedNum = newNum.ToString().PadLeft(4, '0');
// 5. 組合最終的 print_id
r = $"{combinedPrintInit}{formattedNum}";
}
}
}
catch (Exception ex)
{
// 異常處理:記錄錯誤並返回原始 print_id
Console.WriteLine($"Error generating sequential ID: {ex.Message}");
r = this.print_id;
}
return r;
}
}
[MetadataType(typeof(pro_order_recordMetadata))]
public partial class pro_order_record
{
private class pro_order_recordMetadata
{
/// <summary>
/// 主鍵,付款記錄編號
/// </summary>
[Display(Name = "付款記錄編號")]
public int num { get; set; }
/// <summary>
/// 關聯到報名明細編號 (pro_order_detail.num)
/// </summary>
[Display(Name = "報名明細編號")]
[Required(ErrorMessage = "報名明細編號為必填欄位")]
public Nullable<int> detail_num { get; set; }
/// <summary>
/// 付款金額
/// </summary>
[Display(Name = "付款金額")]
[Required(ErrorMessage = "付款金額為必填欄位")]
[Range(0.01, double.MaxValue, ErrorMessage = "付款金額必須大於0")]
public Nullable<float> price { get; set; }
/// <summary>
/// 付款方式 (1=現金, 2=匯款, 3=支票)
/// </summary>
[Display(Name = "付款方式")]
[Required(ErrorMessage = "付款方式為必填欄位")]
public Nullable<int> payment { get; set; }
/// <summary>
/// 登記時間 (系統自動產生)
/// </summary>
[Display(Name = "登記時間")]
public Nullable<System.DateTime> reg_time { get; set; }
/// <summary>
/// 付款日期
/// </summary>
[Display(Name = "付款日期")]
[Required(ErrorMessage = "付款日期為必填欄位")]
public Nullable<System.DateTime> pay_date { get; set; }
/// <summary>
/// 付款機構 (銀行名稱等)
/// </summary>
[Display(Name = "付款機構")]
[StringLength(100, ErrorMessage = "付款機構長度不能超過100個字元")]
public string organization { get; set; }
/// <summary>
/// 銀行代碼或帳號後5碼
/// </summary>
[Display(Name = "帳號後5碼")]
[StringLength(10, ErrorMessage = "帳號後5碼長度不能超過10個字元")]
public string bank_code { get; set; }
/// <summary>
/// 關聯到匯款登記編號 (transfer_register.num)
/// </summary>
[Display(Name = "匯款登記編號")]
public Nullable<int> transfer_id { get; set; }
/// <summary>
/// 關聯到會計科目分類
/// </summary>
[JsonIgnore]
public virtual accounting_kind2 accounting_kind2 { get; set; }
/// <summary>
/// 關聯到報名明細
/// </summary>
[JsonIgnore]
public virtual pro_order_detail pro_order_detail { get; set; }
/// <summary>
/// 關聯到匯款登記資料
/// </summary>
[JsonIgnore]
public virtual transfer_register transfer_register { get; set; }
}
/// <summary>
/// 付款方式列舉
/// </summary>
public enum pay_kind : int
{
/// <summary>
/// 現金付款
/// </summary>
[Description("現金")]
Cash = 1,
/// <summary>
/// 匯款付款
/// </summary>
[Description("匯款")]
ATM = 2,
/// <summary>
/// 支票付款
/// </summary>
[Description("支票")]
Check = 3
}
/// <summary>
/// 取得付款方式的中文描述
/// </summary>
/// <param name="paymentType">付款方式代碼</param>
/// <returns>付款方式中文描述</returns>
public static string GetPaymentDescription(int? paymentType)
{
if (!paymentType.HasValue) return "未指定";
switch (paymentType.Value)
{
case (int)pay_kind.Cash:
return "現金";
case (int)pay_kind.ATM:
return "匯款";
case (int)pay_kind.Check:
return "支票";
default:
return "未知";
}
}
/// <summary>
/// 取得付款方式的完整資訊
/// </summary>
/// <returns>包含付款方式、機構、帳號的完整資訊</returns>
public string GetPaymentFullInfo()
{
string paymentDesc = GetPaymentDescription(this.payment);
string fullInfo = paymentDesc;
if (!string.IsNullOrEmpty(this.organization))
{
fullInfo += $" - {this.organization}";
}
if (!string.IsNullOrEmpty(this.bank_code))
{
fullInfo += $" ({this.bank_code})";
}
return fullInfo;
}
}
}

View File

@@ -0,0 +1,34 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(projectMetadata))]
public partial class project
{
private class projectMetadata
{
[JsonIgnore]
public virtual project_kind project_kind { get; set; }
}
public const int KindLevelMax = 3; //頁面層數
public string log;
public const string Dir = "~/upload/project"; //圖片上傳位置
}
}

View File

@@ -0,0 +1,58 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(stockMetadata))]
public partial class stock
{
private class stockMetadata
{
[JsonIgnore]
public virtual actItem actItem { get; set; }
[JsonIgnore]
public virtual activity activity { get; set; }
[JsonIgnore]
public virtual member member { get; set; }
[JsonIgnore]
public virtual ICollection<stock_files> stock_files { get; set; }
[JsonIgnore]
public virtual stock_kind stock_kind { get; set; }
[JsonIgnore]
public virtual stock_reason stock_reason { get; set; }
[JsonIgnore]
public virtual supplier supplier1 { get; set; }
}
public const int KindLevelMax = 3; //頁面層數
public const int ReasonLevelMax = 1; //頁面層數
public const string Dir = "~/upload/stock"; //圖片上傳位置
public string log;
public enum type : int //進出類型
{
[Description("庫存增加(+)")]
Purchase = 1,
[Description("庫存減少(-)")]
Reduce = 2,
[Description("租借(-)")]
Rent = 3,
[Description("租借歸還(+)")]
Return = 4
}
}
}

View File

@@ -0,0 +1,34 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
// 為對應資料表MODEL宣告額外參數類別(Metadata)
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
[MetadataType(typeof(supplierMetadata))]
public partial class supplier
{
private class supplierMetadata
{
[JsonIgnore]
public virtual supplier_kind supplier_kind { get; set; }
}
public const int KindLevelMax = 3; //收支層數
public const string Dir = "~/upload/supplier"; //圖片上傳位置
public string log;
}
}

View File

@@ -0,0 +1,177 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Web.Http;
namespace Model
{
[MetadataType(typeof(transfer_registerMetadata))]
public partial class transfer_register
{
private class transfer_registerMetadata
{
[JsonIgnore]
public virtual accounting accounting { get; set; }
[JsonIgnore]
public virtual accounting_kind2 accounting_kind2 { get; set; }
[JsonIgnore]
public virtual activity activity { get; set; }
[JsonIgnore]
public virtual follower follower { get; set; }
[JsonIgnore]
public virtual follower follower1 { get; set; }
[JsonIgnore]
public virtual member member { get; set; }
[JsonIgnore]
public virtual actItem actItem { get; set; }
[JsonIgnore]
public virtual pro_order_detail pro_order_detail { get; set; }
[DisplayName("系統流水號")]
public int id { get; set; }
[DisplayName("法會編號")]
public int? activity_num { get; set; }
[DisplayName("姓名")]
[StringLength(50)]
public string name { get; set; }
[DisplayName("電話")]
[StringLength(30)]
public string phone { get; set; }
[DisplayName("支付方式")]
public int? pay_type { get; set; }
[DisplayName("帳號後五碼")]
[StringLength(10)]
public string account_last5 { get; set; }
[DisplayName("支付金額")]
public int? amount { get; set; }
[DisplayName("支付型態")]
[StringLength(10)]
public string pay_mode { get; set; }
[DisplayName("備註")]
[StringLength(200)]
public string note { get; set; }
[DisplayName("匯款憑證圖片檔名")]
[StringLength(100)]
public string proof_img { get; set; }
[DisplayName("信眾核對狀態(階段1)")]
public int? status { get; set; }
[DisplayName("自動比對信眾編號")]
public int? f_num_match { get; set; }
[DisplayName("信眾編號")]
public int? f_num { get; set; }
[DisplayName("入帳銀行帳戶編號")]
public int? acc_num { get; set; }
[DisplayName("入帳日期")]
public DateTime? check_date { get; set; }
[DisplayName("入帳金額")]
public int? check_amount { get; set; }
[DisplayName("帳簿備註")]
[StringLength(200)]
public string check_memo { get; set; }
[DisplayName("匯款核對狀態(階段2)")]
public int? check_status { get; set; }
[DisplayName("入帳帳戶類型")]
public int? acc_kind { get; set; }
[DisplayName("會員編號")]
public int? member_num { get; set; }
[DisplayName("核對時間")]
public DateTime? verify_time { get; set; }
[DisplayName("核對記錄")]
[StringLength(200)]
public string verify_note { get; set; }
[DisplayName("沖帳暫存資料(JSON)")]
public string draft { get; set; }
[DisplayName("剩餘金額")]
public int? remain_amount { get; set; }
[DisplayName("餘額處理-活動品項")]
public int? balance_act_item { get; set; }
[DisplayName("餘額處理-訂單明細")]
public int? balance_pro_order_detail { get; set; }
[DisplayName("建立時間")]
public DateTime? create_time { get; set; }
}
public const string Dir = "~/upload/transfer"; // 匯款證明圖片上傳位置
public string log;
public enum PayType : int // 支付方式
{
[Description("現金")]
Cash = 1,
[Description("匯款")]
Transfer = 2,
[Description("支票")]
Check = 3
}
public enum Status : int // 信眾核對狀態 : 階段1
{
[Description("待確認")]
Pending = 1,
[Description("確認")]
Confirmed = 2,
[Description("作廢")]
Void = 3
}
public enum CheckStatus : int // 匯款核對狀態 : 階段2
{
[Description("未核對")]
Unchecked = 1,
[Description("核對")]
Checked = 2,
[Description("金額不符")]
AmountMismatch = 3,
[Description("其他問題")]
OtherIssue = 4,
[Description("作廢")]
Void = 5,
// 沖帳完成時, 若還有餘額未沖, 將 status 改為 98, 此值不可下拉
[Description("沖帳有餘額")]
Remained = 90,
// 餘額沖帳相關狀態,
[Description("未聯絡")]
Uncontacted = 91,
[Description("已聯絡")]
Contacted = 92,
[Description("餘額核銷")]
BalanceVoided = 95,
// 沖帳完成後, 若餘額為0, 將 status 改為 99, 此值不可下拉
[Description("沖帳完成")]
Voided = 99
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for accounting
/// </summary>
public class accounting
{
public accounting()
{
//
// TODO: Add constructor logic here
//
}
public Nullable<int> category { get; set; }
public Nullable<int> kind { get; set; }
public Nullable<int> kind2 { get; set; }
public Nullable<System.DateTime> uptime1 { get; set; }
public Nullable<System.DateTime> uptime2 { get; set; }
public string activity_num_txt { get; set; }
public string mem_num_txt { get; set; }
public string debtor { get; set; }
}
public class accounting_kind
{
public accounting_kind()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
}
public class accounting_kind2
{
public accounting_kind2()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
public string record_payment { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb;
//using System.Data.SqlClient;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for actItem_kind
/// </summary>
public class actItem_kind
{
public actItem_kind()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
public string status { get; set; }
}
}

View File

@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb;
//using System.Data.SqlClient;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for activity
/// </summary>
public class activity
{
public activity()
{
//
// TODO: Add constructor logic here
//
}
public Nullable<int> kind { get; set; }
public string kindTxt { get; set; }
public string subject { get; set; }
public int? num { get; set; }
public string is_reconcile { get; set; }
}
public class actItem
{
public actItem()
{
//
// TODO: Add constructor logic here
//
}
public int num { get; set; }
public Nullable<int> kind { get; set; }
public string kindTxt { get; set; }
public string subject { get; set; }
public Nullable<int> category { get; set; }
public string categorys { get; set; }
public string extend { get; set; }
public string status { get; set; }
public string fileTxt { get; set; }
public Nullable<float> price { get; set; }
public string demo { get; set; }
public string customize_data { get; set; }
public Nullable<System.DateTime> reg_time { get; set; }
public string partno { get; set; }
public string print_init { get; set; }
// 顯示用的組合欄位
public string subject_with_price { get; set; }
public string full_description { get; set; }
}
public class activity_kind
{
public activity_kind()
{
//
// TODO: Add constructor logic here
//
}
public int? num { get; set; }
public string kind { get; set; }
}
public class activity_check
{
public activity_check()
{
//
// TODO: Add constructor logic here
//
}
public Nullable<int> f_num { get; set; }
public Nullable<int> activity_num { get; set; }
public string activityTxt { get; set; }
public Nullable<System.DateTime> reg_time { get; set; }
public Nullable<int> status { get; set; }
public Nullable<System.DateTime> check_time { get; set; }
public Nullable<System.DateTime> reg_time1 { get; set; }
public Nullable<System.DateTime> reg_time2 { get; set; }
}
public class activity_category_kind
{
public activity_category_kind()
{
//
// TODO: Add constructor logic here
//
}
public int? num { get; set; }
public string kind { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb;
//using System.Data.SqlClient;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for admin
/// </summary>
public class admin
{
public admin()
{
//
// TODO: Add constructor logic here
//
}
public int? num { get; set; }
public string u_id { get; set; }
public string u_name { get; set; }
public string power { get; set; }
public bool online { get; set; }
public bool? removeExist { get; set; }
}
}

View File

@@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
using System.Web.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.IO.Compression;
using System.Net.Mail;
using System.Configuration;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using Microsoft.VisualBasic;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Security;
using System.Security.Cryptography;
using System.Web.UI;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.IO;
using System.Security.Principal;
using System.Web.Caching;
using System.Web.ModelBinding;
using System.Web.Routing;
using System.Web.SessionState;
using System.Web.UI.Adapters;
using System.Web.UI.HtmlControls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Text;
using System.Text.RegularExpressions;
using System.Net;
using System.Reflection;
using System.ComponentModel;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for pro_order
/// </summary>
public class bed_order
{
public bed_order()
{
//
// TODO: Add constructor logic here
//
}
public string bed_order_no { get; set; }
public string order_no { get; set; }
public Nullable<int> o_detail_id { get; set; }
public string keyin1 { get; set; }
}
public class bed_order_detail
{
public bed_order_detail()
{
//
// TODO: Add constructor logic here
//
}
public string bed_order_no { get; set; }
public Nullable<System.DateTime> checkIn_date { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb;
//using System.Data.SqlClient;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for bed_kind
/// </summary>
public class bed_kind
{
public bed_kind()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
public string sex { get; set; }
public int? num { get; set; }
public int? root { get; set; }
}
public class bed_kind_detail
{
public bed_kind_detail()
{
//
// TODO: Add constructor logic here
//
}
public Nullable<int> bed_kind_id { get; set; }
public string bed_name { get; set; }
public Nullable<int> bed_type { get; set; }
public string bed_type_txt { get; set; }
public DateTime? inTime { get; set; }
public int? num { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Linq;
using System.Web;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for country
/// </summary>
public class country
{
public country()
{
//
// TODO: Add constructor logic here
//
}
public string ID { get; set; }
public string keyword { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for files
/// </summary>
public class files
{
public files()
{
//
// TODO: Add constructor logic here
//
}
public Nullable<System.DateTime> reg_time1 { get; set; }
public Nullable<System.DateTime> reg_time2 { get; set; }
public string subject { get; set; }
}
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb;
//using System.Data.SqlClient;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for follower
/// </summary>
public class follower
{
public follower()
{
//
// TODO: Add constructor logic here
//
}
public int? num { get; set; }
public int? f_num { get; set; }
public int? leader { get; set; }
public int? appellation_id { get; set; }
public string f_number { get; set; }
public string u_name { get; set; }
public string sex { get; set; }
public string phone { get; set; }
public string id_code { get; set; }
public string address { get; set; }
public bool? ept_self { get; set; }
public Nullable<int> identity_type { get; set; }
public Nullable<System.DateTime> birthday { get; set; }
public Nullable<System.DateTime> birthday2 { get; set; }
public string country { get; set; }
public string country2 { get; set; }
}
public class followers_tablet
{
public followers_tablet()
{
//
// TODO: Add constructor logic here
//
}
public int? num { get; set; }
public int? f_num { get; set; }
public string type { get; set; }
public string title { get; set; }
}
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb;
//using System.Data.SqlClient;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for member
/// </summary>
public class member
{
public member()
{
//
// TODO: Add constructor logic here
//
}
public Nullable<int> group_kind { get; set; }
public Nullable<int> title_kind { get; set; }
public string u_name { get; set; }
public string sex { get; set; }
public string m_number { get; set; }
public Nullable<System.TimeSpan> starttime { get; set; }
public Nullable<System.TimeSpan> offtime { get; set; }
}
public class member_check
{
public member_check()
{
//
// TODO: Add constructor logic here
//
}
public Nullable<int> group_kind { get; set; }
public string u_name { get; set; }
public int? check_date_year { get; set; }
public int? check_date_month { get; set; }
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb;
//using System.Data.SqlClient;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for member_title & member_group
/// </summary>
public class member_title
{
public member_title()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
public bool inTime { get; set; }
}
public class member_group
{
public member_group()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
}
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb;
//using System.Data.SqlClient;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for news
/// </summary>
public class news
{
public news()
{
//
// TODO: Add constructor logic here
//
}
public string subject { get; set; }
public Nullable<int> kind { get; set; }
public string status { get; set; }
public Nullable<System.DateTime> selltime1 { get; set; }
public Nullable<System.DateTime> selltime2 { get; set; }
public Nullable<System.DateTime> uptime1 { get; set; }
public Nullable<System.DateTime> uptime2 { get; set; }
public Nullable<int> activity_num { get; set; }
public string activity_numTxt { get; set; }
}
public class news_kind
{
public news_kind()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
public bool inTime { get; set; }
}
}

View File

@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb;
//using System.Data.SqlClient;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for pro_order
/// </summary>
public class pro_order
{
public pro_order()
{
//
// TODO: Add constructor logic here
//
}
public string order_no { get; set; }
public Nullable<System.DateTime> up_time1 { get; set; }
public Nullable<System.DateTime> up_time2 { get; set; }
public string keyin1 { get; set; }
public Nullable<int> f_num { get; set; }
public string u_name { get; set; }
public Nullable<int> activity_num { get; set; }
public string subject { get; set; }
public string address { get; set; }
public string actItemTxt { get; set; }
public string introducerTxt { get; set; }
public string country { get; set; }
public string country2 { get; set; }
}
public class pro_order_detail
{
public pro_order_detail()
{
//
// TODO: Add constructor logic here
//
}
public int num { get; set; }
public string order_no { get; set; }
public Nullable<int> actItem_num { get; set; }
public Nullable<int> actItem_kind_num { get; set; }
public Nullable<int> f_num { get; set; }
public string f_num_txt { get; set; }
public Nullable<int> from_id { get; set; }
public string address { get; set; }
public string from_id_tablet { get; set; }
public Nullable<System.DateTime> due_date { get; set; }
public Nullable<int> bed_type { get; set; }
public Nullable<float> price { get; set; }
public Nullable<int> qty { get; set; }
public Nullable<System.DateTime> start_date { get; set; }
public Nullable<System.DateTime> extend_date { get; set; }
public Nullable<float> pay { get; set; }
public Nullable<System.DateTime> pay_date { get; set; }
public Nullable<int> keyin1 { get; set; }
public string demo { get; set; }
public string customize_data { get; set; }
public string printed_files { get; set; }
public Nullable<int> parent_num { get; set; }
public string print_id { get; set; }
public Nullable<System.DateTime> UpdateTime { get; set; }
// 顯示用的組合欄位
public string actitem_name { get; set; }
public string follower_name { get; set; }
public string full_description { get; set; }
public string order_info { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for project
/// </summary>
public class project
{
public project()
{
//
// TODO: Add constructor logic here
//
}
public int? num { get; set; }
public string subject { get; set; }
public Nullable<int> kind { get; set; }
public Nullable<int> actItem_num { get; set; }
}
public class project_kind
{
public project_kind()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for stock
/// </summary>
public class stock
{
public stock()
{
//
// TODO: Add constructor logic here
//
}
public Nullable<int> category { get; set; }
public Nullable<int> kind { get; set; }
public Nullable<int> reason { get; set; }
public Nullable<int> activity_num { get; set; }
public Nullable<int> actItem_num { get; set; }
public Nullable<System.DateTime> uptime1 { get; set; }
public Nullable<System.DateTime> uptime2 { get; set; }
public string activity_num_txt { get; set; }
public string mem_num_txt { get; set; }
public string debtor { get; set; }
}
public class stock_kind
{
public stock_kind()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
}
public class stock_reason
{
public stock_reason()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
public Nullable<int> category { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for supplier
/// </summary>
public class supplier
{
public supplier()
{
//
// TODO: Add constructor logic here
//
}
public Nullable<int> kind { get; set; }
public string u_name { get; set; }
public string s_number { get; set; }
public string kindTxt { get; set; }
}
public class supplier_kind
{
public supplier_kind()
{
//
// TODO: Add constructor logic here
//
}
public string kind { get; set; }
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Globalization;
namespace Model.ViewModel
{
/// <summary>
/// Summary description for transfer_register
/// </summary>
public class transfer_register
{
public transfer_register()
{
//
// TODO: Add constructor logic here
//
}
public int id { get; set; }
public Nullable<int> activity_num { get; set; }
public string name { get; set; }
public string phone { get; set; }
public string pay_type { get; set; }
public string account_last5 { get; set; }
public Nullable<decimal> amount { get; set; }
public string pay_mode { get; set; }
public string note { get; set; }
public string proof_img { get; set; }
public string status { get; set; }
public Nullable<System.DateTime> create_time { get; set; }
public Nullable<int> f_num_match { get; set; }
public Nullable<int> f_num { get; set; }
public Nullable<int> acc_num { get; set; }
public Nullable<System.DateTime> check_date { get; set; }
public Nullable<decimal> check_amount { get; set; }
public string check_memo { get; set; }
public string check_status { get; set; }
public Nullable<int> acc_kind { get; set; }
public Nullable<int> member_num { get; set; }
public Nullable<System.DateTime> verify_time { get; set; }
public string verify_note { get; set; }
public string draft { get; set; }
public Nullable<decimal> remain_amount { get; set; }
// 新增的餘額相關欄位
public Nullable<int> balance_act_item { get; set; }
public Nullable<int> balance_pro_order_detail { get; set; }
// 顯示用的文字欄位
public string activity_name { get; set; }
public string follower_name { get; set; }
public string actitem_name { get; set; }
public string order_detail_info { get; set; }
public string acc_kind_name { get; set; }
public string status_text { get; set; }
public string check_status_text { get; set; }
}
public class transfer_balance_reconcile
{
public transfer_balance_reconcile()
{
//
// TODO: Add constructor logic here
//
}
public int id { get; set; }
public string name { get; set; }
public string phone { get; set; }
public Nullable<decimal> amount { get; set; }
public Nullable<decimal> remain_amount { get; set; }
public string activity_name { get; set; }
public Nullable<System.DateTime> create_time { get; set; }
public string check_status { get; set; }
public string check_status_text { get; set; }
// 餘額核銷相關
public Nullable<int> balance_act_item { get; set; }
public string balance_actitem_name { get; set; }
public Nullable<int> balance_pro_order_detail { get; set; }
public string balance_order_info { get; set; }
}
}