using Abp.Domain.Entities.Auditing;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WeApp.Authorization.Users;
using WeApp.Configuration;
namespace WeApp.TrainingCamp
{
///
/// 培训营分组得分信息
///
[Table("Train_CampGroupScores")]
public class GroupScoreInfo : CreationAuditedEntity
{
///
/// 培训营编号
///
[MaxLength(IwbConsts.PrimaryKey)]
public string CampNo { get; set; }
///
/// 分组编号
///
[MaxLength(IwbConsts.PrimaryKey)]
public string GroupNo { get; set; }
[ForeignKey("GroupNo")]
public CampGroupInfo CampGroupInfo { get; set; }
///
/// 轮次
///
public int RoundIndex { get; set; }
///
/// 系统评分
///
public decimal SystemScore { get; set; }
///
/// 矫正评分
///
public decimal CorrectionScore { get; set; }
///
/// 专家评分
///
public decimal SpecialistScore { get; set; }
///
/// 参考评分
///
public decimal ReferenceScore { get; set; }
///
/// 最终评分
///
public decimal FinalTotalScore { get; set; }
///
/// 大众评分
///
public decimal AudienceScore { get; set; }
///
/// 电话评分
///
public decimal PhoneScore { get; set; }
/////
///// 大众评分
/////
//[NotMapped]
//public decimal AudienceScore
//{
// get
// {
// return ScoreList.FirstOrDefault(a => a.Name == "audience")?.Value ?? 0;
// }
// set
// {
// var index = ScoreList.FindIndex(a => a.Name == "audience");
// if (index > -1)
// {
// ScoreList.RemoveAt(index);
// }
// ScoreList.Add(new ScoreInfo("audience", value));
// }
//}
/////
///// 电话评分
/////
//[NotMapped]
//public decimal PhoneScore
//{
// get
// {
// return ScoreList.FirstOrDefault(a => a.Name == "phone")?.Value ?? 0;
// }
// set
// {
// var index = ScoreList.FindIndex(a => a.Name == "phone");
// if (index > -1)
// {
// ScoreList.RemoveAt(index);
// }
// ScoreList.Add(new ScoreInfo("phone", value));
// }
//}
/////
/////
/////
//public string Scores
//{
// get => ScoreList.Obj2String();
// set => _scoreList = value.Str2Obj>();
//}
//private List _scoreList = new List();
//private List ScoreList
//{
// get
// {
// if (_scoreList?.Count > 0)
// {
// _scoreList = Scores?.Str2Obj>() ?? new List();
// }
// return _scoreList;
// }
//}
///
/// 行为标签得分信息
///
public string BehaviorTagScoreInfo { get; set; }
//[NotMapped]
//public bool IsChange { get; set; }
}
public class ScoreInfo
{
public ScoreInfo()
{
}
public ScoreInfo(string name, decimal value)
{
Name = name;
Value = value;
}
[JsonProperty("n")]
public string Name { get; set; }
[JsonProperty("v")]
public decimal Value { get; set; }
}
}