日期:2014-05-20 浏览次数:20892 次
DataTable table= ExcelHelper.ImportDataTableFromExcel(path, 0, 2);//导入EXCEL返回DataTable
for (int j = 0; j < table.Row.Count; j++)//所有用户信息
{
DataTable usertable = DatabaseProvider.GetInstance().GetUserSearch(user.Name, user.Sex.ToString(), user.BirthDay, "", "", "", "", "");//
if (usertable.Rows.Count > 0) //用户已经存在
{
uid = usertable.Rows[0]["ID"].ToString();//返回用户ID
}
else
{
DataTable usertableinfo = DatabaseProvider.GetInstance().InsertUserInfo(user);//添加用户
if (usertableinfo.Rows.Count > 0)
{
uid = usertableinfo.Rows[0]["ID"].ToString();
}
}
DataTable tableUserTemp = DatabaseProvider.GetInstance().GetUserTemplateSearch(uid, tid);//是否已存在模版
if (tableUserTemp.Rows.Count > 0)
{
utid = tableUserTemp.Rows[0]["ID"].ToString();//返回模版ID
}
else
{
DataTable table3 = DatabaseProvider.GetInstance().InsertUserTemplate(info);//添加新的模版
if (table3.Rows.Count > 0)
{
utid = table3.Rows[0]["ID"].ToString();返回模版ID
}
}
for (int j = 0; j < table.Columns.Count; j++)