基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,919 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Lskj.Model;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Util;
|
||||
using Lskj.Data;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control;
|
||||
using Lskj.Business;
|
||||
using DevExpress.XtraGrid.Columns;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using DevExpress.XtraGrid.Views.Base;
|
||||
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
|
||||
using DevExpress.XtraEditors;
|
||||
using DevExpress.XtraTab;
|
||||
|
||||
namespace Lskj.PubModelAdd2
|
||||
{
|
||||
public partial class BaseModelAdd : UserControl
|
||||
{
|
||||
public BaseModelAdd()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
#region 私有变量
|
||||
/// <summary>
|
||||
/// 模块初始化完成
|
||||
/// </summary>
|
||||
private bool _isInitFinish;
|
||||
/// <summary>
|
||||
/// 表格列
|
||||
/// </summary>
|
||||
private DataTable _gridColumns = new DataTable();
|
||||
/// <summary>
|
||||
/// 主键名
|
||||
/// </summary>
|
||||
private string _primaryLeftKey;
|
||||
/// <summary>
|
||||
/// 左侧表格查询条件
|
||||
/// </summary>
|
||||
private MyControl _leftGridSearchObj;
|
||||
#endregion
|
||||
#region 公共变量
|
||||
/// <summary>
|
||||
/// 左侧树数据
|
||||
/// </summary>
|
||||
public DataRow LeftRowObj;
|
||||
/// <summary>
|
||||
/// 基础添加模块的入口参数
|
||||
/// </summary>
|
||||
public DynamicPubModelAdd Model;
|
||||
/// <summary>
|
||||
/// 基础添加模块的入口参数
|
||||
/// </summary>
|
||||
public DynamicPubModelAdd BandModel;
|
||||
/// <summary>
|
||||
/// 左侧基础模型
|
||||
/// </summary>
|
||||
public ModuleGridEx MoudleBottomObj { get; set; }
|
||||
public GridDetailModel BottomDetailModel;
|
||||
/// <summary>
|
||||
///左上方查询条件控件
|
||||
/// </summary>
|
||||
public MyControl SearchLeftObj;
|
||||
/// <summary>
|
||||
/// 顶部表格控件
|
||||
/// </summary>
|
||||
public ModuleGridEx ModuleGridObj;
|
||||
/// <summary>
|
||||
/// 系统模块实体对象
|
||||
/// </summary>
|
||||
/// <value>The system model.</value>
|
||||
public ModuleModel SysModel { get; private set; }
|
||||
/// <summary>
|
||||
/// 底部多标签表格数据
|
||||
/// </summary>
|
||||
public List<GridDetailModel> GridDetailList;
|
||||
/// <summary>
|
||||
/// 系统模块下部分实体对象
|
||||
/// </summary>
|
||||
/// <value>The system model.</value>
|
||||
public ModuleModel BottomModel { get; set; }
|
||||
/// <summary>
|
||||
/// 左侧条件
|
||||
/// </summary>
|
||||
public string LeftCond;
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// <para>说明:窗口加载</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2019-06-28 </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>
|
||||
public void OnLoad(DynamicPubModelAdd Model)
|
||||
{
|
||||
WaitForm.ShowForm();
|
||||
try
|
||||
{
|
||||
this._isInitFinish = false;
|
||||
if (Model.isBandGrid)
|
||||
{
|
||||
this.mg_control.Visible = false;
|
||||
this.mg_bandcontrol.Visible = true;
|
||||
this.ModuleGridObj = this.mg_bandcontrol;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mg_control.Visible = true;
|
||||
this.mg_bandcontrol.Visible = false;
|
||||
this.ModuleGridObj = this.mg_control;
|
||||
}
|
||||
this.Model = Model;
|
||||
this.BandModel = Model;
|
||||
DataRow modelRow = MainImpl.GetSystemdllTab(this.Model.ModuleCode);
|
||||
if (modelRow == null)
|
||||
{
|
||||
MessageUtil.Show("模块编号[" + this.Model.ModuleCode + "],配置错误!\r\n该模块信息未找到!");
|
||||
return;
|
||||
}
|
||||
this.SysModel = new ModuleModel(modelRow);
|
||||
this.SetLeftGridView();
|
||||
InitializeGrid();
|
||||
//初始化单表GridView
|
||||
this.mg_control._leftGridSearchObj = _leftGridSearchObj;
|
||||
this.mg_control.InitializeControl(SysModel, Model);
|
||||
this.mg_control.LeftGridEx = gridLeft;
|
||||
this.mg_control.AfterDeleteGridCallBack += mg_control_AfterDeleteGridCallBack;
|
||||
this.mg_control.RightGridCallBack += OnGridAfterRightCallBack;
|
||||
this.BandModel.GridEnumObj = GridEnum.BandedGridView;
|
||||
//初始化多表头GridView
|
||||
this.mg_bandcontrol._leftGridSearchObj = _leftGridSearchObj;
|
||||
this.mg_bandcontrol.LeftGridEx = gridLeft;
|
||||
this.mg_bandcontrol.InitializeControl(SysModel, BandModel);
|
||||
this.ModuleGridObj.SearchObj.OnDataSourceBindCallBack += new EventHandler(OnDataSourceBindCallBack);
|
||||
this.ModuleGridObj.VisibleSearchPanel = false;
|
||||
InitSpliterPosition();
|
||||
this.sccMain_container.SplitterPositionChanged += new EventHandler(OnSccMain_container_LocationChanged);
|
||||
this.sccRight_container.SplitterPositionChanged += new EventHandler(OnSccRight_container_LocationChanged);
|
||||
//this.pl_left_main.Parent = pl_right;
|
||||
//this.sccRight_container.Parent = pl_left;
|
||||
if (this.SysModel.MenuType == 5)
|
||||
{
|
||||
this.pl_left_main.Parent = pl_right;
|
||||
this.sccRight_container.Parent = pl_left;
|
||||
}
|
||||
|
||||
switch (this.SysModel.MenuType)
|
||||
{
|
||||
case 5: // 左侧为表格
|
||||
this.pl_left_main.Parent = pl_right;
|
||||
this.sccRight_container.Parent = pl_left;
|
||||
break;
|
||||
case 2: // 左侧为表格
|
||||
this.pl_left_main.Parent = pl_left;
|
||||
this.sccRight_container.Parent = pl_right;
|
||||
break;
|
||||
case 3: // 左侧为空
|
||||
default:
|
||||
this.sccMain_container.PanelVisibility = SplitPanelVisibility.Panel2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModule);
|
||||
//MessageUtil.Show(ex.Message + "\r\n" + ex.StackTrace);
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this._isInitFinish = true;
|
||||
|
||||
}
|
||||
|
||||
WaitForm.HideForm();
|
||||
}
|
||||
#region 方法
|
||||
#region 数据源绑定完成后执行
|
||||
/// <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>
|
||||
void OnDataSourceBindCallBack(object sender, EventArgs e)
|
||||
{
|
||||
//string sqlValue = ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql);
|
||||
//this.ModuleGridObj.GridControlObj.LastSearchSql = this.ModuleGridObj.SearchObj.SetSearchSqlValue(sqlValue, true, false);
|
||||
//this.ModuleGridObj.SearchObj.SearchLastGrid();
|
||||
}
|
||||
#endregion
|
||||
#region 初始化配置表格表
|
||||
/// <summary>
|
||||
/// <para>说明:判断多标签里是否有明细表</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2019-12-19 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>List<GridDetailModel>.</returns>
|
||||
private List<GridDetailModel> GetDetails(string ModuleCode)
|
||||
{
|
||||
List<GridDetailModel> details = new List<GridDetailModel>();
|
||||
|
||||
DataTable table = BaseModuleImpl.GetBaseDetailPages(ModuleCode);
|
||||
foreach (DataRow item in table.Rows)
|
||||
{
|
||||
if (int.Parse(item["orderId"] + "") <= -1 && int.Parse(item["orderId"] + "") >= -9)
|
||||
{
|
||||
DataTable gridColumns = ReportImpl.GetReportDetailColumns(ModuleCode, item["id"] + "");
|
||||
details.Add(new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView));
|
||||
}
|
||||
}
|
||||
|
||||
return details;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:加载下部分表格</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-09-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private void InitializeGrid()
|
||||
{
|
||||
this.GridDetailList = GetDetails(this.Model.ModuleCode);// 底部多标签表格数据
|
||||
//DataTable moduleDetailTable = BaseModuleImpl.GetBaseDetailPages(this.Model.ModuleCode);//通过明细获取动态表格
|
||||
//DataRow LeftItem = moduleDetailTable.Rows.Cast<DataRow>().FirstOrDefault(x => int.Parse(x["orderId"] + "") <= -1 && int.Parse(x["orderId"] + "") >= -9);
|
||||
if (GridDetailList.Count > 0)
|
||||
{
|
||||
this.mg_Bottom.Visible = false;
|
||||
Model.IsDetailSearch = true;
|
||||
this.TabControl.Model = this.Model;
|
||||
this.TabControl.InitTabPages(this.GridDetailList);
|
||||
int i = 0;
|
||||
this.TabControl.TabControlObj.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.OnSelectedPageChanged);
|
||||
foreach (XtraTabPage page in this.TabControl.TabControlObj.TabPages)
|
||||
{
|
||||
Object moduleObject = page.Controls.Cast<Object>().FirstOrDefault();
|
||||
ModuleGridEx moduleGridEx = null;
|
||||
if (moduleObject is ModuleGridEx)
|
||||
{
|
||||
moduleGridEx = moduleObject as ModuleGridEx;
|
||||
//moduleGridEx.VisibleMrpSearchPanel = false;
|
||||
//moduleGridEx.VisibleOperPanel = true;
|
||||
//moduleGridEx.VisibleSearchPanel = true;
|
||||
GridDetailModel DetailModel = moduleGridEx.GridControlObj.Tag as GridDetailModel;
|
||||
ModuleModel BottomModel = new ModuleModel(MainImpl.GetSystemdllTab(DetailModel.UnionModule));
|
||||
//moduleGridEx.GridControlObj.GridView.DoubleClick += new EventHandler(OnBottomDoubleClick);
|
||||
moduleGridEx.SearchObj.OnSourceRefrshCallBack += OnRefreshBillSource;
|
||||
if (i == 0)
|
||||
{
|
||||
this.BottomModel = BottomModel;
|
||||
this.MoudleBottomObj = moduleGridEx;
|
||||
this.BottomDetailModel = DetailModel;
|
||||
if (this.SysModel.DoubleClickMode)
|
||||
{
|
||||
moduleGridEx.GridControlObj.GridView.DoubleClick += new EventHandler(OnBottomDoubleClick);
|
||||
}
|
||||
else {
|
||||
GridDragGrid dragMainGrid = new GridDragGrid(moduleGridEx.GridControlObj.GridView, this.gridLeft.GridView);
|
||||
dragMainGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragMainGridCompleted);
|
||||
}
|
||||
|
||||
}
|
||||
if (BottomModel.GridObjIsCheck == 1)//加载复选框
|
||||
{
|
||||
GridDragGrid.GridAddCheckBox(moduleGridEx.GridControlObj.GridView);
|
||||
}
|
||||
if (this.SysModel.GridObjIsCheck == 1)
|
||||
{
|
||||
GridDragGrid.GridAddCheckBox(moduleGridEx.GridControlObj.GridView);
|
||||
}
|
||||
if (this.SysModel.LeftGridIsCheck == 1)
|
||||
{
|
||||
GridDragGrid.GridAddCheckBox(this.gridLeft.GridView);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (LeftItem != null)
|
||||
//{
|
||||
// this.BottomDetailModel = new GridDetailModel(LeftItem);
|
||||
// this.BottomModel = new ModuleModel(MainImpl.GetSystemdllTab(LeftItem["UnionModule"] + ""));
|
||||
// DynamicModel dyncModel = new DynamicPubModelAdd(new string[] { BottomModel.MenuText, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.Model.Privilege, LeftItem["UnionModule"] + "", "0" });
|
||||
// this.MoudleBottomObj.InitializeControl(BottomModel, dyncModel);
|
||||
|
||||
// this.MoudleBottomObj.GridControlObj.GridView.DoubleClick += new EventHandler(OnBottomDoubleClick);
|
||||
// this.MoudleBottomObj.SearchObj.OnSourceRefrshCallBack += OnRefreshBillSource;
|
||||
// GridDragGrid dragMainGrid = new GridDragGrid(mg_Bottom.GridControlObj.GridView, this.gridLeft.GridView);
|
||||
// dragMainGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragMainGridCompleted);
|
||||
// if (this.BottomModel.GridObjIsCheck == 1)//加载复选框
|
||||
// {
|
||||
// GridDragGrid.GridAddCheckBox(this.MoudleBottomObj.GridControlObj.GridView);
|
||||
// }
|
||||
// if (this.SysModel.GridObjIsCheck == 1)
|
||||
// {
|
||||
// GridDragGrid.GridAddCheckBox(mg_Bottom.GridControlObj.GridView);
|
||||
// }
|
||||
// if (this.SysModel.LeftGridIsCheck == 1)
|
||||
// {
|
||||
// GridDragGrid.GridAddCheckBox(this.gridLeft.GridView);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// 切换页签赋予选中页签
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnSelectedPageChanged(object sender, TabPageChangedEventArgs e)
|
||||
{
|
||||
Object moduleObject = e.Page.Controls.Cast<Object>().FirstOrDefault();
|
||||
ModuleGridEx moduleGridEx = null;
|
||||
if (moduleObject is ModuleGridEx)
|
||||
{
|
||||
this.MoudleBottomObj = moduleObject as ModuleGridEx;
|
||||
GridDetailModel DetailModel = MoudleBottomObj.GridControlObj.Tag as GridDetailModel;
|
||||
this.BottomModel = new ModuleModel(MainImpl.GetSystemdllTab(DetailModel.UnionModule));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 绑定左侧表格的事件
|
||||
/// <summary>
|
||||
/// <para>说明:设置左侧表格数据</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-09-08 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
protected void SetLeftGridView()
|
||||
{
|
||||
this.LeftRowObj = BaseModuleImpl.GetBaseLeftTreeField(this.Model.ModuleCode);
|
||||
if (LeftRowObj != null)
|
||||
{
|
||||
this.mg_control.ParentKeyField = LeftRowObj["fieldsqlid"] + "";
|
||||
this.mg_control.ParentUnionField = LeftRowObj["fieldname"] + "";
|
||||
this.mg_control.LeftGridEx = this.gridLeft;
|
||||
this.mg_control.ParentGridEx = this.gridLeft; // 方便右侧添加数据自动带出相同字段值
|
||||
|
||||
this.mg_bandcontrol.ParentKeyField = LeftRowObj["fieldsqlid"] + "";
|
||||
this.mg_bandcontrol.ParentUnionField = LeftRowObj["fieldname"] + "";
|
||||
this.mg_bandcontrol.LeftGridEx = this.gridLeft;
|
||||
this.mg_bandcontrol.ParentGridEx = this.gridLeft; // 方便右侧添加数据自动带出相同字段值
|
||||
|
||||
DataTable dtTable = BaseModuleImpl.GetBaseLeftGridField(this.Model.ModuleCode);
|
||||
DataTable dtColorTable = BaseModuleImpl.GetBaseGridRowColors(LeftRowObj["fieldKey"] + "");
|
||||
this.gridLeft.GridView.RowClick += new DevExpress.XtraGrid.Views.Grid.RowClickEventHandler(OnGridViewRowClick);
|
||||
this.gridLeft.GridView.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(OnGridFocuseRowChange);
|
||||
this.gridLeft.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(LeftRowObj["fieldKey"] + ""), this.Model, OnGridViewRightCallBack, this._leftGridSearchObj);
|
||||
this.gridLeft.SetGridRowColors(dtColorTable);
|
||||
this.gridLeft.SetReadOnlyColumns(dtTable, GridCustomColumnStruct.BaseLeftGridView + this.Model.ModuleCode);
|
||||
DataTable table = BaseModuleImpl.GetCustomQueryFields(LeftRowObj["fieldKey"] + "");
|
||||
string searchSql = LeftRowObj["fieldsql"] + " " + LeftCond;
|
||||
if (table != null && table.Rows.Count > 0)
|
||||
{
|
||||
// 自定义查询条件
|
||||
this._leftGridSearchObj = new MyControl(searchSql, this.gridLeft);
|
||||
this._leftGridSearchObj.OtherParams = Model.OtherParams();
|
||||
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.gridLeft.GridControl.DataSource = BaseImpl.GetDataTableResult(searchSql);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 数据绑定完成后加载数据
|
||||
/// <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
|
||||
{
|
||||
if (_leftGridSearchObj != null) this._leftGridSearchObj.SearchGrid();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 刷新右侧表格数据
|
||||
/// <summary>
|
||||
/// <para>说明:刷新右侧表格数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-03-19 </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="DevExpress.Data.SelectionChangedEventArgs"/> instance containing the event data.</param>
|
||||
protected void OnGridViewRowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
||||
{
|
||||
string sqlValue = ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql);
|
||||
sqlValue = this.SysModel.MenuSql.StartsWith("select", StringComparison.OrdinalIgnoreCase) ? sqlValue : sqlValue;
|
||||
DataRow dataRow = this.gridLeft.GridView.GetFocusedDataRow();
|
||||
// 左侧gridView时,需要替换sql参数(包含查询条件、表格选中行).
|
||||
sqlValue = this._leftGridSearchObj != null ? this._leftGridSearchObj.ReplaceParentControlValue(sqlValue) : sqlValue;
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(dataRow, sqlValue);
|
||||
this.ModuleGridObj.GridControlObj.LastSearchSql = this.ModuleGridObj.SearchObj.ReplaceLeftOrGridValue(sqlValue, true);
|
||||
this.ModuleGridObj.SearchObj.SearchLastGrid();
|
||||
bool Replacement = false;
|
||||
//右侧表格条件构建
|
||||
foreach (ControlModel model in this.MoudleBottomObj.SearchObj._models)
|
||||
{
|
||||
if (dataRow.Table.Columns.Contains(model.FieldName))
|
||||
{
|
||||
this.MoudleBottomObj.SearchObj.SetControlValue(model, dataRow[model.FieldName] + "");
|
||||
Replacement = true;
|
||||
}
|
||||
}
|
||||
if (Replacement) this.MoudleBottomObj.SearchObj.SearchGrid();
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:刷新右侧表格数据</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-03-19 </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="DevExpress.Data.SelectionChangedEventArgs"/> instance containing the event data.</param>
|
||||
protected void OnGridFocuseRowChange(object sender, FocusedRowObjectChangedEventArgs e)
|
||||
{
|
||||
string sqlValue = ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql);
|
||||
sqlValue = this.SysModel.MenuSql.StartsWith("select", StringComparison.OrdinalIgnoreCase) ? sqlValue : sqlValue;
|
||||
// 左侧gridView时,需要替换sql参数(包含查询条件、表格选中行).
|
||||
sqlValue = this._leftGridSearchObj != null ? this._leftGridSearchObj.ReplaceParentControlValue(sqlValue) : sqlValue;
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(this.gridLeft.GridView.GetFocusedDataRow(), sqlValue);
|
||||
this.ModuleGridObj.GridControlObj.LastSearchSql = this.ModuleGridObj.SearchObj.ReplaceLeftOrGridValue(sqlValue, true);
|
||||
this.ModuleGridObj.SearchObj.SearchLastGrid();
|
||||
}
|
||||
|
||||
#endregion
|
||||
//#region 选中刷新右侧表格数据
|
||||
///// <summary>
|
||||
///// <para>说明:刷新右侧表格数据</para>
|
||||
///// <para>创建人:龚宇超</para>
|
||||
///// <para>创建日期:2018-03-19 </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="DevExpress.Data.SelectionChangedEventArgs"/> instance containing the event data.</param>
|
||||
//protected void OnGridFocuseRowChange(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventArgs e)
|
||||
//{
|
||||
// string sqlValue = ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql);
|
||||
// sqlValue = this.SysModel.MenuSql.StartsWith("select", StringComparison.OrdinalIgnoreCase) ? sqlValue : sqlValue;
|
||||
// // 左侧gridView时,需要替换sql参数(包含查询条件、表格选中行).
|
||||
// sqlValue = this._leftGridSearchObj != null ? this._leftGridSearchObj.ReplaceParentControlValue(sqlValue) : sqlValue;
|
||||
// sqlValue = ReplaceHelper.ReplaceRowParam(this.gridLeft.GridView.GetFocusedDataRow(), sqlValue);
|
||||
// this.ModuleGridObj.GridControlObj.LastSearchSql = this.ModuleGridObj.SearchObj.ReplaceLeftOrGridValue(sqlValue, true);
|
||||
// this.ModuleGridObj.SearchObj.SearchLastGrid();
|
||||
//}
|
||||
//#endregion
|
||||
#endregion
|
||||
#region 初始化分割条位置
|
||||
#region 初始化分割条位置
|
||||
/// <summary>
|
||||
/// <para>说明:初始化分割条位置</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-12-15</para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private void InitSpliterPosition()
|
||||
{
|
||||
string spliterPosition = IniHelper.Read(string.Format("Step_spliterPositionMain_{0}", this.Model.ModuleCode));
|
||||
string spliterRightPosition = IniHelper.Read(string.Format("Step_spliterRightPositionMain_{0}", this.Model.ModuleCode));
|
||||
if (!string.IsNullOrEmpty(spliterPosition)) this.sccMain_container.SplitterPosition = Convert.ToInt32(spliterPosition);
|
||||
if (!string.IsNullOrEmpty(spliterRightPosition)) this.sccRight_container.SplitterPosition = Convert.ToInt32(spliterRightPosition);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
#region 事件
|
||||
#region 下方选择模板动态刷新列
|
||||
/// <summary>
|
||||
/// <para>说明:下方选择模板动态刷新列</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-09-11 </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>
|
||||
private void OnRefreshBillSource(object sender, EventArgs e)
|
||||
{
|
||||
BaseUserControl baseControl = (sender as System.Windows.Forms.Control).ToBaseUserControl();
|
||||
ControlModel model = baseControl.Model as ControlModel;
|
||||
string ConditionValue = this.MoudleBottomObj.SearchObj.GetControlValue(model.FieldName);//获取同它条件的替换值
|
||||
DataTable columns = BillImpl.GetBillDetailBrpColumns(ConditionValue);
|
||||
string colorUnion = string.Format("MODULECOLOR_{0}", ConditionValue);
|
||||
|
||||
if (columns != null && columns.Rows.Count > 0)
|
||||
{
|
||||
if ((columns.Rows.Cast<DataRow>().FirstOrDefault(x => (x["userName"] + "").Contains("|")) != null))
|
||||
{
|
||||
this.mg_control.Visible = false;
|
||||
this.mg_bandcontrol.Visible = true;
|
||||
this.ModuleGridObj = this.mg_bandcontrol;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mg_control.Visible = true;
|
||||
this.mg_bandcontrol.Visible = false;
|
||||
this.ModuleGridObj = this.mg_control;
|
||||
}
|
||||
this.ModuleGridObj.GridControlObj.SetEditColumns(columns);
|
||||
this.ModuleGridObj.GridControlObj.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(colorUnion));
|
||||
}
|
||||
else
|
||||
{
|
||||
this._gridColumns = BaseModuleImpl.GetBaseGridColumns(this.Model.ModuleCode);
|
||||
if (Model.isBandGrid)
|
||||
{
|
||||
this.mg_control.Visible = false;
|
||||
this.mg_bandcontrol.Visible = true;
|
||||
this.ModuleGridObj = this.mg_bandcontrol;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mg_control.Visible = true;
|
||||
this.mg_bandcontrol.Visible = false;
|
||||
this.ModuleGridObj = this.mg_control;
|
||||
}
|
||||
if (SysModel.CanEdit)
|
||||
{
|
||||
this.ModuleGridObj.GridControlObj.SetEditColumns(this._gridColumns, GridCustomColumnStruct.BaseMainGridView + this.SysModel.FormKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ModuleGridObj.GridControlObj.SetReadOnlyColumns(this._gridColumns, GridCustomColumnStruct.BaseMainGridView + this.SysModel.FormKey);
|
||||
}
|
||||
this.ModuleGridObj.GridControlObj.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(this.Model.ModuleCode));
|
||||
}
|
||||
string sql = this.SysModel.MenuSql + "and " + this.MoudleBottomObj.SearchObj.RefreshControl + "='" + ConditionValue + "'";
|
||||
//左侧上下结构刷新
|
||||
this.ModuleGridObj.GridControlObj.LastSearchSql = this.ModuleGridObj.SearchObj.SetSearchSqlValue(sql);
|
||||
this.ModuleGridObj.GridControlObj.SetGridViewDataSource(MainImpl.GetDataTableResult(this.ModuleGridObj.GridControlObj.LastSearchSql));
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// <para>说明:明细拖拽保存主表方法</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2021-03-10 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The e.</param>
|
||||
private void OnDragMainGridCompleted(object sender, GridDragGridArgs e)
|
||||
{
|
||||
if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0) return;
|
||||
try
|
||||
{
|
||||
if (MessageUtil.Show(ResourceKeys.DragSelectRow, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
GridView ge = sender as GridView;
|
||||
DataRow[] rowItems = e.GridViewSelectRows;
|
||||
DataRow GridLeftItem = this.gridLeft.GridView.GetFocusedDataRow();
|
||||
GridColumnCollection gridColumns = this.ModuleGridObj.GridControlObj.GridView.Columns;
|
||||
DataTable table = this.ModuleGridObj.GridControlObj.gridControl.DataSourceTable();
|
||||
foreach (DataRow rowItem in rowItems)
|
||||
{
|
||||
DataRow newRow = table.NewRow();
|
||||
foreach (GridColumn col in gridColumns)
|
||||
{
|
||||
if ("id".Equals(col.FieldName) || col.FieldName.Equals(this.BottomModel.ParmaryKey)) continue;
|
||||
string ConditionValue = this.MoudleBottomObj.SearchObj.GetControlValue(col.FieldName);//获取同它条件的替换值
|
||||
if (rowItem.Table.Columns.Contains(col.FieldName))
|
||||
{
|
||||
// 列中是否包含对应字段,包含则使用值
|
||||
newRow[col.FieldName] = string.IsNullOrWhiteSpace(ConditionValue) ? rowItem[col.FieldName] : ConditionValue;
|
||||
}
|
||||
if (GridLeftItem.Table.Columns.Contains(col.FieldName))
|
||||
{
|
||||
newRow[col.FieldName] = GridLeftItem[col.FieldName];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// 未包含字段,则使用控件默认值.
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue);
|
||||
if (!string.IsNullOrEmpty(model.DefaultValue) || !string.IsNullOrEmpty(ConditionValue))
|
||||
{
|
||||
newRow[col.FieldName] = string.IsNullOrWhiteSpace(ConditionValue) ? fieldValue : ConditionValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
table.Rows.Add(newRow);
|
||||
}
|
||||
this.ModuleGridObj.GridControlObj.GridView.ClearSelection();
|
||||
this.ModuleGridObj.GridControlObj.GridView.UpdateCurrentRow();
|
||||
this.ModuleGridObj.GridControlObj.GridView.ShowEditor();
|
||||
string sql = this.SysModel.MenuSql;
|
||||
//左侧上下结构刷新
|
||||
//this.ModuleGridObj.GridControlObj.LastSearchSql = this.ModuleGridObj.SearchObj.SetSearchSqlValue(sql, true, false);
|
||||
|
||||
string sqlValue = ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql);
|
||||
sqlValue = this.SysModel.MenuSql.StartsWith("select", StringComparison.OrdinalIgnoreCase) ? sqlValue : sqlValue;
|
||||
// 左侧gridView时,需要替换sql参数(包含查询条件、表格选中行).
|
||||
sqlValue = this._leftGridSearchObj != null ? this._leftGridSearchObj.ReplaceParentControlValue(sqlValue) : sqlValue;
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(this.gridLeft.GridView.GetFocusedDataRow(), sqlValue);
|
||||
this.ModuleGridObj.GridControlObj.LastSearchSql = this.ModuleGridObj.SearchObj.ReplaceLeftOrGridValue(sqlValue, true);
|
||||
this.ModuleGridObj.SaveGridRecord(false);
|
||||
this.ModuleGridObj.GridControlObj.GridView.SelectRowHandler(table.Rows.Count - 1);
|
||||
if (this.BottomDetailModel != null && this.BottomDetailModel.AutoRefresh)
|
||||
{
|
||||
this.MoudleBottomObj.SearchObj.SearchLastGrid();
|
||||
if (this.BottomModel.GridObjIsCheck == 1)
|
||||
{
|
||||
this.MoudleBottomObj.GridControlObj.GridView.ClearSelection();
|
||||
}
|
||||
}
|
||||
this._leftGridSearchObj.SearchLastGrid();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
LogUtil.WriteError("单据来源表格拖拽完出错!", ex);
|
||||
//MessageUtil.Show(ResourceKeys.OperFault);
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
#region 下部分表双击添加事件
|
||||
/// <summary>
|
||||
/// <para>说明:下部分表双击添加事件</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-09-08</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>
|
||||
private void OnBottomDoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Point mouseDowmPoint = this.MoudleBottomObj.GridControlObj.gridControl.PointToClient(System.Windows.Forms.Control.MousePosition);
|
||||
GridHitInfo info = this.MoudleBottomObj.GridControlObj.GridView.CalcHitInfo(mouseDowmPoint);
|
||||
//在列标题栏内则退出该方法
|
||||
if (info.InColumnPanel) return;
|
||||
|
||||
|
||||
DataRow[] rowItems = null;
|
||||
if (this.BottomModel.GridObjIsCheck == 1)
|
||||
{
|
||||
rowItems = this.MoudleBottomObj.GridControlObj.GetViewFocusedDataRows();
|
||||
}
|
||||
else
|
||||
{
|
||||
rowItems = new DataRow[] { this.mg_Bottom.GridControlObj.GridView.GetFocusedDataRow() };
|
||||
}
|
||||
|
||||
if (!ValidateDetailCond(rowItems, BottomModel.DoubleClickAddCond)) return;//不满足条件则退出该方法
|
||||
|
||||
DataRow GridLeftItem = this.gridLeft.GridView.GetFocusedDataRow();
|
||||
GridColumnCollection gridColumns = this.ModuleGridObj.GridControlObj.GridView.Columns;
|
||||
DataTable table = this.ModuleGridObj.GridControlObj.gridControl.DataSourceTable();
|
||||
foreach (DataRow rowItem in rowItems)
|
||||
{
|
||||
if (rowItem == null) continue;
|
||||
DataRow newRow = table.NewRow();
|
||||
foreach (GridColumn col in gridColumns)
|
||||
{
|
||||
if ("id".Equals(col.FieldName) || col.FieldName.Equals(this.BottomModel.ParmaryKey)) continue;
|
||||
string ConditionValue = this.MoudleBottomObj.SearchObj.GetControlValue(col.FieldName);//获取同它条件的替换值
|
||||
if (rowItem.Table.Columns.Contains(col.FieldName))
|
||||
{
|
||||
// 列中是否包含对应字段,包含则使用值
|
||||
newRow[col.FieldName] = string.IsNullOrWhiteSpace(ConditionValue) ? rowItem[col.FieldName] : ConditionValue;
|
||||
}
|
||||
else if (GridLeftItem != null && GridLeftItem.Table.Columns.Contains(col.FieldName))
|
||||
{
|
||||
newRow[col.FieldName] = GridLeftItem[col.FieldName];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// 未包含字段,则使用控件默认值.
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue);
|
||||
if (!string.IsNullOrEmpty(model.DefaultValue) || !string.IsNullOrEmpty(ConditionValue))
|
||||
{
|
||||
newRow[col.FieldName] = string.IsNullOrWhiteSpace(ConditionValue) ? fieldValue : ConditionValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
table.Rows.Add(newRow);
|
||||
}
|
||||
this.ModuleGridObj.GridControlObj.GridView.ClearSelection();
|
||||
this.ModuleGridObj.GridControlObj.GridView.UpdateCurrentRow();
|
||||
this.ModuleGridObj.GridControlObj.GridView.ShowEditor();
|
||||
string sql = this.SysModel.MenuSql;
|
||||
//左侧上下结构刷新
|
||||
//this.ModuleGridObj.GridControlObj.LastSearchSql = this.ModuleGridObj.SearchObj.SetSearchSqlValue(sql, true, false);
|
||||
|
||||
string sqlValue = ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql);
|
||||
sqlValue = this.SysModel.MenuSql.StartsWith("select", StringComparison.OrdinalIgnoreCase) ? sqlValue : sqlValue;
|
||||
// 左侧gridView时,需要替换sql参数(包含查询条件、表格选中行).
|
||||
sqlValue = this._leftGridSearchObj != null ? this._leftGridSearchObj.ReplaceParentControlValue(sqlValue) : sqlValue;
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(this.gridLeft.GridView.GetFocusedDataRow(), sqlValue);
|
||||
this.ModuleGridObj.GridControlObj.LastSearchSql = this.ModuleGridObj.SearchObj.ReplaceLeftOrGridValue(sqlValue, true);
|
||||
this.ModuleGridObj.SaveGridRecord(false);
|
||||
this.ModuleGridObj.GridControlObj.GridView.SelectRowHandler(table.Rows.Count - 1);
|
||||
if (this.BottomDetailModel != null && this.BottomDetailModel.AutoRefresh)
|
||||
{
|
||||
this.MoudleBottomObj.SearchObj.SearchLastGrid();
|
||||
if (this.BottomModel.GridObjIsCheck == 1)
|
||||
{
|
||||
this.MoudleBottomObj.GridControlObj.GridView.ClearSelection();
|
||||
}
|
||||
}
|
||||
if (_leftGridSearchObj != null) this._leftGridSearchObj.SearchLastGrid();
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUtil.WriteError("表格双击移动错误", ex);
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
//MessageUtil.Show(ResourceKeys.OperFault);
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 删除后刷新明细数据源
|
||||
private void mg_control_AfterDeleteGridCallBack(object sender, EventArgs e)
|
||||
{
|
||||
if (this.BottomDetailModel != null && this.BottomDetailModel.AutoRefresh)
|
||||
{
|
||||
this.MoudleBottomObj.SearchObj.SearchLastGrid();
|
||||
if (this.BottomModel.GridObjIsCheck == 1)
|
||||
{
|
||||
this.MoudleBottomObj.GridControlObj.GridView.ClearSelection();
|
||||
}
|
||||
}
|
||||
if (_leftGridSearchObj != null) this._leftGridSearchObj.SearchLastGrid();
|
||||
}
|
||||
/// <summary>
|
||||
/// 右键回调刷新所有
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnGridAfterRightCallBack(object sender, EventArgs e)
|
||||
{
|
||||
if (this.BottomDetailModel != null && this.BottomDetailModel.AutoRefresh)
|
||||
{
|
||||
this.MoudleBottomObj.SearchObj.SearchLastGrid();
|
||||
if (this.BottomModel.GridObjIsCheck == 1)
|
||||
{
|
||||
this.MoudleBottomObj.GridControlObj.GridView.ClearSelection();
|
||||
}
|
||||
}
|
||||
this._leftGridSearchObj.SearchLastGrid();
|
||||
}
|
||||
#endregion
|
||||
#region 右键菜单执行后刷新数据,刷新规则按照上一次查询条件刷新
|
||||
/// <summary>
|
||||
/// <para>说明:右键菜单执行后刷新数据,刷新规则按照上一次查询条件刷新</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-09-09 </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 OnGridViewRightCallBack(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataRow item = this.ModuleGridObj.GridControlObj.GridView.GetFocusedDataRow();
|
||||
if (_leftGridSearchObj != null) this._leftGridSearchObj.SearchLastGrid();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
#region 分隔条位置改变事件
|
||||
/// <summary>
|
||||
/// 分隔条位置改变事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnSccMain_container_LocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
IniHelper.Write(string.Format("Step_spliterPositionMain_{0}", this.Model.ModuleCode), this.sccMain_container.SplitterPosition + "");
|
||||
}
|
||||
/// <summary>
|
||||
/// 分隔条右边位置改变事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnSccRight_container_LocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
IniHelper.Write(string.Format("Step_spliterRightPositionMain_{0}", this.Model.ModuleCode), this.sccRight_container.SplitterPosition + "");
|
||||
}
|
||||
#endregion
|
||||
#region 条件判断
|
||||
/// <summary>
|
||||
/// <para>说明:条件判断</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-30 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
private bool ValidateDetailCond(DataRow[] rowItems, string conditions)
|
||||
{
|
||||
bool validate = false;
|
||||
try
|
||||
{
|
||||
foreach (DataRow rowItem in rowItems)
|
||||
{
|
||||
string detailCond = ReplaceHelper.ReplaceRowParam(rowItem, conditions);
|
||||
if (detailCond.Contains("#"))
|
||||
{
|
||||
List<string> condition = ReplaceHelper.GetParamFields(detailCond);
|
||||
foreach (string item in condition)
|
||||
{
|
||||
string fieldValue = this.MoudleBottomObj.SearchObj.GetControlValue(item.Replace("{#", "").Replace("}", ""));
|
||||
detailCond = detailCond.Replace(item, fieldValue);
|
||||
}
|
||||
}
|
||||
if (detailCond.StartsWith("@") || detailCond.StartsWith("!"))
|
||||
{
|
||||
validate = "1".Equals(BaseImpl.GetDefaultValue(detailCond));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
validate = ReplaceHelper.EvalCond(detailCond);
|
||||
}
|
||||
if (!validate)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteLog(ex.StackTrace);
|
||||
LogUtil.WriteError("验证多条添加条件出错!", ex);
|
||||
//MessageUtil.Show(ResourceKeys.CondtionError + "\r\n" + unionModel.ModelObj.DetailEnableCond);
|
||||
}
|
||||
return validate;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user