133 lines
5.3 KiB
C#
133 lines
5.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using CommonLib;
|
|
using CommonLib.data;
|
|
using DevExpress.XtraTab;
|
|
using Lskj.PubPageDetail;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace Lskj.PubSearchInfo {
|
|
public partial class FrmMain : FormBase {
|
|
|
|
#region 属性
|
|
/// <summary>
|
|
/// 对象ID
|
|
/// </summary>
|
|
public string objectId { get; set; }
|
|
|
|
/// <summary>
|
|
/// dll 传入Sql 语句
|
|
/// </summary>
|
|
public string dllSql { get; set; }
|
|
|
|
public string isView { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region 构造函数
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
public FrmMain() {
|
|
//DevExpress.Skins.SkinManager.EnableFormSkins();//设置皮肤
|
|
//DevExpress.XtraGrid.Localization.GridResLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraGridCHS();
|
|
//DevExpress.XtraEditors.Controls.Localizer.Active = new Dxper.LocalizationCHS.Win.XtraEditorsCHS();
|
|
//DevExpress.XtraLayout.Localization.LayoutLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraLayoutCHS();
|
|
//DevExpress.XtraPrinting.Localization.PreviewLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraPrintingCHS();
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化数据
|
|
/// </summary>
|
|
/// <param name="e"></param>
|
|
protected override void OnLoad(EventArgs e) {
|
|
this.Text = FormText;
|
|
CreateTabPage();//创建选项卡
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建选项卡
|
|
/// </summary>
|
|
public void CreateTabPage() {
|
|
//清空选项卡
|
|
tabMain.TabPages.Clear();
|
|
//查询选项卡
|
|
String sql = "select * from p_systemDlltabDetail where tab='" + DLLCoid + "' and isVisible=0 order by orderId";
|
|
DataTable dtTab = SqlHelper.ExecuteDataSet(sql).Tables[0];
|
|
foreach (DataRow row in dtTab.Rows) {
|
|
SqlParameter[] p =
|
|
{
|
|
new SqlParameter("@modid",SqlDbType.VarChar,20),
|
|
new SqlParameter("@operatorname",SqlDbType.VarChar,20)
|
|
};
|
|
p[0].Value = row["UnionModule"];
|
|
p[1].Value = OperatorName;
|
|
DataTable dtCol = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "[p_getBaseModuleField]", "temp", p).Tables[0];
|
|
|
|
XtraTabPage tabPage = new XtraTabPage();
|
|
tabPage.Text = row["detailName"] + "";
|
|
Panel_TabPage p_tabPage = new Panel_TabPage();
|
|
tabPage.Controls.Add(p_tabPage);
|
|
p_tabPage.Dock = DockStyle.Fill;
|
|
p_tabPage.BringToFront();
|
|
p_tabPage.nullableFields = dtCol.Rows.OfType<DataRow>().Where(x => x["tagid"] + "" == "1").ToArray();
|
|
p_tabPage.gridList.SetColumns2(dtCol);
|
|
p_tabPage.Name = "tab";
|
|
String idFileName = (row["unionValue"] + "").Replace("{", "").Replace("}", "");
|
|
DataTable dtMain = SqlHelper.ExecuteDataSet("select * from p_systemdlltab where dllcoid='" + row["UnionModule"] + "'").Tables[0];
|
|
if (dtMain != null && dtMain.Rows.Count > 0) {
|
|
String sqlData = dtMain.Rows[0]["SQL"] + "";
|
|
if (sqlData.IndexOf("where", StringComparison.OrdinalIgnoreCase) != -1) {
|
|
sqlData = sqlData + " and " + idFileName + "='" + objectId + "'";
|
|
}
|
|
else {
|
|
sqlData = sqlData + " where " + idFileName + "='" + objectId + "'";
|
|
}
|
|
p_tabPage.gridList.Sql = sqlData;
|
|
}
|
|
p_tabPage.DLLCoid = row["UnionModule"] + "";
|
|
//p_tabPage.FormText = FormText;
|
|
p_tabPage.FormText = row["detailName"] + "";
|
|
p_tabPage.OperatorId = OperatorId;
|
|
p_tabPage.OperatorName = OperatorName;
|
|
p_tabPage.Privilege = Privilege;
|
|
p_tabPage.objectId = idFileName; //EmployeeName
|
|
p_tabPage.objectValue = objectId;
|
|
p_tabPage.dllSql = dllSql.TrimStart('#');
|
|
p_tabPage.isView = isView;
|
|
p_tabPage.autoRefresh = row["autoRefresh"] + "";
|
|
p_tabPage.dtColumns = dtCol;
|
|
tabMain.TabPages.Add(tabPage);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 选项卡点击事件
|
|
/// <summary>
|
|
/// 选项卡点击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void tabMain_SelectedPageChanged(object sender, TabPageChangedEventArgs e) {
|
|
XtraTabPage page = e.Page;
|
|
if (page != null) {
|
|
Control[] ctrs = page.Controls.Find("tab", true);
|
|
if (ctrs != null && ctrs.Length > 0) {
|
|
Panel_TabPage tab = ctrs[0] as Panel_TabPage;
|
|
if (tab.autoRefresh == "1") {
|
|
tab.InitData(tab.gridList.Sql);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|