SVN r430
SVN-Revision: r430
This commit is contained in:
@@ -476,11 +476,52 @@ namespace Lskj.Control.Model
|
|||||||
}
|
}
|
||||||
// 保存管理员、普通用户列均保存到P_systemGridConfigTab表中,不操作系统表.
|
// 保存管理员、普通用户列均保存到P_systemGridConfigTab表中,不操作系统表.
|
||||||
StringBuilder sBuilder = new StringBuilder();
|
StringBuilder sBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
bool isGroupIndex = false;
|
||||||
|
bool isFilterInfo = false;
|
||||||
|
bool isDisplayFiltering = false;
|
||||||
|
string saveFieldName = string.Empty;
|
||||||
|
//分组号
|
||||||
|
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "GroupIndex"))
|
||||||
|
{
|
||||||
|
isGroupIndex = true;
|
||||||
|
saveFieldName = ",GroupIndex";
|
||||||
|
|
||||||
|
}
|
||||||
|
//列筛选条件
|
||||||
|
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "FilterInfo"))
|
||||||
|
{
|
||||||
|
isFilterInfo = true;
|
||||||
|
saveFieldName += ",FilterInfo";
|
||||||
|
}
|
||||||
|
//是否显示筛选行
|
||||||
|
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering"))
|
||||||
|
{
|
||||||
|
isDisplayFiltering = true;
|
||||||
|
saveFieldName += ",DisplayFiltering";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (BandedGridColumn col in gridView.Columns)
|
foreach (BandedGridColumn col in gridView.Columns)
|
||||||
{
|
{
|
||||||
|
string fieldValue = string.Empty;
|
||||||
|
if (isGroupIndex)
|
||||||
|
{
|
||||||
|
fieldValue = ",'" + col.GroupIndex + "'";
|
||||||
|
}
|
||||||
|
if (isFilterInfo)
|
||||||
|
{
|
||||||
|
fieldValue += ",'" + col.FilterInfo.FilterString.Replace("'", "''") + "'";
|
||||||
|
}
|
||||||
|
if (isDisplayFiltering)
|
||||||
|
{
|
||||||
|
fieldValue += gridView.OptionsView.ShowAutoFilterRow ? ",'1'" : ",'0'";
|
||||||
|
}
|
||||||
|
|
||||||
GridColumnModel model = col.Tag as GridColumnModel;
|
GridColumnModel model = col.Tag as GridColumnModel;
|
||||||
string tempSql = string.Format(@"insert into {8}(formkey,fieldname,username,orderid,isvisible,operatorid,operatorName,operatedate,fieldWidth,IfFixColumn,FieldText) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}',getdate(),'{7}','{9}','{10}');",
|
if (model == null) continue;
|
||||||
key, col.FieldName, col.Caption, col.VisibleIndex, Convert.ToInt32(col.Visible), ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, col.Width, ResourceKeys.SettingTableName, col.OwnerBand != null ? col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left : false, model.FieldText);
|
string tempSql = string.Format(@"insert into {8}(formkey,fieldname,username,orderid,isvisible,operatorid,operatorName,operatedate,fieldWidth,IfFixColumn,FieldText {11}) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}',getdate(),'{7}','{9}','{10}' {12});",
|
||||||
|
key, col.FieldName, col.Caption, col.VisibleIndex, Convert.ToInt32(col.Visible), ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, col.Width, ResourceKeys.SettingTableName, col.OwnerBand != null ? col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left : false, model.FieldText, saveFieldName, fieldValue);
|
||||||
sBuilder.Append(tempSql);
|
sBuilder.Append(tempSql);
|
||||||
}
|
}
|
||||||
return BaseImpl.ExecSqlValue(sBuilder.ToString()) > 0;
|
return BaseImpl.ExecSqlValue(sBuilder.ToString()) > 0;
|
||||||
@@ -518,12 +559,56 @@ namespace Lskj.Control.Model
|
|||||||
string sqlValue = string.Format("select * from {0} where formKey='{1}' and OperatorId='{2}'", ResourceKeys.SettingTableName, key, ERPInfo.Instance.UserId);
|
string sqlValue = string.Format("select * from {0} where formKey='{1}' and OperatorId='{2}'", ResourceKeys.SettingTableName, key, ERPInfo.Instance.UserId);
|
||||||
DataTable customTable = SqlHelper.ExecuteDataTable(sqlValue);
|
DataTable customTable = SqlHelper.ExecuteDataTable(sqlValue);
|
||||||
StringBuilder sBuilder = new StringBuilder();
|
StringBuilder sBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
bool isGroupIndex = false;
|
||||||
|
bool isFilterInfo = false;
|
||||||
|
bool isDisplayFiltering = false;
|
||||||
|
string saveFieldName = string.Empty;
|
||||||
|
//分组号
|
||||||
|
if (customTable.Columns.Contains("GroupIndex"))
|
||||||
|
{
|
||||||
|
isGroupIndex = true;
|
||||||
|
saveFieldName = ",GroupIndex";
|
||||||
|
|
||||||
|
}
|
||||||
|
//列筛选条件
|
||||||
|
if (customTable.Columns.Contains("FilterInfo"))
|
||||||
|
{
|
||||||
|
isFilterInfo = true;
|
||||||
|
saveFieldName += ",FilterInfo";
|
||||||
|
}
|
||||||
|
//是否显示筛选行
|
||||||
|
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering"))
|
||||||
|
{
|
||||||
|
isDisplayFiltering = true;
|
||||||
|
saveFieldName += ",DisplayFiltering";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (BandedGridColumn col in gridView.Columns)
|
foreach (BandedGridColumn col in gridView.Columns)
|
||||||
{
|
{
|
||||||
|
string fieldValue = string.Empty;
|
||||||
|
string updateField = string.Empty;
|
||||||
|
if (isGroupIndex)
|
||||||
|
{
|
||||||
|
fieldValue = ",'" + col.GroupIndex + "'";
|
||||||
|
updateField = string.Format(" ,GroupIndex='{0}' ", col.GroupIndex);
|
||||||
|
}
|
||||||
|
if (isFilterInfo)
|
||||||
|
{
|
||||||
|
fieldValue += ",'" + col.FilterInfo.FilterString.Replace("'", "''") + "'";
|
||||||
|
updateField += string.Format(" ,FilterInfo='{0}' ", col.FilterInfo.FilterString.Replace("'", "''"));
|
||||||
|
}
|
||||||
|
if (isDisplayFiltering)
|
||||||
|
{
|
||||||
|
fieldValue += gridView.OptionsView.ShowAutoFilterRow ? ",'1'" : ",'0'";
|
||||||
|
updateField += gridView.OptionsView.ShowAutoFilterRow ? " ,DisplayFiltering='1' " : " ,DisplayFiltering='0' ";
|
||||||
|
}
|
||||||
|
|
||||||
GridColumnModel model = col.Tag as GridColumnModel;
|
GridColumnModel model = col.Tag as GridColumnModel;
|
||||||
DataRow a = customTable.Rows.Cast<DataRow>().FirstOrDefault(x => col.Name.Equals(x["fieldName"] + "", StringComparison.OrdinalIgnoreCase));
|
DataRow a = customTable.Rows.Cast<DataRow>().FirstOrDefault(x => col.Name.Equals(x["fieldName"] + "", StringComparison.OrdinalIgnoreCase));
|
||||||
string tempSql = a == null ? string.Format(@"insert into {8}(formkey,fieldname,username,orderid,isvisible,operatorid,operatorName,operatedate,fieldWidth,IfFixColumn,FieldText) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}',getdate(),'{7}','{9}','{10}');",
|
string tempSql = a == null ? string.Format(@"insert into {8}(formkey,fieldname,username,orderid,isvisible,operatorid,operatorName,operatedate,fieldWidth,IfFixColumn,FieldText {11}) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}',getdate(),'{7}','{9}','{10}' {12});",
|
||||||
key, col.FieldName, col.Caption, col.VisibleIndex, Convert.ToInt32(col.Visible), ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, col.Width, ResourceKeys.SettingTableName, col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left, model.FieldText) : string.Format(@"update {6} set orderid='{0}',fieldWidth='{1}',isvisible={2},IfFixColumn='{7}' where formkey='{3}' and fieldname='{4}' and operatorid='{5}';",
|
key, col.FieldName, col.Caption, col.VisibleIndex, Convert.ToInt32(col.Visible), ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, col.Width, ResourceKeys.SettingTableName, col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left, model.FieldText, saveFieldName, fieldValue) : string.Format(@"update {6} set orderid='{0}',fieldWidth='{1}',isvisible={2},IfFixColumn='{7}' where formkey='{3}' and fieldname='{4}' and operatorid='{5}';",
|
||||||
col.VisibleIndex, col.Width, Convert.ToInt32(col.Visible), key, col.FieldName, ERPInfo.Instance.UserId, ResourceKeys.SettingTableName, col.OwnerBand != null ? col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left : false);
|
col.VisibleIndex, col.Width, Convert.ToInt32(col.Visible), key, col.FieldName, ERPInfo.Instance.UserId, ResourceKeys.SettingTableName, col.OwnerBand != null ? col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left : false);
|
||||||
sBuilder.Append(tempSql);
|
sBuilder.Append(tempSql);
|
||||||
}
|
}
|
||||||
@@ -1853,6 +1938,7 @@ namespace Lskj.Control.Model
|
|||||||
for (int i = 0; i < headerRow.LastCellNum; i++)
|
for (int i = 0; i < headerRow.LastCellNum; i++)
|
||||||
{
|
{
|
||||||
ICell cell = headerRow.GetCell(i);
|
ICell cell = headerRow.GetCell(i);
|
||||||
|
if (cell == null) continue;
|
||||||
if (index != 1)
|
if (index != 1)
|
||||||
{
|
{
|
||||||
GridColumn col = gridView.Columns.OfType<GridColumn>().FirstOrDefault(x => Regex.Replace(x.Caption, @"\s", "") == Regex.Replace(cell.ToString(), @"\s", ""));
|
GridColumn col = gridView.Columns.OfType<GridColumn>().FirstOrDefault(x => Regex.Replace(x.Caption, @"\s", "") == Regex.Replace(cell.ToString(), @"\s", ""));
|
||||||
@@ -1901,7 +1987,7 @@ namespace Lskj.Control.Model
|
|||||||
if (colFields.IndexOf("lskjimport_errorFlag") != -1 && !table.Columns.Contains("lskjimport_errorFlag"))
|
if (colFields.IndexOf("lskjimport_errorFlag") != -1 && !table.Columns.Contains("lskjimport_errorFlag"))
|
||||||
table.Columns.Add("lskjimport_errorFlag");
|
table.Columns.Add("lskjimport_errorFlag");
|
||||||
|
|
||||||
bool AutoImportCal = SystemInfo.Instance.AutoImportCal;//是否执行 计算公式
|
bool AutoImportCal = SystemInfo.Instance.AutoImportCal;//是否执行 关联和计算公式
|
||||||
//bool ImportDefaultValue= SystemInfo.Instance.ImportDefaultValue;//是否为空单元格添加默认值
|
//bool ImportDefaultValue= SystemInfo.Instance.ImportDefaultValue;//是否为空单元格添加默认值
|
||||||
//bool isImportRows = true;//是否是导入行(如果是合计行就不触发默认值)
|
//bool isImportRows = true;//是否是导入行(如果是合计行就不触发默认值)
|
||||||
// 添加行
|
// 添加行
|
||||||
@@ -1922,6 +2008,7 @@ namespace Lskj.Control.Model
|
|||||||
ICell cell = row.GetCell(j);
|
ICell cell = row.GetCell(j);
|
||||||
ICell headcell = headerRow.GetCell(j);
|
ICell headcell = headerRow.GetCell(j);
|
||||||
ICell Bandcell = BandheaderRow.GetCell(j);
|
ICell Bandcell = BandheaderRow.GetCell(j);
|
||||||
|
if (headcell == null && Bandcell == null) continue;
|
||||||
//cell.CellStyle.Indention 获取单元格的缩进
|
//cell.CellStyle.Indention 获取单元格的缩进
|
||||||
columnName = headcell.StringCellValue;
|
columnName = headcell.StringCellValue;
|
||||||
|
|
||||||
@@ -1941,6 +2028,7 @@ namespace Lskj.Control.Model
|
|||||||
if (cell.CellType == CellType.Formula)
|
if (cell.CellType == CellType.Formula)
|
||||||
{
|
{
|
||||||
//isImportRows = false;
|
//isImportRows = false;
|
||||||
|
// dataRow[col.FieldName] = cell.StringCellValue;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cell.CellType == CellType.Numeric && (cell.NumericCellValue + "").StartsWith("-"))
|
if (cell.CellType == CellType.Numeric && (cell.NumericCellValue + "").StartsWith("-"))
|
||||||
@@ -2009,6 +2097,7 @@ namespace Lskj.Control.Model
|
|||||||
|| model.FieldType == ControlType.LabCheckBox
|
|| model.FieldType == ControlType.LabCheckBox
|
||||||
|| model.FieldType == ControlType.LabAutoGridValue
|
|| model.FieldType == ControlType.LabAutoGridValue
|
||||||
|| model.FieldType == ControlType.LabAutoGridValueParam
|
|| model.FieldType == ControlType.LabAutoGridValueParam
|
||||||
|
|| model.FieldType == ControlType.LabSelectReturnId
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
bool isEmpty = model.CanNull;
|
bool isEmpty = model.CanNull;
|
||||||
@@ -2344,6 +2433,7 @@ namespace Lskj.Control.Model
|
|||||||
|| model.FieldType == ControlType.LabCheckBox
|
|| model.FieldType == ControlType.LabCheckBox
|
||||||
|| model.FieldType == ControlType.LabAutoGridValue
|
|| model.FieldType == ControlType.LabAutoGridValue
|
||||||
|| model.FieldType == ControlType.LabAutoGridValueParam
|
|| model.FieldType == ControlType.LabAutoGridValueParam
|
||||||
|
|| model.FieldType == ControlType.LabSelectReturnId
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
bool isEmpty = model.CanNull;
|
bool isEmpty = model.CanNull;
|
||||||
@@ -2713,9 +2803,19 @@ namespace Lskj.Control.Model
|
|||||||
|| model.FieldType == ControlType.LabCheckBox
|
|| model.FieldType == ControlType.LabCheckBox
|
||||||
|| model.FieldType == ControlType.LabAutoGridValue
|
|| model.FieldType == ControlType.LabAutoGridValue
|
||||||
|| model.FieldType == ControlType.LabAutoGridValueParam
|
|| model.FieldType == ControlType.LabAutoGridValueParam
|
||||||
|
|| model.FieldType == ControlType.LabSelectReturnId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
string sqlValue = model.SqlSource;
|
string sqlValue = model.SqlSource;
|
||||||
|
if (model.FieldType == ControlType.LabSelectReturnId)
|
||||||
|
{
|
||||||
|
if (model.IsRadio && !string.IsNullOrWhiteSpace(model.addModuleld))
|
||||||
|
{
|
||||||
|
//单选模式数据源为模块sql
|
||||||
|
DataRow modelRow = Business.Impl.MainImpl.GetSystemdllTab(model.addModuleld);
|
||||||
|
sqlValue = modelRow["SQL"] + "";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (sqlValue.Contains(" #"))
|
if (sqlValue.Contains(" #"))
|
||||||
{
|
{
|
||||||
//sqlValue = sqlValue.Replace("#", "");
|
//sqlValue = sqlValue.Replace("#", "");
|
||||||
@@ -2776,6 +2876,7 @@ namespace Lskj.Control.Model
|
|||||||
|| model.FieldType == ControlType.LabCheckBox
|
|| model.FieldType == ControlType.LabCheckBox
|
||||||
|| model.FieldType == ControlType.LabAutoGridValue
|
|| model.FieldType == ControlType.LabAutoGridValue
|
||||||
|| model.FieldType == ControlType.LabAutoGridValueParam
|
|| model.FieldType == ControlType.LabAutoGridValueParam
|
||||||
|
|| model.FieldType == ControlType.LabSelectReturnId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
string sqlValue = model.SqlSource;
|
string sqlValue = model.SqlSource;
|
||||||
@@ -3077,47 +3178,4 @@ namespace Lskj.Control.Model
|
|||||||
// 设置填充模式为实心填充
|
// 设置填充模式为实心填充
|
||||||
cellStyle.FillPattern = FillPattern.SolidForeground;
|
cellStyle.FillPattern = FillPattern.SolidForeground;
|
||||||
}
|
}
|
||||||
cell.CellStyle = cellStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 保存更改回原始文件
|
|
||||||
using (FileStream file = new FileStream(excelFilePath, FileMode.Create, FileAccess.Write))
|
|
||||||
{
|
|
||||||
workbook.Write(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否存在未保存的数据
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="control"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsDataNotSaved(this GridControlEx control)
|
|
||||||
{
|
|
||||||
DataTable table = control.gridControl.DataSource as DataTable;
|
|
||||||
foreach (DataRow row in table.Rows)
|
|
||||||
{
|
|
||||||
if (row.RowState == DataRowState.Modified || row.RowState == DataRowState.Added)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user