62,046
社区成员
发帖
与我相关
我的任务
分享
string usr = this.Session["curUser"] == null ? "" : this.Session["curUser"].ToString();
string curFile = string.Format("{0}_sc_{1}.csv", usr, DateTime.Now.ToString("yyyyMMdd"));
string curPath = this.Server.MapPath("../upload/" + curFile);
if (File.Exists(curPath) == false)
{
this.Jscript.Text = Msg.FileNotFound;
return;
}
try
{
StreamReader sr = new StreamReader(curPath, System.Text.Encoding.Default);
string readLine = null;
string[] keyWord;
string sql = "";
while ((readLine = sr.ReadLine()) != null)
{
if (readLine != "") //跳过第一行(字段名)和空行
{
keyWord = readLine.Split(',');
if (keyWord[0] != "调拨单号") //跳过第一行字段名
{
sql = sql + " UPDATE Contract_Order SET "
//+ "Contract_No=" + keyWord[0] + ", " //调拨单号
//+ "Contract_Date=" + keyWord[1] + ", " //调拨日期
+ "Design_Fee=" + DBA.GetInt32Value(keyWord[2]) + ", " //设计费用
+ "Should_Rcv_Date='" + keyWord[3] + "', " //应回款日期
+ "Should_To_TA_Date='" + keyWord[4] + "', " //特安要求回款日期
+ "Is_TA_Amt='" + keyWord[5] + "', " //是否回款特安
+ "Mortgage_Amount=" + DBA.GetInt32Value(keyWord[6]) + ", " //抵押金额
+ "Mortgage_Date='" + keyWord[7] + "', " //抵押日期
+ "Surpass_Quality_Margin_Fee=" + DBA.GetInt32Value(keyWord[8]) + ", " //超质保金比例应扣费用
+ "Surpass_Quality_Margin_UnrecvFee=" + DBA.GetInt32Value(keyWord[9]) + ", " //超质保期未回应扣费用
+ "Last_Modified_Date=GetDate() "
+ "WHERE Contract_No='" + keyWord[0] + "' ";
}
}
}
sr.Close();
int n = DAL.ExecuteNonQuery(sql);
if (n > 0)
{
FillData(1); //导入数据后刷新
this.curHeaderKey.Value = "";
this.Jscript.Text = Msg.ImportOk;
}
else this.Jscript.Text = Msg.ImportFail;
}
catch
{
this.Jscript.Text = Msg.ImportFail;
}
File.Delete(curPath); //删除上传临时文件