using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using YBDevice.Entity;
namespace YBDevice.NApi.Application.MeasureInfo
{
///
/// 记录对比
///
public class ResultDiffC2SDto : IValidatableObject
{
///
/// 第一个记录ID
///
[Required(ErrorMessage = "请选择第一条记录")]
public Guid FirstId { get; set; }
///
/// 第二个记录ID
///
[Required(ErrorMessage = "请选择第二条记录")]
public Guid SecondId { get; set; }
///
/// 设备类型
///
public int DevType { get; set; } = 1;
///
/// 家庭成员ID
///
public int FamilyId { get; set; }
///
/// 验证
///
///
///
public IEnumerable Validate(ValidationContext validationContext)
{
if (FamilyId <= 0)
{
yield return new ValidationResult("请先选择家庭成员", new[] { nameof(FamilyId) });
}
if(FirstId == SecondId)
{
yield return new ValidationResult("请选择两条不同的数据", new[] { nameof(FirstId) });
}
}
}
///
/// 测量记录详情
///
public class ResultDetailC2SDto
{
///
/// 测量记录ID
///
public Guid Id { get; set; }
}
///
/// 记录对比返回值
///
public class ResultDiffS2CDto
{
///
/// 时间
///
public string Time { get; set; }
///
/// 头像
///
public string HeadImg { get; set; }
///
/// 昵称
///
public string NickName { get; set; }
///
/// 性别,1-男,2-女
///
public GenderType Sex { get; set; }
///
/// 天数
///
public int Day { get; set; }
///
/// 体重差
///
public decimal WeightDiff { get; set; }
///
/// 减脂差
///
public decimal Fat_WDiff { get; set; }
///
/// 第一个记录测量项
///
public ResultDiffItemS2SDto FirstResult { get; set; }
///
/// 第二个记录测量项
///
public ResultDiffItemS2SDto SecondResult { get; set; }
}
///
/// 测量 项
///
public class ResultDiffItemS2SDto: UserMeasureModel
{
}
///
/// 删除测量记录
///
public class DeleteResultC2SDto : IValidatableObject
{
///
/// 测量记录ID
///
[Required(ErrorMessage = "请先选择记录")]
public Guid Id { get; set; }
public IEnumerable Validate(ValidationContext validationContext)
{
if (Id == Guid.Empty)
{
yield return new ValidationResult("请先选择记录", new[] { nameof(Id) });
}
}
}
}