/******************************
* 说明:表格明细对象
* 创建人:龚宇超
* 创建日期:2017-11-21
* 修改人:
* 修改日期:
* 修改备注:
* 版本:1.0.0.0
******************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Lskj.Model;
namespace Lskj.Control.Model
{
///
/// 表格明细对象(p_systemDlltabDetail)
///
public class GridDetailModel
{
private int _id;
private int _detailType;
private int _orderid;
private int _rightdockid;
private int _autoMultiHeader;
private bool _autoRefresh;
private bool _rightVisible;
private bool _isSearch;
private bool _isDownloadRelated;
private string _detailName;
private string _detailSql;
private string _formKey;
private string _unionModule;
private string _unionCond;
private string _unionValue;
private string _unionParentField;
private string _columnKey;
private DataTable _columns;
private int _isCheck;
private bool _transverseHistogram;
private bool _isUnioDetail;
private bool _isMrpDrag;
private string _mrpDragTag;
private string _parentModuleCode;
///
/// Gets the identifier.
///
/// The identifier.
public int Id { get { return _id; } }
public int DetailType { get { return _detailType; } }
///
/// 右边停靠id
///
public int Rightdockid { get { return _rightdockid; } }
///
/// 是左侧的明细
///
/// true if this instance is search; otherwise, false.
public bool IsUnioDetail { get { return this._isUnioDetail; } }
///
/// 是否为编辑展现方式
///
/// true if this instance is report; otherwise, false.
public bool IsReadOnly { get { return !string.IsNullOrEmpty(this._detailSql) || string.IsNullOrEmpty(this._unionModule); } }
///
/// 是否显示查询条件
///
/// true if this instance is search; otherwise, false.
public bool IsSearch { get { return this._isSearch; } }
///
/// 是否为图表
///
/// true if this instance is chart; otherwise, false.
public bool IsChart { get { return this._detailType == 1; } }
///
/// 是否为Excel
///
/// true if this instance is excel; otherwise, false.
public bool IsExcel { get { return this._detailType == 1; } }
///
/// 网页地址,下载验证
///
/// true if this instance is web view; otherwise, false.
public bool IsWebView { get { return this._detailType == 2; } }
///
/// 网页地址,原有下载
///
/// true if this instance is web view; otherwise, false.
public bool IsWebView2 { get { return this._detailType == 5; } }
///
/// 网页地址,禁止下载
///
/// true if this instance is web view; otherwise, false.
public bool IsWebView3 { get { return this._detailType == 6; } }
///
/// 添加界面
///
/// true if this instance is add panel; otherwise, false.
public bool IsAddPanel { get { return this._detailType == 3; } }
///
/// 明细页签
///
/// true if this instance is web view; otherwise, false.
public bool IsDetailView { get { return this._detailType == 4; } }
///
/// 明细页签(带虚拟日期)
///
/// true if this instance is web view; otherwise, false.
public bool IsSched { get { return this._detailType == 7; } }
///
/// sql配置明细是否可以保存
///
public bool DetailIsSave;
///
/// 拖拽模式下是否可以拖拽明细
///
public bool IsDrag;
///
/// 明细替换左侧表格
///
public bool IsUnionleft;
///
/// 排序号
///
/// The orderid.
public int Orderid { get { return _orderid; } }
///
/// 自动刷新
///
/// true if [automatic refresh]; otherwise, false.
public bool AutoRefresh { get { return _autoRefresh; } }
///
/// 右侧显示
///
/// true if this instance is right visible; otherwise, false.
public bool IsRightVisible { get { return _rightVisible; } }
///
/// Gets the form key.
///
/// The form key.
public string FormKey { get { return _formKey; } }
///
/// 标签名称
///
/// The name of the detail.
public string DetailName { get { return _detailName; } }
///
/// 标签数据源SQL
///
/// The detail SQL.
public string DetailSql { get { return _detailSql; } set { this._detailSql = value; } }
///
/// 关联模块
///
/// The union module.
public string UnionModule { get { return _unionModule; } }
///
/// 关联条件
///
/// The union module.
public string UnionCond { get { return _unionCond; } }
///
/// 关联值
///
/// The union value.
public string UnionValue { get { return _unionValue.Replace("{", "").Replace("}", "").Replace("{", "").Replace("}", ""); } }
///
/// 关联父级数据字段
///
/// The union parent field.
public string UnionParentField { get { return _unionParentField.Replace("}", "").Replace("{", "").Replace("}", ""); } }
///
/// 自定义表格列标识字段
///
/// The grid custom column key.
public string GridCustomColumnKey { get { return _columnKey + this._formKey; } }
///
/// 默认明细为多表头控件
///
/// The grid custom column key.
public int AutoMultiHeader;
///
/// 明细衍生到右侧数据
///
/// The Detail Right Data.
public int rightVisible;
///
/// 明细衍生到下侧平铺数据
///
/// The Detail Bottom Data.
public int displayMode;
///
/// 表格列数据源
///
/// The grid columns.
public DataTable GridColumns { get { return this._columns; } set { this._columns = value; } }
///
/// 对应的模块对象
///
public ModuleModel SystemModel;
///
/// 是否添加复选框
///
public int IsCheck { get { return this._isCheck; } }
///
/// 柱状图表是否横向展示
///
public bool transverseHistogram { get { return this._transverseHistogram; } }
///
/// 是否Mrp拖拽
///
public bool IsMrpDrag { get { return this._isMrpDrag; } }
///
/// 批量关联明细
///
public bool IsDownloadRelated { get { return this._isDownloadRelated; } }
///
/// Mrp拖拽标记
///
public string MrpDragTag { get { return this._mrpDragTag; } }
///
/// 底部配置为2个名字相同的名字时,执行右键是否刷新(默认false)
///
public bool BottomDetailsRefresh;
///
/// 图档预览模块中,左下明细是否关联右侧页签(右侧页签为左下第一个页签的第一个明细)
///
public bool AssociateRight;
///
///单据审核中下载明细表的明细的条件
///
public string Enablecond;
///
///双击执行
///
public bool DBClickEvent;
///
///扫码模块(Lskj.SweepCode.dll)中,扫码后不刷新
///
public bool ProhibitRefresh;
///
///页签配置左右明细时,推拽执行sql
///
public string DragExecuteSql;
///
///页签配置左右明细时,查询后再次查询(替换上方主表行数据)
///
public bool QueryAgain;
///
///页签配置左右明细时,右键执行后刷新主表
///
public bool BottomRefreshMain;
///
///显示筛选行
///
public bool LoadFilter;
///
///动态明细模式
///
public bool DynamicDetails;
///
///显示明细条件
///
public bool DetailSearch;
///
///记住上下复选行(上下表都有复选框才生效)
///
public bool RecordDetailsCheckbox;
///
///mrp条件页签(根据页签选中行去设置别的页签中对应的条件)
///
public bool MrpConditionTab;
///
/// 刷新明细的序号(排产模块)
///
public string PlanLetfControl;
///
/// 隐藏下方操作按钮(后续配置Dll模板,配置为Lskj.Report.dll也会隐藏下方,dll模板的配置是cs和bs通用的)
///
public bool HideBottomPanel;
///
/// 隐藏下方操作按钮
///
public string ChartText;
///
/// 隐藏下方操作按钮
///
public string ChartTextColor;
///
/// 刷新单表明细时忽略关联字段(单表中,有关联模块,但是没有关联条件,关联值,是不会去查询数据的)
///
public bool IgnoreAssociatedFields;
///
/// Dll模板
///
public string Library;
///
/// pubadd模块中,对应的页签隐藏下方操作按钮
///
public bool AddHideBottomPanel;
///
/// 禁用条件
///
public string VisibleCond;
///
/// 主模块编号
///
public string ParentModuleCode
{
get { return this._parentModuleCode; }
set { this._parentModuleCode = value; }
}
public GridDetailModel(DataRow item)
: this(item, null, GridCustomColumnStruct.BaseDetailGridView)
{
}
public GridDetailModel(DataRow item, DataTable gridColumns, string columnKey, bool isSearch = false)
{
if (item == null || string.IsNullOrEmpty(columnKey)) return;
this._rightdockid = item.Table.Columns.Contains("Rightdockid") && !string.IsNullOrEmpty(item["Rightdockid"] + "") ? Convert.ToInt32(item["Rightdockid"] + "") : 0;
this._id = Convert.ToInt32(item["id"] + "");
this._detailType = item.Table.Columns.Contains("detailType") ? string.IsNullOrEmpty(item["detailType"] + "") ? 0 : Convert.ToInt32(item["detailType"] + "") : 0;
this._orderid = string.IsNullOrEmpty(item["orderid"] + "") ? 0 : Convert.ToInt32(item["orderid"] + "");
this._autoRefresh = string.IsNullOrEmpty(item["autoRefresh"] + "") ? false : "1".Equals(item["autoRefresh"] + "");
this._rightVisible = item.Table.Columns.Contains("rightVisible") ? "1".Equals(item["rightVisible"] + "") : false;
this.DetailIsSave = item.Table.Columns.Contains("DetailIsSave") ? "1".Equals(item["DetailIsSave"] + "") : false;
this.IsDrag = item.Table.Columns.Contains("IsDrag") ? "1".Equals(item["IsDrag"] + "") : false;
this.IsUnionleft = item.Table.Columns.Contains("IsUnionleft") ? "1".Equals(item["IsUnionleft"] + "") : false;
this._detailName = item["detailName"] + "";
if (Business.Impl.LanguageTranslation.Translatable)
{
this._detailName = Business.Impl.LanguageTranslation.GetTranslatedText(this._detailName);
}
this._detailSql = item["detailSql"] + "";
this._formKey = item["formKey"] + "";
this._columnKey = columnKey;
this._unionCond = item.Table.Columns.Contains("unionCond") ? (item["unionCond"] + "") : string.Empty;
this._unionModule = item.Table.Columns.Contains("unionModule") ? (item["unionModule"] + "").Replace("{", "").Replace("}", "") : string.Empty;
this._unionValue = item.Table.Columns.Contains("unionValue") ? (item["unionValue"] + "").Replace("{", "").Replace("}", "") : string.Empty;
this._unionParentField = item.Table.Columns.Contains("unionParentField") ? (item["unionParentField"] + "").Replace("{", "").Replace("}", "") : string.Empty;
this._columns = gridColumns;
this._isDownloadRelated = item.Table.Columns.Contains("IsDownloadRelated") ? "True".Equals(item["IsDownloadRelated"] + "") : false;
this._isSearch = isSearch;
this._isUnioDetail = item.Table.Columns.Contains("IsUnioDetail") ? "1".Equals(item["IsUnioDetail"] + "") : false;
this.AutoMultiHeader = item.Table.Columns.Contains("AutoMultiHeader") && !string.IsNullOrEmpty(item["AutoMultiHeader"] + "") ? Convert.ToInt32(item["AutoMultiHeader"] + "") : 0;
this.displayMode = item.Table.Columns.Contains("displayMode") && !string.IsNullOrEmpty(item["displayMode"] + "") ? Convert.ToInt32(item["displayMode"] + "") : 0;
this.rightVisible = item.Table.Columns.Contains("rightVisible") && !string.IsNullOrEmpty(item["rightVisible"] + "") ? Convert.ToInt32(item["rightVisible"] + "") : 0;
this._isCheck = item.Table.Columns.Contains("gridDetailCheck") && !string.IsNullOrEmpty(item["gridDetailCheck"] + "") ? Convert.ToInt32(item["gridDetailCheck"] + "") : 0;
this._transverseHistogram = item.Table.Columns.Contains("transverseHistogram") ? "1".Equals(item["transverseHistogram"] + "") : false;
this._isMrpDrag = item.Table.Columns.Contains("isMrpDrag") ? "1".Equals(item["isMrpDrag"] + "") : false;
this._mrpDragTag = item.Table.Columns.Contains("mrpDragTag") ? item["mrpDragTag"] + "" : "";
this._parentModuleCode = item.Table.Columns.Contains("tab") ? item["tab"] + "" : "";
this.BottomDetailsRefresh = item.Table.Columns.Contains("BottomDetailsRefresh") ? "1".Equals(item["BottomDetailsRefresh"] + "") : false;
this.AssociateRight = item.Table.Columns.Contains("AssociateRight") ? "1".Equals(item["AssociateRight"] + "") : false;
this.Enablecond = item.Table.Columns.Contains("Enablecond") ? (item["Enablecond"] + "") : string.Empty;
this.DBClickEvent = item.Table.Columns.Contains("DBClickEvent") ? "1".Equals(item["DBClickEvent"] + "") : false;
this.ProhibitRefresh = item.Table.Columns.Contains("ProhibitRefresh") ? "1".Equals(item["ProhibitRefresh"] + "") : false;
this.DragExecuteSql = item.Table.Columns.Contains("DragExecuteSql") ? item["DragExecuteSql"] + "" : "";
this.QueryAgain = item.Table.Columns.Contains("QueryAgain") ? "1".Equals(item["QueryAgain"] + "") : false;
this.BottomRefreshMain = item.Table.Columns.Contains("BottomRefreshMain") ? "1".Equals(item["BottomRefreshMain"] + "") : false;
this.LoadFilter = item.Table.Columns.Contains("LoadFilter") ? "1".Equals(item["LoadFilter"] + "") : false;
this.DynamicDetails = item.Table.Columns.Contains("DynamicDetails") ? "1".Equals(item["DynamicDetails"] + "") : false;
this.DetailSearch = item.Table.Columns.Contains("DetailSearch") ? "1".Equals(item["DetailSearch"] + "") : false;
this.RecordDetailsCheckbox = item.Table.Columns.Contains("RecordDetailsCheckbox") ? "1".Equals(item["RecordDetailsCheckbox"] + "") : false;
this.MrpConditionTab = item.Table.Columns.Contains("MrpConditionTab") ? "1".Equals(item["MrpConditionTab"] + "") : false;
this.PlanLetfControl = item.Table.Columns.Contains("PlanLetfControl") ? item["PlanLetfControl"] + "" : "";
this.HideBottomPanel = item.Table.Columns.Contains("HideBottomPanel") ? "1".Equals(item["HideBottomPanel"] + "") : false;
this.ChartText = item.Table.Columns.Contains("ChartText") ? item["ChartText"] + "" : "";
this.ChartTextColor = item.Table.Columns.Contains("ChartTextColor") ? item["ChartTextColor"] + "" : "";
this.IgnoreAssociatedFields = item.Table.Columns.Contains("IgnoreAssociatedFields") ? "1".Equals(item["IgnoreAssociatedFields"] + "") : false;
this.Library = item.Table.Columns.Contains("Library") ? item["Library"] + "" : "";
this.AddHideBottomPanel = item.Table.Columns.Contains("AddHideBottomPanel") ? "1".Equals(item["AddHideBottomPanel"] + "") : false;
this.VisibleCond = item.Table.Columns.Contains("VisibleCond") ? item["VisibleCond"] + "" : "";
}
}
}