SVN r520
SVN-Revision: r520
This commit is contained in:
+100
-12
@@ -100,12 +100,12 @@ namespace Lskj.Control
|
||||
/// <summary>
|
||||
/// 带操作表格的自定义控件对象
|
||||
/// </summary>
|
||||
public ModuleGridEx ModuleGridObj { get { return this.moduleGridDetailEx1.ModuleGridObj; } }
|
||||
public ModuleGridEx ModuleGridObj { get { return this.MainBodyTab.Visible ? (this.MainBodyTab.SelectedTabPage.Tag as ModuleGridDetailEx).ModuleGridObj : this.moduleGridDetailEx1.ModuleGridObj; } }
|
||||
/// <summary>
|
||||
/// Gets the module grid detail object.
|
||||
/// </summary>
|
||||
/// <value>The module grid detail object.</value>
|
||||
public ModuleGridDetailEx ModuleGridDetailObj { get { return this.moduleGridDetailEx1; } }
|
||||
public ModuleGridDetailEx ModuleGridDetailObj { get { return this.MainBodyTab.Visible? this.MainBodyTab.SelectedTabPage.Tag as ModuleGridDetailEx : this.moduleGridDetailEx1; } }
|
||||
/// <summary>
|
||||
/// 左侧树结构对象
|
||||
/// </summary>
|
||||
@@ -137,8 +137,10 @@ namespace Lskj.Control
|
||||
/// 上一次选中的树表格节点
|
||||
/// </summary>
|
||||
public TreeListNode treeListNode;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 动态列名表
|
||||
/// </summary>
|
||||
public DataTable ColumnNameTable;
|
||||
|
||||
|
||||
public ModuleEx()
|
||||
@@ -343,7 +345,7 @@ namespace Lskj.Control
|
||||
|
||||
}
|
||||
this.ModuleGridObj.OnExportCallBack += new EventHandler(SetExportGridView);
|
||||
|
||||
this.InitializeTab();
|
||||
|
||||
}
|
||||
else
|
||||
@@ -556,7 +558,8 @@ namespace Lskj.Control
|
||||
/// <param name="where">The where key.</param>
|
||||
protected void SetMainGridView(string where = "")
|
||||
{
|
||||
string sqlValue = ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql);
|
||||
|
||||
string sqlValue = ReplaceHelper.ReplaceWhereCond(this.MainBodyTab.Visible? (this.MainBodyTab.SelectedTabPage.Tag as ModuleGridDetailEx).SysModel.MenuSql : this.SysModel.MenuSql);
|
||||
//sqlValue = this.SysModel.MenuSql.Trim().StartsWith("select", StringComparison.OrdinalIgnoreCase) ? sqlValue + where : sqlValue;
|
||||
//判断是否是select开头,上方的判断可能出现开头是空格或者注释的情况
|
||||
sqlValue = IsSelectAtStart(sqlValue) ? sqlValue + where : sqlValue;
|
||||
@@ -810,7 +813,7 @@ namespace Lskj.Control
|
||||
}
|
||||
else
|
||||
{
|
||||
this.treeGridLeft.GridControl.DataSource = leftGridCondtionTable;
|
||||
this.treeGridLeft.TreeListObj.DataSource = leftGridCondtionTable;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1007,8 +1010,13 @@ namespace Lskj.Control
|
||||
this.ModuleGridObj.GridControlObj.SetDisplayColumns(dataRow["DisplayColumns"] + "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(this.SysModel.DynamicColumnNameSql) && e != null)
|
||||
{
|
||||
DataRow dataRow = this.gridLeft.GetViewFocusedDataRow();
|
||||
string sql = ReplaceHelper.ReplaceRowParam(dataRow, this.SysModel.DynamicColumnNameSql);
|
||||
DataRow row = BaseImpl.GetDataRowResult(sql);
|
||||
if (row != null) this.ModuleGridObj.GridControlObj.SetColumnName(row);
|
||||
}
|
||||
|
||||
this.SetMainGridView(where);
|
||||
if (this.IsDragDetail)
|
||||
@@ -1123,7 +1131,13 @@ namespace Lskj.Control
|
||||
this.ModuleGridObj.GridControlObj.SetDisplayColumns(dataRow["DisplayColumns"] + "");
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(this.SysModel.DynamicColumnNameSql))
|
||||
{
|
||||
DataRow dataRow = this.treeGridLeft.GetViewFocusedDataRow();
|
||||
string sql = ReplaceHelper.ReplaceRowParam(dataRow, this.SysModel.DynamicColumnNameSql);
|
||||
DataRow row = BaseImpl.GetDataRowResult(sql);
|
||||
if (row != null) this.ModuleGridObj.GridControlObj.SetColumnName(row);
|
||||
}
|
||||
|
||||
this.SetMainGridView();
|
||||
if (this.IsDragDetail)
|
||||
@@ -1437,7 +1451,14 @@ namespace Lskj.Control
|
||||
this.ModuleGridObj.GridControlObj.SetDisplayColumns(dataRows[0]["DisplayColumns"] + "");
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(this.SysModel.DynamicColumnNameSql))
|
||||
{
|
||||
DataRow[] dataRows = this.treeLeft.DataSource.Select(this.treeLeft.TreeNodeKeyField + "='" + e.Node.Name + "'");
|
||||
DataRow dataRow = dataRows.Length > 0 ? dataRows[0] : null;
|
||||
string sql = ReplaceHelper.ReplaceRowParam(dataRow, this.SysModel.DynamicColumnNameSql);
|
||||
DataRow row = BaseImpl.GetDataRowResult(sql);
|
||||
if (row != null) this.ModuleGridObj.GridControlObj.SetColumnName(row);
|
||||
}
|
||||
|
||||
this.SetMainGridView(where);
|
||||
if (this.IsDragDetail)
|
||||
@@ -1542,4 +1563,71 @@ namespace Lskj.Control
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否是selete开头(可以处理sql前方有注释和空格的情况)
|
||||
|
||||
/// </summary>
|
||||
/// <param name="sqlText"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsSelectAtStart(string sqlText)
|
||||
{
|
||||
// Remove comments and whitespace at the start of the text
|
||||
string cleanedText = Regex.Replace(sqlText, @"^(\s*--.*?(\r\n|\n)|\s*)*", "");
|
||||
// Check if the remaining text starts with 'select'
|
||||
return cleanedText.StartsWith("select", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 关闭模块时调用
|
||||
/// </summary>
|
||||
public void CloseModule()
|
||||
{
|
||||
if (this.SysModel != null && this.SysModel.RecordRowUponExit)
|
||||
{
|
||||
int Handle = this.ModuleGridObj.GridControlObj.GridView.FocusedRowHandle > 0 ? this.ModuleGridObj.GridControlObj.GridView.FocusedRowHandle : 0;
|
||||
IniHelper.Write(string.Format("RecordRowUponExit_{0}", this.Model.ModuleCode), Handle + "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化页签
|
||||
/// </summary>
|
||||
public void InitializeTab()
|
||||
{
|
||||
DataTable table = BaseModuleImpl.GetBaseAttach(this.Model.ModuleCode);//查看是否有附加模块
|
||||
if (table.Rows.Count > 0)
|
||||
{
|
||||
XtraTabPage MainTableTab = new XtraTabPage();
|
||||
MainTableTab.Text = this.SysModel.MenuText;
|
||||
MainTableTab.Controls.Add(this.moduleGridDetailEx1);
|
||||
MainTableTab.Tag = this.moduleGridDetailEx1;
|
||||
this.MainBodyTab.TabPages.Add(MainTableTab);
|
||||
|
||||
foreach (DataRow item in table.Rows)
|
||||
{
|
||||
DataRow modelRow = MainImpl.GetSystemdllTab(item["unionModule"] + "");
|
||||
//modelRow = MainImpl.GetSystemdllTab ("mps001");
|
||||
if (modelRow == null) continue;
|
||||
ModuleModel addModel = new ModuleModel(modelRow);
|
||||
|
||||
XtraTabPage page = new XtraTabPage();
|
||||
page.Text = item["AttachName"] + "";
|
||||
ModuleGridDetailEx modegridEx = new ModuleGridDetailEx();
|
||||
modegridEx.Name = "moduleGridDetailEx";
|
||||
modegridEx.Dock = DockStyle.Fill;
|
||||
DynamicModel dyncModel = new DynamicModuleModel(new string[] { "0", ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "1", item["unionModule"] + "", "0" });
|
||||
modegridEx.InitializeControl(addModel, dyncModel);
|
||||
|
||||
//modegridEx.SearchObj.OnDataSourceBindCallBack += OnDataSourceBindCallBack;
|
||||
|
||||
//加载复选框
|
||||
if (table.Columns.Contains("gridObjCheck") && "1".Equals(item["gridObjCheck"] + ""))
|
||||
{
|
||||
GridDragGrid.GridAddCheckBox(modegridEx.ModuleGridObj.GridControlObj.GridView);
|
||||
}
|
||||
page.Controls.Add(modegridEx);
|
||||
page.Tag = modegridEx;
|
||||
this.MainBodyTab.TabPages.Add(page);
|
||||
}
|
||||
|
||||
this.MainBodyTab.SelectedPageChanged += MainBodyTab_SelectedPageChanged;
|
||||
thi
|
||||
Reference in New Issue
Block a user