public static bool AddOfficialCaseRegisters(string path)//选择导出的路径
{
List<DataTable> dt = GetLeadinExcel(path);
int z = 0;
for (int i = 2; i < dt[0].Rows.Count; i++)
{
string sql1 = string.Format("select * from OfficialCaseRegisters where Identitycard='{0}' and FillTime='{1}' ", dt[0].Rows[i][2], dt[0].Rows[0][7]);
DataTable tb = DBHelper.GetDataSet(sql1);
if (tb.Rows.Count == 0)
{
if (dt[0].Rows[i][1].ToString() != "")
{
string sql = string.Format(@"insert into OfficialCaseRegisters(ID,Name,Gender,Identitycard,UnitName,PostName,Rank,Rewards,FillUnitName,FillTime) values('{0}','{1} ','{2} ','{3} ','{4} ','{5} ','{6} ','{7} ','{8}','{9}')",
Guid.NewGuid().ToString(), dt[0].Rows[i][0].ToString().Trim(), dt[0].Rows[i][1].ToString(), dt[0].Rows[i][2].ToString().Trim(), dt[0].Rows[i][3].ToString().Trim(), dt[0].Rows[i][4].ToString().Trim(), dt[0].Rows[i][5].ToString().Trim(), dt[0].Rows[i][6].ToString().Trim(), dt[0].Rows[0][1].ToString().Trim(), dt[0].Rows[0][7].ToString().Trim());
z = DBHelper.ExecuteCommand(sql);
}
}
}
if (z != 0)
{
for (int j = 3; j < dt[1].Rows.Count - 1; j++)
{
string sql3 = string.Format(@"insert into PraiseInfo(Id,Appointment,Attend,SumNumber,Award,RewardsThree,RewardsTwo,RewardsOne,Garland,Other,FileDepart,FileTime)
values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')", Guid.NewGuid().ToString(), dt[1].Rows[j][1].ToString(), dt[1].Rows[j][2].ToString(), dt[1].Rows[j][3].ToString(), dt[1].Rows[j][4].ToString(), dt[1].Rows[j][5].ToString(), dt[1].Rows[j][6].ToString(), dt[1].Rows[j][7].ToString(), dt[1].Rows[j][8].ToString(), dt[1].Rows[j][9].ToString(), dt[0].Rows[0][1].ToString().Trim(), dt[0].Rows[0][7].ToString().Trim());
DBHelper.ExecuteCommand(sql3);
}
for (int k = 4; k < dt[2].Rows.Count - 1; k++)
{
string sql2 = string.Format(@"insert into PrepareCase(Id,CheckGrade,TotalNumber,TotalThan,TCondemnNumber,TCondemnThan,FCondemnNumber,FCondemnThan,TNaturalNumber,TNaturalThan,FNaturalNumber,FNaturalThan,NnturalMagNumber,NnturalMagThan,TradeManNumber,TradeManThan,FIleDepart,FileTime)
values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}')",
Guid.NewGuid().ToString(), dt[2].Rows[k][1].ToString(), dt[2].Rows[k][2].ToString(), dt[2].Rows[k][3].ToString(), dt[2].Rows[k][4].ToString(), dt[2].Rows[k][5].ToString(), dt[2].Rows[k][6].ToString(), dt[2].Rows[k][7].ToString(), dt[2].Rows[k][8].ToString(), dt[2].Rows[k][9].ToString(), dt[2].Rows[k][10].ToString(), dt[2].Rows[k][11].ToString(), dt[2].Rows[k][12].ToString(), dt[2].Rows[k][13].ToString(), dt[2].Rows[k][14].ToString(), dt[2].Rows[k][15].ToString(), dt[0].Rows[0][1].ToString().Trim(), dt[0].Rows[0][7].ToString().Trim());
DBHelper.ExecuteCommand(sql2);
}
return true;
}
else
{
return false;
}
}