1036 lines
49 KiB
C#
1036 lines
49 KiB
C#
using DevExpress.XtraEditors.Repository;
|
|
using DevExpress.XtraGrid.Columns;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using Kdbndp;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Control;
|
|
using Lskj.Core;
|
|
using Lskj.Util;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Data.Common;
|
|
using System.Data.SqlClient;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.PubApiSetModule
|
|
{
|
|
public partial class FrmMain : BaseForm
|
|
{
|
|
public DynamicApiSetModel Model;
|
|
public DbDataAdapter SendMainAdapterObj;
|
|
public DbDataAdapter SendDetailAdapterObj;
|
|
public DbDataAdapter GetMainAdapterObj;
|
|
public DbDataAdapter GetDetailAdapterObj;
|
|
public FrmMain()
|
|
{
|
|
InitializeComponent();
|
|
this.Load += OnFrmMainLoad;
|
|
}
|
|
/// <summary>
|
|
/// 初始化时
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnFrmMainLoad(object sender, EventArgs e)
|
|
{
|
|
InitlizeSpiltLocation();
|
|
InitEventApiTable();
|
|
InitEventApiPmsTable();
|
|
InitToLsEventApiTable();
|
|
InitToLsEventApiPmsTable();
|
|
InitToLsEventApiDtlsTable();
|
|
InitToLsEventApiDtlsPmsTable();
|
|
InitEventApiLogTable();
|
|
InitEventApiLogErrorTable();
|
|
InitToLsEventApiLogTable();
|
|
InitEvents();
|
|
InitColumnsData();
|
|
InitApiTabDataSource();
|
|
InitGetApiTabDataSource();
|
|
}
|
|
/// <summary>
|
|
/// 初始化事件
|
|
/// </summary>
|
|
private void InitEvents()
|
|
{
|
|
splitControlSend.SplitterPositionChanged += OnSplitContainerPositionChanged;
|
|
splitControlGet.SplitterPositionChanged += OnSplitContainerPositionChanged;
|
|
#region send
|
|
sendMainView.CustomColumnDisplayText += OnCustomColumnDisplayText;
|
|
sendDetailView.CustomColumnDisplayText += OnCustomColumnDisplayText;
|
|
sendMainView.InitNewRow += OnViewInitNewRow;
|
|
sendDetailView.InitNewRow += OnViewInitNewRow;
|
|
sendMainView.FocusedRowObjectChanged += OnFocusedRowObjectChanged;
|
|
#endregion
|
|
#region get
|
|
getMainView.CustomColumnDisplayText += OnCustomColumnDisplayText;
|
|
getDetailView.CustomColumnDisplayText += OnCustomColumnDisplayText;
|
|
getMainView.InitNewRow += OnViewInitNewRow;
|
|
getDetailView.InitNewRow += OnViewInitNewRow;
|
|
getMainView.FocusedRowObjectChanged += OnFocusedRowObjectChanged;
|
|
#endregion
|
|
#region ADD
|
|
btnApiAdd.Click += OnBtnAddClick;
|
|
btnPmsAdd.Click += OnBtnAddClick;
|
|
btnGetApiAdd.Click += OnBtnAddClick;
|
|
btnGetApiPmsAdd.Click += OnBtnAddClick;
|
|
#endregion
|
|
#region SAVE
|
|
btnApiSave.Click += OnBtnSaveClick;
|
|
btnPmsSave.Click += OnBtnSaveClick;
|
|
btnGetApiSave.Click += OnBtnSaveClick;
|
|
btnGetApiPmsSave.Click += OnBtnSaveClick;
|
|
#endregion
|
|
#region DELETE
|
|
btnApiDelete.Click += OnBtnDeleteClick;
|
|
btnPmsDelete.Click += OnBtnDeleteClick;
|
|
btnGetApiDelete.Click += OnBtnDeleteClick;
|
|
btnGetApiPmsDelete.Click += OnBtnDeleteClick;
|
|
#endregion
|
|
#region REFRESH
|
|
btnApiRefresh.Click += OnBtnRefreshClick;
|
|
btnPmsRefresh.Click += OnBtnRefreshClick;
|
|
btnGetApiRefresh.Click += OnBtnRefreshClick;
|
|
btnGetApiPmsRefresh.Click += OnBtnRefreshClick;
|
|
#endregion
|
|
}
|
|
/// <summary>
|
|
/// 添加按钮点击
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnBtnAddClick(object sender, EventArgs e)
|
|
{
|
|
if (sender == btnApiAdd)
|
|
{
|
|
sendMainView.AddNewRow();
|
|
}
|
|
else if (sender == btnPmsAdd)
|
|
{
|
|
sendDetailView.AddNewRow();
|
|
}
|
|
else if (sender == btnGetApiAdd)
|
|
{
|
|
getMainView.AddNewRow();
|
|
}
|
|
else if (sender == btnGetApiPmsAdd)
|
|
{
|
|
getDetailView.AddNewRow();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 删除按钮点击
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnBtnDeleteClick(object sender, EventArgs e)
|
|
{
|
|
if (sender == btnApiDelete)
|
|
{
|
|
sendMainView.DeleteRow(sendMainView.FocusedRowHandle);
|
|
}
|
|
else if (sender == btnPmsDelete)
|
|
{
|
|
sendDetailView.DeleteRow(sendDetailView.FocusedRowHandle);
|
|
}
|
|
else if (sender == btnGetApiDelete)
|
|
{
|
|
getMainView.DeleteRow(getMainView.FocusedRowHandle);
|
|
}
|
|
else if (sender == btnGetApiPmsDelete)
|
|
{
|
|
getDetailView.DeleteRow(getDetailView.FocusedRowHandle);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 保存按钮点击
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnBtnSaveClick(object sender, EventArgs e)
|
|
{
|
|
if (sender == btnApiSave)
|
|
{
|
|
if (sendGcMain.DataSource != null && sendGcMain.DataSource is DataTable sourceTable)
|
|
{
|
|
SendMainAdapterObj.Update(sourceTable);
|
|
int rowHandle = sendMainView.FocusedRowHandle;
|
|
InitApiTabDataSource();
|
|
sendMainView.FocusedRowHandle = rowHandle;
|
|
}
|
|
}
|
|
else if (sender == btnPmsSave)
|
|
{
|
|
if (sendGcDetail.DataSource != null && sendGcDetail.DataSource is DataTable sourceTable)
|
|
{
|
|
SendDetailAdapterObj.Update(sourceTable);
|
|
DataRow focusedRow = sendMainView.GetFocusedDataRow();
|
|
string apiId = focusedRow["id"] + "";
|
|
int rowHandle = sendDetailView.FocusedRowHandle;
|
|
InitApiPmsTabDataSource(apiId);
|
|
sendDetailView.FocusedRowHandle = rowHandle;
|
|
}
|
|
}
|
|
else if (sender == btnGetApiSave)
|
|
{
|
|
if (getGcMain.DataSource != null && getGcMain.DataSource is DataTable sourceTable)
|
|
{
|
|
GetMainAdapterObj.Update(sourceTable);
|
|
DataRow focusedRow = getMainView.GetFocusedDataRow();
|
|
string apiId = focusedRow["id"] + "";
|
|
int rowHandle = getMainView.FocusedRowHandle;
|
|
InitGetApiTabDataSource();
|
|
getMainView.FocusedRowHandle = rowHandle;
|
|
}
|
|
}
|
|
else if (sender == btnGetApiPmsSave)
|
|
{
|
|
if (getGcDetail.DataSource != null && getGcDetail.DataSource is DataTable sourceTable)
|
|
{
|
|
GetDetailAdapterObj.Update(sourceTable);
|
|
DataRow focusedRow = getDetailView.GetFocusedDataRow();
|
|
string apiId = focusedRow["id"] + "";
|
|
int rowHandle = getDetailView.FocusedRowHandle;
|
|
InitGetApiPmsTabDataSource(apiId);
|
|
getDetailView.FocusedRowHandle = rowHandle;
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 刷新数据
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnBtnRefreshClick(object sender, EventArgs e)
|
|
{
|
|
if (sender == btnApiRefresh)
|
|
{
|
|
int rowHandle = sendMainView.FocusedRowHandle;
|
|
InitApiTabDataSource();
|
|
sendMainView.FocusedRowHandle = rowHandle;
|
|
}
|
|
else if (sender == btnPmsRefresh)
|
|
{
|
|
DataRow focusedRow = sendMainView.GetFocusedDataRow();
|
|
if (focusedRow != null)
|
|
{
|
|
string apiId = focusedRow["id"] + "";
|
|
int rowHandle = sendDetailView.FocusedRowHandle;
|
|
InitApiPmsTabDataSource(apiId);
|
|
sendDetailView.FocusedRowHandle = rowHandle;
|
|
}
|
|
}
|
|
else if (sender == btnGetApiRefresh)
|
|
{
|
|
int rowHandle = getMainView.FocusedRowHandle;
|
|
InitGetApiTabDataSource();
|
|
getMainView.FocusedRowHandle = rowHandle;
|
|
}
|
|
else if (sender == btnGetApiPmsRefresh)
|
|
{
|
|
DataRow focusedRow = getDetailView.GetFocusedDataRow();
|
|
if (focusedRow != null)
|
|
{
|
|
string apiId = focusedRow["id"] + "";
|
|
int rowHandle = getDetailView.FocusedRowHandle;
|
|
InitGetApiPmsTabDataSource(apiId);
|
|
getDetailView.FocusedRowHandle = rowHandle;
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 选中行改变时
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnFocusedRowObjectChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventArgs e)
|
|
{
|
|
if (sender == sendMainView)
|
|
{
|
|
if (e.Row is DataRowView dataRowView)
|
|
{
|
|
DataRow focusedRow = dataRowView.Row;
|
|
string apiId = focusedRow["id"] + "";
|
|
InitApiPmsTabDataSource(apiId);
|
|
}
|
|
}
|
|
else if (sender == getMainView)
|
|
{
|
|
if (e.Row is DataRowView dataRowView)
|
|
{
|
|
DataRow focusedRow = dataRowView.Row;
|
|
string apiId = focusedRow["id"] + "";
|
|
InitGetApiPmsTabDataSource(apiId);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 显示下拉框的值
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnCustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|
{
|
|
if (e.Column.ColumnEdit is RepositoryItemComboBox repositoryItemCombo)
|
|
{
|
|
ComBoxModel comBoxModel = repositoryItemCombo.Items.Cast<ComBoxModel>().Where(n => (n.Value + "").Equals(e.Value + "")).FirstOrDefault();
|
|
if (comBoxModel != null)
|
|
{
|
|
e.DisplayText = comBoxModel.ToString();
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 添加行时
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
|
|
private void OnViewInitNewRow(object sender, InitNewRowEventArgs e)
|
|
{
|
|
GridView gridView = (GridView)sender;
|
|
if (gridView == sendMainView)
|
|
{
|
|
}
|
|
else if (gridView == sendDetailView)
|
|
{
|
|
DataRow parentRow = sendMainView.GetFocusedDataRow();
|
|
DataRow dataRow = gridView.GetDataRow(e.RowHandle);
|
|
dataRow["apiId"] = parentRow["id"];
|
|
}
|
|
if (gridView == getMainView)
|
|
{
|
|
}
|
|
else if (gridView == getDetailView)
|
|
{
|
|
DataRow parentRow = getMainView.GetFocusedDataRow();
|
|
DataRow dataRow = gridView.GetDataRow(e.RowHandle);
|
|
dataRow["mainId"] = parentRow["id"];
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 初始化接口主表数据源
|
|
/// </summary>
|
|
private void InitApiTabDataSource()
|
|
{
|
|
//SendMain
|
|
SendMainAdapterObj = BaseImpl.GetAdapterResult("select * from p_systemeventapitab");
|
|
DataTable sendMainTable = new DataTable();
|
|
DbCommandBuilder dbCommandBuilder = SqlHelper.dbFactory.CreateCommandBuilder();
|
|
dbCommandBuilder.DataAdapter = SendMainAdapterObj;
|
|
SendMainAdapterObj.Fill(sendMainTable);
|
|
sendGcMain.DataSource = sendMainTable;
|
|
}
|
|
/// <summary>
|
|
/// 初始化接口明细表数据源
|
|
/// </summary>
|
|
private void InitApiPmsTabDataSource(string apiId)
|
|
{
|
|
//SendDetail
|
|
SendDetailAdapterObj = BaseImpl.GetAdapterResult($"select * from p_systemeventapipmstab where apiid = '{apiId}'");
|
|
DataTable sendDetailTable = new DataTable();
|
|
DbCommandBuilder dbCommandBuilder = SqlHelper.dbFactory.CreateCommandBuilder();
|
|
dbCommandBuilder.DataAdapter = SendDetailAdapterObj;
|
|
SendDetailAdapterObj.Fill(sendDetailTable);
|
|
sendGcDetail.DataSource = sendDetailTable;
|
|
}
|
|
/// <summary>
|
|
/// 初始化朗速接口主表数据源
|
|
/// </summary>
|
|
private void InitGetApiTabDataSource()
|
|
{
|
|
//SendMain
|
|
GetMainAdapterObj = BaseImpl.GetAdapterResult("select * from P_SystemToLsApiTab");
|
|
DataTable getMainTable = new DataTable();
|
|
DbCommandBuilder dbCommandBuilder = SqlHelper.dbFactory.CreateCommandBuilder();
|
|
dbCommandBuilder.DataAdapter = GetMainAdapterObj;
|
|
GetMainAdapterObj.Fill(getMainTable);
|
|
getGcMain.DataSource = getMainTable;
|
|
}
|
|
/// <summary>
|
|
/// 初始化朗速接口参数数据源
|
|
/// </summary>
|
|
private void InitGetApiPmsTabDataSource(string apiId)
|
|
{
|
|
//SendDetail
|
|
GetDetailAdapterObj = BaseImpl.GetAdapterResult($"select * from P_SystemToLsApiPmsTab where mainId = '{apiId}'");
|
|
DataTable getDetailTable = new DataTable();
|
|
DbCommandBuilder dbCommandBuilder = SqlHelper.dbFactory.CreateCommandBuilder();
|
|
dbCommandBuilder.DataAdapter = GetDetailAdapterObj;
|
|
GetDetailAdapterObj.Fill(getDetailTable);
|
|
getGcDetail.DataSource = getDetailTable;
|
|
}
|
|
/// <summary>
|
|
/// 初始化表格列
|
|
/// </summary>
|
|
private void InitColumnsData()
|
|
{
|
|
#region 主表
|
|
idColumn.OptionsColumn.AllowEdit = false;
|
|
//reqDataType
|
|
reqDataTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "Json" });
|
|
reqDataTypeComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "Text" });
|
|
reqDataTypeComboBox.Items.Add(new ComBoxModel() { Value = 2, Text = "Xml" });
|
|
//resDataType
|
|
resDataTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "Json" });
|
|
resDataTypeComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "Text" });
|
|
resDataTypeComboBox.Items.Add(new ComBoxModel() { Value = 2, Text = "Xml" });
|
|
//method
|
|
methodComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "Get" });
|
|
methodComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "Post" });
|
|
//actionType
|
|
actionTypeComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "手动触发" });
|
|
actionTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "循环触发" });
|
|
//eType
|
|
eTypeComboBox.Items.Add(new ComBoxModel() { Value = "AfterModuleDataChange", Text = "数据改变后" });
|
|
eTypeComboBox.Items.Add(new ComBoxModel() { Value = "BeforeModuleDataChange", Text = "数据改变前" });
|
|
eTypeComboBox.Items.Add(new ComBoxModel() { Value = "AfterModuleContextMenu", Text = "右键执行后" });
|
|
eTypeComboBox.Items.Add(new ComBoxModel() { Value = "BeforeModuleContextMenu", Text = "右键执行前" });
|
|
eTypeComboBox.Items.Add(new ComBoxModel() { Value = "AfterModuleAuditStateChange", Text = "审核执行后" });
|
|
eTypeComboBox.Items.Add(new ComBoxModel() { Value = "BeforeModuleAuditStateChange", Text = "审核执行前" });
|
|
eTypeComboBox.Items.Add(new ComBoxModel() { Value = "BeforeUploadFile", Text = "文件上传前" });
|
|
eTypeComboBox.Items.Add(new ComBoxModel() { Value = "AfterUploadFile", Text = "文件上传后" });
|
|
//tokenType
|
|
tokenTypeComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "Token文本" });
|
|
tokenTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "Cookie" });
|
|
//eTypeCode
|
|
eTypeCodeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "新增" });
|
|
eTypeCodeComboBox.Items.Add(new ComBoxModel() { Value = 2, Text = "更新" });
|
|
eTypeCodeComboBox.Items.Add(new ComBoxModel() { Value = 3, Text = "删除" });
|
|
eTypeCodeComboBox.Items.Add(new ComBoxModel() { Value = 21, Text = "提交审核" });
|
|
eTypeCodeComboBox.Items.Add(new ComBoxModel() { Value = 31, Text = "审核" });
|
|
eTypeCodeComboBox.Items.Add(new ComBoxModel() { Value = 32, Text = "反审" });
|
|
//pmsType
|
|
pmsTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "老版" });
|
|
pmsTypeComboBox.Items.Add(new ComBoxModel() { Value = 2, Text = "新版" });
|
|
//allowShowMsg
|
|
allowShowMsgComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "不提示" });
|
|
allowShowMsgComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "提示" });
|
|
//disableTag
|
|
disableTagComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "启用" });
|
|
disableTagComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "禁用" });
|
|
#endregion
|
|
#region 明细表
|
|
pmsIdColumn.OptionsColumn.AllowEdit = false;
|
|
//pmType
|
|
pmTypeComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "发送参数" });
|
|
pmTypeComboBox.Items.Add(new ComBoxModel() { Value = 2, Text = "Header参数" });
|
|
pmTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "接收参数" });
|
|
//valueType
|
|
valueTypeComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "json值" });
|
|
valueTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "json对象" });
|
|
valueTypeComboBox.Items.Add(new ComBoxModel() { Value = 2, Text = "json数组" });
|
|
valueTypeComboBox.Items.Add(new ComBoxModel() { Value = 3, Text = "文件" });
|
|
//valueDataType
|
|
valueDataTypeComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "文本" });
|
|
valueDataTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "整数" });
|
|
valueDataTypeComboBox.Items.Add(new ComBoxModel() { Value = 2, Text = "小数" });
|
|
//allowNull
|
|
allowNullComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "必填" });
|
|
allowNullComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "非必填" });
|
|
//valueEncryptType
|
|
valueEncryptTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "UTF8MD5小写" });
|
|
valueEncryptTypeComboBox.Items.Add(new ComBoxModel() { Value = 2, Text = "UTF8MD5大写" });
|
|
valueEncryptTypeComboBox.Items.Add(new ComBoxModel() { Value = 3, Text = "URL地址加密" });
|
|
valueEncryptTypeComboBox.Items.Add(new ComBoxModel() { Value = 4, Text = "URL文件Base64" });
|
|
valueEncryptTypeComboBox.Items.Add(new ComBoxModel() { Value = 5, Text = "RSA" });
|
|
valueEncryptTypeComboBox.Items.Add(new ComBoxModel() { Value = 101, Text = "航天凯特特殊加密" });
|
|
valueEncryptTypeComboBox.Items.Add(new ComBoxModel() { Value = 102, Text = "SHA256ToBase64" });
|
|
valueEncryptTypeComboBox.Items.Add(new ComBoxModel() { Value = 103, Text = "道宏发票接口特殊加密" });
|
|
valueEncryptTypeComboBox.Items.Add(new ComBoxModel() { Value = 104, Text = "SHA256ToBit" });
|
|
#endregion
|
|
#region 朗速接口主表
|
|
getIdColumn.OptionsColumn.AllowEdit = false;
|
|
//IsLogin
|
|
getIsLoginComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "启用验证" });
|
|
getIsLoginComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "禁止验证" });
|
|
//actionType
|
|
getActionTypeComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "新增/更新" });
|
|
getActionTypeComboBox.Items.Add(new ComBoxModel() { Value = 2, Text = "删除" });
|
|
getActionTypeComboBox.Items.Add(new ComBoxModel() { Value = 3, Text = "自定义" });
|
|
#endregion
|
|
#region 朗速接口参数表
|
|
getPmsDisInsertComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "禁止插入" });
|
|
getPmsDisInsertComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "允许插入" });
|
|
getPmsDisUpdateComboBox.Items.Add(new ComBoxModel() { Value = 1, Text = "禁止更新" });
|
|
getPmsDisUpdateComboBox.Items.Add(new ComBoxModel() { Value = 0, Text = "允许更新" });
|
|
#endregion
|
|
sendMainView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDown;
|
|
foreach (GridColumn gridColumn in sendMainView.Columns)
|
|
{
|
|
if (gridColumn.ColumnEdit is RepositoryItemComboBox repositoryItemCombo)
|
|
{
|
|
repositoryItemCombo.ParseEditValue += (s, e) =>
|
|
{
|
|
if (e.Value is ComBoxModel comBoxModel)
|
|
{
|
|
e.Value = comBoxModel.Value;
|
|
e.Handled = true;
|
|
}
|
|
};
|
|
repositoryItemCombo.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
|
}
|
|
}
|
|
sendDetailView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDown;
|
|
foreach (GridColumn gridColumn in sendDetailView.Columns)
|
|
{
|
|
if (gridColumn.ColumnEdit is RepositoryItemComboBox repositoryItemCombo)
|
|
{
|
|
repositoryItemCombo.ParseEditValue += (s, e) =>
|
|
{
|
|
if (e.Value is ComBoxModel comBoxModel)
|
|
{
|
|
e.Value = comBoxModel.Value;
|
|
e.Handled = true;
|
|
}
|
|
};
|
|
repositoryItemCombo.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
|
}
|
|
}
|
|
getMainView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDown;
|
|
foreach (GridColumn gridColumn in getMainView.Columns)
|
|
{
|
|
if (gridColumn.ColumnEdit is RepositoryItemComboBox repositoryItemCombo)
|
|
{
|
|
repositoryItemCombo.ParseEditValue += (s, e) =>
|
|
{
|
|
if (e.Value is ComBoxModel comBoxModel)
|
|
{
|
|
e.Value = comBoxModel.Value;
|
|
e.Handled = true;
|
|
}
|
|
};
|
|
repositoryItemCombo.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
|
}
|
|
}
|
|
getDetailView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDown;
|
|
foreach (GridColumn gridColumn in getDetailView.Columns)
|
|
{
|
|
if (gridColumn.ColumnEdit is RepositoryItemComboBox repositoryItemCombo)
|
|
{
|
|
repositoryItemCombo.ParseEditValue += (s, e) =>
|
|
{
|
|
if (e.Value is ComBoxModel comBoxModel)
|
|
{
|
|
e.Value = comBoxModel.Value;
|
|
e.Handled = true;
|
|
}
|
|
};
|
|
repositoryItemCombo.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
|
}
|
|
}
|
|
}
|
|
#region 构建数据表
|
|
/// <summary>
|
|
/// 接口主表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool InitEventApiTable()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> colDic = new Dictionary<string, string>();
|
|
colDic.Add("title", "varchar(200)");
|
|
colDic.Add("url", "varchar(1000)");
|
|
colDic.Add("dllcoid", "varchar(100)");
|
|
colDic.Add("contextMenuId", "int");
|
|
colDic.Add("reqDataType", "int");
|
|
colDic.Add("resDataType", "int");
|
|
colDic.Add("method", "int");
|
|
colDic.Add("datasource", "varchar(8000)");
|
|
colDic.Add("actionType", "int");
|
|
colDic.Add("actionDelay", "int");
|
|
colDic.Add("eType", "varchar(1000)");
|
|
colDic.Add("finshAction", "varchar(8000)");
|
|
colDic.Add("orderValue", "int");
|
|
colDic.Add("isSucceedCond", "varchar(100)");
|
|
colDic.Add("isTokenErrorCond", "varchar(100)");
|
|
colDic.Add("tokenApiId", "int");
|
|
colDic.Add("tokenType", "int");
|
|
colDic.Add("dynamicToken", "varchar(2000)");
|
|
colDic.Add("pmsType", "int");
|
|
colDic.Add("allowShowMsg", "int");
|
|
colDic.Add("ContentType", "varchar(200)");
|
|
colDic.Add("eTypeCode", "int");
|
|
colDic.Add("disableTag", "int");
|
|
colDic.Add("customMsg", "varchar(500)");
|
|
string isExitApiTab = "select top 1 * from sysObjects where Id=OBJECT_ID(N'p_systemEventApiTab') and xtype='U'";
|
|
DataTable apiTab = SqlHelper.ExecuteDataTable(isExitApiTab);
|
|
if (apiTab.Rows.Count > 0)//存在日志表
|
|
{
|
|
DataTable columnsTab = SqlHelper.ExecuteDataTable(string.Format("select name from syscolumns where id=object_id('p_systemEventApiTab')"));
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
|
if (dataRows.Length == 0)
|
|
{
|
|
string addColSql = string.Format("alter table p_systemEventApiTab add {0} {1}", colunmField.Key, colunmField.Value);
|
|
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string createTabSql = "create table p_systemEventApiTab(id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,{0})";
|
|
string createCol = string.Empty;
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
}
|
|
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 接口参数表
|
|
/// </summary>
|
|
private bool InitEventApiPmsTable()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> colDic = new Dictionary<string, string>();
|
|
colDic.Add("apiId", "int");
|
|
colDic.Add("title", "varchar(200)");
|
|
colDic.Add("pmType", "int");
|
|
colDic.Add("valueType", "int");
|
|
colDic.Add("pmsDataSource", "varchar(8000)");
|
|
colDic.Add("name", "varchar(100)");
|
|
colDic.Add("value", "varchar(8000)");
|
|
colDic.Add("valueDataType", "int");
|
|
colDic.Add("unionPmsId", "int");
|
|
colDic.Add("valueEncryptType", "int");
|
|
colDic.Add("encryptKey", "varchar(100)");
|
|
colDic.Add("allowNull", "int");
|
|
string isExitApiTab = "select top 1 * from sysObjects where Id=OBJECT_ID(N'P_systemEventApiPmsTab') and xtype='U'";
|
|
DataTable apiTab = SqlHelper.ExecuteDataTable(isExitApiTab);
|
|
if (apiTab.Rows.Count > 0)//存在日志表
|
|
{
|
|
DataTable columnsTab = SqlHelper.ExecuteDataTable(string.Format("select name from syscolumns where id=object_id('P_systemEventApiPmsTab')"));
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
|
if (dataRows.Length == 0)
|
|
{
|
|
string addColSql = string.Format("alter table P_systemEventApiPmsTab add {0} {1}", colunmField.Key, colunmField.Value);
|
|
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string createTabSql = "create table P_systemEventApiPmsTab(id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,{0})";
|
|
string createCol = string.Empty;
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
}
|
|
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 朗速接口主表
|
|
/// </summary>
|
|
private bool InitToLsEventApiTable()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> colDic = new Dictionary<string, string>();
|
|
colDic.Add("tableName", "varchar(100)");
|
|
colDic.Add("actionType", "int");
|
|
colDic.Add("primaryKey", "varchar(200)");
|
|
colDic.Add("outputKey", "varchar(1000)");
|
|
colDic.Add("afterSql", "varchar(MAX)");
|
|
colDic.Add("isLogin", "int");
|
|
colDic.Add("description", "varchar(50)");
|
|
string isExitApiTab = "select top 1 * from sysObjects where Id=OBJECT_ID(N'P_SystemToLsApiTab') and xtype='U'";
|
|
DataTable apiTab = SqlHelper.ExecuteDataTable(isExitApiTab);
|
|
if (apiTab.Rows.Count > 0)//存在日志表
|
|
{
|
|
DataTable columnsTab = SqlHelper.ExecuteDataTable(string.Format("select name from syscolumns where id=object_id('P_SystemToLsApiTab')"));
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
|
if (dataRows.Length == 0)
|
|
{
|
|
string addColSql = string.Format("alter table P_SystemToLsApiTab add {0} {1}", colunmField.Key, colunmField.Value);
|
|
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string createTabSql = "create table P_SystemToLsApiTab(id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,{0})";
|
|
string createCol = string.Empty;
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
}
|
|
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 朗速接口参数表
|
|
/// </summary>
|
|
private bool InitToLsEventApiPmsTable()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> colDic = new Dictionary<string, string>();
|
|
colDic.Add("mainId", "int");
|
|
colDic.Add("fileName", "varchar(500)");
|
|
colDic.Add("disInsert", "int");
|
|
colDic.Add("disUpdate", "int");
|
|
colDic.Add("defaultValue", "varchar(500)");
|
|
//colDic.Add("conditionInsert", "varchar(1000)");
|
|
//colDic.Add("condition", "varchar(1000)");
|
|
string isExitApiTab = "select top 1 * from sysObjects where Id=OBJECT_ID(N'P_SystemToLsApiPmsTab') and xtype='U'";
|
|
DataTable apiTab = SqlHelper.ExecuteDataTable(isExitApiTab);
|
|
if (apiTab.Rows.Count > 0)//存在日志表
|
|
{
|
|
DataTable columnsTab = SqlHelper.ExecuteDataTable(string.Format("select name from syscolumns where id=object_id('P_SystemToLsApiPmsTab')"));
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
|
if (dataRows.Length == 0)
|
|
{
|
|
string addColSql = string.Format("alter table P_SystemToLsApiPmsTab add {0} {1}", colunmField.Key, colunmField.Value);
|
|
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string createTabSql = "create table P_SystemToLsApiPmsTab(id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,{0})";
|
|
string createCol = string.Empty;
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
}
|
|
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 朗速接口明细表
|
|
/// </summary>
|
|
private bool InitToLsEventApiDtlsTable()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> colDic = new Dictionary<string, string>();
|
|
colDic.Add("mainId", "int");
|
|
colDic.Add("fileName", "varchar(100)");
|
|
colDic.Add("tableName", "varchar(100)");
|
|
colDic.Add("primaryKey", "varchar(100)");
|
|
colDic.Add("afterSql", "varchar(MAX)");
|
|
colDic.Add("mainUnionKey", "varchar(100)");
|
|
colDic.Add("dtlUnionKey", "varchar(100)");
|
|
string isExitApiTab = "select top 1 * from sysObjects where Id=OBJECT_ID(N'P_SystemToLsApiDtlsTab') and xtype='U'";
|
|
DataTable apiTab = SqlHelper.ExecuteDataTable(isExitApiTab);
|
|
if (apiTab.Rows.Count > 0)//存在日志表
|
|
{
|
|
DataTable columnsTab = SqlHelper.ExecuteDataTable(string.Format("select name from syscolumns where id=object_id('P_SystemToLsApiDtlsTab')"));
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
|
if (dataRows.Length == 0)
|
|
{
|
|
string addColSql = string.Format("alter table P_SystemToLsApiDtlsTab add {0} {1}", colunmField.Key, colunmField.Value);
|
|
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string createTabSql = "create table P_SystemToLsApiDtlsTab(id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,{0})";
|
|
string createCol = string.Empty;
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
}
|
|
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 朗速接口明细参数表
|
|
/// </summary>
|
|
private bool InitToLsEventApiDtlsPmsTable()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> colDic = new Dictionary<string, string>();
|
|
colDic.Add("mainId", "int");
|
|
colDic.Add("fileName", "varchar(500)");
|
|
colDic.Add("defaultValue", "varchar(500)");
|
|
string isExitApiTab = "select top 1 * from sysObjects where Id=OBJECT_ID(N'P_SystemToLsApiDtlsPmsTab') and xtype='U'";
|
|
DataTable apiTab = SqlHelper.ExecuteDataTable(isExitApiTab);
|
|
if (apiTab.Rows.Count > 0)//存在日志表
|
|
{
|
|
DataTable columnsTab = SqlHelper.ExecuteDataTable(string.Format("select name from syscolumns where id=object_id('P_SystemToLsApiDtlsPmsTab')"));
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
|
if (dataRows.Length == 0)
|
|
{
|
|
string addColSql = string.Format("alter table P_SystemToLsApiDtlsPmsTab add {0} {1}", colunmField.Key, colunmField.Value);
|
|
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string createTabSql = "create table P_SystemToLsApiDtlsPmsTab(id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,{0})";
|
|
string createCol = string.Empty;
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
}
|
|
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 接口日志表
|
|
/// </summary>
|
|
private bool InitEventApiLogTable()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> colDic = new Dictionary<string, string>();
|
|
colDic.Add("url", "varchar(1000)");
|
|
colDic.Add("data", "varchar(MAX)");
|
|
colDic.Add("succeed", "varchar(100)");
|
|
colDic.Add("msg", "varchar(MAX)");
|
|
colDic.Add("sendDate", "datetime");
|
|
colDic.Add("datasourceRow", "varchar(MAX)");
|
|
colDic.Add("pmsHashData", "varchar(MAX)");
|
|
colDic.Add("returnCode", "varchar(100)");
|
|
colDic.Add("returnMsg", "varchar(MAX)");
|
|
colDic.Add("eventId", "int");
|
|
colDic.Add("dataIndex", "int");
|
|
colDic.Add("action", "varchar(100)");
|
|
colDic.Add("isRepeater", "varchar(100)");
|
|
colDic.Add("pushState", "varchar(100)");
|
|
string isExitApiTab = "select top 1 * from sysObjects where Id=OBJECT_ID(N'p_systemEventApiLogTab') and xtype='U'";
|
|
DataTable apiTab = SqlHelper.ExecuteDataTable(isExitApiTab);
|
|
if (apiTab.Rows.Count > 0)//存在日志表
|
|
{
|
|
DataTable columnsTab = SqlHelper.ExecuteDataTable(string.Format("select name from syscolumns where id=object_id('p_systemEventApiLogTab')"));
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
|
if (dataRows.Length == 0)
|
|
{
|
|
string addColSql = string.Format("alter table p_systemEventApiLogTab add {0} {1}", colunmField.Key, colunmField.Value);
|
|
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string createTabSql = "create table p_systemEventApiLogTab(id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,{0})";
|
|
string createCol = string.Empty;
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
}
|
|
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 接口错误日志表
|
|
/// </summary>
|
|
private bool InitEventApiLogErrorTable()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> colDic = new Dictionary<string, string>();
|
|
colDic.Add("errorType", "varchar(200)");
|
|
colDic.Add("repushErrorMsg", "varchar(200)");
|
|
colDic.Add("repushMsg", "varchar(1000)");
|
|
colDic.Add("repushSucceed", "varchar(200)");
|
|
colDic.Add("errorMessage", "varchar(1000)");
|
|
colDic.Add("sendDate", "datetime");
|
|
colDic.Add("repushTag", "int");
|
|
string isExitApiTab = "select top 1 * from sysObjects where Id=OBJECT_ID(N'p_systemEventApiErrorLogTab') and xtype='U'";
|
|
DataTable apiTab = SqlHelper.ExecuteDataTable(isExitApiTab);
|
|
if (apiTab.Rows.Count > 0)//存在日志表
|
|
{
|
|
DataTable columnsTab = SqlHelper.ExecuteDataTable(string.Format("select name from syscolumns where id=object_id('p_systemEventApiErrorLogTab')"));
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
|
if (dataRows.Length == 0)
|
|
{
|
|
string addColSql = string.Format("alter table p_systemEventApiErrorLogTab add {0} {1}", colunmField.Key, colunmField.Value);
|
|
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string createTabSql = "create table p_systemEventApiErrorLogTab(id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,{0})";
|
|
string createCol = string.Empty;
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
}
|
|
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 朗速接口日志表
|
|
/// </summary>
|
|
private bool InitToLsEventApiLogTable()
|
|
{
|
|
try
|
|
{
|
|
Dictionary<string, string> colDic = new Dictionary<string, string>();
|
|
colDic.Add("url", "varchar(1000)");
|
|
colDic.Add("apiNo", "int");
|
|
colDic.Add("tableName", "varchar(100)");
|
|
colDic.Add("actionType", "int");
|
|
colDic.Add("actionTypeName", "varchar(100)");
|
|
colDic.Add("data", "varchar(MAX)");
|
|
colDic.Add("succeed", "varchar(100)");
|
|
colDic.Add("returnMsg", "varchar(MAX)");
|
|
colDic.Add("sendDate", "datetime");
|
|
string isExitApiTab = "select top 1 * from sysObjects where Id=OBJECT_ID(N'P_SystemToLsApiLogTab') and xtype='U'";
|
|
DataTable apiTab = SqlHelper.ExecuteDataTable(isExitApiTab);
|
|
if (apiTab.Rows.Count > 0)//存在日志表
|
|
{
|
|
DataTable columnsTab = SqlHelper.ExecuteDataTable(string.Format("select name from syscolumns where id=object_id('P_SystemToLsApiLogTab')"));
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
|
if (dataRows.Length == 0)
|
|
{
|
|
string addColSql = string.Format("alter table P_SystemToLsApiLogTab add {0} {1}", colunmField.Key, colunmField.Value);
|
|
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string createTabSql = "create table P_SystemToLsApiLogTab(id bigint IDENTITY(1,1) PRIMARY KEY NOT NULL,{0})";
|
|
string createCol = string.Empty;
|
|
foreach (KeyValuePair<string, string> colunmField in colDic)
|
|
{
|
|
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
|
}
|
|
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
|
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
#endregion
|
|
/// <summary>
|
|
/// 设置分割条位置
|
|
/// </summary>
|
|
private void InitlizeSpiltLocation()
|
|
{
|
|
try
|
|
{
|
|
string splitControlSendWidth = IniHelper.Read("PubApiSetModule_SplitControlSendWidth");//通过Key获取Value值
|
|
if (!string.IsNullOrEmpty(splitControlSendWidth))
|
|
{
|
|
splitControlSend.SplitterPosition = Convert.ToInt32(splitControlSendWidth);
|
|
}
|
|
string splitControlGetWidth = IniHelper.Read("PubApiSetModule_SplitControlGetWidth");//通过Key获取Value值
|
|
if (!string.IsNullOrEmpty(splitControlGetWidth))
|
|
{
|
|
splitControlGet.SplitterPosition = Convert.ToInt32(splitControlGetWidth);
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 分隔位置改变时
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnSplitContainerPositionChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (sender == splitControlSend)
|
|
{
|
|
IniHelper.Write("PubApiSetModule_SplitControlSendWidth", splitControlSend.SplitterPosition + "");
|
|
}
|
|
if (sender == splitControlGet)
|
|
{
|
|
IniHelper.Write("PubApiSetModule_SplitControlGetWidth", splitControlGet.SplitterPosition + "");
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|