添加项目文件。
This commit is contained in:
1 parent
05e131ca4e
commit
514d6f5255
1162 files changed
+81255
No files matched your search
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
public enum ActionLogTypesEnum
|
||||
{
|
||||
[Display(Name = "_Admin.Normal")]
|
||||
Normal,
|
||||
[Display(Name = "_Admin.Exception")]
|
||||
Exception,
|
||||
[Display(Name = "_Admin.Debug")]
|
||||
Debug,
|
||||
[Display(Name = "_Admin.Job")]
|
||||
Job
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// ActionLog
|
||||
/// </summary>
|
||||
[Table("ActionLogs")]
|
||||
public class ActionLog : BasePoco,ITenant, ICloneable
|
||||
{
|
||||
[Display(Name = "_Admin.Module")]
|
||||
[StringLength(255, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string ModuleName { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Action")]
|
||||
[StringLength(255, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string ActionName { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Account")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string ITCode { get; set; }
|
||||
|
||||
[Display(Name = "Url")]
|
||||
[StringLength(250, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string ActionUrl { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.ActionTime")]
|
||||
public DateTime ActionTime { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Duration")]
|
||||
public double Duration { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Remark")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
[Display(Name = "IP")]
|
||||
public string IP { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.LogType")]
|
||||
public ActionLogTypesEnum LogType { get; set; }
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone();
|
||||
}
|
||||
|
||||
public string GetLogString()
|
||||
{
|
||||
return $@"
|
||||
|-{Core.CoreProgram._localizer?["_Admin.ActionTime"]}:{this.ActionTime}
|
||||
|-{Core.CoreProgram._localizer?["_Admin.Account"]}:{this.ITCode??""}
|
||||
|-IP:{this.IP??""}
|
||||
|-{Core.CoreProgram._localizer?["_Admin.Module"]}:{this.ModuleName??""}
|
||||
|-{Core.CoreProgram._localizer?["_Admin.MethodName"]}:{this.ActionName ?? ""}
|
||||
|-Url:{this.ActionUrl ?? ""}
|
||||
|-{Core.CoreProgram._localizer?["_Admin.Duration"]}:{this.Duration.ToString("F2")+" s"}
|
||||
|-{Core.CoreProgram._localizer?["_Admin.Remark"]}:{this.Remark}
|
||||
";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
|
||||
public interface IBasePoco
|
||||
{
|
||||
DateTime? CreateTime { get; set; }
|
||||
string CreateBy { get; set; }
|
||||
DateTime? UpdateTime { get; set; }
|
||||
string UpdateBy { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Model层的基类,所有的model都应该继承这个类。这会使所有的model层对应的数据库表都有一个自增主键
|
||||
/// </summary>
|
||||
public class BasePoco : TopBasePoco, IBasePoco
|
||||
{
|
||||
/// <summary>
|
||||
/// CreateTime
|
||||
/// </summary>
|
||||
[Display(Name = "_Admin.CreateTime")]
|
||||
public DateTime? CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// CreateBy
|
||||
/// </summary>
|
||||
[Display(Name = "_Admin.CreateBy")]
|
||||
[StringLength(50,ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string CreateBy { get; set; }
|
||||
/// <summary>
|
||||
/// UpdateTime
|
||||
/// </summary>
|
||||
[Display(Name = "_Admin.UpdateTime")]
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
/// <summary>
|
||||
/// UpdateBy
|
||||
/// </summary>
|
||||
[Display(Name = "_Admin.UpdateBy")]
|
||||
[StringLength(50,ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string UpdateBy { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// DataPrivilege
|
||||
/// </summary>
|
||||
[Table("DataPrivileges")]
|
||||
public class DataPrivilege : BasePoco,ITenant
|
||||
{
|
||||
[Display(Name = "_Admin.User")]
|
||||
public string UserCode { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Group")]
|
||||
public string GroupCode { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
[StringLength(50,ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
[Display(Name = "_Admin.TableName")]
|
||||
public string TableName { get; set; }
|
||||
public string RelateId { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Domain")]
|
||||
public string Domain { get; set; }
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.IO;
|
||||
using System.Text.Json.Serialization;
|
||||
using WalkingTec.Mvvm.Core.Models;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// FileAttachment
|
||||
/// </summary>
|
||||
[Table("FileAttachments")]
|
||||
public class FileAttachment : TopBasePoco, IWtmFile,ITenant, IDisposable
|
||||
{
|
||||
[Display(Name = "_Admin.FileName")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public string FileName { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.FileExt")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
[StringLength(10)]
|
||||
public string FileExt { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Path")]
|
||||
public string Path { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Length")]
|
||||
public long Length { get; set; }
|
||||
|
||||
public DateTime UploadTime { get; set; }
|
||||
|
||||
public string SaveMode { get; set; }
|
||||
|
||||
public byte[] FileData { get; set; }
|
||||
|
||||
public string ExtraInfo { get; set; }
|
||||
public string HandlerInfo { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[JsonIgnore]
|
||||
public Stream DataStream { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if(DataStream != null)
|
||||
{
|
||||
DataStream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
string IWtmFile.GetID()
|
||||
{
|
||||
return ID.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
|
||||
[Table("FrameworkGroups")]
|
||||
[SoftKey(nameof(FrameworkGroup.GroupCode))]
|
||||
public class FrameworkGroup : TreePoco<FrameworkGroup>,ITenant
|
||||
{
|
||||
[Display(Name = "_Admin.GroupCode")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
[RegularExpression("^[0-9]*$", ErrorMessage = "Validate.{0}number")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
[CanNotEdit]
|
||||
public string GroupCode { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.GroupName")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public string GroupName { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Remark")]
|
||||
public string GroupRemark { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.GroupManager")]
|
||||
public string Manager { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[Display(Name = "_Admin.UsersCount")]
|
||||
public int UsersCount { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// FrameworkMenu
|
||||
/// </summary>
|
||||
[Table("FrameworkMenus")]
|
||||
public class FrameworkMenu : TreePoco<FrameworkMenu>
|
||||
{
|
||||
|
||||
[Display(Name = "_Admin.PageName")]
|
||||
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public string PageName { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.ActionName")]
|
||||
public string ActionName { get; set; }
|
||||
|
||||
[Display(Name = "Codegen.ModuleName")]
|
||||
public string ModuleName { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.FolderOnly")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public bool FolderOnly { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.IsInherit")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public bool IsInherit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ClassName
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MethodName
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string MethodName { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Domain")]
|
||||
public string Domain { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.ShowOnMenu")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public bool ShowOnMenu { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.IsPublic")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public bool IsPublic { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.DisplayOrder")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public int? DisplayOrder { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.IsInside")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public bool? IsInside { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.TenantAllowed")]
|
||||
public bool? TenantAllowed { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Url
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Url { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Icon")]
|
||||
[StringLength(50)]
|
||||
public string Icon { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// FrameworkRole
|
||||
/// </summary>
|
||||
[Table("FrameworkRoles")]
|
||||
[SoftKey(nameof(FrameworkRole.RoleCode))]
|
||||
public class FrameworkRole : BasePoco,ITenant
|
||||
{
|
||||
[Display(Name = "_Admin.RoleCode")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
[RegularExpression("^[0-9]*$", ErrorMessage = "Validate.{0}number")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
[CanNotEdit]
|
||||
public string RoleCode { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.RoleName")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public string RoleName { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Remark")]
|
||||
public string RoleRemark { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
|
||||
|
||||
[NotMapped]
|
||||
[Display(Name = "_Admin.UsersCount")]
|
||||
public int UsersCount { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using WalkingTec.Mvvm.Core.Support.Json;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// FrameworkUser
|
||||
/// </summary>
|
||||
[Table("FrameworkTenants")]
|
||||
public class FrameworkTenant : BasePoco, ITenant
|
||||
{
|
||||
[Display(Name = "_Admin.TenantCode")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TCode { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.TenantName")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TName { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.TenantDb")]
|
||||
public string TDb { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.TenantDbType")]
|
||||
public DBTypeEnum? TDbType { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.TenantDbContext")]
|
||||
public string DbContext { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.TenantDomain")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TDomain { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.TenantEnableSub")]
|
||||
public bool EnableSub { get; set; }
|
||||
|
||||
[Display(Name = "Sys.Enable")]
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
[NotMapped]
|
||||
public bool IsUsingDB
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(TDb) == false && TDbType != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IDataContext CreateDC(WTMContext wtm)
|
||||
{
|
||||
if (IsUsingDB == false)
|
||||
{
|
||||
var rv = wtm.CreateDC();
|
||||
rv.SetTenantCode(TCode);
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
var context = string.IsNullOrEmpty(this.DbContext) ? "DataContext" : this.DbContext;
|
||||
var DcConstructor = CS.CisFull.Where(x => x.DeclaringType.Name.ToLower() == context.ToLower()).FirstOrDefault();
|
||||
var tenantdc = (IDataContext)DcConstructor?.Invoke(new object[] { this.TDb, this.TDbType });
|
||||
if (tenantdc == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
tenantdc.IsDebug = wtm.ConfigInfo.IsQuickDebug;
|
||||
if (wtm.LoggerFactory != null)
|
||||
{
|
||||
tenantdc.SetLoggerFactory(wtm.LoggerFactory);
|
||||
}
|
||||
tenantdc.SetTenantCode(this.TCode);
|
||||
return tenantdc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WalkingTec.Mvvm.Core.Support.Json;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// FrameworkUser
|
||||
/// </summary>
|
||||
[Table("FrameworkUsers")]
|
||||
public abstract class FrameworkUserBase : BasePoco,ITenant
|
||||
{
|
||||
[Display(Name = "_Admin.Account")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
[StringLength(50,ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
[CanNotEdit]
|
||||
public string ITCode { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Password")]
|
||||
[Required(AllowEmptyStrings = false, ErrorMessage = "Validate.{0}required")]
|
||||
[StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Name")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.IsValid")]
|
||||
public bool IsValid { get; set; } = true;
|
||||
|
||||
[Display(Name = "_Admin.Photo")]
|
||||
public Guid? PhotoId { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Photo")]
|
||||
[JsonIgnore]
|
||||
public FileAttachment Photo { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
using WalkingTec.Mvvm.Core.Attributes;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
[Table("FrameworkUserGroups")]
|
||||
public class FrameworkUserGroup : BasePoco, ITenant
|
||||
{
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string UserCode { get; set; }
|
||||
[Display(Name = "_Admin.Group")]
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string GroupCode { get; set; }
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
using WalkingTec.Mvvm.Core.Attributes;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
[Table("FrameworkUserRoles")]
|
||||
public class FrameworkUserRole : BasePoco, ITenant
|
||||
{
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string UserCode { get; set; }
|
||||
[Required]
|
||||
[Display(Name = "_Admin.Role")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string RoleCode { get; set; }
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// FunctionPrivilege
|
||||
/// </summary>
|
||||
[Table("FunctionPrivileges")]
|
||||
public class FunctionPrivilege : BasePoco,ITenant
|
||||
{
|
||||
[Display(Name = "_Admin.Role")]
|
||||
public string RoleCode { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.MenuItem")]
|
||||
public Guid MenuItemId { get; set; }
|
||||
|
||||
[Display(Name = "_Admin.Allowed")]
|
||||
[Required(ErrorMessage = "Validate.{0}required")]
|
||||
public bool? Allowed { get; set; }
|
||||
[Display(Name = "_Admin.Tenant")]
|
||||
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
|
||||
public string TenantCode { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// ISearcher
|
||||
/// </summary>
|
||||
public interface ISearcher
|
||||
{
|
||||
#region Property
|
||||
|
||||
#region 分页相关
|
||||
/// <summary>
|
||||
/// 当前页
|
||||
/// </summary>
|
||||
int Page { get; set; }
|
||||
/// <summary>
|
||||
/// 每页数
|
||||
/// </summary>
|
||||
int Limit { get; set; }
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
long Count { get; set; }
|
||||
/// <summary>
|
||||
/// 分页数
|
||||
/// </summary>
|
||||
int PageCount { get; set; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 记录 Controller 中的表单数据
|
||||
/// </summary>
|
||||
Dictionary<string, object> FC { get; set; }
|
||||
|
||||
IDataContext DC { get; set; }
|
||||
/// <summary>
|
||||
/// VMFullName
|
||||
/// </summary>
|
||||
string VMFullName { get; }
|
||||
|
||||
ISessionService Session { get; }
|
||||
|
||||
LoginUserInfo LoginUserInfo { get; }
|
||||
/// <summary>
|
||||
/// 排序信息
|
||||
/// </summary>
|
||||
SortInfo SortInfo { get; set; }
|
||||
/// <summary>
|
||||
/// 用于框架判断列表页是否全局刷新
|
||||
/// </summary>
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event
|
||||
|
||||
/// <summary>
|
||||
/// InitVM 完成后触发的事件
|
||||
/// </summary>
|
||||
event Action<ISearcher> OnAfterInit;
|
||||
/// <summary>
|
||||
/// ReInitVM 完成后触发的事件
|
||||
/// </summary>
|
||||
event Action<ISearcher> OnAfterReInit;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
/// <summary>
|
||||
/// 将源 VM 的 FC 等内容复制到本VM中
|
||||
/// </summary>
|
||||
/// <param name="vm"></param>
|
||||
void CopyContext(IBaseVM vm);
|
||||
|
||||
/// <summary>
|
||||
/// 调用 InitVM 并触发 OnAfterInit 事件
|
||||
/// </summary>
|
||||
void DoInit();
|
||||
|
||||
/// <summary>
|
||||
/// 调用 ReInitVM 并触发 OnAfterReInit 事件
|
||||
/// </summary>
|
||||
void DoReInit();
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
public interface ISubFile
|
||||
{
|
||||
Guid FileId { get; set; }
|
||||
FileAttachment File { get; set; }
|
||||
int Order { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
public interface ITenant
|
||||
{
|
||||
string TenantCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core.Models
|
||||
{
|
||||
public interface IWtmFile
|
||||
{
|
||||
string Path { get; set; }
|
||||
|
||||
string FileName { get; set; }
|
||||
string FileExt { get; set; }
|
||||
long Length { get; set; }
|
||||
|
||||
DateTime UploadTime { get; set; }
|
||||
|
||||
string SaveMode { get; set; }
|
||||
string ExtraInfo { get; set; }
|
||||
string HandlerInfo { get; set; }
|
||||
|
||||
Stream DataStream { get; set; }
|
||||
|
||||
string GetID();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
public interface IPersistPoco
|
||||
{
|
||||
bool IsValid { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 所有持久化model的基类,所有的不应被物理删除的model都应该继承这个类
|
||||
/// </summary>
|
||||
public abstract class PersistPoco : BasePoco, IPersistPoco
|
||||
{
|
||||
/// <summary>
|
||||
/// IsValid
|
||||
/// </summary>
|
||||
[Display(Name = "_Admin.IsValid")]
|
||||
public bool IsValid { get; set; } = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Json.Serialization;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// TopBasePoco
|
||||
/// </summary>
|
||||
public class TopBasePoco
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
[Key]
|
||||
public Guid ID
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// 标识当前行数据是否被选中
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
//[JsonConverter(typeof(InternalBoolConverter))]
|
||||
//[JsonProperty("LAY_CHECKED")]
|
||||
[JsonIgnore]
|
||||
public bool Checked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// BatchError
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
[JsonIgnore]
|
||||
public string BatchError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ExcelIndex
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
[JsonIgnore]
|
||||
public long ExcelIndex { get; set; }
|
||||
|
||||
public object GetID()
|
||||
{
|
||||
var idpro = this.GetType().GetSingleProperty("ID");
|
||||
var id = idpro.GetValue(this);
|
||||
return id;
|
||||
}
|
||||
|
||||
public bool HasID()
|
||||
{
|
||||
bool rv = false;
|
||||
var id = this.GetID();
|
||||
switch (id)
|
||||
{
|
||||
case Guid g1 when g1 != Guid.Empty:
|
||||
rv = true;
|
||||
break;
|
||||
case string s when string.IsNullOrEmpty(s) == false:
|
||||
rv = true;
|
||||
break;
|
||||
case int i when i>0:
|
||||
rv = true;
|
||||
break;
|
||||
case long l when l > 0:
|
||||
rv = true;
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
public object GetParentID()
|
||||
{
|
||||
var idpro = this.GetType().GetSingleProperty("ParentId");
|
||||
var id = idpro.GetValue(this) ?? "";
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public Type GetIDType()
|
||||
{
|
||||
var idpro = this.GetType().GetSingleProperty("ID");
|
||||
return idpro.PropertyType;
|
||||
}
|
||||
|
||||
public void SetID(object id)
|
||||
{
|
||||
var idpro = this.GetType().GetSingleProperty("ID");
|
||||
idpro.SetValue(this, id.ConvertValue(idpro.PropertyType));
|
||||
|
||||
}
|
||||
|
||||
private bool? _isBasePoco = null;
|
||||
[NotMapped]
|
||||
[JsonIgnore]
|
||||
public bool IsBasePoco
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_isBasePoco == null)
|
||||
{
|
||||
_isBasePoco = typeof(IBasePoco).IsAssignableFrom(this.GetType());
|
||||
}
|
||||
return _isBasePoco.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
public abstract class TreePoco : TopBasePoco
|
||||
{
|
||||
[Display(Name = "_Admin.Parent")]
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class TreePoco<T> : TreePoco where T:TreePoco<T>
|
||||
{
|
||||
|
||||
[Display(Name = "_Admin.Parent")]
|
||||
[JsonIgnore]
|
||||
public T Parent { get; set; }
|
||||
[InverseProperty("Parent")]
|
||||
[Display(Name = "_Admin.Children")]
|
||||
public List<T> Children { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public bool HasChildren
|
||||
{
|
||||
get
|
||||
{
|
||||
return Children?.Any() == true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user