SVN r1089
SVN-Revision: r1089
This commit is contained in:
@@ -49,6 +49,7 @@ using DevExpress.Data;
|
||||
using DevExpress.Data.Filtering;
|
||||
using System.Data.SqlClient;
|
||||
using DevExpress.Utils;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace Lskj.Control.Model
|
||||
{
|
||||
@@ -472,11 +473,13 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "IfFixColumn"))
|
||||
DataTable dataTable = BaseImpl.GetTableColumns(ResourceKeys.SettingTableName);
|
||||
|
||||
if (!dataTable.Columns.Contains("IfFixColumn"))
|
||||
{
|
||||
BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add IfFixColumn bit");
|
||||
}
|
||||
if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "FieldText"))
|
||||
if (!dataTable.Columns.Contains("FieldText"))
|
||||
{
|
||||
BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add FieldText varchar(100)");
|
||||
}
|
||||
@@ -488,20 +491,20 @@ namespace Lskj.Control.Model
|
||||
bool isDisplayFiltering = false;
|
||||
string saveFieldName = string.Empty;
|
||||
//分组号
|
||||
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "GroupIndex"))
|
||||
if (dataTable.Columns.Contains("GroupIndex"))
|
||||
{
|
||||
isGroupIndex = true;
|
||||
saveFieldName = ",GroupIndex";
|
||||
|
||||
}
|
||||
//列筛选条件
|
||||
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "FilterInfo"))
|
||||
if (dataTable.Columns.Contains("FilterInfo"))
|
||||
{
|
||||
isFilterInfo = true;
|
||||
saveFieldName += ",FilterInfo";
|
||||
}
|
||||
//是否显示筛选行
|
||||
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering"))
|
||||
if (dataTable.Columns.Contains("DisplayFiltering"))
|
||||
{
|
||||
isDisplayFiltering = true;
|
||||
saveFieldName += ",DisplayFiltering";
|
||||
@@ -554,14 +557,18 @@ namespace Lskj.Control.Model
|
||||
public static bool UpdateCustomColumnToDatabase(this BandedGridView gridView, string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key)) return false;
|
||||
if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "IfFixColumn"))
|
||||
|
||||
DataTable dataTable = BaseImpl.GetTableColumns(ResourceKeys.SettingTableName);
|
||||
|
||||
if (!dataTable.Columns.Contains("IfFixColumn"))
|
||||
{
|
||||
BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add IfFixColumn bit");
|
||||
}
|
||||
if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "FieldText"))
|
||||
if (!dataTable.Columns.Contains("FieldText"))
|
||||
{
|
||||
BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add FieldText varchar(100)");
|
||||
}
|
||||
|
||||
string sqlValue = string.Format("select * from {0} where formKey='{1}' and OperatorId='{2}'", ResourceKeys.SettingTableName, key, ERPInfo.Instance.UserId);
|
||||
DataTable customTable = SqlHelper.ExecuteDataTable(sqlValue);
|
||||
StringBuilder sBuilder = new StringBuilder();
|
||||
@@ -584,7 +591,7 @@ namespace Lskj.Control.Model
|
||||
saveFieldName += ",FilterInfo";
|
||||
}
|
||||
//是否显示筛选行
|
||||
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering"))
|
||||
if (customTable.Columns.Contains("DisplayFiltering"))
|
||||
{
|
||||
isDisplayFiltering = true;
|
||||
saveFieldName += ",DisplayFiltering";
|
||||
@@ -636,7 +643,9 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "IfFixColumn"))
|
||||
DataTable dataTable = BaseImpl.GetTableColumns(ResourceKeys.SettingTableName);
|
||||
|
||||
if (!dataTable.Columns.Contains("IfFixColumn"))
|
||||
{
|
||||
BaseImpl.ExecSqlValue("alter table " + ResourceKeys.SettingTableName + " add IfFixColumn bit");
|
||||
}
|
||||
@@ -648,20 +657,20 @@ namespace Lskj.Control.Model
|
||||
bool isDisplayFiltering = false;
|
||||
string saveFieldName = string.Empty;
|
||||
//分组号
|
||||
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "GroupIndex"))
|
||||
if (dataTable.Columns.Contains("GroupIndex"))
|
||||
{
|
||||
isGroupIndex = true;
|
||||
saveFieldName = ",GroupIndex";
|
||||
|
||||
}
|
||||
//列筛选条件
|
||||
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "FilterInfo"))
|
||||
if (dataTable.Columns.Contains("FilterInfo"))
|
||||
{
|
||||
isFilterInfo = true;
|
||||
saveFieldName += ",FilterInfo";
|
||||
}
|
||||
//是否显示筛选行
|
||||
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering"))
|
||||
if (dataTable.Columns.Contains("DisplayFiltering"))
|
||||
{
|
||||
isDisplayFiltering = true;
|
||||
saveFieldName += ",DisplayFiltering";
|
||||
@@ -767,7 +776,7 @@ namespace Lskj.Control.Model
|
||||
saveFieldName += ",FilterInfo";
|
||||
}
|
||||
//是否显示筛选行
|
||||
if (BaseImpl.HasExistsColumn(ResourceKeys.SettingTableName, "DisplayFiltering"))
|
||||
if (customTable.Columns.Contains("DisplayFiltering"))
|
||||
{
|
||||
isDisplayFiltering = true;
|
||||
saveFieldName += ",DisplayFiltering";
|
||||
@@ -1436,7 +1445,6 @@ namespace Lskj.Control.Model
|
||||
//}
|
||||
|
||||
|
||||
|
||||
switch (fileExt)
|
||||
{
|
||||
case ".xls":
|
||||
@@ -1452,6 +1460,7 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
newControl.ExportToXls(dialog.FileName, xlsOptionsEx);
|
||||
//control.ExportToXls(dialog.FileName);
|
||||
}
|
||||
@@ -2043,7 +2052,8 @@ namespace Lskj.Control.Model
|
||||
/// <para>版本:1.0.0.3</para>
|
||||
/// </summary>
|
||||
/// <param name="colFields">The col fields.</param>
|
||||
public static DataTable ToExcelDataTable(this GridView gridView, string fileName, string colFields, bool isDirectImport = false, bool isBillImport = false)
|
||||
/// <param name="AutoImportCalMode">导入时是否触发关联计算(模块配置)</param>
|
||||
public static DataTable ToExcelDataTable(this GridView gridView, string fileName, string colFields, bool isDirectImport = false, bool isBillImport = false,bool AutoImportCalMode = false)
|
||||
{
|
||||
DataTable table = new DataTable();
|
||||
int index = gridView is BandedGridView ? 1 : 0;
|
||||
@@ -2054,7 +2064,6 @@ namespace Lskj.Control.Model
|
||||
int CurrentColumn = 0;//当前列数
|
||||
string columnName = string.Empty;//当前列名
|
||||
bool ToAssignment = false;//是否在给新表赋值
|
||||
|
||||
try
|
||||
{
|
||||
ISheet sheet = ExcelHelper.GetSheet(fileName);
|
||||
@@ -2130,7 +2139,8 @@ namespace Lskj.Control.Model
|
||||
if (colFields.IndexOf("lskjimport_errorFlag") != -1 && !table.Columns.Contains("lskjimport_errorFlag"))
|
||||
table.Columns.Add("lskjimport_errorFlag");
|
||||
|
||||
bool AutoImportCal = SystemInfo.Instance.AutoImportCal;//是否执行 关联和计算公式
|
||||
|
||||
bool AutoImportCal = SystemInfo.Instance.AutoImportCal|| AutoImportCalMode;//是否执行 关联和计算公式
|
||||
//bool ImportDefaultValue= SystemInfo.Instance.ImportDefaultValue;//是否为空单元格添加默认值
|
||||
//bool isImportRows = true;//是否是导入行(如果是合计行就不触发默认值)
|
||||
// 添加行
|
||||
@@ -2239,8 +2249,8 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
else
|
||||
{
|
||||
dataRow[col.FieldName] = cell.NumericCellValue;
|
||||
|
||||
string customFormattedValue = string.Format("{0:" + "#################0.#################" + "}", cell.NumericCellValue);
|
||||
dataRow[col.FieldName] = customFormattedValue;
|
||||
if (AutoImportCal)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(model.UnionFields))
|
||||
@@ -2410,7 +2420,7 @@ namespace Lskj.Control.Model
|
||||
catch (IOException exe)
|
||||
{
|
||||
//string Message = ErrorMessage.PromptErrorMessage(exe);
|
||||
//MessageUtil.Show(Message, exe.Message);
|
||||
//MessageUtil.Show(exe.Message);
|
||||
MessageUtil.Show(string.Format(ResourceKeys.UseingFile, Path.GetFileName(fileName)));
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -2435,7 +2445,8 @@ namespace Lskj.Control.Model
|
||||
/// <para>版本:1.0.0.3</para>
|
||||
/// </summary>
|
||||
/// <param name="colFields">The col fields.</param>
|
||||
public static DataTable ToExcelTreeDataTable(this TreeList treeList, string fileName, string colFields, bool isDirectImport = false, bool isBillImport = false)
|
||||
/// <param name="AutoImportCalMode">导入时是否触发关联计算(模块配置)</param>
|
||||
public static DataTable ToExcelTreeDataTable(this TreeList treeList, string fileName, string colFields, bool isDirectImport = false, bool isBillImport = false, bool AutoImportCalMode = false)
|
||||
{
|
||||
DataTable table = new DataTable();
|
||||
isBillImport = isBillImport;
|
||||
@@ -2495,7 +2506,7 @@ namespace Lskj.Control.Model
|
||||
if (colFields.IndexOf("lskjimport_errorFlag") != -1 && !table.Columns.Contains("lskjimport_errorFlag"))
|
||||
table.Columns.Add("lskjimport_errorFlag");
|
||||
|
||||
bool AutoImportCal = SystemInfo.Instance.AutoImportCal;//是否执行 计算公式
|
||||
bool AutoImportCal = SystemInfo.Instance.AutoImportCal|| AutoImportCalMode;//是否执行 计算公式
|
||||
//bool ImportDefaultValue= SystemInfo.Instance.ImportDefaultValue;//是否为空单元格添加默认值
|
||||
//bool isImportRows = true;//是否是导入行(如果是合计行就不触发默认值)
|
||||
// 添加行
|
||||
@@ -2846,7 +2857,7 @@ namespace Lskj.Control.Model
|
||||
|
||||
string fileName = dialog.FileName;
|
||||
string colFields = gridControlEx.GridView.Columns.ToString(',');
|
||||
ImportTable = gridControlEx.GridView.ToExcelDataTable(fileName, colFields, true);
|
||||
ImportTable = gridControlEx.GridView.ToExcelDataTable(fileName, colFields, true,false, SysModel.AutoImportCalMode);
|
||||
|
||||
|
||||
if (ImportTable == null && ImportTable.Rows.Count < 1)
|
||||
@@ -2948,8 +2959,11 @@ namespace Lskj.Control.Model
|
||||
try
|
||||
{
|
||||
string sql = "select * from " + SysModel.MenuTable + " where 1<>1";
|
||||
SqlDataAdapter dat = BaseImpl.GetAdapterResult(sql);
|
||||
SqlCommandBuilder scb = new SqlCommandBuilder(dat);
|
||||
|
||||
DbDataAdapter dat = BaseImpl.GetAdapterResult(sql);
|
||||
DbCommandBuilder cb = SqlHelper.dbFactory.CreateCommandBuilder();
|
||||
cb.DataAdapter = dat;
|
||||
// SqlCommandBuilder scb = new SqlCommandBuilder(dat);
|
||||
DataTable datatb = new DataTable();
|
||||
DataTable failedData = new DataTable();
|
||||
dat.Fill(datatb);
|
||||
@@ -3185,7 +3199,7 @@ namespace Lskj.Control.Model
|
||||
string sqlValue = string.Format("update {0} set {1}='0' ", SysModel.MenuTable, _importFlag);
|
||||
sqlValue = string.Format("update {0} set {1}='0' where {1}!='0' ", SysModel.MenuTable, _importFlag);
|
||||
SqlHelper.ExecuteNonQuery(sqlValue);
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(SysModel.afterimportSql2) && failed == 0 && datatb.Rows.Count > 0)
|
||||
{
|
||||
try
|
||||
@@ -3668,7 +3682,7 @@ namespace Lskj.Control.Model
|
||||
// MessageUtil.Show(string.Format("明细列:{0}不能为空!", gridView.Columns[requiredField].Caption));
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(gridView.GetRowCellDisplayText(i, requiredField)))
|
||||
|
||||
Reference in New Issue
Block a user