public bool ImportPurviewManIds(string fileName, string CurrentUserDomainId, string Pduid, string uploadtype)
{
try
{
if (File.Exists(fileName))
{
//读取文件 一行一行读取
StreamReader objReader = new StreamReader(fileName, Encoding.Default);
string sLine = "";
List<string> arrText = new List<string>();
while (sLine != null)
{
sLine = objReader.ReadLine();
if (!string.IsNullOrEmpty(sLine))
{
arrText.Add(sLine);
}
}
objReader.Close();
List<iPAL.Models.Pub.INFO_USER_CONFIG> objlist = new List<INFO_USER_CONFIG>();
IUserVisit uv = new UserVisit();
foreach (string strline in arrText.Distinct())
{
if (string.IsNullOrEmpty(strline.Trim()))
continue;
UserInfo info = uv.GetHRInfo(strline.ToLower().Trim());
INFO_USER_CONFIG obj = new INFO_USER_CONFIG();
obj.SvrId = int.Parse(Pduid);
obj.RoleName = "普通用户";
obj.UserId = strline.ToLower().Trim();
obj.UserCnName = info.UserName;
objlist.Add(obj);
}
db.INFO_USER_CONFIG.InsertAllOnSubmit(objlist);
db.SubmitChanges();
}
return true;
}
catch (Exception ex)
{
throw ex;
return false;
}
}