基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,626 @@
|
||||
using DevExpress.Utils;
|
||||
using DevExpress.XtraEditors;
|
||||
using DevExpress.XtraGrid.Columns;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using DevExpress.XtraTab;
|
||||
using Lskj.Business;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Core;
|
||||
using Lskj.Data;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.ProductBarCode2
|
||||
{
|
||||
public partial class FrmMain : BaseForm
|
||||
{
|
||||
/// <summary>
|
||||
/// 左侧树数据
|
||||
/// </summary>
|
||||
public DataRow LeftRowObj;
|
||||
/// <summary>
|
||||
/// 主键名
|
||||
/// </summary>
|
||||
private string _primaryLeftKey;
|
||||
/// <summary>
|
||||
/// 表格对象
|
||||
/// </summary>
|
||||
/// <value>The grid view object.</value>
|
||||
public GridControlEx GridControlObj { get { return (xtc_container.SelectedTabPage.Tag as FrmMainModule).GridControlObj; } }
|
||||
/// <summary>
|
||||
/// 表格对象
|
||||
/// </summary>
|
||||
/// <value>The grid view object.</value>
|
||||
public GridControlEx gcBottom { get { return (xtc_container.SelectedTabPage.Tag as FrmMainModule).GcBottom; } }
|
||||
|
||||
/// <summary>
|
||||
/// 必须录入字段
|
||||
/// </summary>
|
||||
private DataRow[] _nullFields = new DataRow[] { };
|
||||
/// <summary>
|
||||
/// 基础模型
|
||||
/// </summary>
|
||||
public ModuleModel MoudleObj { get { return (xtc_container.SelectedTabPage.Tag as FrmMainModule).MoudleObj; } }
|
||||
/// <summary>
|
||||
/// 底部基础模型
|
||||
/// </summary>
|
||||
public ModuleModel MoudleBottomObj { get { return (xtc_container.SelectedTabPage.Tag as FrmMainModule).MoudleBottomObj; } }
|
||||
/// <summary>
|
||||
/// 表格明细集合
|
||||
/// </summary>
|
||||
public List<GridDetailModel> GridDetailModelObjs;
|
||||
/// <summary>
|
||||
/// 控件源数据
|
||||
/// </summary>
|
||||
private DataTable _dtFields;
|
||||
/// <summary>
|
||||
/// 单据信息
|
||||
/// </summary>
|
||||
private DataRow _drBillInfo{ get { return (xtc_container.SelectedTabPage.Tag as FrmMainModule)._drBillInfo; } }
|
||||
/// <summary>
|
||||
/// 单据模型
|
||||
/// </summary>
|
||||
public BillModel BillModelObj;
|
||||
public DynamicBarCodeModel SysModel;
|
||||
public DynamicModuleModel dmoudelModel;
|
||||
/// <summary>
|
||||
/// 单表模型
|
||||
/// </summary>
|
||||
public DynamicModuleModel moudelModel;
|
||||
/// <summary>
|
||||
/// 控件对象
|
||||
/// </summary>
|
||||
public MyControl ControlObj { get { return (xtc_container.SelectedTabPage.Tag as FrmMainModule).ControlObj; } }
|
||||
/// <summary>
|
||||
/// 控件高度
|
||||
/// </summary>
|
||||
/// <value>The height of the control.</value>
|
||||
public int ControlHeight { get; private set; }
|
||||
/// <summary>
|
||||
/// 控件数据源
|
||||
/// </summary>
|
||||
private DataTable _controlTable;
|
||||
/// <summary>
|
||||
/// 单据明细列
|
||||
/// </summary>
|
||||
private DataTable _detailColumns;
|
||||
/// <summary>
|
||||
/// 单据关联字段
|
||||
/// </summary>
|
||||
public string BillRelation;
|
||||
|
||||
/// <summary>
|
||||
/// 单据明细id
|
||||
/// </summary>
|
||||
public int MxId;
|
||||
/// <summary>
|
||||
/// 设置红蓝单据
|
||||
/// </summary>
|
||||
public string BillStatus;
|
||||
/// <summary>
|
||||
/// 单据名称
|
||||
/// </summary>
|
||||
public string typename;
|
||||
/// <summary>
|
||||
/// 左侧表格查询条件
|
||||
/// </summary>
|
||||
private MyControl _leftGridSearchObj;
|
||||
/// <summary>
|
||||
/// 传入的参数
|
||||
/// </summary>
|
||||
public string[] IncomingParameters;
|
||||
/// <summary>
|
||||
/// 右侧页签存的模块号和对应的顺序
|
||||
/// </summary>
|
||||
public Dictionary<string, int> TabInformation = new Dictionary<string, int>();
|
||||
|
||||
|
||||
public FrmMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
SetInterfaceState();//设置界面状态
|
||||
SetLeftGridView();
|
||||
InitializeSetting();
|
||||
SelectSettingsRows();//加载左侧数据源和设置左侧选中行
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
//MessageUtil.Show(ex);
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message,ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
|
||||
WaitForm.HideForm();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:判断是否终审,加载界面是否可以编辑</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-10-25 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
protected void SetInterfaceState()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.BillModelObj = new BillAuditModel(BillImpl.GetBillInfo(this.SysModel.ModuleCode));
|
||||
this.BillModelObj.MasterPreFix = BaseImpl.GetColumnPrefix(this.BillModelObj.MasterTable);
|
||||
this.BillModelObj.DetailPreFix = BaseImpl.GetColumnPrefix(this.BillModelObj.DetailTable);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:设置左侧表格数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-10-25 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
protected void SetLeftGridView()
|
||||
{
|
||||
this.LeftRowObj = BaseModuleImpl.GetBaseLeftTreeField(this.SysModel.MoudelId);
|
||||
|
||||
if (this.LeftRowObj != null)
|
||||
{
|
||||
DataTable dtTable = BaseModuleImpl.GetBaseLeftGridField(this.SysModel.MoudelId);
|
||||
DataTable dtColorTable = BaseModuleImpl.GetBaseGridRowColors(this.LeftRowObj["fieldKey"] + "");
|
||||
BillRelation = "{" + this.LeftRowObj["fieldsqlname"] + "}";
|
||||
this.gcLeft.GridView.FocusedRowObjectChanged += OnGridViewRowClick;
|
||||
//this.gcLeft.GridView.RowClick += new DevExpress.XtraGrid.Views.Grid.RowClickEventHandler(OnGridViewRowClick);
|
||||
this.gcLeft.SetGridRowColors(dtColorTable);
|
||||
this.gcLeft.SetReadOnlyColumns(dtTable, GridCustomColumnStruct.BaseLeftGridView + this.SysModel.MoudelId);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
typename = SqlHelper.ExecuteScalar(string.Format("select replace(typename,'单','') as typename from p_systembilltype where typecode='{0}'", this.SysModel.ModuleCode)) + "";
|
||||
}
|
||||
#region 初始化属性
|
||||
/// <summary>
|
||||
/// <para>说明:初始化属性设置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-02-27</para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private void InitializeSetting()
|
||||
{
|
||||
XtraTabPage page = new XtraTabPage();
|
||||
page.Text = IncomingParameters[9];
|
||||
|
||||
FrmMainModule frmMainModule = new FrmMainModule();
|
||||
frmMainModule.BillModelObj = BillModelObj;
|
||||
frmMainModule.SysModel = this.SysModel;
|
||||
frmMainModule.gridLeft = this.gcLeft;
|
||||
frmMainModule.Dock = DockStyle.Fill;
|
||||
if (this.LeftRowObj != null)
|
||||
{
|
||||
frmMainModule.ModuleGridEx.ParentKeyField = this.LeftRowObj["fieldsqlid"] + "";
|
||||
frmMainModule.ModuleGridEx.ParentUnionField = this.LeftRowObj["fieldname"] + "";
|
||||
frmMainModule.GcBottom.GridView.DoubleClick += new EventHandler(OnGridViewDoubleClick);
|
||||
}
|
||||
frmMainModule.initial();
|
||||
|
||||
page.Tag = frmMainModule;
|
||||
page.Controls.Add(frmMainModule);
|
||||
this.xtc_container.TabPages.Add(page);
|
||||
|
||||
this.TabInformation.Add(page.Text, this.xtc_container.TabPages.Count-1);
|
||||
this.xtc_container.ShowTabHeader = DefaultBoolean.False;
|
||||
this.xtc_container.SelectedPageChanged -= Xtc_container_SelectedPageChanged;
|
||||
this.xtc_container.SelectedPageChanged += Xtc_container_SelectedPageChanged;
|
||||
}
|
||||
|
||||
//页签切换时刷新
|
||||
private void Xtc_container_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
|
||||
{
|
||||
if (xtc_container.SelectedTabPage.Tag is FrmMainModule)
|
||||
{
|
||||
FrmMainModule frmMainModule = xtc_container.SelectedTabPage.Tag as FrmMainModule;
|
||||
this.gcLeft.Model = frmMainModule.SysModel;
|
||||
this.gcLeft.ParentControl = frmMainModule.ControlObj;
|
||||
|
||||
DataRow rowArray = this.gcLeft.GetViewFocusedDataRow();
|
||||
if (!string.IsNullOrWhiteSpace(SysModel.DefaultEnabled) && rowArray.Table.Columns.Contains(SysModel.DefaultEnabled))
|
||||
{
|
||||
string varlue = rowArray[SysModel.DefaultEnabled] + "";
|
||||
if (varlue.Equals("0"))
|
||||
{
|
||||
frmMainModule.SetPermissions(true);
|
||||
}
|
||||
else if (varlue.Equals("1"))
|
||||
{
|
||||
frmMainModule.SetPermissions(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 创建条码控件
|
||||
/// </summary>
|
||||
private void InitControls()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region 修改表头
|
||||
/// <summary>
|
||||
/// <para>说明:获取配置条件头属性设置</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2021-09-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
private void SetCodeHeader(DataRow newRow)
|
||||
{
|
||||
|
||||
StringBuilder updateBuilder = new StringBuilder();
|
||||
foreach (ControlModel model in this.ControlObj.ControlModels)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(model.DefaultValue))
|
||||
{
|
||||
bool isStart = model.DefaultValue.StartsWith("{");
|
||||
string fieldName = model.DefaultValue.Replace("{", "").Replace("}", "");
|
||||
if (newRow!=null&&newRow.Table.Columns.Contains(fieldName))
|
||||
{
|
||||
this.ControlObj.SetControlValue(model.FieldName, newRow[fieldName] + "");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ControlObj.SetControlValue(model.FieldName, isStart ? string.Empty : model.DefaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// <para>说明:条码点击加载详细条码</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-01-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="RowCellClickEventArgs"/> instance containing the event data.</param>
|
||||
private void OnGridViewRowClick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataRow rowArray = this.gcLeft.GetViewFocusedDataRow();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(SysModel.ModuleNumber) &&rowArray.Table.Columns.Contains(SysModel.ModuleNumber))
|
||||
{
|
||||
if (!IncomingParameters[9].Equals(rowArray[SysModel.ModuleNumber] + ""))
|
||||
{
|
||||
string key=IncomingParameters[9] = rowArray[SysModel.ModuleNumber] + "";
|
||||
int value = 0;
|
||||
if (TabInformation.TryGetValue(key, out value))
|
||||
{
|
||||
//页签中已经存在,直接切换页签
|
||||
this.xtc_container.SelectedTabPageIndex = value;
|
||||
}
|
||||
else {
|
||||
//添加新页签
|
||||
SysModel = new DynamicBarCodeModel(IncomingParameters);
|
||||
InitializeSetting();
|
||||
if (this.xtc_container.SelectedTabPageIndex == this.xtc_container.TabPages.Count - 1) Xtc_container_SelectedPageChanged(null,null);
|
||||
this.xtc_container.SelectedTabPageIndex = this.xtc_container.TabPages.Count - 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
SetCodeHeader(rowArray);
|
||||
string detailSql = ReplaceHelper.ReplaceRowParam(rowArray, this.MoudleObj.MenuSql);
|
||||
string BatchBarCodeViewSql = ReplaceHelper.ReplaceRowParam(rowArray, this.MoudleBottomObj.MenuSql);
|
||||
BatchBarCodeViewSql = ReplaceHelper.ReplaceRowParam(_drBillInfo, BatchBarCodeViewSql);
|
||||
this.GridControlObj.LastSearchSql = detailSql;
|
||||
this.GridControlObj.SetGridViewDataSource(MainImpl.GetAdapterResult(this.GridControlObj.LastSearchSql));
|
||||
this.gcBottom.LastSearchSql = BatchBarCodeViewSql;
|
||||
this.gcBottom.SetGridViewDataSource(MainImpl.GetAdapterResult(this.gcBottom.LastSearchSql));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message,ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:删除主程序后刷新所有界面</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-01-30 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
protected void OnDelCallBackEven(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.GridControlObj.SetGridViewDataSource(MainImpl.GetAdapterResult(this.GridControlObj.LastSearchSql));
|
||||
this.gcBottom.SetGridViewDataSource(MainImpl.GetAdapterResult(this.gcBottom.LastSearchSql));
|
||||
MessageUtil.Show("刷新成功!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message,ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:增加条码后,刷新规则按照上一次查询条件刷新</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-01-30 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
protected void OnGridAddCallBack(object sender, EventArgs e)
|
||||
{
|
||||
//if (this.addControl.addbtnSql == null) return;
|
||||
//int refreshTypes = SqlHelper.ExecuteNonQuery(this.addControl.addbtnSql);
|
||||
//if (refreshTypes == 1)
|
||||
//{
|
||||
// this.gcMain.SetGridViewDataSource(MainImpl.GetAdapterResult(this.gcMain.LastSearchSql));
|
||||
// this.gcBottom.SetGridViewDataSource(MainImpl.GetAdapterResult(this.gcBottom.LastSearchSql));
|
||||
// MessageUtil.Show("成功!");
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:条码点击需要生产的条码</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-01-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="RowCellClickEventArgs"/> instance containing the event data.</param>
|
||||
private void OnGridViewDoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
int successQuantity = 0;//执行成功条数
|
||||
int AllQuantity = 0;//全部条数
|
||||
string mag = string.Empty;
|
||||
try
|
||||
{
|
||||
string msgs = string.Empty;
|
||||
//DataRow dr = this.gcBottom.GetViewFocusedDataRow();
|
||||
DataRow[] dataRows = this.gcBottom.GetViewFocusedDataRows();
|
||||
AllQuantity = dataRows.Length;
|
||||
if (this.SysModel.Required.Equals("1") && dataRows.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (DataRow dr in dataRows)
|
||||
{
|
||||
|
||||
DataRow rowArray = this.gcLeft.GetViewFocusedDataRow();
|
||||
string sql = this.ControlObj.ReplaceControlValue(this.SysModel.AddbtnSql);
|
||||
sql = ReplaceHelper.ReplaceRowParam(rowArray, sql);
|
||||
sql = ReplaceHelper.ReplaceRowParam(dr, sql);
|
||||
|
||||
string result = SqlHelper.ExecuteScalar(sql) + "";
|
||||
if (result == "1")
|
||||
{
|
||||
successQuantity++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mag += result + "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (successQuantity>0)
|
||||
{
|
||||
this.GridControlObj.SetGridViewDataSource(MainImpl.GetAdapterResult(this.GridControlObj.LastSearchSql));
|
||||
this.gcBottom.SetGridViewDataSource(MainImpl.GetAdapterResult(this.gcBottom.LastSearchSql));
|
||||
if(AllQuantity== successQuantity&& !this.SysModel.CancelPrompt) MessageUtil.Show("成功!");
|
||||
}
|
||||
if (AllQuantity > successQuantity)
|
||||
{
|
||||
MessageUtil.Show(mag);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 界面关闭事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataRow rowArray = this.gcLeft.GetViewFocusedDataRow();
|
||||
string sql = ReplaceHelper.ReplaceRowParam(rowArray, this.SysModel.ClosebtnSql);
|
||||
|
||||
string result = SqlHelper.ExecuteScalar(sql) + "";
|
||||
if (result == "1")
|
||||
{
|
||||
e.Cancel = false;//取消关闭事件
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DialogResult = MessageUtil.Show(string.Format(result), MessageBoxButtons.YesNo);
|
||||
if (this.DialogResult == DialogResult.No)
|
||||
{
|
||||
e.Cancel = true;//取消关闭事件
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
this.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///左侧表格选中设置行
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SelectSettingsRows()
|
||||
{
|
||||
try
|
||||
{
|
||||
//设置左侧数据源
|
||||
string detailSql = ReplaceHelper.ReplaceParamToValue(this.BillModelObj.DetailSql + " " + SysModel.LeftCondition, this.SysModel.BillDocumentId);
|
||||
//设置左侧条件和加载左侧表数据源
|
||||
if (this.LeftRowObj != null)
|
||||
{
|
||||
DataTable table = BaseModuleImpl.GetCustomQueryFields(this.LeftRowObj["fieldKey"] + "");
|
||||
string searchSql = detailSql + " ";
|
||||
if (table != null && table.Rows.Count > 0)
|
||||
{
|
||||
// 自定义查询条件
|
||||
this._leftGridSearchObj = new MyControl(searchSql, this.gcLeft);
|
||||
this.pl_left_top.Height = this._leftGridSearchObj.InitSearchControl(table, this.pl_left_top);
|
||||
this._leftGridSearchObj.OnDataSourceBindCallBack += new EventHandler(OnLeftControlObjDataSourceBindCallBack);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pl_left_top.Visible = false;
|
||||
this.gcLeft.SetGridViewDataSource(BaseImpl.GetDataTableResult(detailSql));
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.gcLeft.SetGridViewDataSource(BaseImpl.GetDataTableResult(detailSql));
|
||||
|
||||
}
|
||||
//设置选中行
|
||||
if (!string.IsNullOrWhiteSpace(this.SysModel.SelectionCriteria))
|
||||
{
|
||||
DataTable dt = this.gcLeft.gridControl.DataSource as DataTable;
|
||||
DataRow[] dataRows = dt.Select(this.SysModel.SelectionCriteria);
|
||||
if (dt.Rows.Count > 0 && dataRows.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
if (dt.Rows[i] == dataRows[0])
|
||||
{
|
||||
this.gcLeft.GridView.SelectRowHandler(i);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show("左侧行选择错误", ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:数据绑定完成后加载数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期: </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
protected void OnLeftControlObjDataSourceBindCallBack(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this._leftGridSearchObj.SearchGrid();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user