本文整理汇总了C#中Voodoo.Basement.DataEntities.AddToJobResumeFile方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.AddToJobResumeFile方法的具体用法?C# DataEntities.AddToJobResumeFile怎么用?C# DataEntities.AddToJobResumeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voodoo.Basement.DataEntities
的用法示例。
在下文中一共展示了DataEntities.AddToJobResumeFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveResume
/// <summary>
/// 上传简历
/// </summary>
/// <param name="file">简历文件</param>
/// <param name="id">用户id,不输入的话则自动创建新用户</param>
public static void SaveResume(HttpPostedFile file, int id = 0)
{
DataEntities ent = new DataEntities();
string extName = Path.GetExtension(file.FileName).ToLower();
string fileName = string.Format("/u/Resume/{0}{1}", DateTime.Now.ToString("yyyyMMddHHmmssfff"), extName);
BasePage.UpLoadFile(file, fileName);
Aspose.Words.Document doc = new Aspose.Words.Document(System.Web.HttpContext.Current.Server.MapPath(fileName));
string Context = doc.GetText();
User u = new User();
if (id <= 0)
{
u.UserName = @int.GetRandomNumber(1000, 999999).ToS();
u.UserPass = Voodoo.Security.Encrypt.Md5("1");
u.RegTime = DateTime.Now;
u.RegIP = WS.GetIP();
u.LoginCount = 0;
u.LastLoginTime = DateTime.Now;
u.LastLoginIP = WS.GetIP();
u.Cent = 0;
u.Enable = true;
u.Group = 1;
ent.AddToUser(u);
ent.SaveChanges();
}
else
{
u = (from l in ent.User where l.ID == id select l).First();
}
JobResumeInfo r = new JobResumeInfo();
var userResume = from l in ent.JobResumeInfo where l.UserID == u.ID select l;
if (userResume.Count() > 0)
{
r = userResume.First();
}
else
{
r.UserID = u.ID;
r.Title = string.Format("{0}的临时简历", u.UserName);
ent.AddToJobResumeInfo(r);
ent.SaveChanges();
}
#region 文件处理
var files = from l in ent.JobResumeFile where l.UserID == u.ID select l;
var resumeFile = new JobResumeFile();
if (files.Count() == 0)
{
resumeFile.UserID = u.ID;
resumeFile.ResumeID = r.ID;
resumeFile.FilePath = fileName;
resumeFile.FileName = Path.GetFileName(file.FileName);
ent.AddToJobResumeFile(resumeFile);
}
else
{
resumeFile = files.First();
resumeFile.FilePath = fileName;
resumeFile.FileName = file.FileName;
}
ent.SaveChanges();
Match match = new Regex("男|女").Match(Context);
string str_r = "";
if (match.Success)
{
str_r = match.Groups[0].Value;
if (str_r == "男")
{
r.IsMale = true;
}
else
{
r.IsMale = false;
}
}
match = new Regex("[a-zA-Z\\._]*[email protected]*?\\.(com|net|org|cn|edu|gov)").Match(Context);
if (match.Success)
{
if (id <= 0)
{
u.Email = match.Groups[0].Value;
}
r.Email = match.Groups[0].Value;
}
match = new Regex("姓名.{1,3}[^ ;,\\r]*").Match(Context);
if (match.Success)
//.........这里部分代码省略.........