You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
3.6 KiB
C#

9 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using POSV.Utils;
namespace POSV.Bean
{
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
public class ShoppingCartItem : IEquatable<ShoppingCartItem>
{
private List<CartRow> _rows =new List<CartRow>();
/// <summary>
/// 品类显示颜色1
/// </summary>
[JsonProperty(PropertyName = "rows")]
public List<CartRow> Rows
{
get { return this._rows; }
set { this._rows = value; }
}
private int _rowHeight = 20;
/// <summary>
/// 行高度
/// </summary>
[JsonProperty(PropertyName = "height")]
public int RowHeight
{
get { return this._rowHeight; }
set
{
this._rowHeight = (value <= 0 ? 20 : value);
}
}
private string _textColor = ColorTranslator.ToHtml(Color.White);
/// <summary>
/// 字体显示颜色
/// </summary>
[JsonProperty(PropertyName = "tcolor")]
public string TextColor
{
get { return this._textColor; }
set { this._textColor = value; }
}
private SystemFont _titleFont = SystemFont.;
/// <summary>
/// 品项的字体
/// </summary>
[JsonProperty(PropertyName = "font")]
public SystemFont TitleFont
{
get { return this._titleFont; }
set
{
this._titleFont = value;
}
}
private string _titleColor = ColorTranslator.ToHtml(Color.Black);
/// <summary>
/// 品类显示颜色
/// </summary>
[JsonProperty(PropertyName = "bcolor")]
public string TitleColor
{
get { return this._titleColor; }
set { this._titleColor = value; }
}
public bool Equals(ShoppingCartItem other)
{
if (other == null)
{
return false;
}
return JsonUtils.Serialize(this).Equals(JsonUtils.Serialize(other));
}
}
/// <summary>
/// 订单列设置呈现对应的实体类
/// </summary>
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
public class CartRow : IEquatable<CartRow>
{
/// <summary>
/// 显示序号
/// </summary>
[JsonProperty(PropertyName = "order")]
public int Order { get; set; }
/// <summary>
/// 名称
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// 对应的数据
/// </summary>
[JsonProperty(PropertyName = "text")]
public string Text { get; set; }
/// <summary>
/// 别名
/// </summary>
[JsonProperty(PropertyName = "alias")]
public string Alias { get; set; }
/// <summary>
/// 是否显示
/// </summary>
[JsonProperty(PropertyName = "display")]
public bool Display { get; set; }
/// <summary>
/// 最小宽度
/// </summary>
[JsonProperty(PropertyName = "width")]
[DefaultValue(80)]
public long Width { get; set; }
public bool Equals(CartRow obj)
{
if (obj == null)
{
return false;
}
return JsonUtils.Serialize(this).Equals(JsonUtils.Serialize(obj));
}
}
}