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.

140 lines
3.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
namespace POSV.Printer
{
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
public class R1Parameter
{
/// <summary>
/// 模版变量
/// </summary>
[JsonProperty(PropertyName = "template")]
public Tuple<R1Template> Template { get; set; }
[JsonProperty(PropertyName = "font")]
public FontStyle FontStyle { get; set; }
[JsonProperty(PropertyName = "align")]
public AlignStyle AlignStyle { get; set; }
/// <summary>
/// 背景颜色
/// </summary>
[JsonProperty(PropertyName = "color")]
public Color BackColor { get; set; }
/// <summary>
/// 填充线条
/// </summary>
[JsonProperty(PropertyName = "line")]
public LineStyle LineStyle { get; set; }
}
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
public class R1Template
{
private Dictionary<string , List<VariableItem>> _dataSource;
public R1Template(Dictionary<string , List<VariableItem>> dataSource)
{
this._dataSource = dataSource;
this.DataSourceKey = "默认数据源";
this.Prefix = string.Empty;
this.Middle = string.Empty;
this.Suffix = string.Empty;
this.Var1 = new VariableItem();
this.Var2 = new VariableItem();
this.Condition = new VariableItem();
this.Percent = 100;
}
/// <summary>
/// 数据源
/// </summary>
[JsonIgnore]
public Dictionary<string , List<VariableItem>> DataSource
{
get
{
return this._dataSource;
}
set
{
this._dataSource = value;
}
}
/// <summary>
/// 绑定的数据源Key
/// </summary>
[JsonProperty(PropertyName = "data")]
public string DataSourceKey { get; set; }
/// <summary>
/// 行的打印条件变量
/// </summary>
[JsonProperty(PropertyName = "condition")]
public VariableItem Condition { get; set; }
/// <summary>
/// 打印内容前缀
/// </summary>
[JsonProperty(PropertyName = "prefix")]
public string Prefix { get; set; }
/// <summary>
/// 打印变量1
/// </summary>
[JsonProperty(PropertyName = "var1")]
public VariableItem Var1 { get; set; }
/// <summary>
/// 变量中缀
/// </summary>
[JsonProperty(PropertyName = "middle")]
public string Middle { get; set; }
/// <summary>
/// 打印变量2
/// </summary>
[JsonProperty(PropertyName = "var2")]
public VariableItem Var2 { get; set; }
/// <summary>
/// 变量后缀
/// </summary>
[JsonProperty(PropertyName = "suffix")]
public string Suffix { get; set; }
/// <summary>
/// 打印字体
/// </summary>
[JsonProperty(PropertyName = "font")]
public FontStyle FontStyle { get; set; }
/// <summary>
/// 打印对齐方式
/// </summary>
[JsonProperty(PropertyName = "align")]
public AlignStyle AlignStyle { get; set; }
/// <summary>
/// 宽度百分比
/// </summary>
[JsonProperty(PropertyName = "percent")]
public decimal Percent { get; set; }
}
}