public Boolean InsertJob(Job obj, Recruiter rec) { if (obj != null && rec != null && CheckUserStatus(rec)) { TabJob job = new TabJob(); job.JId = obj.JobId; job.PostedBy = rec.Username; job.JTitle = obj.Title; job.JDescription = obj.Description; job.JWorkDay = obj.Workdays; job.JApplicationDeadline = obj.DateApllicationDeadline; job.JAmount = obj.Amount; db.TabJobs.InsertOnSubmit(job); db.SubmitChanges(); foreach (var i in obj.reqSkills) { db.TabJobSkills.InsertOnSubmit(new TabJobSkill() { PostedBy = rec.Username + "-" + obj.JobId.ToString() + "-" + obj.reqSkills.IndexOf(i), JSkillRequiremets = i, JId = obj.JobId }); } db.SubmitChanges(); return(true); } else { return(false); } }
public Boolean DeleteJob(Job job) { if (job != null) { var v = from j in db.TabJobs where j.JId == Convert.ToInt32(GetJobIdByTitle(job.Title)) select j; var w = from k in db.TabJobApplications where k.JId == GetJobIdByTitle(job.Title) select k; var x = from l in db.TabJobSkills where l.JId == Convert.ToInt32(GetJobIdByTitle(job.Title)) select l; if (v.Count() == 1) { TabJob tab = v.First(); db.TabJobs.DeleteOnSubmit(tab); if (x != null) { foreach (var item in x) { TabJobSkill tabSkill = item; db.TabJobSkills.DeleteOnSubmit(tabSkill); } } if (w != null) { foreach (var item in w) { TabJobApplication tabApp = item; db.TabJobApplications.DeleteOnSubmit(tabApp); } } db.SubmitChanges(); return(true); } else { return(false); } } else { return(false); } }
public Boolean ApproveJob(Job job) { if (job != null) { var v = from j in db.TabJobs where j.JId == Convert.ToInt32(GetJobIdByTitle(job.Title)) select j; TabJob tab = v.First(); tab.status = "approved"; db.SubmitChanges(); return(true); } else { return(false); } }