基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
/***********************
|
||||
* 说明:日程控件右键菜单配置
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2018-03-27
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本:1.0.0.0
|
||||
***********************/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DevExpress.XtraScheduler;
|
||||
using DevExpress.Utils.Menu;
|
||||
using Lskj.Util;
|
||||
using System.Data;
|
||||
|
||||
namespace Lskj.Control.Model.MenuStrip
|
||||
{
|
||||
/// <summary>
|
||||
/// Class AppointmentMenuStrip.
|
||||
/// </summary>
|
||||
public class AppointmentMenuStrip : BaseRightMenu
|
||||
{
|
||||
/// <summary>
|
||||
/// 日程任务条
|
||||
/// </summary>
|
||||
protected Appointment AppointmentObj;
|
||||
/// <summary>
|
||||
/// 日程数据对象
|
||||
/// </summary>
|
||||
protected SchedulerStorage SchedulerControlObj;
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置日程右键菜单</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-03-27</para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="view">数据资源.</param>
|
||||
/// <param name="appointment">任务对象</param>
|
||||
/// <param name="table">数据表名.</param>
|
||||
/// <param name="model">模型</param>
|
||||
/// <param name="control"></param>
|
||||
/// <param name="menu"></param>
|
||||
/// <param name="e">获取popmenu 对象 <see cref="PopupMenuShowingEventArgs"/> instance containing the event data.</param>
|
||||
public void SetRightMenus(SchedulerStorage view, Appointment appointment, System.Data.DataTable table, Lskj.Model.DynamicModel model, MyControl control = null, System.Windows.Forms.ContextMenuStrip menu = null, PopupMenuShowingEventArgs e = null)
|
||||
{
|
||||
Model = model;
|
||||
SchedulerControlObj = view as SchedulerStorage;
|
||||
AppointmentObj = appointment;
|
||||
//动态添加菜单
|
||||
for (int i = 0; i < table.Rows.Count; i++)
|
||||
{
|
||||
GridRightMenuModel menuModel = new GridRightMenuModel(table.Rows[i]);
|
||||
DXMenuItem updateItem = new SchedulerMenuItem(menuModel.MenuName);
|
||||
updateItem.Tag = menuModel;
|
||||
updateItem.Click += new EventHandler(MenuStripItemClick);
|
||||
updateItem.BeginGroup = true;
|
||||
e.Menu.Items.Add(updateItem);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:获取选中行</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-03-27</para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
protected override DataRow[] GetSelectedRows()
|
||||
{
|
||||
DataRow dr = AppointmentObj.GetRow(SchedulerControlObj) as DataRow;
|
||||
DataRow[] drSelect = { dr };
|
||||
return drSelect;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/***********************
|
||||
* 说明:附件菜单配置
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2018-02-24
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本:1.0.0.0
|
||||
***********************/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using DevExpress.XtraEditors;
|
||||
using System.Windows.Forms;
|
||||
using System.Data;
|
||||
using Lskj.Data;
|
||||
using Lskj.Util;
|
||||
|
||||
namespace Lskj.Control.Model
|
||||
{
|
||||
public class AttachViewMenuStrip : BaseRightMenu
|
||||
{
|
||||
/// <summary>
|
||||
/// 附件容器面
|
||||
/// </summary>
|
||||
protected Panel PanelMain;
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置菜单</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-01-29 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataRow[].</returns>
|
||||
public override void InitRightMenus(System.Windows.Forms.Control view, System.Data.DataTable table, Lskj.Model.DynamicModel model, MyControl control = null, System.Windows.Forms.ContextMenuStrip menu = null)
|
||||
{
|
||||
base.InitRightMenus(view, table, model, control, menu);
|
||||
PanelMain = view as Panel;
|
||||
foreach (AttachControlEx attach in this.PanelMain.Controls)
|
||||
{
|
||||
//排除文件夹
|
||||
if (attach.FileNo!=0)
|
||||
{
|
||||
attach.ContextMenuStrip = base.MenuStrip;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取选中附件模块</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-03-23 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>DataRow[].</returns>
|
||||
protected override DataRow[] GetSelectedRows()
|
||||
{
|
||||
DataRow[] drSelect=this.PanelMain.Controls.Cast<AttachControlEx>().Where(o => o.Selected).Select(o=>o.FileDetial).ToArray();
|
||||
return drSelect;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DevExpress.XtraTreeList;
|
||||
using System.Data;
|
||||
using Lskj.Model;
|
||||
using DevExpress.XtraTreeList.Nodes;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using DevExpress.XtraGrid.Columns;
|
||||
using Lskj.Data;
|
||||
using Lskj.Util;
|
||||
using DevExpress.XtraGrid.Views.Base;
|
||||
using Lskj.Control.Properties;
|
||||
using Lskj.Business.Impl;
|
||||
|
||||
namespace Lskj.Control.Model.MenuStrip
|
||||
{
|
||||
public class BandedGridMenuStrip : BaseRightMenu
|
||||
{
|
||||
private int _oldRowHandler;
|
||||
private GridView _gridView;
|
||||
protected BandedGridControlEx BandedGridControlObj;
|
||||
private MyControl _control;
|
||||
public override void InitRightMenus(System.Windows.Forms.Control view, DataTable table, DynamicModel model, MyControl control = null, ContextMenuStrip menu = null)
|
||||
{
|
||||
base.InitRightMenus(view, table, model, control, menu);
|
||||
this.BandedGridControlObj = view as BandedGridControlEx;
|
||||
if (this.BandedGridControlObj != null)
|
||||
{
|
||||
this.BaseGridView = this._gridView = this.BandedGridControlObj.GridView;
|
||||
this._control = control;
|
||||
this.BandedGridControlObj.gridControl.ContextMenuStrip = base.MenuStrip;
|
||||
}
|
||||
}
|
||||
protected override void MenuStripOpening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
int[] mSelectRows = this._gridView.GetSelectedRows();
|
||||
if (mSelectRows == null || mSelectRows.Length == 0) return;
|
||||
|
||||
DataRow mSelectRow = this._gridView.GetDataRow(mSelectRows[0]);
|
||||
|
||||
ContextMenuStrip cmsMenu = (ContextMenuStrip)sender;
|
||||
cmsMenu.Items.Clear();
|
||||
cmsMenu.Items.AddRange(this.RightMenuItems.ToArray());
|
||||
|
||||
// 创建QQ、浏览器右键菜单
|
||||
List<ToolStripMenuItem> mQQArray = new List<ToolStripMenuItem>();
|
||||
List<ToolStripMenuItem> mBrowerArray = new List<ToolStripMenuItem>();
|
||||
|
||||
foreach (GridColumn column in this._gridView.Columns)
|
||||
{
|
||||
if (!mSelectRow.Table.Columns.Contains(column.Name))
|
||||
continue;
|
||||
string rowValue = mSelectRow[column.Name] + "";
|
||||
if (!string.IsNullOrWhiteSpace(rowValue))
|
||||
{
|
||||
GridColumnModel model = column.Tag as GridColumnModel;
|
||||
if (model == null) continue;
|
||||
|
||||
if (model.FieldType == ControlType.LabQQ)
|
||||
{
|
||||
ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq);
|
||||
item.Tag = mSelectRow[column.Name] + "";
|
||||
item.Click += new EventHandler(QQItemClick);
|
||||
mQQArray.Add(item);
|
||||
}
|
||||
|
||||
if (model.FieldType == ControlType.LabWWW ||
|
||||
rowValue.StartsWith("www.") ||
|
||||
rowValue.StartsWith("http://") ||
|
||||
rowValue.StartsWith("https://") ||
|
||||
rowValue.StartsWith("ftp://") ||
|
||||
rowValue.StartsWith("file://"))
|
||||
{
|
||||
ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq);
|
||||
item.Tag = mSelectRow[column.Name] + "";
|
||||
item.Click += new EventHandler(BrowerItemClick);
|
||||
mBrowerArray.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmsMenu.Items.AddRange(mQQArray.ToArray());
|
||||
cmsMenu.Items.AddRange(mBrowerArray.ToArray());
|
||||
|
||||
// 判断右键菜单是否可用
|
||||
foreach (ToolStripItem cms in cmsMenu.Items)
|
||||
{
|
||||
GridRightMenuModel model = cms.Tag as GridRightMenuModel;
|
||||
if (model != null)
|
||||
{
|
||||
if (model.PrivilegeOper.Length > 1 && !model.PrivilegeOper.Contains(ERPInfo.Instance.UserName + ","))
|
||||
{
|
||||
if (model.ForbiddenDisplay)
|
||||
{
|
||||
cms.Visible = false;
|
||||
}
|
||||
cms.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(model.MenuCond))
|
||||
{
|
||||
try
|
||||
{
|
||||
string cond = string.Empty;
|
||||
if (this._control != null)
|
||||
cond = _control.ReplaceParentControlValue(model.MenuCond);
|
||||
cond = ReplaceHelper.ReplaceRowParam(mSelectRow, model.MenuCond);
|
||||
if (this._gridView != null)
|
||||
{
|
||||
GridCell[] cells = this._gridView.GetSelectedCells();
|
||||
if (cells != null && cells.Length > 0 && cond.Contains("{COLUMN_"))
|
||||
{
|
||||
GridCell cell = cells[0];
|
||||
DataRow focusedRow = this.BaseGridView.GetFocusedDataRow();
|
||||
string colValue = focusedRow == null || !focusedRow.Table.Columns.Contains(cell.Column.Name) ? "" : focusedRow[cell.Column.Name] + "";
|
||||
cond = cond.ReplaceColumnParam(cell.Column.Name, cell.Column.Caption, colValue);
|
||||
}
|
||||
}
|
||||
if (ControlObj != null)
|
||||
cond = ControlObj.ReplaceParentControlValue(cond);
|
||||
//cms.Enabled = ReplaceHelper.EvalCond(cond);
|
||||
if (model.ForbiddenDisplay)
|
||||
{
|
||||
cms.Visible = ValidateCond(cond, null); ;
|
||||
}
|
||||
cms.Enabled = ValidateCond(cond, null); ;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(ResourceKeys.SetRightMenuCondFault + "\r\n" + Message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override DataRow[] GetSelectedRows()
|
||||
{
|
||||
return this.BandedGridControlObj.GetViewFocusedDataRows();
|
||||
}
|
||||
protected override void MenuStripItemClick(object sender, EventArgs e)
|
||||
{
|
||||
base.MenuStripItemClick(sender, e);
|
||||
}
|
||||
protected override void MenuStripClickBefore(ToolStripMenuItem item, GridRightMenuModel model)
|
||||
{
|
||||
this._oldRowHandler = this._gridView.FocusedRowHandle;
|
||||
}
|
||||
protected override void MenuStripClickAfter(ToolStripMenuItem item, GridRightMenuModel model)
|
||||
{
|
||||
this._gridView.ClearSelection();
|
||||
this._gridView.SelectRowHandler(this._oldRowHandler);
|
||||
}
|
||||
protected override List<string> HandleRightMenuParams(List<string> paramList, DataRow rowData, DataRow[] rowDatas = null, int actionType = 0)
|
||||
{
|
||||
List<string> handleParamList = base.HandleRightMenuParams(paramList, rowData, rowDatas, actionType);
|
||||
|
||||
foreach (string item in handleParamList)
|
||||
{
|
||||
if (item.StartsWith("{"))
|
||||
{
|
||||
string field = item.Replace("{", "").Replace("}", "");
|
||||
if ("COLUMN_NAME".Equals(field))
|
||||
{
|
||||
handleParamList.Add(this._gridView.FocusedColumn.FieldName);
|
||||
}
|
||||
else if ("COLUMN_TITLE".Equals(field))
|
||||
{
|
||||
|
||||
handleParamList.Add(this._gridView.FocusedColumn.GetTextCaption());
|
||||
}
|
||||
else
|
||||
{
|
||||
handleParamList.Add(rowData[field] + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return handleParamList;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using System.Data;
|
||||
using Lskj.Model;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.Control.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// ChartView右键菜单
|
||||
/// </summary>
|
||||
public class ChartViewMenuStrip : BaseRightMenu
|
||||
{
|
||||
/// <summary>
|
||||
/// 图表控件
|
||||
/// </summary>
|
||||
protected ChartControlEx ChartControlObj;
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置右键菜单</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2018-01-29 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="view">The view.</param>
|
||||
/// <param name="table">The table.</param>
|
||||
/// <param name="model">The model.</param>
|
||||
/// <param name="control">The control.</param>
|
||||
/// <param name="menu">The menu.</param>
|
||||
public override void InitRightMenus(System.Windows.Forms.Control view, DataTable table, DynamicModel model, MyControl control = null, ContextMenuStrip menu = null)
|
||||
{
|
||||
base.InitRightMenus(view, table, model, control, menu);
|
||||
|
||||
this.ChartControlObj = view as ChartControlEx;
|
||||
if (this.ChartControlObj != null)
|
||||
{
|
||||
this.ChartControlObj.ContextMenuStrip = base.MenuStrip;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using System.Data;
|
||||
using Lskj.Model;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.XtraGrid.Columns;
|
||||
using Lskj.Control.Properties;
|
||||
using Lskj.Util;
|
||||
using Lskj.Data;
|
||||
using DevExpress.XtraGrid.Views.Base;
|
||||
using Lskj.Business.Impl;
|
||||
|
||||
namespace Lskj.Control.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// GridView右键菜单
|
||||
/// </summary>
|
||||
public class GridViewMenuStrip : BaseRightMenu
|
||||
{
|
||||
private int[] _oldSelectRows;
|
||||
private DataRow _oldDataRow;
|
||||
private int _oldRowHandler;
|
||||
private GridView _gridView;
|
||||
private MyControl _control;
|
||||
protected GridControlEx GridControlObj;
|
||||
public override void InitRightMenus(System.Windows.Forms.Control view, DataTable table, DynamicModel model, MyControl control = null, ContextMenuStrip menu = null)
|
||||
{
|
||||
base.InitRightMenus(view, table, model, control, menu);
|
||||
this.GridControlObj = view as GridControlEx;
|
||||
if (this.GridControlObj != null)
|
||||
{
|
||||
this.BaseGridView = this._gridView = this.GridControlObj.GridView;
|
||||
this._control = control;
|
||||
this.GridControlObj.gridControl.ContextMenuStrip = base.MenuStrip;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void MenuStripOpening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
int[] mSelectRows = this._gridView.GetSelectedRows();
|
||||
if (mSelectRows == null || mSelectRows.Length == 0) return;
|
||||
DataRow mSelectRow = this._gridView.GetDataRow(mSelectRows[0]);
|
||||
this._gridView.UpdateCurrentRow();
|
||||
this._gridView.ShowEditor();
|
||||
|
||||
ContextMenuStrip cmsMenu = (ContextMenuStrip)sender;
|
||||
cmsMenu.Items.Clear();
|
||||
cmsMenu.Items.AddRange(this.RightMenuItems.ToArray());
|
||||
|
||||
// 创建QQ、浏览器右键菜单
|
||||
List<ToolStripMenuItem> mQQArray = new List<ToolStripMenuItem>();
|
||||
List<ToolStripMenuItem> mBrowerArray = new List<ToolStripMenuItem>();
|
||||
|
||||
foreach (GridColumn column in this._gridView.Columns)
|
||||
{
|
||||
if (!mSelectRow.Table.Columns.Contains(column.Name))
|
||||
continue;
|
||||
string rowValue = mSelectRow[column.Name] + "";
|
||||
if (!string.IsNullOrWhiteSpace(rowValue))
|
||||
{
|
||||
GridColumnModel model = column.Tag as GridColumnModel;
|
||||
if (model == null) continue;
|
||||
|
||||
if (model.FieldType == ControlType.LabQQ)
|
||||
{
|
||||
ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq);
|
||||
item.Tag = mSelectRow[column.Name] + "";
|
||||
item.Click += new EventHandler(QQItemClick);
|
||||
mQQArray.Add(item);
|
||||
}
|
||||
|
||||
if (model.FieldType == ControlType.LabWWW &&
|
||||
(rowValue.StartsWith("www.") ||
|
||||
rowValue.StartsWith("http://") ||
|
||||
rowValue.StartsWith("https://") ||
|
||||
rowValue.StartsWith("ftp://") ||
|
||||
rowValue.StartsWith("file://")))
|
||||
{
|
||||
ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq);
|
||||
item.Tag = mSelectRow[column.Name] + "";
|
||||
item.Click += new EventHandler(BrowerItemClick);
|
||||
mBrowerArray.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmsMenu.Items.AddRange(mQQArray.ToArray());
|
||||
cmsMenu.Items.AddRange(mBrowerArray.ToArray());
|
||||
|
||||
// 判断右键菜单是否可用
|
||||
foreach (ToolStripItem cms in cmsMenu.Items)
|
||||
{
|
||||
GridRightMenuModel model = cms.Tag as GridRightMenuModel;
|
||||
if (model != null)
|
||||
{
|
||||
// !model.PrivilegeOper.Contains(ERPInfo.Instance.UserName + "," 2024-2-23换成下面的判断
|
||||
if (model.PrivilegeOper.Length > 1 && !model.PrivilegeOper.Split(',').Contains(ERPInfo.Instance.UserName))
|
||||
{
|
||||
if (model.ForbiddenDisplay)
|
||||
{
|
||||
cms.Visible = false;
|
||||
}
|
||||
cms.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(model.MenuCond))
|
||||
{
|
||||
try
|
||||
{
|
||||
bool condResult = false;
|
||||
StringBuilder condBuilder = new StringBuilder();
|
||||
StringBuilder sqlCondBuilder = new StringBuilder();
|
||||
GridCell[] cells = this._gridView.GetSelectedCells();
|
||||
DataRow focusedRow = this.BaseGridView.GetFocusedDataRow();
|
||||
foreach (int itemIndex in mSelectRows)
|
||||
{
|
||||
DataRow selectRow = this._gridView.GetDataRow(itemIndex);
|
||||
string cond = string.Empty;
|
||||
if (this._control != null)
|
||||
{
|
||||
cond = _control.ReplaceParentControlValue(model.MenuCond);
|
||||
}
|
||||
cond = ReplaceHelper.ReplaceRowParam(selectRow, model.MenuCond);
|
||||
if (this._gridView != null)
|
||||
{
|
||||
if (cells != null && cells.Length > 0 && cond.Contains("{COLUMN_"))
|
||||
{
|
||||
GridCell cell = cells[0];
|
||||
string colValue = focusedRow == null || !focusedRow.Table.Columns.Contains(cell.Column.Name) ? "" : focusedRow[cell.Column.Name] + "";
|
||||
cond = cond.ReplaceColumnParam(cell.Column.Name, cell.Column.Caption, colValue);
|
||||
}
|
||||
}
|
||||
if (ControlObj != null)
|
||||
{
|
||||
cond = ControlObj.ReplaceParentControlValue(cond);
|
||||
}
|
||||
if (cond.StartsWith("@"))
|
||||
{
|
||||
sqlCondBuilder.Append($"({cond.TrimStart('@')}) = '1' and ");
|
||||
}
|
||||
else
|
||||
{
|
||||
condBuilder.Append($"({cond}) and ");
|
||||
}
|
||||
}
|
||||
string condStr = "";
|
||||
if (model.MenuCond.StartsWith("@"))
|
||||
{
|
||||
condStr = $"@if({sqlCondBuilder.ToString().TrimEnd().TrimEnd('d', 'n', 'a')}) begin select '1' end else begin select '0' end";
|
||||
}
|
||||
else
|
||||
{
|
||||
condStr = condBuilder.ToString().TrimEnd().TrimEnd('d', 'n', 'a');
|
||||
}
|
||||
condResult = ValidateCond(condStr, null);
|
||||
//if (!condResult) break;
|
||||
//cms.Enabled = ReplaceHelper.EvalCond(cond);
|
||||
if (model.ForbiddenDisplay)
|
||||
{
|
||||
cms.Visible = condResult;
|
||||
}
|
||||
cms.Enabled = condResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(ResourceKeys.SetRightMenuCondFault + "\r\n" + Message);
|
||||
e.Cancel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void MenuStripItemClick(object sender, EventArgs e)
|
||||
{
|
||||
base.MenuStripItemClick(sender, e);
|
||||
}
|
||||
protected override DataRow[] GetSelectedRows()
|
||||
{
|
||||
return this.GridControlObj.GetViewFocusedDataRows();
|
||||
}
|
||||
protected override void MenuStripClickBefore(ToolStripMenuItem item, GridRightMenuModel model)
|
||||
{
|
||||
this._oldSelectRows = this._gridView.GetSelectedRows();
|
||||
this._oldDataRow = this._gridView.GetFocusedDataRow();
|
||||
this._oldRowHandler = this._gridView.FocusedRowHandle;
|
||||
}
|
||||
protected override void MenuStripClickAfter(ToolStripMenuItem item, GridRightMenuModel model)
|
||||
{
|
||||
DataTable dataTable = this.GridControlObj.GridView.GetGridViewFilteredAndSortedDataToDataTable() as DataTable;
|
||||
List<DataRow> rows = new List<DataRow>() { this._oldDataRow };
|
||||
IEnumerable<DataRow> QBJ = dataTable.Select().AsEnumerable().Intersect(rows.AsEnumerable(), DataRowComparer.Default);
|
||||
int NRowHandle = 0;
|
||||
try
|
||||
{
|
||||
DataTable NDataTable = QBJ.CopyToDataTable();
|
||||
if (NDataTable.Rows.Count > 0)
|
||||
{
|
||||
NRowHandle = dataTable.Rows.IndexOf(QBJ.First());
|
||||
this._oldRowHandler = NRowHandle >= 0 ? NRowHandle : this._oldRowHandler;
|
||||
}
|
||||
}
|
||||
catch (System.InvalidOperationException ex) //如果差集为null,就回进当前报错
|
||||
{
|
||||
}
|
||||
if (this._gridView.OptionsSelection.MultiSelect == true && this._gridView.OptionsSelection.EnableAppearanceFocusedCell == false && this._gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect)
|
||||
{
|
||||
if (model.RefreshCheckState)
|
||||
this._gridView.ClearSelection();
|
||||
else if (!model.RefreshCheckState && this._oldSelectRows != null)
|
||||
{
|
||||
foreach (int index in this._oldSelectRows)
|
||||
{
|
||||
this._gridView.SelectRow(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._gridView.ClearSelection();
|
||||
this._gridView.SelectRowHandler(this._oldRowHandler);
|
||||
}
|
||||
}
|
||||
protected override List<string> HandleRightMenuParams(List<string> paramList, DataRow rowData, DataRow[] rowDatas = null, int actionType = 0)
|
||||
{
|
||||
List<string> handleParamList = base.HandleRightMenuParams(paramList, rowData, rowDatas, actionType);
|
||||
|
||||
foreach (string item in handleParamList)
|
||||
{
|
||||
if (item.StartsWith("{"))
|
||||
{
|
||||
string field = item.Replace("{", "").Replace("}", "");
|
||||
if ("COLUMN_NAME".Equals(field))
|
||||
{
|
||||
handleParamList.Add(this._gridView.FocusedColumn.FieldName);
|
||||
}
|
||||
else if ("COLUMN_TITLE".Equals(field))
|
||||
{
|
||||
|
||||
handleParamList.Add(this._gridView.FocusedColumn.GetTextCaption());
|
||||
}
|
||||
else
|
||||
{
|
||||
handleParamList.Add(rowData[field] + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return handleParamList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,440 @@
|
||||
/******************************
|
||||
* 说明:右键菜单实体类
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2017-10-27
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本:1.0.0.0
|
||||
******************************/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
|
||||
namespace Lskj.Control.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 右键菜单实体类
|
||||
/// </summary>
|
||||
public class GridRightMenuModel
|
||||
{
|
||||
#region private properties
|
||||
private int _id;
|
||||
private int _actionType;
|
||||
private double _orderId;
|
||||
private string _menuTabName;
|
||||
private int _menuId;
|
||||
private bool _maxWindow;
|
||||
private bool _refresh;
|
||||
private bool _dbClick;
|
||||
private bool _moreClick;
|
||||
private bool _mergEexec;
|
||||
private string _menuName;
|
||||
private string _dllName;
|
||||
private string _beforeMsg;
|
||||
private string _action;
|
||||
private string _successMsg;
|
||||
private string _errorMsg;
|
||||
private string _menuCond;
|
||||
private string _privilegeOper;
|
||||
private bool _refreshCheckState;
|
||||
private string _icoName;
|
||||
private string _dllParam1;
|
||||
private string _dllParam2;
|
||||
private string _dllParam3;
|
||||
private string _dllParam4;
|
||||
private string _dllParam5;
|
||||
private string _dllParam6;
|
||||
private string _dllParam7;
|
||||
private string _dllParam8;
|
||||
private string _dllParam9;
|
||||
private string _dllParam10;
|
||||
private string _dllParam11;
|
||||
private string _dllParam12;
|
||||
private bool _isCopy;
|
||||
private bool _forbiddenDisplay;
|
||||
private bool _noonWindow;
|
||||
private bool _allowNullExec;
|
||||
private string _resultSQL;
|
||||
/// <summary>
|
||||
/// Gets the parameter list.
|
||||
/// </summary>
|
||||
/// <value>The parameter list.</value>
|
||||
private List<string> paramList;
|
||||
#endregion
|
||||
|
||||
#region public properties
|
||||
/// <summary>
|
||||
/// <para>右键菜单执行类型</para>
|
||||
/// <para>0. 执行SQL语句</para>
|
||||
/// <para>1. 执行存储过程</para>
|
||||
/// <para>2. 调用dll程序</para>
|
||||
/// <para>3. 调用delphi程序</para>
|
||||
/// </summary>
|
||||
/// <value>The type of the action.</value>
|
||||
public int ActionType { get { return _actionType; } }
|
||||
/// <summary>
|
||||
/// 右键菜单模块编号
|
||||
/// </summary>
|
||||
/// <value>The menuTabId.</value>
|
||||
public string MenuTabName { get { return _menuTabName; } }
|
||||
/// <summary>
|
||||
/// 右键菜单顺序
|
||||
/// </summary>
|
||||
/// <value>The orderid.</value>
|
||||
public double OrderId { get { return _orderId; } }
|
||||
/// <summary>
|
||||
/// Gets the menuid.
|
||||
/// </summary>
|
||||
/// <value>The menuid.</value>
|
||||
public int MenuId { get { return _menuId; } }
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public int Id { get { return _id; } }
|
||||
/// <summary>
|
||||
/// 当ActionType=2时,打开dll是否最大化
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [maximum window]; otherwise, <c>false</c>.</value>
|
||||
public bool MaxWindow { get { return _maxWindow; } }
|
||||
/// <summary>
|
||||
/// 执行右键菜单后是否刷新表格数据
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if refresh; otherwise, <c>false</c>.</value>
|
||||
public bool Refresh { get { return _refresh; } }
|
||||
/// <summary>
|
||||
/// 执行右键菜单后是否重置选中状态
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if refresh; otherwise, <c>false</c>.</value>
|
||||
public bool RefreshCheckState { get { return _refreshCheckState; } }
|
||||
/// <summary>
|
||||
/// 表格双击时调用
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [database click]; otherwise, <c>false</c>.</value>
|
||||
public bool DbClick { get { return _dbClick; } }
|
||||
/// <summary>
|
||||
/// 右键菜单是否可执行多次
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [more click]; otherwise, <c>false</c>.</value>
|
||||
public bool MoreClick { get { return _moreClick; } }
|
||||
/// <summary>
|
||||
/// 右键菜单是否可执参数替换
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [merg Eexec]; otherwise, <c>false</c>.</value>
|
||||
public bool Mergeexec { get { return _mergEexec; } }
|
||||
/// <summary>
|
||||
/// 菜单名称
|
||||
/// </summary>
|
||||
/// <value>The name of the menu.</value>
|
||||
public string MenuName { get { return _menuName.Replace("\r", "").Replace("\n", ""); } }
|
||||
/// <summary>
|
||||
/// 调用dll名称
|
||||
/// </summary>
|
||||
/// <value>The name of the DLL.</value>
|
||||
public string DllName
|
||||
{
|
||||
get
|
||||
{
|
||||
// 基础档案修改界面特殊处理
|
||||
if ("lskj.pubadd2.dll".Equals(_dllName.Trim().ToLower()) || "lskj.pubadd3.dll".Equals(_dllName.Trim().ToLower()))
|
||||
return "lskj.pubadd.dll";
|
||||
return _dllName.Trim();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 右键菜单执行前提示信息
|
||||
/// </summary>
|
||||
/// <value>The before MSG.</value>
|
||||
public string BeforeMsg { get { return _beforeMsg; } }
|
||||
/// <summary>
|
||||
/// Gets the action.
|
||||
/// </summary>
|
||||
/// <value>The action.</value>
|
||||
public string Action { get { return _action; } set { _action = value; } }
|
||||
/// <summary>
|
||||
/// 执行右键菜单成功后提示信息
|
||||
/// </summary>
|
||||
/// <value>The success MSG.</value>
|
||||
public string SuccessMsg { get { return _successMsg; } }
|
||||
/// <summary>
|
||||
/// 执行右键菜单失败后提示信息
|
||||
/// </summary>
|
||||
/// <value>The error MSG.</value>
|
||||
public string ErrorMsg { get { return _errorMsg; } }
|
||||
/// <summary>
|
||||
/// 右键菜单是否可用条件
|
||||
/// </summary>
|
||||
/// <value>The menu cond.</value>
|
||||
public string MenuCond { get { return _menuCond; } }
|
||||
/// <summary>
|
||||
/// 右键菜单权限
|
||||
/// </summary>
|
||||
/// <value>The privilege oper.</value>
|
||||
public string PrivilegeOper { get { return _privilegeOper; } }
|
||||
/// <summary>
|
||||
/// 扩展参数1
|
||||
/// </summary>
|
||||
/// <value>The DLL param1.</value>
|
||||
public string DllParam1 { get { return _dllParam1; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param2.
|
||||
/// </summary>
|
||||
/// <value>The DLL param2.</value>
|
||||
public string DllParam2 { get { return _dllParam2; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param3.
|
||||
/// </summary>
|
||||
/// <value>The DLL param3.</value>
|
||||
public string DllParam3 { get { return _dllParam3; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param4.
|
||||
/// </summary>
|
||||
/// <value>The DLL param4.</value>
|
||||
public string DllParam4 { get { return _dllParam4; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param5.
|
||||
/// </summary>
|
||||
/// <value>The DLL param5.</value>
|
||||
public string DllParam5 { get { return _dllParam5; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param6.
|
||||
/// </summary>
|
||||
/// <value>The DLL param6.</value>
|
||||
public string DllParam6 { get { return _dllParam6; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param7.
|
||||
/// </summary>
|
||||
/// <value>The DLL param7.</value>
|
||||
public string DllParam7 { get { return _dllParam7; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param8.
|
||||
/// </summary>
|
||||
/// <value>The DLL param8.</value>
|
||||
public string DllParam8 { get { return _dllParam8; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param9.
|
||||
/// </summary>
|
||||
/// <value>The DLL param9.</value>
|
||||
public string DllParam9 { get { return _dllParam9; } set { _dllParam9 = value; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param10.
|
||||
/// </summary>
|
||||
/// <value>The DLL param10.</value>
|
||||
public string DllParam10 { get { return _dllParam10; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param11.
|
||||
/// </summary>
|
||||
/// <value>The DLL param11.</value>
|
||||
public string DllParam11 { get { return _dllParam11; } }
|
||||
/// <summary>
|
||||
/// Gets the DLL param12.
|
||||
/// </summary>
|
||||
/// <value>The DLL param12.</value>
|
||||
public string DllParam12 { get { return _dllParam12; } }
|
||||
/// <summary>
|
||||
/// 在mes中,是否直接执行
|
||||
/// </summary>
|
||||
public bool isStartRun;
|
||||
/// <summary>
|
||||
/// 右键后触发的post接口
|
||||
/// </summary>
|
||||
public string DelToPost;
|
||||
/// <summary>
|
||||
/// 右键后触发的post接口,获取post所需参数的sql
|
||||
/// </summary>
|
||||
public string DelToPostSql;
|
||||
/// <summary>
|
||||
/// 获取post所需参数的sql后参数存入的sql
|
||||
/// </summary>
|
||||
public string SynchronizationToolSQL;
|
||||
/// <summary>
|
||||
/// 表格操作列按钮图标名
|
||||
/// </summary>
|
||||
public string IcoName { get { return _icoName; } }
|
||||
|
||||
/// <summary>
|
||||
/// 右键复制功能,把值存到剪切板中
|
||||
/// </summary>
|
||||
public bool isCopy { get { return _isCopy; } }
|
||||
|
||||
/// <summary>
|
||||
/// 右键执行时弹出进度条
|
||||
/// </summary>
|
||||
public bool PopupProgressBar;
|
||||
|
||||
/// <summary>
|
||||
/// 右键不满足条件是否隐藏
|
||||
/// </summary>
|
||||
public bool ForbiddenDisplay { get { return _forbiddenDisplay; } }
|
||||
/// <summary>
|
||||
/// 右键执行成功时,弹出提示框(默认弹出)
|
||||
/// </summary>
|
||||
public bool SuccessfulPopup = true;
|
||||
/// <summary>
|
||||
/// 设置是否隐藏窗体页头
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [noon window]; otherwise, <c>false</c>.</value>
|
||||
public bool NoonWindow { get { return _noonWindow; } }
|
||||
/// <summary>
|
||||
/// 右键点击后默认点击搜索按钮的页签id
|
||||
/// </summary>
|
||||
/// <value>The title label object.</value>
|
||||
public string AutomaticSearchId;
|
||||
/// <summary>
|
||||
/// 允许不选中行执行右键
|
||||
/// </summary>
|
||||
public bool AllowNullExec { get { return _allowNullExec; } }
|
||||
/// <summary>
|
||||
/// 单据辅助功能添加保存后sql
|
||||
/// </summary>
|
||||
public string ResultSQL { get { return _resultSQL; } }
|
||||
/// <summary>
|
||||
/// 右键点击时先执行右键的序号(右键点击前先执行对应的右键)
|
||||
/// </summary>
|
||||
public string ExecuteFirstCode;
|
||||
/// <summary>
|
||||
/// 右键点击时先执行右键
|
||||
/// </summary>
|
||||
public GridRightMenuModel ExecuteFirstRightModel;
|
||||
/// <summary>
|
||||
/// 右键后最小化程序
|
||||
/// </summary>
|
||||
public bool DuringExecutionMinimize;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 需要单独处理的exe程序
|
||||
/// </summary>
|
||||
/// <value>The wipe exes.</value>
|
||||
public string[] WipeExes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[] { "iexplore.exe", "lstest.exe" };
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 参数集合
|
||||
/// </summary>
|
||||
/// <value>The parameter list.</value>
|
||||
public List<string> ParamList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (paramList == null)
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
_dllParam1, _dllParam2, _dllParam3, _dllParam4, _dllParam5,
|
||||
_dllParam6, _dllParam7, _dllParam8, _dllParam9, _dllParam10,
|
||||
_dllParam11,_dllParam12
|
||||
}.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.paramList;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
this.paramList = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GridRightMenuModel"/> class.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
public GridRightMenuModel(DataRow item)
|
||||
{
|
||||
if (item == null) return;
|
||||
|
||||
this._id = !string.IsNullOrEmpty(item["id"] + "") ? Convert.ToInt32(item["id"]) : 0;
|
||||
this._menuName = item["menuname"] + "";
|
||||
if (Business.Impl.LanguageTranslation.Translatable)
|
||||
{
|
||||
this._menuName = Business.Impl.LanguageTranslation.GetTranslatedText(this._menuName);
|
||||
}
|
||||
this._dllName = "PubSpec.dll".Equals(item["dllname"] + "") ? "Lskj.PubSpec.dll" : item["dllname"] + "";
|
||||
this._action = item["action"] + "";
|
||||
this._actionType = string.IsNullOrWhiteSpace(item["actiontype"] + "") ? 0 : Convert.ToInt32(item["actiontype"] + "");
|
||||
this._beforeMsg = item["beforeMsg"] + "";
|
||||
this._successMsg = item["msgSuccess"] + "";
|
||||
this._errorMsg = item["msgError"] + "";
|
||||
this._orderId = string.IsNullOrWhiteSpace(item["orderid"] + "") ? 0 : Convert.ToDouble(item["orderid"] + "");
|
||||
this._menuId = string.IsNullOrWhiteSpace(item["menuid"] + "") ? 0 : Convert.ToInt32(item["menuid"] + "");
|
||||
this._dllParam1 = item["dllpar1"] + "";
|
||||
this._dllParam2 = item["dllpar2"] + "";
|
||||
this._dllParam3 = item["dllpar3"] + "";
|
||||
this._dllParam4 = item["dllpar4"] + "";
|
||||
this._dllParam5 = item["dllpar5"] + "";
|
||||
this._dllParam6 = item["dllpar6"] + "";
|
||||
this._dllParam7 = item["dllpar7"] + "";
|
||||
this._dllParam8 = item["dllpar8"] + "";
|
||||
this._dllParam9 = item["dllpar9"] + "";
|
||||
this._dllParam10 = item["dllpar10"] + "";
|
||||
this._dllParam11 = item.Table.Columns.Contains("dllpar11") ? item["dllpar11"] + "" : "";
|
||||
this._dllParam12 = item.Table.Columns.Contains("dllpar12") ? item["dllpar12"] + "" : "";
|
||||
this._menuCond = item["menuCond"] + "";
|
||||
this._refreshCheckState = item.Table.Columns.Contains("refreshCheckState") && !string.IsNullOrEmpty(item["refreshCheckState"] + "") ? "1".Equals(item["refreshCheckState"] + "") : false;
|
||||
|
||||
if (item.Table.Columns.Contains("tab"))
|
||||
this._menuTabName = item["tab"] + "";
|
||||
if (item.Table.Columns.Contains("maxWindow"))
|
||||
this._maxWindow = string.IsNullOrWhiteSpace(item["maxWindow"] + "") ? false : "1".Equals(item["maxWindow"] + "");
|
||||
if (item.Table.Columns.Contains("ifRefresh"))
|
||||
this._refresh = string.IsNullOrWhiteSpace(item["ifRefresh"] + "") ? false : "1".Equals(item["ifRefresh"] + "");
|
||||
if (item.Table.Columns.Contains("privilegeOper"))
|
||||
this._privilegeOper = item["privilegeOper"] + "";
|
||||
if (item.Table.Columns.Contains("DbClickEvent"))
|
||||
this._dbClick = string.IsNullOrWhiteSpace(item["DbClickEvent"] + "") ? false : "1".Equals(item["DbClickEvent"] + "");
|
||||
if (item.Table.Columns.Contains("ifMoreClick"))
|
||||
this._moreClick = string.IsNullOrWhiteSpace(item["ifMoreClick"] + "") ? false : "1".Equals(item["ifMoreClick"] + "");
|
||||
if (item.Table.Columns.Contains("mergeexec"))
|
||||
this._mergEexec = string.IsNullOrWhiteSpace(item["mergeexec"] + "") ? false : "1".Equals(item["mergeexec"] + "");
|
||||
if (item.Table.Columns.Contains("isStartRun"))
|
||||
this.isStartRun = string.IsNullOrWhiteSpace(item["isStartRun"] + "") ? false : "1".Equals(item["isStartRun"] + "");
|
||||
if (item.Table.Columns.Contains("DelToPost"))
|
||||
this.DelToPost = item["DelToPost"] + "";
|
||||
if (item.Table.Columns.Contains("DelToPostSql"))
|
||||
this.DelToPostSql = item["DelToPostSql"] + "";
|
||||
if (item.Table.Columns.Contains("SynchronizationToolSQL"))
|
||||
this.SynchronizationToolSQL = item["SynchronizationToolSQL"] + "";
|
||||
this._icoName = item.Table.Columns.Contains("IcoName") && !string.IsNullOrEmpty(item["IcoName"] + "") ? item["IcoName"] + "" : "";
|
||||
|
||||
if (item.Table.Columns.Contains("isCopy"))
|
||||
this._isCopy = string.IsNullOrWhiteSpace(item["isCopy"] + "") ? false : "1".Equals(item["isCopy"] + "");
|
||||
if (item.Table.Columns.Contains("PopupProgressBar"))
|
||||
this.PopupProgressBar = string.IsNullOrWhiteSpace(item["PopupProgressBar"] + "") ? false : "1".Equals(item["PopupProgressBar"] + "");
|
||||
if (item.Table.Columns.Contains("ForbiddenDisplay"))
|
||||
this._forbiddenDisplay = string.IsNullOrWhiteSpace(item["ForbiddenDisplay"] + "") ? false : "1".Equals(item["ForbiddenDisplay"] + "");
|
||||
if (item.Table.Columns.Contains("SuccessfulPopup"))
|
||||
this.SuccessfulPopup = string.IsNullOrWhiteSpace(item["SuccessfulPopup"] + "") ? true : !"1".Equals(item["SuccessfulPopup"] + "");
|
||||
if (item.Table.Columns.Contains("noonWindow"))
|
||||
this._noonWindow = string.IsNullOrWhiteSpace(item["noonWindow"] + "") ? false : "1".Equals(item["noonWindow"] + "");
|
||||
if (item.Table.Columns.Contains("AutomaticSearchId"))
|
||||
this.AutomaticSearchId = item["AutomaticSearchId"] + "";
|
||||
if (item.Table.Columns.Contains("AllowNullExec"))
|
||||
this._allowNullExec = string.IsNullOrWhiteSpace(item["AllowNullExec"] + "") ? false : "1".Equals(item["AllowNullExec"] + "");
|
||||
if (item.Table.Columns.Contains("ResultSQL"))
|
||||
this._resultSQL = item["ResultSQL"] + "";
|
||||
if (item.Table.Columns.Contains("ExecuteFirstCode"))
|
||||
this.ExecuteFirstCode = item["ExecuteFirstCode"] + "";
|
||||
if (item.Table.Columns.Contains("DuringExecutionMinimize"))
|
||||
this.DuringExecutionMinimize = string.IsNullOrWhiteSpace(item["DuringExecutionMinimize"] + "") ? false : "1".Equals(item["DuringExecutionMinimize"] + "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///是否必须选中行
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has must select row; otherwise, <c>false</c>.</value>
|
||||
public bool IsMustSelectRow()
|
||||
{
|
||||
return ParamList.Contains("{") || _beforeMsg.Contains("{") || _successMsg.Contains("{") || Action.Contains("{");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DevExpress.XtraTreeList;
|
||||
using System.Data;
|
||||
using Lskj.Model;
|
||||
using DevExpress.XtraTreeList.Nodes;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.XtraGrid.Columns;
|
||||
using Lskj.Control.Properties;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using Lskj.Util;
|
||||
using DevExpress.XtraGrid.Views.Base;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Data;
|
||||
using DevExpress.XtraTreeList.Columns;
|
||||
|
||||
namespace Lskj.Control.Model.MenuStrip
|
||||
{
|
||||
public class TreeGridViewMenuStrip : BaseRightMenu
|
||||
{
|
||||
private int _oldRowHandler;
|
||||
private TreeList _treeView;
|
||||
private MyControl _control;
|
||||
protected TreeGridControlEx TreeGridControlObj;
|
||||
public override void InitRightMenus(System.Windows.Forms.Control view, DataTable table, DynamicModel model, MyControl control = null, ContextMenuStrip menu = null)
|
||||
{
|
||||
base.InitRightMenus(view, table, model, control, menu);
|
||||
this.TreeGridControlObj = view as TreeGridControlEx;
|
||||
if (this.TreeGridControlObj != null)
|
||||
{
|
||||
this._treeView = this.TreeGridControlObj.TreeListObj;
|
||||
this.TreeGridControlObj.TreeListObj.ContextMenuStrip = base.MenuStrip;
|
||||
}
|
||||
}
|
||||
protected override DataRow[] GetSelectedRows()
|
||||
{
|
||||
return this.TreeGridControlObj.GetViewFocusedDataRows();
|
||||
}
|
||||
protected override List<string> HandleRightMenuParams(List<string> paramList, DataRow rowData, DataRow[] rowDatas = null, int actionType = 0)
|
||||
{
|
||||
List<string> handleParamList = base.HandleRightMenuParams(paramList, rowData, rowDatas, actionType);
|
||||
|
||||
foreach (string item in handleParamList)
|
||||
{
|
||||
if (item.StartsWith("{"))
|
||||
{
|
||||
string field = item.Replace("{", "").Replace("}", "");
|
||||
if ("COLUMN_NAME".Equals(field))
|
||||
{
|
||||
handleParamList.Add(this._treeView.FocusedColumn.FieldName);
|
||||
}
|
||||
else if ("COLUMN_TITLE".Equals(field))
|
||||
{
|
||||
|
||||
handleParamList.Add(this._treeView.FocusedColumn.GetTextCaption());
|
||||
}
|
||||
else
|
||||
{
|
||||
handleParamList.Add(rowData[field] + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return handleParamList;
|
||||
}
|
||||
protected override void MenuStripOpening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
DataRow[] mSelectRows = this.TreeGridControlObj.GetViewFocusedDataRows();
|
||||
if (mSelectRows == null || mSelectRows.Length == 0) return;
|
||||
|
||||
DataRow mSelectRow = mSelectRows[0];
|
||||
this._treeView.EndCurrentEdit();
|
||||
this._treeView.ShowEditor();
|
||||
|
||||
ContextMenuStrip cmsMenu = (ContextMenuStrip)sender;
|
||||
cmsMenu.Items.Clear();
|
||||
cmsMenu.Items.AddRange(this.RightMenuItems.ToArray());
|
||||
|
||||
// 创建QQ、浏览器右键菜单
|
||||
List<ToolStripMenuItem> mQQArray = new List<ToolStripMenuItem>();
|
||||
List<ToolStripMenuItem> mBrowerArray = new List<ToolStripMenuItem>();
|
||||
|
||||
foreach (TreeListColumn column in this._treeView.Columns)
|
||||
{
|
||||
if (!mSelectRow.Table.Columns.Contains(column.Name))
|
||||
continue;
|
||||
string rowValue = mSelectRow[column.Name] + "";
|
||||
if (!string.IsNullOrWhiteSpace(rowValue))
|
||||
{
|
||||
GridColumnModel model = column.Tag as GridColumnModel;
|
||||
if (model == null) continue;
|
||||
|
||||
if (model.FieldType == ControlType.LabQQ)
|
||||
{
|
||||
ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq);
|
||||
item.Tag = mSelectRow[column.Name] + "";
|
||||
item.Click += new EventHandler(QQItemClick);
|
||||
mQQArray.Add(item);
|
||||
}
|
||||
|
||||
if (model.FieldType == ControlType.LabWWW &&
|
||||
(rowValue.StartsWith("www.") ||
|
||||
rowValue.StartsWith("http://") ||
|
||||
rowValue.StartsWith("https://") ||
|
||||
rowValue.StartsWith("ftp://") ||
|
||||
rowValue.StartsWith("file://")))
|
||||
{
|
||||
ToolStripMenuItem item = new ToolStripMenuItem("(" + column.Caption + ")" + rowValue, Resources.qq);
|
||||
item.Tag = mSelectRow[column.Name] + "";
|
||||
item.Click += new EventHandler(BrowerItemClick);
|
||||
mBrowerArray.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmsMenu.Items.AddRange(mQQArray.ToArray());
|
||||
cmsMenu.Items.AddRange(mBrowerArray.ToArray());
|
||||
|
||||
// 判断右键菜单是否可用
|
||||
foreach (ToolStripItem cms in cmsMenu.Items)
|
||||
{
|
||||
GridRightMenuModel model = cms.Tag as GridRightMenuModel;
|
||||
if (model != null)
|
||||
{
|
||||
if (model.PrivilegeOper.Length > 1 && !model.PrivilegeOper.Contains(ERPInfo.Instance.UserName + ","))
|
||||
{
|
||||
if (model.ForbiddenDisplay)
|
||||
{
|
||||
cms.Visible = false;
|
||||
}
|
||||
cms.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(model.MenuCond))
|
||||
{
|
||||
try
|
||||
{
|
||||
string cond = string.Empty;
|
||||
if (this._control != null)
|
||||
cond = _control.ReplaceParentControlValue(model.MenuCond);
|
||||
cond = ReplaceHelper.ReplaceRowParam(mSelectRow, model.MenuCond);
|
||||
if (this._treeView != null)
|
||||
{
|
||||
List<TreeListCell> cells = this._treeView.GetSelectedCells();
|
||||
if (cells != null && cells.Count > 0 && cond.Contains("{COLUMN_"))
|
||||
{
|
||||
TreeListCell cell = cells[0];
|
||||
DataRow focusedRow = this.BaseGridView.GetFocusedDataRow();
|
||||
string colValue = focusedRow == null || !focusedRow.Table.Columns.Contains(cell.Column.Name) ? "" : focusedRow[cell.Column.Name] + "";
|
||||
cond = cond.ReplaceColumnParam(cell.Column.Name, cell.Column.Caption, colValue);
|
||||
}
|
||||
}
|
||||
if (ControlObj != null)
|
||||
cond = ControlObj.ReplaceParentControlValue(cond);
|
||||
//cms.Enabled = ReplaceHelper.EvalCond(cond);
|
||||
|
||||
if (model.ForbiddenDisplay)
|
||||
{
|
||||
cms.Visible = ValidateCond(cond, null);
|
||||
}
|
||||
|
||||
cms.Enabled = ValidateCond(cond, null); ;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(ResourceKeys.SetRightMenuCondFault + "\r\n" + Message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user