public ActionResult saveotherinfoapplicant(applicantrep t) { try { var app = db.tbl_applicants.Where(a => a.applicant_id == t.applicant_id).SingleOrDefault(); app.f_name = t.f_name; app.l_name = t.l_name; app.birthday = t.birthday.HasValue == true?shamsi.ToMiladi(t.birthday.Value) : DateTime.Now; app.borncity = t.borncity; app.degree_id = t.degree_id; app.edu_field = t.edu_field; app.Expected_salary = t.Expected_salary; app.fathername = t.fathername; app.Insurance = t.Insurance; app.Insurancenumber = t.Insurancenumber; app.Insurancepriod = t.Insurancepriod; app.job_id = t.job_id; app.Married = t.Married; app.Mentalphysicalhealth = t.Mentalphysicalhealth; app.method_introduction = t.method_introduction; app.militaryservicestatus = t.militaryservicestatus; app.nationality = t.nationality; app.number_child = t.number_child; app.Religion = t.Religion; app.sex = t.sex; app.shenasnamenum = t.shenasnamenum; app.status_smoking = t.status_smoking; app.workingnow = t.workingnow; app.Type_cooperation = t.Type_cooperation; app.cellnumber = t.cellnumber; app.uniqekey = t.uniqekey; db.SaveChanges(); TempData["step"] = "1"; return(RedirectToAction("Recruitment", "home", new { codemelli = app.codemelli, cellnumber = app.cellnumber, uniqekey = app.uniqekey })); } catch (Exception e) { throw e; } }
public ActionResult Recruitment(string codemelli, string cellnumber, int uniqekey = 0) { string attention = " در صورت تکمیل هر چه بیشتر و دقیق تر اطلاعات فوق, کارشناسان استخدام زود تر با شما ارتباط برقرار می کنند"; int user = 0; if (User.Identity.IsAuthenticated) { user = int.Parse(HttpContext.User.Claims.FirstOrDefault().Value); } var access = db.tbl_accesslevels.Where(a => a.userid == user && a.accessid == 31 && a.accessvalue == true).SingleOrDefault(); if (access == null) { var q = db.tbl_applicants.Where(a => a.codemelli == codemelli && a.cellnumber == cellnumber && a.uniqekey == uniqekey).SingleOrDefault(); if (q != null) { List <tbl_skillappinfo> lstskillinf = new List <tbl_skillappinfo>(); foreach (var item in db.tbl_skills) { if (q.tbl_skillappinfo.Where(a => a.appid == q.applicant_id && a.skillid == item.id).SingleOrDefault() == null) { tbl_skillappinfo t = new tbl_skillappinfo(); t.appid = q.applicant_id; t.skillid = item.id; t.skillvalue = "1"; lstskillinf.Add(t); } } db.tbl_skillappinfo.AddRange(lstskillinf); db.SaveChanges(); applicantrep ap = new applicantrep(); ap.applicant_id = q.applicant_id; ap.applicant_image = q.applicant_image; ap.birthday = q.birthday.HasValue == true ? q.birthday.Value : DateTime.Now; ap.borncity = q.borncity; ap.cellnumber = q.cellnumber; ap.codemelli = q.codemelli; ap.degree_id = q.degree_id; ap.driverlicense = q.driverlicense; ap.edu_field = q.edu_field; ap.Expected_salary = q.Expected_salary; ap.f_name = q.f_name; ap.fathername = q.fathername; ap.Insurance = q.Insurance; ap.Insurancenumber = q.Insurancenumber; ap.Insurancepriod = q.Insurancepriod; ap.job_id = q.job_id; ap.l_name = q.l_name; ap.Married = q.Married; ap.Mentalphysicalhealth = q.Mentalphysicalhealth; ap.method_introduction = q.method_introduction; ap.militaryservicestatus = q.militaryservicestatus; ap.nationality = q.nationality; ap.number_child = q.number_child; ap.Religion = q.Religion; ap.sabtdate = q.sabtdate; ap.sex = q.sex; ap.shenasnamenum = q.shenasnamenum; ap.status_smoking = q.status_smoking; ap.Type_cooperation = q.Type_cooperation; ap.workingnow = q.workingnow; TempData["message"] = attention; return(View(ap)); } else { TempData["message"] = "اطلاعات وارده صحیح نمی باشد"; return(RedirectToAction("editapplicantinfo", "home")); } } else { var q = db.tbl_applicants.Where(a => a.codemelli == codemelli && a.cellnumber == cellnumber).SingleOrDefault(); if (q != null) { List <tbl_skillappinfo> lstskillinf = new List <tbl_skillappinfo>(); foreach (var item in db.tbl_skills) { if (q.tbl_skillappinfo.Where(a => a.appid == q.applicant_id && a.skillid == item.id).SingleOrDefault() == null) { tbl_skillappinfo t = new tbl_skillappinfo(); t.appid = q.applicant_id; t.skillid = item.id; t.skillvalue = "1"; lstskillinf.Add(t); } } db.tbl_skillappinfo.AddRange(lstskillinf); db.SaveChanges(); applicantrep ap = new applicantrep(); ap.applicant_id = q.applicant_id; ap.applicant_image = q.applicant_image; ap.birthday = q.birthday.HasValue == true ? q.birthday.Value : DateTime.Now; ap.borncity = q.borncity; ap.cellnumber = q.cellnumber; ap.codemelli = q.codemelli; ap.degree_id = q.degree_id; ap.driverlicense = q.driverlicense; ap.edu_field = q.edu_field; ap.Expected_salary = q.Expected_salary; ap.f_name = q.f_name; ap.fathername = q.fathername; ap.Insurance = q.Insurance; ap.Insurancenumber = q.Insurancenumber; ap.Insurancepriod = q.Insurancepriod; ap.job_id = q.job_id; ap.l_name = q.l_name; ap.Married = q.Married; ap.Mentalphysicalhealth = q.Mentalphysicalhealth; ap.method_introduction = q.method_introduction; ap.militaryservicestatus = q.militaryservicestatus; ap.nationality = q.nationality; ap.number_child = q.number_child; ap.Religion = q.Religion; ap.sabtdate = q.sabtdate; ap.sex = q.sex; ap.shenasnamenum = q.shenasnamenum; ap.status_smoking = q.status_smoking; ap.Type_cooperation = q.Type_cooperation; ap.workingnow = q.workingnow; ap.uniqekey = q.uniqekey; TempData["access"] = "okay"; return(View(ap)); } else { TempData["message"] = "اطلاعات وارده صحیح نمی باشد"; return(RedirectToAction("editapplicantinfo", "home")); } } }