/// <summary> /// 发布招聘信息 /// </summary> /// <returns></returns> public IActionResult Recruit(DateTime rstartdate, DateTime renddate, string raddress, string rtype, string rsalary, string rpeople, string rtel, string rrequire, string rdescribe) { using (parttimejobContext db = new parttimejobContext()) { int randomnumber = new Random().Next(); string b = randomnumber.ToString(); Recruit rinfo = new Recruit(); rinfo.RId = b; rinfo.CId = common.key; rinfo.PId = ""; rinfo.RStartDate = rstartdate; rinfo.REndDate = renddate; rinfo.RAddress = raddress; rinfo.RType = rtype; rinfo.RSalary = rsalary; rinfo.RPeople = rpeople; rinfo.RTel = rtel; rinfo.RDescribe = rdescribe; rinfo.RRequire = rrequire; System.DateTime dt = new System.DateTime(); dt = System.DateTime.Now; rinfo.RCreatTime = dt; if (rinfo.RAddress == null) { var script = String.Format("<script>alert('Publish failed,fill in blanks');location.href = '{0}'</script>", Url.Action("Companys")); return(Content(script, "text/html")); } db.Add(rinfo); db.SaveChanges(); var script1 = String.Format("<script>alert('Publish successfully!!!');location.href = '{0}'</script>", Url.Action("Companys")); return(Content(script1, "text/html")); } }
/// <summary> /// 编辑应聘方信息 /// </summary> /// <returns></returns> public IActionResult Applicanti(string aname, string asex, string anumber, string acollege, string amajor, string askill, string ahobby, string atel, string aaddress, string aemail, string aexper, string aremark, string alanguage) { using (parttimejobContext db = new parttimejobContext()) { Applicantinfo ainfo = db.Applicantinfo.FirstOrDefault(x => x.AId == common.key); if (ainfo == null) { Applicantinfo ainfo1 = new Applicantinfo(); ainfo1.AId = common.key; ainfo1.AName = aname; ainfo1.ASex = asex; ainfo1.ANumber = anumber; ainfo1.ACollege = acollege; ainfo1.AMajor = amajor; ainfo1.ATel = atel; ainfo1.AAddress = aaddress; ainfo1.AEmail = aemail; ainfo1.AHobby = ahobby; ainfo1.ASkill = askill; ainfo1.ARemark = aremark; ainfo1.AExper = aexper; ainfo1.ALanguage = alanguage; if (ainfo1.AName == null) { var script = String.Format("<script>alert('Save failed,fill in blanks!!!');location.href = '{0}'</script>", Url.Action("Applicants")); return(Content(script, "text/html")); } db.Add(ainfo1); db.SaveChanges(); var script1 = String.Format("<script>alert('Save successfully!!!');location.href = '{0}'</script>", Url.Action("Applicants")); return(Content(script1, "text/html")); //ViewData["error"] = "提示:修改成功"; } else { ainfo.AName = aname; ainfo.ASex = asex; ainfo.ANumber = anumber; ainfo.ACollege = acollege; ainfo.AMajor = amajor; ainfo.ATel = atel; ainfo.AAddress = aaddress; ainfo.AEmail = aemail; ainfo.AHobby = ahobby; ainfo.ASkill = askill; ainfo.ARemark = aremark; ainfo.AExper = aexper; ainfo.ALanguage = alanguage; db.SaveChanges(); var script = String.Format("<script>alert('Change successfully!!!');location.href = '{0}'</script>", Url.Action("Applicants")); return(Content(script, "text/html")); //ViewData["error"] = "提示:修改成功"; } } }
// GET: /<controller>/ /// <summary> /// 显示公司信息管理 /// </summary> /// <returns></returns> public IActionResult Companyinfo(string cname, string cindustry, string caddress, string cremark, string csize, string ctel) { using (parttimejobContext db = new parttimejobContext()) { Companyinfo cinfo = db.Companyinfo.FirstOrDefault(x => x.CId == common.key); if (cinfo == null) { Companyinfo cinfor = new Companyinfo(); cinfor.CId = common.key; cinfor.CIndustry = cindustry; cinfor.CName = cname; cinfor.CAddress = caddress; cinfor.CRemark = cremark; cinfor.CSize = csize; cinfor.CTel = ctel; if (cinfor.CName == null) { var script = String.Format("<script>alert('Save failed,fill in blanks');location.href = '{0}'</script>", Url.Action("Companys")); return(Content(script, "text/html")); } db.Add(cinfor); db.SaveChanges(); var script1 = String.Format("<script>alert('Save successfully!!!');location.href = '{0}'</script>", Url.Action("Companys")); return(Content(script1, "text/html")); } else { cinfo.CIndustry = cindustry; cinfo.CName = cname; cinfo.CAddress = caddress; cinfo.CRemark = cremark; cinfo.CSize = csize; cinfo.CTel = ctel; db.SaveChanges(); var script1 = String.Format("<script>alert('Change successfully!!!');location.href = '{0}'</script>", Url.Action("Companys")); return(Content(script1, "text/html")); } } }
// GET: /<controller>/ /// <summary> /// 显示公司信息管理 /// </summary> /// <returns></returns> public IActionResult Personinfo(string pname, string psex, string paddress, string premark, string pnumber, string ptel) { using (parttimejobContext db = new parttimejobContext()) { Personinfo cinfo = db.Personinfo.FirstOrDefault(x => x.PId == common.key); if (cinfo == null) { Personinfo cinfor = new Personinfo(); cinfor.PId = common.key; cinfor.PSex = psex; cinfor.PName = pname; cinfor.PAddress = paddress; cinfor.CRemark = premark; cinfor.PNumber = pnumber; cinfor.PTel = ptel; if (cinfor.PName == null) { var script = String.Format("<script>alert('Save failed,fill in blanks');location.href = '{0}'</script>", Url.Action("Persons")); return(Content(script, "text/html")); } db.Add(cinfor); db.SaveChanges(); var script1 = String.Format("<script>alert('Save successfully!!!');location.href = '{0}'</script>", Url.Action("Persons")); return(Content(script1, "text/html")); } else { cinfo.PSex = psex; cinfo.PName = pname; cinfo.PAddress = paddress; cinfo.CRemark = premark; cinfo.PNumber = pnumber; cinfo.PTel = ptel; db.SaveChanges(); var script1 = String.Format("<script>alert('Change successfully!!!');location.href = '{0}'</script>", Url.Action("Persons")); return(Content(script1, "text/html")); } } }
public IActionResult Register1(string username, string password1, string password2, string status) { if (password1 == password2) { if (status == "student") { using (var db = new parttimejobContext()) { var applicant = db.Applicant.FirstOrDefault(b => b.AId == username); if (applicant == null) { using (parttimejobContext app = new parttimejobContext()) { Applicant ainfo = new Applicant(); ainfo.AId = username; ainfo.APassword = password1; ainfo.AStatus = 0; db.Add(ainfo); db.SaveChanges(); } return(View("Login", "Home")); } else { ViewData["error"] = "提示:此用户名已存在,请重新输入"; return(View("register", "Home")); } } } else if (status == "company") { using (var db = new parttimejobContext()) { var company = db.Company.FirstOrDefault(b => b.CId == username); if (company == null) { using (parttimejobContext app = new parttimejobContext()) { Company ainfo = new Company(); ainfo.CId = username; ainfo.CPassword = password1; ainfo.CStatus = 0; db.Add(ainfo); db.SaveChanges(); } return(View("Login", "home")); } else { ViewData["error"] = "提示:此用户名已存在,请重新输入"; return(View("register", "home")); } } } else if (status == "person") { using (var db = new parttimejobContext()) { var person = db.Person.FirstOrDefault(b => b.PId == username); if (person == null) { using (parttimejobContext app = new parttimejobContext()) { Person ainfo = new Person(); ainfo.PId = username; ainfo.PPassword = password1; ainfo.PStatus = 0; db.Add(ainfo); db.SaveChanges(); } return(View("Login", "home")); } else { ViewData["error"] = "提示:此用户名已存在,请重新输入"; return(View("register", "home")); } } } else { ViewData["error"] = "提示:请选择注册人员类别"; return(View("register", "home")); } } else { ViewData["error"] = "提示:两次密码输入不一致"; return(View("register", "home")); } }