init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,547 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using DevExpress.XtraGrid.Columns;
|
||||
using System.Data.Common;
|
||||
using System.Data.SqlClient;
|
||||
using Lskj;
|
||||
using CommonLib;
|
||||
using Lskj.MyControl;
|
||||
using DevExpress.XtraEditors.Repository;
|
||||
using DevExpress.XtraEditors;
|
||||
|
||||
namespace ExcelPlus
|
||||
{
|
||||
|
||||
|
||||
public partial class frmImport : DevExpress.XtraEditors.XtraForm
|
||||
{
|
||||
public frmImport()
|
||||
{
|
||||
DevExpress.Skins.SkinManager.EnableFormSkins();
|
||||
InitializeComponent();
|
||||
}
|
||||
private GridControlEx importGrid;
|
||||
private string importTable = "";
|
||||
private string OperatorId = "1";
|
||||
private string OperatorName = "管理员";
|
||||
private string mainKeyField = "";
|
||||
private string mainKeyValue = "";
|
||||
private string columnPrefix = "";
|
||||
private string leftField, leftValue;
|
||||
private int success = 0, failed = 0;
|
||||
private Dictionary<string, DataTable> lookupTables;
|
||||
public frmImport(GridControlEx grid, string table,string mainKey,string mainValue, string inoperatorid, string inoperatorname,string colPrefix)
|
||||
{
|
||||
DevExpress.Skins.SkinManager.EnableFormSkins();
|
||||
InitializeComponent();
|
||||
importGrid = grid;
|
||||
importTable = table;
|
||||
lookupTables = grid.lookupTables;
|
||||
OperatorId = inoperatorid;
|
||||
OperatorName = inoperatorname;
|
||||
mainKeyField = mainKey;
|
||||
mainKeyValue = mainValue;
|
||||
columnPrefix = colPrefix;
|
||||
//初始化grid
|
||||
grdImp.gridView.Columns.Clear();
|
||||
GridView grv = (GridView)grid.gridView;
|
||||
foreach (GridColumn gc in grv.VisibleColumns)
|
||||
{
|
||||
GridColumn gctmp = grdImp.gridView.Columns.Add();
|
||||
gctmp.Tag = gc.Tag;
|
||||
gctmp.FieldName = gc.FieldName;
|
||||
gctmp.Width = gc.Width;
|
||||
gctmp.Caption = gc.Caption;
|
||||
gctmp.Visible = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public frmImport(GridControlEx grid, GridControlEx gridMain, string MainModId, string ModId, string table, string inoperatorid, string inoperatorname)
|
||||
{
|
||||
DevExpress.Skins.SkinManager.EnableFormSkins();
|
||||
InitializeComponent();
|
||||
importGrid = grid;
|
||||
importTable = table;
|
||||
OperatorId = inoperatorid;
|
||||
OperatorName = inoperatorname;
|
||||
lookupTables = grid.lookupTables;
|
||||
//初始化grid
|
||||
grdImp.gridView.Columns.Clear();
|
||||
GridView grv = (GridView)grid.gridView;
|
||||
foreach (GridColumn gc in grv.VisibleColumns)
|
||||
{
|
||||
GridColumn gctmp = grdImp.gridView.Columns.Add();
|
||||
gctmp.Tag = gc.Tag;
|
||||
gctmp.FieldName = gc.FieldName;
|
||||
gctmp.Width = gc.Width;
|
||||
gctmp.Caption = gc.Caption;
|
||||
gctmp.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public frmImport(GridControlEx grid, string table, string mainKey, string mainValue, string inoperatorid, string inoperatorname, string colPrefix, string leftField, string leftValue)
|
||||
{
|
||||
DevExpress.Skins.SkinManager.EnableFormSkins();
|
||||
InitializeComponent();
|
||||
importGrid = grid;
|
||||
importTable = table;
|
||||
lookupTables = grid.lookupTables;
|
||||
OperatorId = inoperatorid;
|
||||
OperatorName = inoperatorname;
|
||||
mainKeyField = mainKey;
|
||||
mainKeyValue = mainValue;
|
||||
columnPrefix = colPrefix;
|
||||
this.leftField = leftField;
|
||||
this.leftValue = leftValue;
|
||||
//初始化grid
|
||||
grdImp.gridView.Columns.Clear();
|
||||
GridView grv = (GridView)grid.gridView;
|
||||
foreach (GridColumn gc in grv.VisibleColumns)
|
||||
{
|
||||
GridColumn gctmp = grdImp.gridView.Columns.Add();
|
||||
gctmp.Tag = gc.Tag;
|
||||
gctmp.FieldName = gc.FieldName;
|
||||
gctmp.Width = gc.Width;
|
||||
gctmp.Caption = gc.Caption;
|
||||
gctmp.Visible = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void simpleButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Title = "导入文件选择";
|
||||
ofd.Filter = "Excel文件(*.xls)|*.xls|(*.xlsx)|*.xlsx";
|
||||
DialogResult dialogResult = ofd.ShowDialog();
|
||||
if (dialogResult == DialogResult.OK)
|
||||
{
|
||||
string file = ofd.FileName;
|
||||
DataTable dt = ExcelHelper.ImportToGrid(file, importTable, false, grdImp.gridControl);
|
||||
grdImp.gridControl.DataSource = dt;
|
||||
}
|
||||
}
|
||||
|
||||
private void simpleButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
importFromGridBySql();
|
||||
}
|
||||
|
||||
private void importFromGrid()
|
||||
{
|
||||
DataTable dt = (DataTable)grdImp.gridControl.DataSource;
|
||||
if (dt == null)
|
||||
{
|
||||
MessageBox.Show("请先读取Excel文件数据", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dt.Rows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("没有任何数据可以进行导入", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
//提交到数据库
|
||||
try
|
||||
{
|
||||
string sql = "select * from " + importTable + " where 1<>1";
|
||||
SqlDataAdapter dat = SqlHelper.ExecuteAdapter(CommandType.Text, sql);
|
||||
SqlCommandBuilder scb = new SqlCommandBuilder(dat);
|
||||
DataTable datatb = new DataTable();
|
||||
dat.Fill(datatb);
|
||||
//根据全表字段类型进行默认填充
|
||||
int currRow = 0;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
DataRow tmpRow = datatb.NewRow();
|
||||
foreach (DataColumn dc in datatb.Columns)
|
||||
{
|
||||
if (dc.DataType.Name.ToLower() == "string")
|
||||
tmpRow[dc] = "";
|
||||
if (dc.DataType.Name.ToLower().IndexOf("char") >= 0)
|
||||
tmpRow[dc] = "";
|
||||
if (dc.DataType.Name.ToLower().IndexOf("int") >= 0)
|
||||
tmpRow[dc] = 0;
|
||||
if (dc.DataType.Name.ToLower() == "decimal")
|
||||
tmpRow[dc] = 0;
|
||||
//if (dc.DataType.Name.ToLower().IndexOf("date") >= 0)
|
||||
// tmpRow[dc] = DateTime.Now;
|
||||
}
|
||||
foreach (GridColumn gc in grdImp.gridView.VisibleColumns)
|
||||
{
|
||||
int fieldType = (gc.Tag as MyTagModel).fieldTypeId;
|
||||
string lookupKey = (gc.Tag as MyTagModel).lookupKey;
|
||||
string lookupValue = (gc.Tag as MyTagModel).lookupValue;
|
||||
if ((fieldType == 1) || (fieldType == 5) || (fieldType == 15))
|
||||
{
|
||||
DataTable tmpdt = lookupTables[gc.FieldName];
|
||||
DataRow[] tmpdr = tmpdt.Select(lookupValue + "='" + dr[gc.FieldName] + "'");
|
||||
if ((tmpdr != null) && (tmpdr.Length < 1))
|
||||
{
|
||||
MessageBox.Show("数据导入错误,未找到对应的编码,请检查!\r\n第" + (currRow + 1).ToString() + "行,第" + (gc.VisibleIndex + 1).ToString() + "列", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
tmpRow[gc.FieldName] = tmpdr[0][lookupKey];
|
||||
}
|
||||
//排除数值型导入空值的可能
|
||||
else if (dr[gc.FieldName].ToString().Trim() != "")
|
||||
{
|
||||
if (dr[gc.FieldName].ToString().Trim() == "校验")
|
||||
tmpRow[gc.FieldName] = "1";
|
||||
else if (dr[gc.FieldName].ToString().Trim() == "非校验")
|
||||
tmpRow[gc.FieldName] = "0";
|
||||
else
|
||||
tmpRow[gc.FieldName] = dr[gc.FieldName];
|
||||
}
|
||||
}
|
||||
if (datatb.Columns.Contains(columnPrefix + "operatorid"))
|
||||
tmpRow[columnPrefix + "operatorid"] = OperatorId;
|
||||
if (datatb.Columns.Contains(columnPrefix + "operatorname"))
|
||||
tmpRow[columnPrefix + "operatorname"] = OperatorName;
|
||||
if (datatb.Columns.Contains(columnPrefix + "operatedate"))
|
||||
tmpRow[columnPrefix + "operatedate"] = DateTime.Now;
|
||||
if (datatb.Columns.Contains(columnPrefix + leftField))
|
||||
tmpRow[columnPrefix + leftField] = leftValue;
|
||||
if (mainKeyField != "")
|
||||
tmpRow[mainKeyField] = mainKeyValue;
|
||||
datatb.Rows.Add(tmpRow);
|
||||
currRow++;
|
||||
}
|
||||
dat.Update(datatb);
|
||||
datatb.AcceptChanges();
|
||||
dt.AcceptChanges();
|
||||
MessageBox.Show("数据导入成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
datatb.Clear();
|
||||
dt.Clear();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("数据提交错误:\n" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void importFromGridBySql()
|
||||
{
|
||||
success = failed = 0;
|
||||
DataTable dt = (DataTable)grdImp.gridControl.DataSource;
|
||||
if (dt == null)
|
||||
{
|
||||
MessageBox.Show("请先读取Excel文件数据", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dt.Rows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("没有任何数据可以进行导入", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
//提交到数据库
|
||||
try
|
||||
{
|
||||
string sql = "select * from " + importTable + " where 1<>1";
|
||||
SqlDataAdapter dat = SqlHelper.ExecuteAdapter(CommandType.Text, sql);
|
||||
SqlCommandBuilder scb = new SqlCommandBuilder(dat);
|
||||
DataTable datatb = new DataTable();
|
||||
DataTable failedData = new DataTable();
|
||||
dat.Fill(datatb);
|
||||
failedData = dt.Clone();
|
||||
//根据全表字段类型进行默认填充
|
||||
int currRow = 0;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
DataRow tmpRow = datatb.NewRow();
|
||||
foreach (DataColumn dc in datatb.Columns)
|
||||
{
|
||||
if (dc.DataType.Name.ToLower() == "string")
|
||||
tmpRow[dc] = "";
|
||||
if (dc.DataType.Name.ToLower().IndexOf("char") >= 0)
|
||||
tmpRow[dc] = "";
|
||||
if (dc.DataType.Name.ToLower().IndexOf("int") >= 0)
|
||||
tmpRow[dc] = 0;
|
||||
if (dc.DataType.Name.ToLower() == "decimal")
|
||||
tmpRow[dc] = 0;
|
||||
//if (dc.DataType.Name.ToLower().IndexOf("date") >= 0)
|
||||
// tmpRow[dc] = DateTime.Now;
|
||||
}
|
||||
foreach (GridColumn gc in grdImp.gridView.VisibleColumns)
|
||||
{
|
||||
if (datatb.Columns.Contains(gc.FieldName))
|
||||
{
|
||||
int fieldType = (gc.Tag as MyTagModel).fieldTypeId;
|
||||
string lookupKey = (gc.Tag as MyTagModel).lookupKey;
|
||||
string lookupValue = (gc.Tag as MyTagModel).lookupValue;
|
||||
bool isEmpty = (gc.Tag as MyTagModel).IsEmpt;
|
||||
if ((fieldType == 1) || (fieldType == 5) || (fieldType == 15)||(fieldType==3))
|
||||
{
|
||||
DataTable tmpdt = lookupTables[gc.FieldName];
|
||||
DataRow[] tmpdr = tmpdt.Select(lookupValue + "='" + dr[gc.FieldName] + "'");
|
||||
if ((tmpdr != null) && (tmpdr.Length < 1))
|
||||
{
|
||||
if (isEmpty)
|
||||
{
|
||||
MessageBox.Show("数据导入错误,未找到对应的编码,请检查!\r\n第" + (currRow + 1).ToString() + "行,第" + (gc.VisibleIndex + 1).ToString() + "列-" + gc.Caption, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
GridColumn column = importGrid.gridView.Columns[gc.FieldName];
|
||||
if (column.ColumnType.Name.ToLower().IndexOf("int") >= 0)
|
||||
if (column.ColumnType.Name.ToLower() == "string")
|
||||
tmpRow[gc.FieldName] = "";
|
||||
if (column.ColumnType.Name.ToLower().IndexOf("char") >= 0)
|
||||
tmpRow[gc.FieldName] = "";
|
||||
if (column.ColumnType.Name.ToLower().IndexOf("int") >= 0)
|
||||
tmpRow[gc.FieldName] = 0;
|
||||
if (column.ColumnType.Name.ToLower() == "decimal")
|
||||
tmpRow[gc.FieldName] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpRow[gc.FieldName] = tmpdr[0][lookupKey];
|
||||
}
|
||||
}
|
||||
//排除数值型导入空值的可能
|
||||
else if (dr[gc.FieldName].ToString().Trim() != "")
|
||||
{
|
||||
GridColumn column = importGrid.gridView.Columns[gc.FieldName];
|
||||
|
||||
if (dr[gc.FieldName].ToString().Trim() == "校验")
|
||||
tmpRow[gc.FieldName] = "1";
|
||||
else if (dr[gc.FieldName].ToString().Trim() == "非校验")
|
||||
tmpRow[gc.FieldName] = "0";
|
||||
|
||||
string fieldValue= dr[gc.FieldName].ToString().Trim();
|
||||
if (fieldValue == "是" || fieldValue == "否")
|
||||
{
|
||||
if (column.ColumnEdit != null && column.ColumnEdit.GetType() == typeof(RepositoryItemCheckEdit))
|
||||
{
|
||||
tmpRow[gc.FieldName] = "1";
|
||||
}
|
||||
else if (column.ColumnType != null && column.ColumnType.Name.ToLower() == "boolean")
|
||||
{
|
||||
tmpRow[gc.FieldName] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpRow[gc.FieldName] = fieldValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
tmpRow[gc.FieldName] = fieldValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (datatb.Columns.Contains(columnPrefix + "operatorid"))
|
||||
// tmpRow[columnPrefix + "operatorid"] = OperatorId;
|
||||
//if (datatb.Columns.Contains(columnPrefix + "operatorname"))
|
||||
// tmpRow[columnPrefix + "operatorname"] = OperatorName;
|
||||
//if (datatb.Columns.Contains(columnPrefix + "operatedate"))
|
||||
// tmpRow[columnPrefix + "operatedate"] = DateTime.Now;
|
||||
setDefaultValue(datatb, tmpRow);
|
||||
|
||||
if (mainKeyField != "")
|
||||
tmpRow[mainKeyField] = mainKeyValue;
|
||||
if (datatb.Columns.Contains(columnPrefix + leftField))
|
||||
{
|
||||
if (tmpRow[columnPrefix + leftField]+""=="")
|
||||
tmpRow[columnPrefix + leftField] = leftValue;
|
||||
}
|
||||
datatb.Rows.Add(tmpRow);
|
||||
try
|
||||
{
|
||||
dat.Update(datatb);
|
||||
datatb.AcceptChanges();
|
||||
success++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
dr.RowError = ex.Message;
|
||||
failedData.ImportRow(dr);
|
||||
datatb.Rows.Remove(tmpRow);
|
||||
failed++;
|
||||
}
|
||||
currRow++;
|
||||
}
|
||||
//dat.Update(datatb);
|
||||
//datatb.AcceptChanges();
|
||||
dt.AcceptChanges();
|
||||
XtraMessageBox.Show("数据导入完成,成功"+success.ToString()+"条,失败"+failed.ToString()+"条", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
datatb.Clear();
|
||||
dt.Clear();
|
||||
if (failed>0)
|
||||
grdImp.gridControl.DataSource = failedData;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string mesage = ex.Message;
|
||||
foreach (GridColumn gc in grdImp.gridView.VisibleColumns)
|
||||
{
|
||||
if (ex.Message.Contains(gc.FieldName))
|
||||
{
|
||||
mesage = gc.Caption + " 格式不正确,请检查!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show("数据提交错误:\n" + mesage, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void simpleButton3_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
private void btnExprotTemp_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExcelHelper.SaveXls(grdImp.gridControl);
|
||||
}
|
||||
|
||||
private void grdvImp_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
GridView gridView = grdImp.gridView;
|
||||
if (sender != null && e != null)
|
||||
{
|
||||
if ((e.KeyCode == Keys.F6) || (e.KeyCode == Keys.F7))
|
||||
{
|
||||
GridColumn gc = gridView.FocusedColumn;
|
||||
if ((gc != null) && (gridView.RowCount > 0) && (gc.OptionsColumn.AllowEdit == true) && (gridView.OptionsBehavior.Editable == true))
|
||||
{
|
||||
DevExpress.XtraGrid.Views.Base.GridCell[] selecells = gridView.GetSelectedCells();
|
||||
if (selecells.Length == 1)
|
||||
{
|
||||
if (gridView.FocusedRowHandle < gridView.RowCount)
|
||||
{
|
||||
DialogResult dlr = MessageBox.Show("是否替换本列下所有数据为当前单元格数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (dlr == DialogResult.Yes)
|
||||
{
|
||||
object obj = gridView.GetFocusedRowCellValue(gc);
|
||||
if (obj != null)
|
||||
{
|
||||
for (int i = gridView.FocusedRowHandle; i <= gridView.RowCount; i++)
|
||||
{
|
||||
object obj1 = gridView.GetRowCellValue(i, gc);
|
||||
if (e.KeyCode == Keys.F6)
|
||||
{
|
||||
if ((obj1 == null) || (obj1.ToString() == "0") || (obj1.ToString() == ""))
|
||||
gridView.SetRowCellValue(i, gc, obj);
|
||||
}
|
||||
else
|
||||
gridView.SetRowCellValue(i, gc, obj);
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((e.KeyCode == Keys.F8))
|
||||
{
|
||||
GridColumn gc = gridView.FocusedColumn;
|
||||
if ((gc != null) && (gridView.RowCount > 0) && (gc.OptionsColumn.AllowEdit == true) && (gridView.OptionsBehavior.Editable == true))
|
||||
{
|
||||
DevExpress.XtraGrid.Views.Base.GridCell[] selecells = gridView.GetSelectedCells();
|
||||
if (selecells.Length == 1)
|
||||
{
|
||||
if (gridView.FocusedRowHandle < gridView.RowCount)
|
||||
{
|
||||
DialogResult dlr = MessageBox.Show("是否按顺序生成本列数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (dlr == DialogResult.Yes)
|
||||
{
|
||||
object obj = gridView.GetFocusedRowCellValue(gc);
|
||||
int lint = 0;
|
||||
int ilen = 0;
|
||||
if ((obj != null) && (Int32.TryParse(obj + "", out lint)))
|
||||
{
|
||||
ilen = obj.ToString().Length;
|
||||
for (int i = gridView.FocusedRowHandle; i <= gridView.RowCount; i++)
|
||||
{
|
||||
string istr = lint.ToString().PadLeft(ilen, '0');
|
||||
gridView.SetRowCellValue(i, gc, istr);
|
||||
|
||||
lint++;
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void frmImport_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
this.DialogResult = success > 0 ? DialogResult.OK : DialogResult.No;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找当前是否存在指定值
|
||||
/// </summary>
|
||||
/// <param name="dtTable"></param>
|
||||
/// <param name="currentRow"></param>
|
||||
/// <param name="key"></param>
|
||||
private void setDefaultValue(DataTable dtTable, DataRow currentRow)
|
||||
{
|
||||
if ((dtTable.Columns.Contains(columnPrefix + "operatorid")) && ((string.IsNullOrEmpty(currentRow[columnPrefix + "operatorid"] + "") || currentRow[columnPrefix + "operatorid"] + "" == "0")))
|
||||
currentRow[columnPrefix + "operatorid"] = OperatorId;
|
||||
if ((dtTable.Columns.Contains(columnPrefix + "operatorname")) && ((string.IsNullOrEmpty(currentRow[columnPrefix + "operatorname"] + "") || currentRow[columnPrefix + "operatorname"] + "" == "0")))
|
||||
currentRow[columnPrefix + "operatorname"] = OperatorName;
|
||||
if ((dtTable.Columns.Contains(columnPrefix + "operatedate")) && ((string.IsNullOrEmpty(currentRow[columnPrefix + "operatedate"] + "") || currentRow[columnPrefix + "operatedate"] + "" == "0")))
|
||||
currentRow[columnPrefix + "operatedate"] = DateTime.Now;
|
||||
/*
|
||||
foreach (DataColumn col in dtTable.Columns)
|
||||
{
|
||||
if (string.IsNullOrEmpty(currentRow[col.ColumnName] + "") || currentRow[col.ColumnName] + "" == "0")
|
||||
{
|
||||
if (col.ColumnName.Contains(columnPrefix + "operatorid"))
|
||||
currentRow[col.ColumnName] = OperatorId;
|
||||
if (col.ColumnName.Contains(columnPrefix+"operatorname"))
|
||||
currentRow[col.ColumnName] = OperatorName;
|
||||
if (col.ColumnName.Contains(columnPrefix+"operatedate"))
|
||||
currentRow[col.ColumnName] = DateTime.Now;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user