129 lines
4.2 KiB
C#
129 lines
4.2 KiB
C#
|
|
|
|||
|
|
|
|||
|
|
using System.ComponentModel.DataAnnotations;
|
|||
|
|
|
|||
|
|
using Autodesk.Revit.DB;
|
|||
|
|
|
|||
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|||
|
|
|
|||
|
|
using Dapper.Contrib.Extensions;
|
|||
|
|
|
|||
|
|
using Newtonsoft.Json;
|
|||
|
|
|
|||
|
|
namespace Szmedi.RevitToolkit.Approval.Models
|
|||
|
|
{
|
|||
|
|
///// <summary>
|
|||
|
|
///// 建筑的基本属性
|
|||
|
|
///// </summary>
|
|||
|
|
//public partial class AfcaArchiBaseCategory
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
// //[Dapper.Editable(false)]
|
|||
|
|
// public string Category => $"{Level1}-{Level2}-{Level3}-{Level4}-{Level5}";
|
|||
|
|
|
|||
|
|
// public string Comments { get; set; }
|
|||
|
|
|
|||
|
|
// //[Dapper.Editable(false)]
|
|||
|
|
// //public string FullName => $"{Level1}-{Level2}-{Level3}-{Level4}-{Level5}-{ParamName}";
|
|||
|
|
|
|||
|
|
// [Dapper.Contrib.Extensions.Key] public int Index { get; set; }
|
|||
|
|
// public string ParametersJson { get; set; }
|
|||
|
|
// public string Level1 { get; set; }
|
|||
|
|
|
|||
|
|
// public string Level2 { get; set; }
|
|||
|
|
|
|||
|
|
// public string Level3 { get; set; }
|
|||
|
|
|
|||
|
|
// public string Level4 { get; set; }
|
|||
|
|
|
|||
|
|
// public string Level5 { get; set; }
|
|||
|
|
|
|||
|
|
// public Major Major { get; set; }
|
|||
|
|
|
|||
|
|
// public List<AfcaArchiParameter> Parameters => JsonConvert.DeserializeObject<List<AfcaArchiParameter>>(ParametersJson);
|
|||
|
|
// //[Dapper.Editable(false)]
|
|||
|
|
//}
|
|||
|
|
///// <summary>
|
|||
|
|
///// 仅标记为JsonProperty才序列化/反序列化,把数据库的参数json反序列化
|
|||
|
|
///// </summary>
|
|||
|
|
//[JsonObject(MemberSerialization.OptIn)]
|
|||
|
|
//public partial class AfcaArchiParameter : ObservableValidator
|
|||
|
|
//{
|
|||
|
|
// [ObservableProperty]
|
|||
|
|
// public partial bool IsChecked { get; set; }
|
|||
|
|
// public static ValidationResult ValidateParameterValue(string value, ValidationContext context)
|
|||
|
|
// {
|
|||
|
|
// AfcaArchiParameter instance = (AfcaArchiParameter)context.ObjectInstance;
|
|||
|
|
// bool isValid = instance.Values.Count() == 0 || instance.Values.Contains(value);
|
|||
|
|
// if (isValid)
|
|||
|
|
// {
|
|||
|
|
// return ValidationResult.Success;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// return new("值有误");
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// [JsonProperty]
|
|||
|
|
// public string ParamName { get; set; }
|
|||
|
|
// [ObservableProperty]
|
|||
|
|
// [NotifyPropertyChangedFor(nameof(ParamType))]
|
|||
|
|
// [JsonProperty]
|
|||
|
|
// public partial string DataType { get; set; }
|
|||
|
|
// [JsonIgnore]
|
|||
|
|
// //[Dapper.Editable(false)]
|
|||
|
|
// public ParameterType ParamType => DataType == "double" ? ParameterType.Number : ParameterType.Text;
|
|||
|
|
|
|||
|
|
// [ObservableProperty]
|
|||
|
|
// [NotifyDataErrorInfo]
|
|||
|
|
// [CustomValidation(typeof(AfcaArchiParameter), nameof(ValidateParameterValue))]
|
|||
|
|
// //[Dapper.Editable(false)]
|
|||
|
|
// public partial string ParamValue { get; set; }
|
|||
|
|
// [JsonProperty]
|
|||
|
|
// public string Unit { get; set; }
|
|||
|
|
|
|||
|
|
// [ObservableProperty]
|
|||
|
|
// [NotifyPropertyChangedFor(nameof(Values))]
|
|||
|
|
// [JsonProperty]
|
|||
|
|
// public partial string ValueRange { get; set; }
|
|||
|
|
// public string[] Values
|
|||
|
|
// {
|
|||
|
|
// get
|
|||
|
|
// {
|
|||
|
|
// if (ValueRange == null)
|
|||
|
|
// {
|
|||
|
|
// return [];
|
|||
|
|
// }
|
|||
|
|
// if (ValueRange.Contains("|"))
|
|||
|
|
// {
|
|||
|
|
// return ValueRange.Split('|');
|
|||
|
|
// }
|
|||
|
|
// return [];
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//[Table("afca_architecture_major")]
|
|||
|
|
//public class AfcaArchitectureCategory : AfcaArchiBaseCategory
|
|||
|
|
//{
|
|||
|
|
// public AfcaArchitectureCategory() { Major = Major.Architecture; }
|
|||
|
|
//}
|
|||
|
|
//[Table("afca_electrical_major")]
|
|||
|
|
//public class AfcaElectricalParameter : AfcaArchiBaseCategory
|
|||
|
|
//{
|
|||
|
|
// public AfcaElectricalParameter() { Major = Major.Electrical; }
|
|||
|
|
//}
|
|||
|
|
//[Table("afca_mechanical_major")]
|
|||
|
|
//public class AfcaMechanicalParameter : AfcaArchiBaseCategory
|
|||
|
|
//{
|
|||
|
|
// public AfcaMechanicalParameter() { Major = Major.Mechanical; }
|
|||
|
|
//}
|
|||
|
|
//[Table("afca_piping_major")]
|
|||
|
|
//public class AfcaPipingParameter : AfcaArchiBaseCategory
|
|||
|
|
//{
|
|||
|
|
// public AfcaPipingParameter() { Major = Major.Piping; }
|
|||
|
|
//}
|
|||
|
|
//[Table("afca_structure_major")]
|
|||
|
|
//public class AfcaStructureParameter : AfcaArchiBaseCategory
|
|||
|
|
//{
|
|||
|
|
// public AfcaStructureParameter() { Major = Major.Structure; }
|
|||
|
|
//}
|
|||
|
|
}
|