using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json; namespace POSV.Printer { [Serializable] [JsonObject(MemberSerialization.OptIn)] public class BarCodeXParameter { /// /// 模版变量 /// [JsonProperty(PropertyName = "template")] public Tuple Template { get; set; } [JsonProperty(PropertyName = "font")] public FontStyle FontStyle { get; set; } [JsonProperty(PropertyName = "align")] public AlignStyle AlignStyle { get; set; } } [Serializable] [JsonObject(MemberSerialization.OptIn)] public class BarCodeXTemplate { private Dictionary> _dataSource; public BarCodeXTemplate(Dictionary> dataSource) { this._dataSource = dataSource; this.DataSourceKey = "默认数据源"; this.ShowLabel = false; this.Var1 = new VariableItem(); this.Var2 = new VariableItem(); this.Condition = new VariableItem(); } /// /// 数据源 /// [JsonIgnore] public Dictionary> DataSource { get { return this._dataSource; } set { this._dataSource = value; } } /// /// 绑定的数据源Key /// [JsonProperty(PropertyName = "data")] public string DataSourceKey { get; set; } /// /// 行的打印条件变量 /// [JsonProperty(PropertyName = "condition")] public VariableItem Condition { get; set; } /// /// 是否显示标签 /// [JsonProperty(PropertyName = "label")] public bool ShowLabel { get; set; } /// /// 条码内容变量 /// [JsonProperty(PropertyName = "var1")] public VariableItem Var1 { get; set; } /// /// 条码标签变量 /// [JsonProperty(PropertyName = "var2")] public VariableItem Var2 { get; set; } public override string ToString() { return JSON.Serialize(this); } } }