// /Representative/addJobsTODb public ActionResult addJobsTODb() { string type = (string)Session["TypeOfUser"]; if (type == null) { return RedirectToAction("Index", "Home"); } else if (type.CompareTo("Representative") != 0) { return RedirectToAction("Index", "Home"); } RepresentativeAddJobOffer obj = new RepresentativeAddJobOffer(); List<string> jobtypes = new List<string>(); jobtypes.Add("Full-Time"); jobtypes.Add("Part-Time"); ViewBag.jobtype = jobtypes; ViewBag.companyname = (string)Session["UserName"]; List<string> stream = new List<string>(); stream.Add("Engineering"); stream.Add("Finance"); ViewBag.streams = stream; List<string> location = new List<string>(); location.Add("Bangalore"); location.Add("Delhi"); location.Add("Pune"); location.Add("Kolkata"); location.Add("Jaipur"); ViewBag.locations = location; //obj.Items return View(); }
public int addJobOffer(RepresentativeAddJobOffer obj,int repID) { string connectionString = Connstr(); int value = -1; int locid=0; if (obj.Location.CompareTo("Bangalore") == 0) locid = 1; else if (obj.Location.CompareTo("Delhi") == 0) locid = 2; else if (obj.Location.CompareTo("Kolkata") == 0) locid = 3; else if (obj.Location.CompareTo("Pune") == 0) locid = 4; else if (obj.Location.CompareTo("Jaipur") == 0) locid = 5; string staffStatus = "Pending"; string queryString = null; queryString = "INSERT INTO JobDetails(JobId,RepId,StreamCode,JobType,MinSSCPercent,MinHSCPercent,MinGradAvg,MinPGAvg,SalPerMonth,Experience,AppLastDate,LocationID,Location,StaffApprovalStatus) " + "values(@job,@rep,@stream,@type,@minssc,@minhsc,@mingrad,@minpost,@sal,@exp,@app,@locid,@loc,@staff) ;"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(queryString, connection); command.Parameters.AddWithValue("@job", obj.jobOfferID); command.Parameters.AddWithValue("@rep", repID); command.Parameters.AddWithValue("@stream", obj.streamName); command.Parameters.AddWithValue("@type", obj.jobType); command.Parameters.AddWithValue("@minssc", obj.SscPercentage); command.Parameters.AddWithValue("@minhsc", obj.HscPercentage); command.Parameters.AddWithValue("@mingrad", obj.GraduationPercentage); command.Parameters.AddWithValue("@minpost", obj.PostGraduationPercentage); command.Parameters.AddWithValue("@sal", obj.monthlySalary); command.Parameters.AddWithValue("@exp", obj.Experience); command.Parameters.AddWithValue("@app", obj.LastDate); command.Parameters.AddWithValue("@locid", locid); command.Parameters.AddWithValue("@loc", obj.Location); command.Parameters.AddWithValue("@staff",staffStatus); connection.Open(); command.ExecuteNonQuery(); connection.Close(); } return value; }
public ActionResult addJobsTODb(RepresentativeAddJobOffer obj) { int id=(int)Session["UserID"]; int val=new DataAccess.RepresentativeDAL().addJobOffer(obj,id); return View("SuccessPage"); }