SVN r1138
SVN-Revision: r1138
This commit is contained in:
@@ -343,7 +343,7 @@ namespace Lskj.Control
|
|||||||
cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + "");
|
cond = ReplaceHelper.ReplaceRowParam(gridRow, item["condition"] + "").ReplaceColumnParam(e.Column.Name, e.Column.Caption, e.CellValue + "");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond) && (!string.IsNullOrEmpty(e.CellValue + "") || isLaterDatePresent))
|
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond) && (!string.IsNullOrEmpty(e.CellValue + "") || isLaterDatePresent|| SystemInfo.Instance.isBlankCellColor))
|
||||||
{
|
{
|
||||||
GridRowColorModel model = new GridRowColorModel(item);
|
GridRowColorModel model = new GridRowColorModel(item);
|
||||||
if (!string.IsNullOrWhiteSpace(model.BackColor))
|
if (!string.IsNullOrWhiteSpace(model.BackColor))
|
||||||
@@ -806,6 +806,10 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
PromptMessage.Add(model.FieldName, model.PromptText);
|
PromptMessage.Add(model.FieldName, model.PromptText);
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(model.ColumnAnnotation))
|
||||||
|
{
|
||||||
|
gridColumn.ToolTip = model.ColumnAnnotation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 加载数据源
|
// 加载数据源
|
||||||
//BindDataSource();
|
//BindDataSource();
|
||||||
|
|||||||
@@ -372,9 +372,13 @@ namespace Lskj.Control
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private List<GridColumn> ColumnsList = new List<GridColumn>();
|
private List<GridColumn> ColumnsList = new List<GridColumn>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///选中的行在数据源中的索引
|
///复选模式,表格主键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<int> SelectedDataSource = new List<int>();
|
public string MultiplePrimary = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
///选中的行在数据源中的主键值
|
||||||
|
/// </summary>
|
||||||
|
private List<string> SelectedDataSource = new List<string>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 禁显列不加载数据源
|
/// 禁显列不加载数据源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -963,9 +967,11 @@ namespace Lskj.Control
|
|||||||
Task<DataTable> sourceTask = new Task<DataTable>(() =>
|
Task<DataTable> sourceTask = new Task<DataTable>(() =>
|
||||||
{
|
{
|
||||||
DataTable dataTable = new DataTable();
|
DataTable dataTable = new DataTable();
|
||||||
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper._connection.ConnectionString))
|
|
||||||
|
using (DbConnection sqlConnection = SqlHelper.dbFactory.CreateConnection())
|
||||||
{
|
{
|
||||||
using (SqlCommand cmd = new SqlCommand())
|
sqlConnection.ConnectionString = SqlHelper._connection.ConnectionString;
|
||||||
|
using (DbCommand cmd = SqlHelper.dbFactory.CreateCommand())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -979,11 +985,13 @@ namespace Lskj.Control
|
|||||||
cmd.CommandTimeout = 0;
|
cmd.CommandTimeout = 0;
|
||||||
cmd.CommandText = sqlValue;
|
cmd.CommandText = sqlValue;
|
||||||
cmd.CommandType = CommandType.Text;
|
cmd.CommandType = CommandType.Text;
|
||||||
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
|
DbDataAdapter adapter = SqlHelper.dbFactory.CreateDataAdapter();
|
||||||
|
adapter.SelectCommand = cmd;
|
||||||
adapter.Fill(dataTable);
|
adapter.Fill(dataTable);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -1166,6 +1174,7 @@ namespace Lskj.Control
|
|||||||
protected virtual void SetColumnFormat(GridColumn gridColumn, GridColumnModel model)
|
protected virtual void SetColumnFormat(GridColumn gridColumn, GridColumnModel model)
|
||||||
{
|
{
|
||||||
if (gridColumn == null || model == null) return;
|
if (gridColumn == null || model == null) return;
|
||||||
|
|
||||||
// 格式化数字
|
// 格式化数字
|
||||||
if (!string.IsNullOrEmpty(model.DataFormat))
|
if (!string.IsNullOrEmpty(model.DataFormat))
|
||||||
{
|
{
|
||||||
@@ -1304,9 +1313,10 @@ namespace Lskj.Control
|
|||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(model.FontName) || model.FontSize != 0)
|
if (!string.IsNullOrEmpty(model.FontName) || model.FontSize != 0)
|
||||||
{
|
{
|
||||||
gridColumn.AppearanceCell.Options.UseFont = true;
|
//gridColumn.AppearanceCell.Options.UseFont = true;//设置后数值和英文会加粗,2026-3-17 注释
|
||||||
//gridColumn.AppearanceCell.Font = new System.Drawing.Font(model.FontName, gridColumn.AppearanceCell.Font.Size);
|
//gridColumn.AppearanceCell.Font = new System.Drawing.Font(model.FontName, gridColumn.AppearanceCell.Font.Size);
|
||||||
gridColumn.AppearanceCell.Font = new System.Drawing.Font(string.IsNullOrEmpty(model.FontName) ? gridColumn.AppearanceCell.Font.Name : model.FontName, model.FontSize == 0 ? gridColumn.AppearanceCell.Font.Size : model.FontSize);
|
gridColumn.AppearanceCell.Font = new System.Drawing.Font(string.IsNullOrEmpty(model.FontName) ? gridColumn.AppearanceCell.Font.Name : model.FontName, model.FontSize == 0 ? gridColumn.AppearanceCell.Font.Size : model.FontSize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.SetColumnFormat(gridColumn, model);
|
this.SetColumnFormat(gridColumn, model);
|
||||||
@@ -1323,6 +1333,10 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
PromptMessage.Add(model.FieldName, model.PromptText);
|
PromptMessage.Add(model.FieldName, model.PromptText);
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(model.ColumnAnnotation))
|
||||||
|
{
|
||||||
|
gridColumn.ToolTip = model.ColumnAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1604,6 +1618,10 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
PromptMessage.Add(model.FieldName, model.PromptText);
|
PromptMessage.Add(model.FieldName, model.PromptText);
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(model.ColumnAnnotation))
|
||||||
|
{
|
||||||
|
gridColumn.ToolTip = model.ColumnAnnotation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DataTable customTable = this.gridView.GetCustomColumnByDatabase(this.CustomColumKey);
|
DataTable customTable = this.gridView.GetCustomColumnByDatabase(this.CustomColumKey);
|
||||||
this.SetCustomColumns(customTable);
|
this.SetCustomColumns(customTable);
|
||||||
@@ -1664,6 +1682,11 @@ namespace Lskj.Control
|
|||||||
}
|
}
|
||||||
|
|
||||||
//gridView.OptionsView.AllowCellMerge = gridView.OptionsView.AllowCellMerge;
|
//gridView.OptionsView.AllowCellMerge = gridView.OptionsView.AllowCellMerge;
|
||||||
|
if (!string.IsNullOrWhiteSpace(model.TitleColor))
|
||||||
|
{
|
||||||
|
gridColumn.AppearanceHeader.Options.UseForeColor = true;
|
||||||
|
gridColumn.AppearanceHeader.ForeColor = ColorTranslator.FromHtml(model.TitleColor);
|
||||||
|
}
|
||||||
|
|
||||||
if (EnabledChangeColor)
|
if (EnabledChangeColor)
|
||||||
{
|
{
|
||||||
@@ -1691,7 +1714,7 @@ namespace Lskj.Control
|
|||||||
//修改字体控制
|
//修改字体控制
|
||||||
if (!string.IsNullOrEmpty(model.FontName) || model.FontSize != 0)
|
if (!string.IsNullOrEmpty(model.FontName) || model.FontSize != 0)
|
||||||
{
|
{
|
||||||
gridColumn.AppearanceCell.Options.UseFont = true;
|
//gridColumn.AppearanceCell.Options.UseFont = true;//设置后数值和英文会加粗,2026-3-17 注释
|
||||||
//gridColumn.AppearanceCell.Font = new System.Drawing.Font(model.FontName, gridColumn.AppearanceCell.Font.Size);
|
//gridColumn.AppearanceCell.Font = new System.Drawing.Font(model.FontName, gridColumn.AppearanceCell.Font.Size);
|
||||||
gridColumn.AppearanceCell.Font = new System.Drawing.Font(string.IsNullOrEmpty(model.FontName) ? gridColumn.AppearanceCell.Font.Name : model.FontName, model.FontSize == 0 ? gridColumn.AppearanceCell.Font.Size : model.FontSize);
|
gridColumn.AppearanceCell.Font = new System.Drawing.Font(string.IsNullOrEmpty(model.FontName) ? gridColumn.AppearanceCell.Font.Name : model.FontName, model.FontSize == 0 ? gridColumn.AppearanceCell.Font.Size : model.FontSize);
|
||||||
|
|
||||||
@@ -1735,6 +1758,10 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
PromptMessage.Add(model.FieldName, model.PromptText);
|
PromptMessage.Add(model.FieldName, model.PromptText);
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(model.ColumnAnnotation))
|
||||||
|
{
|
||||||
|
gridColumn.ToolTip = model.ColumnAnnotation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Model != null)
|
if (Model != null)
|
||||||
@@ -6242,7 +6269,7 @@ namespace Lskj.Control
|
|||||||
/// <exception cref="System.NotImplementedException"></exception>
|
/// <exception cref="System.NotImplementedException"></exception>
|
||||||
protected void OnGridViewRowCellStyle(object sender, RowCellStyleEventArgs e)
|
protected void OnGridViewRowCellStyle(object sender, RowCellStyleEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.RowHandle >= 0 && this.GridRowColorsTable != null && this.GridRowColorsTable.Rows.Count > 0 && !string.IsNullOrEmpty(e.CellValue + ""))
|
if (e.RowHandle >= 0 && this.GridRowColorsTable != null && this.GridRowColorsTable.Rows.Count > 0 && (!string.IsNullOrEmpty(e.CellValue + "")|| SystemInfo.Instance.isBlankCellColor))
|
||||||
{
|
{
|
||||||
// 渲染界面数据量过多界面刷新会很慢
|
// 渲染界面数据量过多界面刷新会很慢
|
||||||
//DataTable table = this.gridControl.DataSourceTable();
|
//DataTable table = this.gridControl.DataSourceTable();
|
||||||
@@ -6256,15 +6283,22 @@ namespace Lskj.Control
|
|||||||
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
|
if (!string.IsNullOrWhiteSpace(cond) && ReplaceHelper.EvalCond(cond))
|
||||||
{
|
{
|
||||||
GridRowColorModel model = new GridRowColorModel(item);
|
GridRowColorModel model = new GridRowColorModel(item);
|
||||||
if (!string.IsNullOrWhiteSpace(model.BackColor))
|
|
||||||
|
// 判断单元格是否被选中
|
||||||
|
bool isCellSelected = gridView.IsCellSelected(e.RowHandle, e.Column);
|
||||||
|
if (!isCellSelected)
|
||||||
{
|
{
|
||||||
e.Appearance.BackColor = ColorTranslator.FromHtml(model.BackColor);
|
if (!string.IsNullOrWhiteSpace(model.BackColor))
|
||||||
}
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(model.ForceColor))
|
e.Appearance.BackColor = ColorTranslator.FromHtml(model.BackColor);
|
||||||
{
|
}
|
||||||
e.Appearance.ForeColor = ColorTranslator.FromHtml(model.ForceColor);
|
if (!string.IsNullOrWhiteSpace(model.ForceColor))
|
||||||
|
{
|
||||||
|
e.Appearance.ForeColor = ColorTranslator.FromHtml(model.ForceColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FontStyle fontStyle = new FontStyle();
|
FontStyle fontStyle = new FontStyle();
|
||||||
if (model.IsBold) fontStyle = fontStyle | FontStyle.Bold;
|
if (model.IsBold) fontStyle = fontStyle | FontStyle.Bold;
|
||||||
if (model.IsItalic) fontStyle = fontStyle | FontStyle.Italic;
|
if (model.IsItalic) fontStyle = fontStyle | FontStyle.Italic;
|
||||||
@@ -6405,6 +6439,29 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
e.Appearance.ForeColor = ColorTranslator.FromHtml(SystemInfo.Instance.SelectRowForeColor);
|
e.Appearance.ForeColor = ColorTranslator.FromHtml(SystemInfo.Instance.SelectRowForeColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//// 如果当前单元格被选中 → 画虚线
|
||||||
|
//if (gridView.IsCellSelected(e.RowHandle, e.Column))
|
||||||
|
//{
|
||||||
|
// // 先绘制默认内容(文字、背景、行颜色不变)
|
||||||
|
// e.DefaultDraw();
|
||||||
|
|
||||||
|
// // 创建虚线笔
|
||||||
|
// using (Pen pen = new Pen(Color.Black, 1))
|
||||||
|
// {
|
||||||
|
// pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; // 虚线样式
|
||||||
|
|
||||||
|
// // 在单元格内部画一圈虚线边框
|
||||||
|
// Rectangle rect = e.Bounds;
|
||||||
|
// rect.Width -= 1;
|
||||||
|
// rect.Height -= 1;
|
||||||
|
// e.Graphics.DrawRectangle(pen, rect);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 标记已处理,防止被覆盖
|
||||||
|
// e.Handled = true;
|
||||||
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//选中行不改变颜色条件设置的颜色
|
//选中行不改变颜色条件设置的颜色
|
||||||
@@ -6695,15 +6752,17 @@ namespace Lskj.Control
|
|||||||
this.SelectedRows = this.gridView.GetSelectedRows();
|
this.SelectedRows = this.gridView.GetSelectedRows();
|
||||||
if (gridView.OptionsSelection.MultiSelect == true && gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect && gridView.OptionsSelection.EnableAppearanceFocusedCell == false) this.gridView.UpdateSummary();
|
if (gridView.OptionsSelection.MultiSelect == true && gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect && gridView.OptionsSelection.EnableAppearanceFocusedCell == false) this.gridView.UpdateSummary();
|
||||||
|
|
||||||
if (SystemInfo.Instance.DisplayCheckboxSelection && gridView.OptionsSelection.MultiSelect == true && gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect && gridView.OptionsSelection.EnableAppearanceFocusedCell == false)
|
if (SystemInfo.Instance.DisplayCheckboxSelection &&!string.IsNullOrWhiteSpace(this.MultiplePrimary) && gridView.OptionsSelection.MultiSelect == true && gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect && gridView.OptionsSelection.EnableAppearanceFocusedCell == false)
|
||||||
{
|
{
|
||||||
SelectedDataSource.Clear();
|
SelectedDataSource.Clear();
|
||||||
// 遍历勾选的行索引,并获取它们在数据源中的索引
|
DataRow[] dataRows = this.GetViewFocusedDataRows();
|
||||||
foreach (int rowHandle in SelectedRows)
|
if (dataRows.Length > 0 && dataRows[0].Table.Columns.Contains(this.MultiplePrimary))
|
||||||
{
|
{
|
||||||
// 获取行在数据源中的索引
|
// 遍历勾选的行索引,并获取它们在数据源中的索引
|
||||||
int dataSourceRowIndex = gridView.GetDataSourceRowIndex(rowHandle);
|
foreach (DataRow row in GetViewFocusedDataRows())
|
||||||
SelectedDataSource.Add(dataSourceRowIndex);
|
{
|
||||||
|
SelectedDataSource.Add(row[this.MultiplePrimary] + "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9033,9 +9092,10 @@ namespace Lskj.Control
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void GridView_CustomRowFilter(object sender, RowFilterEventArgs e)
|
private void GridView_CustomRowFilter(object sender, RowFilterEventArgs e)
|
||||||
{
|
{
|
||||||
if (SystemInfo.Instance.DisplayCheckboxSelection && gridView.OptionsSelection.MultiSelect == true && gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect && gridView.OptionsSelection.EnableAppearanceFocusedCell == false)
|
if (SystemInfo.Instance.DisplayCheckboxSelection && !string.IsNullOrWhiteSpace(this.MultiplePrimary) && gridView.OptionsSelection.MultiSelect == true && gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.CheckBoxRowSelect && gridView.OptionsSelection.EnableAppearanceFocusedCell == false)
|
||||||
{
|
{
|
||||||
if (SelectedDataSource.Contains(e.ListSourceRow))
|
DataRow dataRow = this.gridView.GetDataRow(e.ListSourceRow);
|
||||||
|
if (dataRow!=null&& dataRow.Table.Columns.Contains(this.MultiplePrimary) && SelectedDataSource.Contains(dataRow[this.MultiplePrimary]+""))
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
e.Visible = true;
|
e.Visible = true;
|
||||||
|
|||||||
@@ -233,6 +233,9 @@ namespace Lskj.Control.Model
|
|||||||
/// 合并数据是否求和(合并单元格只计算一次)
|
/// 合并数据是否求和(合并单元格只计算一次)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isSumMerge { get; set; }
|
public bool isSumMerge { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 字体大小
|
||||||
|
/// </summary>
|
||||||
public int FontSize;
|
public int FontSize;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the source row.
|
/// Gets the source row.
|
||||||
@@ -379,6 +382,14 @@ namespace Lskj.Control.Model
|
|||||||
/// 单元格内容为空时的提示信息
|
/// 单元格内容为空时的提示信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PromptText;
|
public string PromptText;
|
||||||
|
/// <summary>
|
||||||
|
/// 列注释(标题注释)
|
||||||
|
/// </summary>
|
||||||
|
public string ColumnAnnotation;
|
||||||
|
/// <summary>
|
||||||
|
/// 标题颜色
|
||||||
|
/// </summary>
|
||||||
|
public string TitleColor;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -474,4 +485,5 @@ namespace Lskj.Control.Model
|
|||||||
this.PrivilegeView = item.Table.Columns.Contains("PrivilegeView") ? item["PrivilegeView"] + "" : string.Empty;
|
this.PrivilegeView = item.Table.Columns.Contains("PrivilegeView") ? item["PrivilegeView"] + "" : string.Empty;
|
||||||
this.PrivilegeOper = item.Table.Columns.Contains("PrivilegeOper") ? item["PrivilegeOper"] + "" : string.Empty;
|
this.PrivilegeOper = item.Table.Columns.Contains("PrivilegeOper") ? item["PrivilegeOper"] + "" : string.Empty;
|
||||||
this.AdditionalAssociations = item.Table.Columns.Contains("AdditionalAssociations") ? "1".Equals(item["AdditionalAssociations"] + "") : false;
|
this.AdditionalAssociations = item.Table.Columns.Contains("AdditionalAssociations") ? "1".Equals(item["AdditionalAssociations"] + "") : false;
|
||||||
thi
|
this.ProhibitPaste = item.Table.Columns.Contains("ProhibitPaste") ? "1".Equals(item["ProhibitPaste"] + "") : false;
|
||||||
|
this.ModuleFrameDisplayText = item.Table.Columns.Contains("ModuleFrameDisplayText") ? "1".Equals(item["ModuleFrameDisplayT
|
||||||
@@ -50,6 +50,8 @@ using DevExpress.Data.Filtering;
|
|||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using DevExpress.Utils;
|
using DevExpress.Utils;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
|
using DevExpress.Spreadsheet;
|
||||||
|
using DevExpress.Docs;
|
||||||
|
|
||||||
namespace Lskj.Control.Model
|
namespace Lskj.Control.Model
|
||||||
{
|
{
|
||||||
@@ -1873,6 +1875,225 @@ namespace Lskj.Control.Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ExportGridToExcel(this GridControl control, string exportFileName, bool ismerger = false, string CustomColumKey = "")
|
||||||
|
{
|
||||||
|
// 基础校验
|
||||||
|
if (control == null)
|
||||||
|
{
|
||||||
|
MessageUtil.Show("GridControl控件不能为空!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(exportFileName))
|
||||||
|
{
|
||||||
|
MessageUtil.Show("导出文件名不能为空!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
WaitForm.ShowForm("导出中,请稍后...");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 1. 获取设置的导出列(复用原有数据库筛选逻辑)
|
||||||
|
DataTable isExportTab = new DataTable();
|
||||||
|
if (!string.IsNullOrEmpty(CustomColumKey))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sqlstr = "select fieldName,userName from {0} where {1}='{2}' and isExport='1' and OperatorId='{3}'";
|
||||||
|
sqlstr = string.Format(sqlstr, ResourceKeys.SettingExportTableName, "formkey", CustomColumKey, ERPInfo.Instance.UserId);
|
||||||
|
isExportTab = SqlHelper.ExecuteDataTable(sqlstr);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// 捕获异常不中断,默认导出所有列
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 筛选需要导出/排除的列
|
||||||
|
List<string> ExportColumnsName = new List<string>();
|
||||||
|
List<string> NoExportColumnsName = new List<string>();
|
||||||
|
GridView sourceView = control.FocusedView as GridView;
|
||||||
|
foreach (GridColumn col in sourceView.Columns)
|
||||||
|
{
|
||||||
|
if (isExportTab != null && isExportTab.Rows.Count > 0 && isExportTab.Columns.Contains("fieldName"))
|
||||||
|
{
|
||||||
|
DataRow[] dataRows = isExportTab.Select(string.Format("fieldName='{0}'", col.FieldName));
|
||||||
|
if (dataRows != null && dataRows.Length > 0)
|
||||||
|
{
|
||||||
|
ExportColumnsName.Add(col.FieldName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NoExportColumnsName.Add(col.FieldName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 无配置时默认导出所有列
|
||||||
|
ExportColumnsName.Add(col.FieldName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 替换Bit列并创建新的GridControl(复用原有逻辑)
|
||||||
|
FrmExport export = new FrmExport();
|
||||||
|
GridControl newControl = export.ReplaceBitColumn(control, NoExportColumnsName.Count() != 0);
|
||||||
|
GridView gridView = newControl.FocusedView as GridView;
|
||||||
|
|
||||||
|
// 4. 移除不导出的列
|
||||||
|
if (ExportColumnsName.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (string item in NoExportColumnsName)
|
||||||
|
{
|
||||||
|
GridColumn column = gridView.Columns.FirstOrDefault(x => x.FieldName.Equals(item));
|
||||||
|
if (column != null) gridView.Columns.Remove(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 取消表格列下拉控件(复用原有逻辑)
|
||||||
|
if (SystemInfo.Instance.ExportClearItemSource)
|
||||||
|
{
|
||||||
|
foreach (GridColumn column in gridView.Columns)
|
||||||
|
{
|
||||||
|
if (column.ColumnEdit != null && column.ColumnEdit is RepositoryItemGridLookUpEdit)
|
||||||
|
{
|
||||||
|
column.ColumnEdit = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. 设置打印自动宽度
|
||||||
|
gridView.OptionsPrint.AutoWidth = false;
|
||||||
|
|
||||||
|
// 7. 处理单元格合并(复用原有逻辑)
|
||||||
|
if (ismerger)
|
||||||
|
{
|
||||||
|
(newControl.MainView as GridView).CellMerge += new CellMergeEventHandler(OnGridViewCellMerge);
|
||||||
|
(newControl.MainView as GridView).OptionsView.AllowCellMerge = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 8. 创建导出链接(复用原有逻辑)
|
||||||
|
CompositeLink link = export.ReplaceBitLink(newControl);
|
||||||
|
|
||||||
|
string fileExt = Path.GetExtension(exportFileName).ToLower();
|
||||||
|
|
||||||
|
// 创建导出选项
|
||||||
|
XlsExportOptionsEx xlsOptionsEx = new XlsExportOptionsEx();
|
||||||
|
xlsOptionsEx.CustomizeCell += (e) =>
|
||||||
|
{
|
||||||
|
GridView mainView = newControl.MainView as GridView;
|
||||||
|
DataRow dataRow = mainView.GetDataRow(e.DataSourceRowIndex);
|
||||||
|
GridColumn gridColumn = mainView.Columns[e.ColumnFieldName];
|
||||||
|
string urlName = "";
|
||||||
|
if (gridColumn.ColumnEdit != null && gridColumn.ColumnEdit is RepositoryItemHyperLinkEdit repositoryItemHyperLinkEdit)
|
||||||
|
{
|
||||||
|
GridColumnModel model = repositoryItemHyperLinkEdit.Tag as GridColumnModel;
|
||||||
|
urlName = model.ValueMember;
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(e.Hyperlink) && dataRow != null && !string.IsNullOrEmpty(urlName))
|
||||||
|
{
|
||||||
|
string linkStr = dataRow.Table.Columns.Contains(urlName) ? dataRow[urlName] + "" : "";
|
||||||
|
if (!string.IsNullOrEmpty(linkStr))
|
||||||
|
{
|
||||||
|
e.Hyperlink = linkStr;
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
XlsxExportOptionsEx xlsxoptionsEx = new XlsxExportOptionsEx();
|
||||||
|
xlsxoptionsEx.CustomizeCell += (e) =>
|
||||||
|
{
|
||||||
|
GridView mainView = newControl.MainView as GridView;
|
||||||
|
DataRow dataRow = mainView.GetDataRow(e.DataSourceRowIndex);
|
||||||
|
GridColumn gridColumn = mainView.Columns[e.ColumnFieldName];
|
||||||
|
string urlName = "";
|
||||||
|
if (gridColumn.ColumnEdit != null && gridColumn.ColumnEdit is RepositoryItemHyperLinkEdit repositoryItemHyperLinkEdit)
|
||||||
|
{
|
||||||
|
GridColumnModel model = repositoryItemHyperLinkEdit.Tag as GridColumnModel;
|
||||||
|
urlName = model.ValueMember;
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(e.Hyperlink) && dataRow != null && !string.IsNullOrEmpty(urlName))
|
||||||
|
{
|
||||||
|
string linkStr = dataRow.Table.Columns.Contains(urlName) ? dataRow[urlName] + "" : "";
|
||||||
|
if (!string.IsNullOrEmpty(linkStr))
|
||||||
|
{
|
||||||
|
e.Hyperlink = linkStr;
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 11. 校验xls行数限制(复用原有逻辑)
|
||||||
|
DataTable dataTable = gridView.GetGridViewFilteredAndSortedDataToDataTable();
|
||||||
|
int totalRowCount = dataTable.Rows.Count;
|
||||||
|
int maxRowCount = 65536;
|
||||||
|
|
||||||
|
// 12. 根据后缀执行导出
|
||||||
|
switch (fileExt)
|
||||||
|
{
|
||||||
|
case ".xls":
|
||||||
|
if (totalRowCount > maxRowCount)
|
||||||
|
{
|
||||||
|
MessageUtil.Show("超过excel最大的保存数量!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (gridView is BandedGridView)
|
||||||
|
{
|
||||||
|
link.ExportToXls(exportFileName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newControl.ExportToXls(exportFileName, xlsOptionsEx);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ".xlsx":
|
||||||
|
newControl.ExportToXlsx(exportFileName, xlsxoptionsEx);
|
||||||
|
break;
|
||||||
|
case ".pdf":
|
||||||
|
newControl.ExportToPdf(exportFileName);
|
||||||
|
break;
|
||||||
|
case ".rtf":
|
||||||
|
link.ExportToRtf(exportFileName);
|
||||||
|
break;
|
||||||
|
case ".html":
|
||||||
|
link.ExportToHtml(exportFileName);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
MessageUtil.Show($"不支持的文件格式:{fileExt},请选择.xls/.xlsx/.pdf/.rtf/.html");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 13. 设置模块名称(复用原有逻辑)
|
||||||
|
if (SystemInfo.Instance.ExportModuleName)
|
||||||
|
{
|
||||||
|
PanelControl panel = null;
|
||||||
|
if (control.Tag is PanelControl) panel = control.Tag as PanelControl;
|
||||||
|
SetModuleName(exportFileName, fileExt, gridView.Columns.Cast<GridColumn>().Count(column => column.Visible), false, panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出成功提示(可根据需要关闭,循环调用时避免多次弹窗)
|
||||||
|
// MessageUtil.Show(ResourceKeys.ExportSuccess);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.Instance.WriteError(ex);
|
||||||
|
LogUtil.WriteError("表格导出文件错误", ex);
|
||||||
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||||
|
MessageUtil.Show(Message, ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
WaitForm.HideForm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>说明:获取GridView过滤或排序后的数据集</para>
|
/// <para>说明:获取GridView过滤或排序后的数据集</para>
|
||||||
/// <para>创建人:龚宇超</para>
|
/// <para>创建人:龚宇超</para>
|
||||||
@@ -2171,6 +2392,7 @@ namespace Lskj.Control.Model
|
|||||||
col = index != 1 ? gridView.Columns.OfType<GridColumn>().FirstOrDefault(x => Regex.Replace(x.Caption, @"\s", "") == Regex.Replace(headcell.ToString(), @"\s", "")) : newBandGrid.Columns.OfType<BandedGridColumn>().FirstOrDefault(x => Regex.Replace(x.OwnerBand + x.Caption, @"\s", "") == Regex.Replace(bandTitel + headcell.ToString(), @"\s", ""));
|
col = index != 1 ? gridView.Columns.OfType<GridColumn>().FirstOrDefault(x => Regex.Replace(x.Caption, @"\s", "") == Regex.Replace(headcell.ToString(), @"\s", "")) : newBandGrid.Columns.OfType<BandedGridColumn>().FirstOrDefault(x => Regex.Replace(x.OwnerBand + x.Caption, @"\s", "") == Regex.Replace(bandTitel + headcell.ToString(), @"\s", ""));
|
||||||
if (col == null) continue;
|
if (col == null) continue;
|
||||||
GridColumnModel model = col.Tag as GridColumnModel;
|
GridColumnModel model = col.Tag as GridColumnModel;
|
||||||
|
|
||||||
if (cell != null)
|
if (cell != null)
|
||||||
{
|
{
|
||||||
if (cell.CellType == CellType.Blank)
|
if (cell.CellType == CellType.Blank)
|
||||||
@@ -3778,7 +4000,7 @@ namespace Lskj.Control.Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IWorkbook workbook;
|
NPOI.SS.UserModel.IWorkbook workbook;
|
||||||
if (fileExt.Equals(".xls"))
|
if (fileExt.Equals(".xls"))
|
||||||
{
|
{
|
||||||
using (FileStream file = new FileStream(excelFilePath, FileMode.Open, FileAccess.Read))
|
using (FileStream file = new FileStream(excelFilePath, FileMode.Open, FileAccess.Read))
|
||||||
|
|||||||
@@ -287,6 +287,20 @@ namespace Lskj.Control.Model
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (model.VerifyUpdate && BaseGridView!=null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < BaseGridView.DataRowCount; i++)
|
||||||
|
{
|
||||||
|
var row = BaseGridView.GetDataRow(i);
|
||||||
|
if (row != null && (row.RowState == DataRowState.Added || row.RowState == DataRowState.Modified))
|
||||||
|
{
|
||||||
|
MessageUtil.Show("有数据未保存,请先保存后在执行右键");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (rowArray.Length == 0 && model.IsMustSelectRow())
|
if (rowArray.Length == 0 && model.IsMustSelectRow())
|
||||||
{
|
{
|
||||||
MessageUtil.Show(ResourceKeys.SelectRowIsNull);
|
MessageUtil.Show(ResourceKeys.SelectRowIsNull);
|
||||||
@@ -908,7 +922,14 @@ namespace Lskj.Control.Model
|
|||||||
result = 0;
|
result = 0;
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag);
|
if (SqlHelper.ConnectionType == ConnectionType.SqlServer)
|
||||||
|
{
|
||||||
|
SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag);
|
||||||
|
}
|
||||||
|
if (SqlHelper.ConnectionType == ConnectionType.DmServer)
|
||||||
|
{
|
||||||
|
SqlStoredProcedurepPrompt.GenerateBillSaveScript_DM(SqlHelper.LastFailureSql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -929,7 +950,14 @@ namespace Lskj.Control.Model
|
|||||||
case -1:
|
case -1:
|
||||||
if (rValue == -1)
|
if (rValue == -1)
|
||||||
{
|
{
|
||||||
SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag);
|
if (SqlHelper.ConnectionType == ConnectionType.SqlServer)
|
||||||
|
{
|
||||||
|
SqlStoredProcedurepPrompt.GenerateProcedureExecutionScript(procName, paramList, isFirstFlag, comfirmFlag);
|
||||||
|
}
|
||||||
|
if (SqlHelper.ConnectionType == ConnectionType.DmServer)
|
||||||
|
{
|
||||||
|
SqlStoredProcedurepPrompt.GenerateBillSaveScript_DM(SqlHelper.LastFailureSql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MessageUtil.Show(string.IsNullOrEmpty(model.ErrorMsg) ? ResourceKeys.OperFault + "\n" + pMsg.Value : model.ErrorMsg);
|
MessageUtil.Show(string.IsNullOrEmpty(model.ErrorMsg) ? ResourceKeys.OperFault + "\n" + pMsg.Value : model.ErrorMsg);
|
||||||
reaultValue = false;
|
reaultValue = false;
|
||||||
@@ -1118,7 +1146,8 @@ namespace Lskj.Control.Model
|
|||||||
paramList[9],
|
paramList[9],
|
||||||
paramList[10],
|
paramList[10],
|
||||||
paramList[11],
|
paramList[11],
|
||||||
paramList[12]//固定添加行数据json字符串
|
paramList[12],
|
||||||
|
paramList[13]//固定添加行数据json字符串
|
||||||
};
|
};
|
||||||
XtraTabPage xtraTab = ERPInfo.Instance.PageControl != null ? ERPInfo.Instance.PageControl.SelectedTabPage : null;
|
XtraTabPage xtraTab = ERPInfo.Instance.PageControl != null ? ERPInfo.Instance.PageControl.SelectedTabPage : null;
|
||||||
DllModule module = new DllModule
|
DllModule module = new DllModule
|
||||||
@@ -1915,11 +1944,8 @@ namespace Lskj.Control.Model
|
|||||||
fieldValue = ReplaceHelper.ReplaceRowParam(rowDatas, fieldValue.Replace("[", "{").Replace("]", "}"), "", "");
|
fieldValue = ReplaceHelper.ReplaceRowParam(rowDatas, fieldValue.Replace("[", "{").Replace("]", "}"), "", "");
|
||||||
|
|
||||||
//如果是sql的情况,可能有 select '[xx]' as xxx 和 where xx in([xxx]) 的情况,start和end不好统一设置,先默认为空
|
//如果是sql的情况,可能有 select '[xx]' as xxx 和 where xx in([xxx]) 的情况,start和end不好统一设置,先默认为空
|
||||||
//string start = "'", end = "'";
|
//ReplaceHelper.ReplaceMultipleLinesParam (rowData, fieldValue); 区分了2种情况
|
||||||
//if (fieldValue.ToUpper().Contains("EXEC"))
|
|
||||||
//{
|
|
||||||
// start = end = string.Empty;
|
|
||||||
//}
|
|
||||||
handleParamList.Add(fieldValue);
|
handleParamList.Add(fieldValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2026,28 +2052,4 @@ namespace Lskj.Control.Model
|
|||||||
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
||||||
if (dataRows.Length == 0)
|
if (dataRows.Length == 0)
|
||||||
{
|
{
|
||||||
string addColSql = string.Format("alter table P_PrivateDllTab add {0} {1}", colunmField.Key, colunmField.Value);
|
string a
|
||||||
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string createTabSql = "create table P_PrivateDllTab(id int IDENTITY(1,1) 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -53,6 +53,7 @@ namespace Lskj.Control.Model
|
|||||||
private string _dllParam10;
|
private string _dllParam10;
|
||||||
private string _dllParam11;
|
private string _dllParam11;
|
||||||
private string _dllParam12;
|
private string _dllParam12;
|
||||||
|
private string _dllParam13;
|
||||||
private bool _isCopy;
|
private bool _isCopy;
|
||||||
private bool _isModal;
|
private bool _isModal;
|
||||||
private bool _forbiddenDisplay;
|
private bool _forbiddenDisplay;
|
||||||
@@ -242,6 +243,11 @@ namespace Lskj.Control.Model
|
|||||||
/// <value>The DLL param12.</value>
|
/// <value>The DLL param12.</value>
|
||||||
public string DllParam12 { get { return _dllParam12; } }
|
public string DllParam12 { get { return _dllParam12; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Gets the DLL param13.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The DLL param13.</value>
|
||||||
|
public string DllParam13 { get { return _dllParam13; } }
|
||||||
|
/// <summary>
|
||||||
/// 在mes中,是否直接执行
|
/// 在mes中,是否直接执行
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isStartRun;
|
public bool isStartRun;
|
||||||
@@ -332,6 +338,10 @@ namespace Lskj.Control.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The menu cond.</value>
|
/// <value>The menu cond.</value>
|
||||||
public string ClickCond;
|
public string ClickCond;
|
||||||
|
/// <summary>
|
||||||
|
/// 右键验证是否有修改后的数据
|
||||||
|
/// </summary>
|
||||||
|
public bool VerifyUpdate;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -359,7 +369,7 @@ namespace Lskj.Control.Model
|
|||||||
{
|
{
|
||||||
_dllParam1, _dllParam2, _dllParam3, _dllParam4, _dllParam5,
|
_dllParam1, _dllParam2, _dllParam3, _dllParam4, _dllParam5,
|
||||||
_dllParam6, _dllParam7, _dllParam8, _dllParam9, _dllParam10,
|
_dllParam6, _dllParam7, _dllParam8, _dllParam9, _dllParam10,
|
||||||
_dllParam11,_dllParam12
|
_dllParam11,_dllParam12,_dllParam13
|
||||||
}.ToList();
|
}.ToList();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -408,6 +418,7 @@ namespace Lskj.Control.Model
|
|||||||
this._dllParam10 = item["dllpar10"] + "";
|
this._dllParam10 = item["dllpar10"] + "";
|
||||||
this._dllParam11 = item.Table.Columns.Contains("dllpar11") ? item["dllpar11"] + "" : "";
|
this._dllParam11 = item.Table.Columns.Contains("dllpar11") ? item["dllpar11"] + "" : "";
|
||||||
this._dllParam12 = item.Table.Columns.Contains("dllpar12") ? item["dllpar12"] + "" : "";
|
this._dllParam12 = item.Table.Columns.Contains("dllpar12") ? item["dllpar12"] + "" : "";
|
||||||
|
this._dllParam13 = item.Table.Columns.Contains("dllpar13") ? item["dllpar13"] + "" : "";
|
||||||
this._menuCond = item["menuCond"] + "";
|
this._menuCond = item["menuCond"] + "";
|
||||||
this._refreshCheckState = item.Table.Columns.Contains("refreshCheckState") && !string.IsNullOrEmpty(item["refreshCheckState"] + "") ? "1".Equals(item["refreshCheckState"] + "") : false;
|
this._refreshCheckState = item.Table.Columns.Contains("refreshCheckState") && !string.IsNullOrEmpty(item["refreshCheckState"] + "") ? "1".Equals(item["refreshCheckState"] + "") : false;
|
||||||
|
|
||||||
@@ -458,4 +469,6 @@ namespace Lskj.Control.Model
|
|||||||
this.DuringExecutionMinimize = string.IsNullOrWhiteSpace(item["DuringExecutionMinimize"] + "") ? false : "1".Equals(item["DuringExecutionMinimize"] + "");
|
this.DuringExecutionMinimize = string.IsNullOrWhiteSpace(item["DuringExecutionMinimize"] + "") ? false : "1".Equals(item["DuringExecutionMinimize"] + "");
|
||||||
if (item.Table.Columns.Contains("SqlDirectExecution"))
|
if (item.Table.Columns.Contains("SqlDirectExecution"))
|
||||||
this.SqlDirectExecution = string.IsNullOrWhiteSpace(item["SqlDirectExecution"] + "") ? false : "1".Equals(item["SqlDirectExecution"] + "");
|
this.SqlDirectExecution = string.IsNullOrWhiteSpace(item["SqlDirectExecution"] + "") ? false : "1".Equals(item["SqlDirectExecution"] + "");
|
||||||
if (item
|
if (item.Table.Columns.Contains("UnionZTid"))
|
||||||
|
this.UnionZTid = string.IsNullOrWhiteSpace(item["UnionZTid"] + "") ? "" : item["UnionZTid"] + "";
|
||||||
|
if (item.Table.Columns.Contains("Di
|
||||||
@@ -15,6 +15,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Data.Common;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -4143,9 +4144,10 @@ namespace Lskj.Control.Model
|
|||||||
sourceTask = new Task<DataTable>(() =>
|
sourceTask = new Task<DataTable>(() =>
|
||||||
{
|
{
|
||||||
DataTable dataTable = new DataTable();
|
DataTable dataTable = new DataTable();
|
||||||
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper._connection.ConnectionString))
|
using (DbConnection sqlConnection = SqlHelper.dbFactory.CreateConnection())
|
||||||
{
|
{
|
||||||
using (SqlCommand cmd = new SqlCommand())
|
sqlConnection.ConnectionString = SqlHelper._connection.ConnectionString;
|
||||||
|
using (DbCommand cmd = SqlHelper.dbFactory.CreateCommand())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -4159,10 +4161,9 @@ namespace Lskj.Control.Model
|
|||||||
cmd.CommandTimeout = 0;
|
cmd.CommandTimeout = 0;
|
||||||
cmd.CommandText = sqlValue;
|
cmd.CommandText = sqlValue;
|
||||||
cmd.CommandType = CommandType.Text;
|
cmd.CommandType = CommandType.Text;
|
||||||
using (SqlDataAdapter adapter = new SqlDataAdapter(cmd))
|
DbDataAdapter adapter = SqlHelper.dbFactory.CreateDataAdapter();
|
||||||
{
|
adapter.SelectCommand = cmd;
|
||||||
adapter.Fill(dataTable);
|
adapter.Fill(dataTable);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2775,8 +2775,12 @@ namespace Lskj.Control
|
|||||||
this.SaveResults = false;
|
this.SaveResults = false;
|
||||||
this.isSuccessfullySaved = false;
|
this.isSuccessfullySaved = false;
|
||||||
string tableName = this.SysModel.MenuTable;
|
string tableName = this.SysModel.MenuTable;
|
||||||
string Autogrowcolumn = BaseImpl.GetResult(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", tableName)) + "";
|
//string Autogrowcolumn = BaseImpl.GetResult(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", tableName)) + "";
|
||||||
DataTable DatabasePropertySheet = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", tableName));//数据库属性表
|
//DataTable DatabasePropertySheet = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", tableName));//数据库属性表
|
||||||
|
|
||||||
|
string Autogrowcolumn = MainImpl.GetAutogrowcolumn(tableName);
|
||||||
|
DataTable DatabasePropertySheet = MainImpl.GetDatabaseProperty(tableName);
|
||||||
|
|
||||||
string SaveErrorMessage = "失败列表:\r\n";
|
string SaveErrorMessage = "失败列表:\r\n";
|
||||||
if (string.IsNullOrEmpty(tableName))
|
if (string.IsNullOrEmpty(tableName))
|
||||||
{
|
{
|
||||||
@@ -3743,6 +3747,8 @@ namespace Lskj.Control
|
|||||||
this.SearchObj.SetGridControlEx(this.gcMain); // 因创建条件时还GridView还未确定,需确定后在进行绑定
|
this.SearchObj.SetGridControlEx(this.gcMain); // 因创建条件时还GridView还未确定,需确定后在进行绑定
|
||||||
//修改条件
|
//修改条件
|
||||||
this.gcMain.ModifyCond = this.SysModel.ModifyCond;
|
this.gcMain.ModifyCond = this.SysModel.ModifyCond;
|
||||||
|
//主键
|
||||||
|
this.gcMain.MultiplePrimary = parmaryKey;
|
||||||
// 常用工具
|
// 常用工具
|
||||||
this.InitializeCommonTool();
|
this.InitializeCommonTool();
|
||||||
if (SysModel.isLeftRightMode) this.pl_top_right.Visible = false;
|
if (SysModel.isLeftRightMode) this.pl_top_right.Visible = false;
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ namespace Lskj.Control
|
|||||||
foreach (BarItemLink itemLink in this.pm_common.ItemLinks)
|
foreach (BarItemLink itemLink in this.pm_common.ItemLinks)
|
||||||
{
|
{
|
||||||
DataRow rowItem = itemLink.Item.Tag as DataRow;
|
DataRow rowItem = itemLink.Item.Tag as DataRow;
|
||||||
if (rowItem != null&& rowItem.Table.Columns.Contains("MenuCond"))
|
if (rowItem != null && rowItem.Table.Columns.Contains("MenuCond"))
|
||||||
{
|
{
|
||||||
string menuCond = rowItem["MenuCond"] + "";
|
string menuCond = rowItem["MenuCond"] + "";
|
||||||
string menuCaption = itemLink.Caption;
|
string menuCaption = itemLink.Caption;
|
||||||
@@ -1720,7 +1720,11 @@ namespace Lskj.Control
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
WaitForm.ShowForm(ResourceKeys.DataSaving);
|
WaitForm.ShowForm(ResourceKeys.DataSaving);
|
||||||
this.AddControlRecord();
|
bool results = this.AddControlRecord();
|
||||||
|
if (this.SysModel.AddAndSubmit&& results)
|
||||||
|
{
|
||||||
|
if (this.btnApply.Visible && this.btnApply.Enabled) this.OnApplyClick(null,null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -2610,9 +2614,9 @@ namespace Lskj.Control
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
string url = string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&isview={3}&dllcoid=", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, idValue, this.btnUpdate.Enabled ? "0" : "1");
|
string url = string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&isview={3}&dllcoid=", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, idValue, this.btnUpdate.Enabled ? "0" : "1");
|
||||||
if (!string.IsNullOrWhiteSpace(this.ParentKey)&& this.SysModel.AttachmentSelectNode)
|
if (!string.IsNullOrWhiteSpace(this.ParentKey) && this.SysModel.AttachmentSelectNode)
|
||||||
{
|
{
|
||||||
url= string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&isview={3}&specno={4}&dllcoid=", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, idValue, this.btnUpdate.Enabled ? "0" : "1", this.ParentKey);
|
url = string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&isview={3}&specno={4}&dllcoid=", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, idValue, this.btnUpdate.Enabled ? "0" : "1", this.ParentKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号)
|
// 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号)
|
||||||
|
|||||||
Reference in New Issue
Block a user