SVN r758
SVN-Revision: r758
This commit is contained in:
@@ -213,7 +213,7 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
get { return this.TipsPanel; }
|
get { return this.TipsPanel; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 搜索界面
|
/// 搜索界面
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -855,9 +855,25 @@ namespace Lskj.Control
|
|||||||
Dictionary<object, Hashtable> dataCaches = Model != null ? Model.DataCaches : null;
|
Dictionary<object, Hashtable> dataCaches = Model != null ? Model.DataCaches : null;
|
||||||
//显示筛选行
|
//显示筛选行
|
||||||
if (this.SysModel.LoadFilter) this.gcMain.GridView.OptionsView.ShowAutoFilterRow = true;
|
if (this.SysModel.LoadFilter) this.gcMain.GridView.OptionsView.ShowAutoFilterRow = true;
|
||||||
// 创建多表头,默认标准表格
|
if (SysModel.AutoMultiHeader == 1 && SysModel.TreeAutoMultiHeader == 1)
|
||||||
if (this.Model.GridEnumObj == GridEnum.BandedGridView || SysModel.AutoMultiHeader == 1)
|
|
||||||
{
|
{
|
||||||
|
// 创建 多表头,树表格
|
||||||
|
this.panelControl1.Controls.Clear();
|
||||||
|
this.gcMain = new TreeBandedGridControlEx() { Expansion = SysModel.TreeTableExpand };
|
||||||
|
this.gcMain.Model = this.Model;
|
||||||
|
this.gcMain.Dock = DockStyle.Fill;
|
||||||
|
if (this._gridColumns.Rows.Count == 0&&!string.IsNullOrWhiteSpace(SysModel.TreeKeyFieldName) && !string.IsNullOrWhiteSpace(SysModel.TreeParentFieldName))
|
||||||
|
{
|
||||||
|
//节点编号
|
||||||
|
(this.gcMain as TreeBandedGridControlEx).TreeListObj.KeyFieldName = SysModel.TreeKeyFieldName;
|
||||||
|
//父节点编号
|
||||||
|
(this.gcMain as TreeBandedGridControlEx).TreeListObj.ParentFieldName = SysModel.TreeParentFieldName;
|
||||||
|
}
|
||||||
|
this.panelControl1.Controls.Add(this.gcMain);
|
||||||
|
}
|
||||||
|
else if (this.Model.GridEnumObj == GridEnum.BandedGridView || SysModel.AutoMultiHeader == 1)
|
||||||
|
{
|
||||||
|
// 创建多表头,默认标准表格
|
||||||
PanelControl panel = null;
|
PanelControl panel = null;
|
||||||
if (this.gcMain.gridControl.Tag is PanelControl) panel = this.gcMain.gridControl.Tag as PanelControl;
|
if (this.gcMain.gridControl.Tag is PanelControl) panel = this.gcMain.gridControl.Tag as PanelControl;
|
||||||
|
|
||||||
@@ -870,14 +886,23 @@ namespace Lskj.Control
|
|||||||
if (this.SysModel.LoadFilter) (this.gcMain as BandedGridControlEx).GridView.OptionsView.ShowAutoFilterRow = true;
|
if (this.SysModel.LoadFilter) (this.gcMain as BandedGridControlEx).GridView.OptionsView.ShowAutoFilterRow = true;
|
||||||
(this.gcMain as BandedGridControlEx).gridControl.Tag = panel;
|
(this.gcMain as BandedGridControlEx).gridControl.Tag = panel;
|
||||||
}
|
}
|
||||||
if (this.Model.GridEnumObj == GridEnum.TreeListGridView || SysModel.TreeAutoMultiHeader == 1)
|
else if (this.Model.GridEnumObj == GridEnum.TreeListGridView || SysModel.TreeAutoMultiHeader == 1)
|
||||||
{
|
{
|
||||||
|
// 创建树表格
|
||||||
this.panelControl1.Controls.Clear();
|
this.panelControl1.Controls.Clear();
|
||||||
this.gcMain = new TreeGridControlEx() { Expansion = SysModel.TreeTableExpand };
|
this.gcMain = new TreeGridControlEx() { Expansion = SysModel.TreeTableExpand };
|
||||||
this.gcMain.Model = this.Model;
|
this.gcMain.Model = this.Model;
|
||||||
this.gcMain.Dock = DockStyle.Fill;
|
this.gcMain.Dock = DockStyle.Fill;
|
||||||
|
if (this._gridColumns.Rows.Count == 0 && !string.IsNullOrWhiteSpace(SysModel.TreeKeyFieldName) && !string.IsNullOrWhiteSpace(SysModel.TreeParentFieldName))
|
||||||
|
{
|
||||||
|
//节点编号
|
||||||
|
(this.gcMain as TreeGridControlEx).TreeListObj.KeyFieldName = SysModel.TreeKeyFieldName;
|
||||||
|
//父节点编号
|
||||||
|
(this.gcMain as TreeGridControlEx).TreeListObj.ParentFieldName = SysModel.TreeParentFieldName;
|
||||||
|
}
|
||||||
this.panelControl1.Controls.Add(this.gcMain);
|
this.panelControl1.Controls.Add(this.gcMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果配置了聚合模式则构建多表头覆盖当前表格
|
//如果配置了聚合模式则构建多表头覆盖当前表格
|
||||||
if (SysModel.IsCustomGroup == 1)
|
if (SysModel.IsCustomGroup == 1)
|
||||||
{
|
{
|
||||||
@@ -3315,10 +3340,10 @@ namespace Lskj.Control
|
|||||||
private void GetPrintOtherParam(string ModeCond)
|
private void GetPrintOtherParam(string ModeCond)
|
||||||
{
|
{
|
||||||
//取得打印完成后的参数
|
//取得打印完成后的参数
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(ModeCond) )
|
if (!string.IsNullOrEmpty(ModeCond))
|
||||||
{
|
{
|
||||||
|
|
||||||
DataRow item = AttachImpl.GetSystemModule(ModeCond);
|
DataRow item = AttachImpl.GetSystemModule(ModeCond);
|
||||||
string tableName = item["TableName"] + "";
|
string tableName = item["TableName"] + "";
|
||||||
string modetype = item["modType"] + "";
|
string modetype = item["modType"] + "";
|
||||||
@@ -3974,7 +3999,7 @@ namespace Lskj.Control
|
|||||||
string printType = printRowItem["printType"] + "";
|
string printType = printRowItem["printType"] + "";
|
||||||
string sourceType = printRowItem["sourceType"] + "";
|
string sourceType = printRowItem["sourceType"] + "";
|
||||||
string printPath = PubUtil.PrintFileAbsolutelyPath70;
|
string printPath = PubUtil.PrintFileAbsolutelyPath70;
|
||||||
string modid= printRowItem["modid"] + "";
|
string modid = printRowItem["modid"] + "";
|
||||||
if (!File.Exists(printPath))
|
if (!File.Exists(printPath))
|
||||||
{
|
{
|
||||||
MessageUtil.Show(ResourceKeys.NotFoundPrintFile);
|
MessageUtil.Show(ResourceKeys.NotFoundPrintFile);
|
||||||
@@ -4033,7 +4058,7 @@ namespace Lskj.Control
|
|||||||
tmpSqls.AddRange(tmpSql2.Split(';').ToList());
|
tmpSqls.AddRange(tmpSql2.Split(';').ToList());
|
||||||
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
||||||
{
|
{
|
||||||
_printSaveParams[5] = tmpSql+ tmpSql1+ tmpSql2;
|
_printSaveParams[5] = tmpSql + tmpSql1 + tmpSql2;
|
||||||
_printSaveParams[3] = dataRow[_printSaveParams[2]] + "";
|
_printSaveParams[3] = dataRow[_printSaveParams[2]] + "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4087,7 +4112,35 @@ namespace Lskj.Control
|
|||||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||||
protected void OnGridViewRightCallBack(object sender, EventArgs e)
|
protected void OnGridViewRightCallBack(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int oldRowHandle = gcMain.GridView.FocusedRowHandle;
|
||||||
|
if (!(gcMain is TreeGridControlEx) && oldRowHandle < 0) return;
|
||||||
|
DataTable dt = this.gcMain.GridView.GetGridViewFilteredAndSortedDataToDataTable();
|
||||||
|
if (gcMain is TreeGridControlEx) dt = (gcMain as TreeGridControlEx).GetGridViewDataSource();
|
||||||
|
if (dt == null || dt.Rows.Count == 0) return;
|
||||||
|
DataRow SelectTheLine = gcMain is TreeGridControlEx ? (gcMain as TreeGridControlEx).GetViewFocusedDataRow() : dt.Rows[oldRowHandle];
|
||||||
|
this.SearchObj.RememberRow = (this.SysModel.AccordingNameSelected == 0);
|
||||||
|
this.SearchObj.SearchLastGrid();
|
||||||
|
if (this.SysModel.AccordingNameSelected != 0)//根据主键刷新目标选中行
|
||||||
|
{
|
||||||
|
DataRow items = dt.Rows.Cast<DataRow>().FirstOrDefault(x => x[ParmaryKey].Equals(SelectTheLine[ParmaryKey]));
|
||||||
|
dt = this.gcMain.GridView.GetGridViewFilteredAndSortedDataToDataTable();
|
||||||
|
BindingSource bindingSource = new BindingSource();
|
||||||
|
bindingSource.DataSource = dt;
|
||||||
|
int numberOfRows = bindingSource.Find(ParmaryKey, SelectTheLine[ParmaryKey].ToString());
|
||||||
|
this.gcMain.GridView.ClearSelection();
|
||||||
|
this.gcMain.GridView.FocusedRowHandle = numberOfRows;
|
||||||
|
this.gcMain.GridView.SelectRow(numberOfRows);
|
||||||
|
}
|
||||||
|
if (this.RightGridCallBack != null) this.RightGridCallBack(sender, e);
|
||||||
|
if (DetailRightGridCallBack != null) this.DetailRightGridCallBack(sender, e);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||||
|
MessageUtil.Show(Message, ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>说明:双击修改界面</para>
|
/// <para>说明:双击修改界面</para>
|
||||||
@@ -4285,29 +4338,45 @@ namespace Lskj.Control
|
|||||||
TreeGridControlEx treeList = gcMain as TreeGridControlEx;
|
TreeGridControlEx treeList = gcMain as TreeGridControlEx;
|
||||||
if (this.GridControlObj != null && this.GridControlObj.AdapterObj != null)
|
if (this.GridControlObj != null && this.GridControlObj.AdapterObj != null)
|
||||||
{
|
{
|
||||||
int result = this.GridControlObj.AdapterObj.Update(treeList.TreeListObj.DataSource as DataTable);
|
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleDataChange, this.Model.ModuleCode, 0))
|
||||||
if (result > 0)
|
|
||||||
{
|
{
|
||||||
isExec = false;
|
goto IsApi;
|
||||||
MessageUtil.Show(ResourceKeys.SaveSuccess);
|
}
|
||||||
if (OnSaveGridCallBack != null)
|
if (this.SysModel.DefaultStoredProcedureSaves)
|
||||||
|
{
|
||||||
|
goto IsApi;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int result = this.GridControlObj.AdapterObj.Update(treeList.TreeListObj.DataSource as DataTable);
|
||||||
|
if (result > 0)
|
||||||
{
|
{
|
||||||
this.OnSaveGridCallBack(sender, e);
|
isExec = false;
|
||||||
|
MessageUtil.Show(ResourceKeys.SaveSuccess);
|
||||||
|
if (OnSaveGridCallBack != null)
|
||||||
|
{
|
||||||
|
this.OnSaveGridCallBack(sender, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isExec)
|
IsApi: if (isExec)
|
||||||
{
|
{
|
||||||
this.SaveTreeRecord();
|
this.SaveTreeRecord();
|
||||||
if (OnSaveGridCallBack != null)
|
if (OnSaveGridCallBack != null)
|
||||||
{
|
{
|
||||||
this.OnSaveGridCallBack(sender, e);
|
this.OnSaveGridCallBack(sender, e);
|
||||||
}
|
}
|
||||||
|
if (this.SysModel.ModifyClose && this.OnCloseCallback != null)
|
||||||
|
{
|
||||||
|
this.OnCloseCallback(null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -4729,6 +4798,19 @@ namespace Lskj.Control
|
|||||||
/// <param name="e">The e.</param>
|
/// <param name="e">The e.</param>
|
||||||
protected void OnReportPrintAfter(object sender, EventArgs e)
|
protected void OnReportPrintAfter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
||||||
|
{
|
||||||
|
//打印完成后添加数据库
|
||||||
|
int result = BaseModuleImpl.SavePrintRecord(_printSaveParams[0], _printSaveParams[1], _printSaveParams[2], _printSaveParams[3], _printSaveParams[4]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||||
|
MessageUtil.Show(Message, ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -4796,7 +4878,15 @@ namespace Lskj.Control
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
protected void OnTsmExportClick(object sender, EventArgs e)
|
protected void OnTsmExportClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.ExportGridRecord();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||||
|
MessageUtil.Show(Message, ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>说明:添加空行</para>
|
/// <para>说明:添加空行</para>
|
||||||
@@ -5342,7 +5432,7 @@ namespace Lskj.Control
|
|||||||
/// <param name="ColumnName"></param>
|
/// <param name="ColumnName"></param>
|
||||||
public void SetDisplayColumns(string text)
|
public void SetDisplayColumns(string text)
|
||||||
{
|
{
|
||||||
if (!this.SysModel.SearchEnable)
|
if (!this.SysModel.SearchEnable)
|
||||||
{
|
{
|
||||||
PromptBox.EditText = text;
|
PromptBox.EditText = text;
|
||||||
// 获取文档对象
|
// 获取文档对象
|
||||||
@@ -5418,7 +5508,8 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
this.scc_container.SplitterPosition = Convert.ToInt32(htight);
|
this.scc_container.SplitterPosition = Convert.ToInt32(htight);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
this.scc_container.SplitterPosition = 250;
|
this.scc_container.SplitterPosition = 250;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ namespace Lskj.Control
|
|||||||
//this.gcMain.OptionsFind.AlwaysVisible = true;
|
//this.gcMain.OptionsFind.AlwaysVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void TreeListObj_CustomDrawNodeIndicator(object sender, CustomDrawNodeIndicatorEventArgs e)
|
private void TreeListObj_CustomDrawNodeIndicator(object sender, CustomDrawNodeIndicatorEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1915,9 +1916,15 @@ namespace Lskj.Control
|
|||||||
/// <param name="selectRowHandler">if set to <c>true</c> [select row handler].</param>
|
/// <param name="selectRowHandler">if set to <c>true</c> [select row handler].</param>
|
||||||
public override void SetGridViewDataSource(DataTable table, bool selectRowHandler = true)
|
public override void SetGridViewDataSource(DataTable table, bool selectRowHandler = true)
|
||||||
{
|
{
|
||||||
|
if (this.ColumnList == null || this.ColumnList.Count == 0)
|
||||||
|
{
|
||||||
|
this.gcMain.Bands.Clear();
|
||||||
|
this.gcMain.Columns.Clear();
|
||||||
|
}
|
||||||
TreeListNode lastNode = this.TreeListObj.FocusedNode;
|
TreeListNode lastNode = this.TreeListObj.FocusedNode;
|
||||||
GetTreeExpanded();
|
GetTreeExpanded();
|
||||||
this.gcMain.DataSource = table;
|
this.gcMain.DataSource = table;
|
||||||
|
this.SetAutoColumns();
|
||||||
//根据记录展开对应节点
|
//根据记录展开对应节点
|
||||||
foreach (TreeListNode treeListNode in treeListNodes)
|
foreach (TreeListNode treeListNode in treeListNodes)
|
||||||
{
|
{
|
||||||
@@ -1932,16 +1939,20 @@ namespace Lskj.Control
|
|||||||
public override int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
|
public override int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
|
||||||
{
|
{
|
||||||
if (adapter == null) return 0;
|
if (adapter == null) return 0;
|
||||||
|
if (this.ColumnList == null || this.ColumnList.Count == 0)
|
||||||
|
{
|
||||||
|
this.gcMain.Bands.Clear();
|
||||||
|
this.gcMain.Columns.Clear();
|
||||||
|
}
|
||||||
TreeListNode lastNode = this.TreeListObj.FocusedNode;
|
TreeListNode lastNode = this.TreeListObj.FocusedNode;
|
||||||
this.AdapterObj = adapter;
|
this.AdapterObj = adapter;
|
||||||
DataSet dataSet = new DataSet();
|
DataSet dataSet = new DataSet();
|
||||||
adapter.Fill(dataSet, "SetGridViewDataSource");
|
adapter.Fill(dataSet, "SetGridViewDataSource");
|
||||||
|
|
||||||
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
|
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
|
||||||
|
|
||||||
GetTreeExpanded();
|
GetTreeExpanded();
|
||||||
this.gcMain.DataSource = dataSet.Tables[0];
|
this.gcMain.DataSource = dataSet.Tables[0];
|
||||||
|
this.SetAutoColumns();
|
||||||
//根据记录展开对应节点
|
//根据记录展开对应节点
|
||||||
foreach (TreeListNode treeListNode in treeListNodes)
|
foreach (TreeListNode treeListNode in treeListNodes)
|
||||||
{
|
{
|
||||||
@@ -1957,6 +1968,10 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
this.gcMain.ExpandToLevel(0);
|
this.gcMain.ExpandToLevel(0);
|
||||||
}
|
}
|
||||||
|
else if ((Expansion + "").Equals("3"))
|
||||||
|
{
|
||||||
|
this.gcMain.CollapseAll();
|
||||||
|
}
|
||||||
if (selectRowHandler)
|
if (selectRowHandler)
|
||||||
{
|
{
|
||||||
this.TreeListObj.FocusedNode = lastNode;
|
this.TreeListObj.FocusedNode = lastNode;
|
||||||
@@ -1966,6 +1981,175 @@ namespace Lskj.Control
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>说明:设置动态列</para>
|
||||||
|
/// <para>创建人:龚宇超</para>
|
||||||
|
/// <para>创建日期:2019-06-03 </para>
|
||||||
|
/// <para>修改人:</para>
|
||||||
|
/// <para>修改日期:</para>
|
||||||
|
/// <para>修改备注:</para>
|
||||||
|
/// <para>版本:1.0</para>
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void SetAutoColumns()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool isShowFooter = false;
|
||||||
|
if (this.ColumnList == null || this.ColumnList.Count == 0)
|
||||||
|
{
|
||||||
|
this.SuspendLayout();
|
||||||
|
this.ResumeLayout();
|
||||||
|
List<String> bandEmptyRows = new List<String>();
|
||||||
|
List<String> bandFields = new List<String>();
|
||||||
|
DataRow dr = MainImpl.GetSystemdllTab(this.Model.ModuleCode);
|
||||||
|
bool isEdit = false;//是否可操作
|
||||||
|
if (dr != null && !(this.Model is DynamicReportModel))
|
||||||
|
{
|
||||||
|
ModuleModel SysModel = new ModuleModel(dr);
|
||||||
|
isEdit = SysModel.CanEdit;
|
||||||
|
}
|
||||||
|
if (this is TreeBandedGridControlEx)
|
||||||
|
{
|
||||||
|
|
||||||
|
TreeListBand gridBandEmpty = new TreeListBand();
|
||||||
|
foreach (TreeListColumn item in gcMain.Columns)
|
||||||
|
{
|
||||||
|
//if (item.FieldName.StartsWith("|")) item.FieldName = item.FieldName.Replace("|","");
|
||||||
|
if (item.FieldName.Contains("|"))
|
||||||
|
{
|
||||||
|
int index = item.FieldName.LastIndexOf("|");
|
||||||
|
string bandField = item.FieldName.Substring(0, index);
|
||||||
|
if (!bandFields.Contains(bandField)) bandFields.Add(bandField);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bandEmptyRows.Add(item.FieldName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (string bandName in bandFields)
|
||||||
|
{
|
||||||
|
TreeListBand gridBand = new TreeListBand();
|
||||||
|
gridBand.Caption = bandName;
|
||||||
|
gridBand.AppearanceHeader.Options.UseFont = true;
|
||||||
|
gridBand.AppearanceHeader.Font = new Font("宋体", 9, FontStyle.Bold);
|
||||||
|
gridBand.AppearanceHeader.Options.UseTextOptions = true;
|
||||||
|
gridBand.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
|
||||||
|
gcMain.Bands.AddRange(new TreeListBand[] { gridBand });
|
||||||
|
//bandFields += "|" + item.BandFields;
|
||||||
|
}
|
||||||
|
if (bandEmptyRows != null && bandEmptyRows.Count() > 0)
|
||||||
|
{
|
||||||
|
// 空白列
|
||||||
|
gridBandEmpty.Caption = "";
|
||||||
|
gridBandEmpty.AppearanceHeader.Options.UseFont = true;
|
||||||
|
gridBandEmpty.AppearanceHeader.Font = new Font("宋体", 9, FontStyle.Bold);
|
||||||
|
gridBandEmpty.AppearanceHeader.Options.UseTextOptions = true;
|
||||||
|
gridBandEmpty.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
|
||||||
|
gcMain.Bands.Insert(0, gridBandEmpty);
|
||||||
|
}
|
||||||
|
gcMain.BeginUpdate();
|
||||||
|
// 创建列
|
||||||
|
for (int i = 0; i < gcMain.Columns.Count; i++)
|
||||||
|
{
|
||||||
|
TreeListColumn col = gcMain.Columns[i];
|
||||||
|
int vsNum = 0; bool isNum = false; string FieldName = col.FieldName; string bandTitle = string.Empty;
|
||||||
|
col.VisibleIndex = i;
|
||||||
|
if (col.FieldName.Contains("|"))
|
||||||
|
{
|
||||||
|
string[] colSplit = col.FieldName.Split('|');
|
||||||
|
if (colSplit.Length >= 2)
|
||||||
|
{
|
||||||
|
FieldName = colSplit[1];
|
||||||
|
bandTitle = colSplit[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (col.VisibleIndex == 0)
|
||||||
|
{
|
||||||
|
isShowFooter = true;
|
||||||
|
|
||||||
|
gcMain.OptionsView.ShowSummaryFooter = true;
|
||||||
|
col.AllNodesSummary = true;
|
||||||
|
col.SummaryFooter = SummaryItemType.Count;
|
||||||
|
col.SummaryFooterStrFormat = "合计:{0:#,###}行";
|
||||||
|
|
||||||
|
}
|
||||||
|
if (FieldName.Contains("_"))
|
||||||
|
{
|
||||||
|
string[] colparame = FieldName.Split('_');
|
||||||
|
if (colparame.Length >= 2)
|
||||||
|
{
|
||||||
|
FieldName = colparame[0];
|
||||||
|
isNum = Int32.TryParse(colparame[1], out vsNum);
|
||||||
|
if (vsNum == 0)
|
||||||
|
col.Visible = false;
|
||||||
|
if (colparame.Length > 2)
|
||||||
|
{
|
||||||
|
bool visible = "1".Equals(colparame[2]);
|
||||||
|
// 设置底部合计
|
||||||
|
if (visible)
|
||||||
|
{
|
||||||
|
isShowFooter = true;
|
||||||
|
|
||||||
|
gcMain.OptionsView.ShowSummaryFooter = true;
|
||||||
|
col.AllNodesSummary = true;
|
||||||
|
col.SummaryFooter = DevExpress.XtraTreeList.SummaryItemType.Sum;
|
||||||
|
col.SummaryFooterStrFormat = "{0:}";
|
||||||
|
}
|
||||||
|
if (colparame.Length > 3)
|
||||||
|
{
|
||||||
|
string dataFormat = colparame[3];
|
||||||
|
if (!string.IsNullOrWhiteSpace(dataFormat))
|
||||||
|
{
|
||||||
|
col.Format.FormatType = FormatType.Custom;
|
||||||
|
col.Format.FormatString = dataFormat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(bandTitle))
|
||||||
|
{
|
||||||
|
// 绑定了多表头显示
|
||||||
|
TreeListBand gridBand = gcMain.Bands.Cast<TreeListBand>().FirstOrDefault(x => x.Caption == bandTitle);
|
||||||
|
if (gridBand != null)
|
||||||
|
{
|
||||||
|
gridBand.Columns.Add(col);//
|
||||||
|
TreeListBandColumnCollection gcc = gridBand.Columns;
|
||||||
|
}
|
||||||
|
gcMain.Columns.Add(col);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 未绑定多表头则直接显示
|
||||||
|
if (bandEmptyRows != null && bandEmptyRows.Contains(col.FieldName))
|
||||||
|
{
|
||||||
|
gridBandEmpty.Columns.Add(col);
|
||||||
|
}
|
||||||
|
gcMain.Columns.Add(col);
|
||||||
|
}
|
||||||
|
if (isNum) col.Width = vsNum;
|
||||||
|
|
||||||
|
col.OptionsColumn.AllowEdit = isEdit;
|
||||||
|
//col.FieldName = FieldName;
|
||||||
|
//col.Name = FieldName;
|
||||||
|
col.Caption = FieldName;
|
||||||
|
col.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
|
||||||
|
col.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
|
||||||
|
col.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
|
||||||
|
//gcMain.OptionsView.ShowFooter = isShowFooter;
|
||||||
|
}
|
||||||
|
gcMain.EndUpdate();
|
||||||
|
//this.bandedGridView.DataSource = bandedGridView.DataSource as DataTable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 记录展开的节点
|
/// 记录展开的节点
|
||||||
@@ -2523,8 +2707,16 @@ namespace Lskj.Control
|
|||||||
/// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs"/> instance containing the event data.</param>
|
/// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs"/> instance containing the event data.</param>
|
||||||
private void OnCustomDrawNodeCell(object sender, CustomDrawNodeCellEventArgs e)
|
private void OnCustomDrawNodeCell(object sender, CustomDrawNodeCellEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Node == this.gcMain.FocusedNode)
|
try
|
||||||
e.Appearance.BackColor = ColorTranslator.FromHtml("#9feb6a");
|
{
|
||||||
|
if (e.Node == this.gcMain.FocusedNode)
|
||||||
|
e.Appearance.BackColor = ColorTranslator.FromHtml("#9feb6a");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 粘贴功能
|
/// 粘贴功能
|
||||||
|
|||||||
@@ -2229,16 +2229,16 @@ namespace Lskj.Control
|
|||||||
public override int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
|
public override int SetGridViewDataSource(SqlDataAdapter adapter, bool selectRowHandler = true)
|
||||||
{
|
{
|
||||||
if (adapter == null) return 0;
|
if (adapter == null) return 0;
|
||||||
|
if (this.ColumnList == null || this.ColumnList.Count == 0)
|
||||||
|
{
|
||||||
|
this.gcMain.Columns.Clear();
|
||||||
|
}
|
||||||
lastNodeIndex = 0;
|
lastNodeIndex = 0;
|
||||||
if (selectRowHandler) lastNodeIndex = this.TreeListObj.GetVisibleIndexByNode(this.TreeListObj.FocusedNode);
|
if (selectRowHandler) lastNodeIndex = this.TreeListObj.GetVisibleIndexByNode(this.TreeListObj.FocusedNode);
|
||||||
this.AdapterObj = adapter;
|
this.AdapterObj = adapter;
|
||||||
DataSet dataSet = new DataSet();
|
DataSet dataSet = new DataSet();
|
||||||
adapter.Fill(dataSet, "SetGridViewDataSource");
|
adapter.Fill(dataSet, "SetGridViewDataSource");
|
||||||
|
|
||||||
if (this.ColumnList == null || this.ColumnList.Count == 0)
|
|
||||||
{
|
|
||||||
this.gcMain.Columns.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
|
SqlCommandBuilder cb = new SqlCommandBuilder(this.AdapterObj);
|
||||||
|
|
||||||
@@ -2971,6 +2971,9 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
if (e.Node == this.gcMain.FocusedNode)
|
if (e.Node == this.gcMain.FocusedNode)
|
||||||
e.Appearance.BackColor = ColorTranslator.FromHtml("#9feb6a");
|
e.Appearance.BackColor = ColorTranslator.FromHtml("#9feb6a");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 粘贴功能
|
/// 粘贴功能
|
||||||
|
|||||||
Reference in New Issue
Block a user