您的位置:首页 > 数据库

[ExtJs4.0]数据从excle2003导入到数据库【2-2】

2012-08-16 13:34 267 查看
if (table.Rows != null)

{
IList<CurrentAccountInfo> currentList = new List<CurrentAccountInfo>();
int ExcelRow = table.Rows.Count;
for (int i = 0; i < ExcelRow; i++)
{
CurrentAccountInfo currentAccountInfo = new CurrentAccountInfo();
string userCode = table.Rows[i][1].ToString().Trim().ToUpper();
if (!string.IsNullOrEmpty(userCode))
{
currentAccountInfo.CreateUserCode = AuthManager.AuthUserInfo.UserId;//添¬¨ª加¨®人¨?工¡è号?
currentAccountInfo.CreateTime = DateTime.Now;//添¬¨ª加¨®时º¡À间?
currentAccountInfo.CreateStationCode = AuthManager.AuthUserInfo.StationId;//添¬¨ª加¨®人¨?网ª?点Ì?代䨲码?
currentAccountInfo.CAType = 0;//类¤¨¤型¨ª 0表À¨ª示º?增?加¨®网ª?点Ì? 1表À¨ª示º?减?少¦¨´网ª?点Ì?
currentAccountInfo.Id = Guid.NewGuid();
currentAccountInfo.RexognitionId = Guid.NewGuid();

string qty = table.Rows[i][0].ToString().Trim();
if (!string.IsNullOrEmpty(qty))//不?为a空?的Ì?时º¡À候¨°
{
if (!RegularHelper.IsNumber(qty))//验¨¦证¡è票¡À数ºy
{
return ExtjsFormFail("第̨²" + (i + 2) + "行D第̨²1列¢D票¡À数ºy【?" + qty + "】?数ºy据Y类¤¨¤型¨ª错䨪误¨®,ê?请?仔ÁD细?核?对?!ê?");
}
}
currentAccountInfo.Qty = Convert.ToInt32(table.Rows[i][0].ToString().Trim());

string weight = table.Rows[i][1].ToString().Trim();
if (!string.IsNullOrEmpty(weight))//不?为a空?的Ì?时º¡À候¨°
{
if (!RegularHelper.IsDecimal(weight))//验¨¦证¡è重?量¢?
{
return ExtjsFormFail("第̨²" + (i + 2) + "行D第̨²2列¢D重?量¢?【?" + weight + "】?数ºy据Y类¤¨¤型¨ª错䨪误¨®,ê?请?仔ÁD细?核?对?!ê?");
}
}
currentAccountInfo.Weight = Convert.ToInt32(table.Rows[i][1].ToString().Trim());

string increaseNumber = table.Rows[i][2].ToString().Trim();
if (!RegularHelper.IsNumber(increaseNumber))//验¨¦证¡è增?加¨®金e额?
{
return ExtjsFormFail("第̨²" + (i + 2) + "行D第̨²3列¢D增?加¨®数ºy【?" + increaseNumber + "】?数ºy据Y类¤¨¤型¨ª错䨪误¨®,ê?请?仔ÁD细?核?对?!ê?");
}
currentAccountInfo.IncreaseNumber = Convert.ToInt32(table.Rows[i][2].ToString().Trim());

string reduceNumber = table.Rows[i][3].ToString().Trim();
if (!RegularHelper.IsNumber(reduceNumber))//验¨¦证¡è减?少¦¨´金e额?
{
return ExtjsFormFail("第̨²" + (i + 2) + "行D第̨²4列¢D减?少¦¨´数ºy【?" + increaseNumber + "】?数ºy据Y类¤¨¤型¨ª错䨪误¨®,ê?请?仔ÁD细?核?对?!ê?");
}
currentAccountInfo.ReduceNumber = Convert.ToInt32(table.Rows[i][3].ToString().Trim());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息