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.

255 lines
6.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using POSV.Utils;
namespace POSV.Bean
{
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
public class ProductItem : IEquatable<ProductItem>
{
private ProductShowType _showType = ProductShowType.;
/// <summary>
/// 呈现方式
/// </summary>
[JsonProperty(PropertyName = "type")]
public ProductShowType ShowType
{
get
{
return this._showType;
}
set
{
this._showType = value;
}
}
private ProductShowCase _showCase = ProductShowCase.1920X1080;
/// <summary>
/// 推荐
/// </summary>
[JsonProperty(PropertyName = "case")]
public ProductShowCase ShowCase
{
get
{
return this._showCase;
}
set
{
this._showCase = value;
}
}
private string _backColor1 = ColorTranslator.ToHtml(Color.DimGray);
/// <summary>
/// 品类显示颜色1
/// </summary>
[JsonProperty(PropertyName = "color1")]
public string BackColor1
{
get { return this._backColor1; }
set { this._backColor1 = value; }
}
private string _backColor2 = ColorTranslator.ToHtml(Color.DimGray);
/// <summary>
/// 品类显示颜色2
/// </summary>
[JsonProperty(PropertyName = "color2")]
public string BackColor2
{
get { return this._backColor2; }
set { this._backColor2 = 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 _productFont = SystemFont.;
/// <summary>
/// 品项的字体
/// </summary>
[JsonProperty(PropertyName = "font")]
public SystemFont ProductFont
{
get { return this._productFont; }
set
{
this._productFont = value;
}
}
private int _itemWidth = 80;
/// <summary>
/// 宽度
/// </summary>
[JsonProperty(PropertyName = "width")]
public int ItemWidth
{
get
{
return this._itemWidth;
}
set
{
this._itemWidth = value;
}
}
private int _itemHeight = 45;
/// <summary>
/// 行高度
/// </summary>
[JsonProperty(PropertyName = "height")]
public int ItemHeight
{
get { return this._itemHeight; }
set
{
this._itemHeight = (value <= 0 ? 1 : value);
}
}
private int _columns = 1;
/// <summary>
/// 大类每行显示的数量
/// </summary>
[JsonProperty(PropertyName = "cols")]
public int Columns
{
get { return this._columns; }
set
{
this._columns = (value <= 0 ? 1 : value);
}
}
private string _color1 = ColorTranslator.ToHtml(Color.DimGray);
/// <summary>
/// 品类显示颜色1
/// </summary>
[JsonProperty(PropertyName = "pcolor1")]
public string PagerColor1
{
get { return this._color1; }
set { this._color1 = value; }
}
private string _color2 = ColorTranslator.ToHtml(Color.DimGray);
/// <summary>
/// 品类显示颜色2
/// </summary>
[JsonProperty(PropertyName = "pcolor2")]
public string PagerColor2
{
get { return this._color2; }
set { this._color2 = value; }
}
/// <summary>
/// 沽清品类显示颜色
/// </summary>
[JsonProperty(PropertyName = "sccolor")]
public string SaleClearColor { get; set; } = ColorTranslator.ToHtml(Color.DimGray);
/// <summary>
/// 沽清品类提醒颜色
/// </summary>
[JsonProperty(PropertyName = "snfcolor")]
public string SaleClearNotifyColor { get; set; } = ColorTranslator.ToHtml(Color.DimGray);
/// <summary>
/// 沽清字体显示颜色
/// </summary>
[JsonProperty(PropertyName = "sctcolor")]
public string SaleClearTextColor { get; set; } = ColorTranslator.ToHtml(Color.White);
/// <summary>
/// 沽清的字体大小
/// </summary>
[JsonProperty(PropertyName = "scfont")]
public SystemFont SaleClearFont { get; set; } = SystemFont.;
/// <summary>
/// 沽清停售显示颜色
/// </summary>
[JsonProperty(PropertyName = "sscolor")]
public string SaleStopColor { get; set; } = ColorTranslator.ToHtml(Color.DimGray);
/// <summary>
/// 选中品项显示颜色
/// </summary>
[JsonProperty(PropertyName = "selcolor")]
public string SelBackColor { get; set; } = ColorTranslator.ToHtml(Color.DarkRed);
/// <summary>
/// 选中字体显示颜色
/// </summary>
[JsonProperty(PropertyName = "seltcolor")]
public string SelTextColor { get; set; } = ColorTranslator.ToHtml(Color.White);
/// <summary>
/// 选中品项的字体
/// </summary>
[JsonProperty(PropertyName = "selfont")]
public SystemFont SelProductFont { get; set; } = SystemFont.;
/// <summary>
/// 品项的显示样式
/// </summary>
[JsonProperty(PropertyName = "corner")]
public CornerType ProductCornerType { get; set; } = CornerType.;
public bool Equals(ProductItem other)
{
if (other == null)
{
return false;
}
return JsonUtils.Serialize(this).Equals(JsonUtils.Serialize(other));
}
}
public enum ProductShowType
{
= 0,
= 1,
= 2,
= 3,
}
public enum ProductShowCase
{
1920X1080 = 0,
1024X768 = 1,
= 2
}
public enum CornerType
{
= 1,
= 2,
= 3
}
}