public static void ScheduleInterviewToDB(InterviewModel interviewModel, User user)
        {
            SqlConnection con = DBUtils.getDBConnection();
            con.Open();
            SqlCommand command;

            command = new SqlCommand("insert into Interview (job_id, date, time, venue, scheduled_by) values (" + interviewModel.JobId + ", '" + interviewModel.Date.ToString() + "', '" + interviewModel.Time.ToString() + "', '" + interviewModel.Venue + "', " + user.user_id + ");", con);
            command.ExecuteNonQuery();

            command = new SqlCommand("UPDATE Job SET status='S' WHERE job_id=" + interviewModel.JobId + " ;", con);
            command.ExecuteNonQuery();

            command = new SqlCommand("UPDATE Application SET status_code='I', status='Interview Scheduled' WHERE job_id=" + interviewModel.JobId + " ;", con);
            command.ExecuteNonQuery();

            con.Close();
        }
 public ActionResult ScheduleInterview(InterviewModel interviewModel)
 {
     if (!Navigator.IsUserLoggedIn(Session))
     {
         @ViewBag.Message = "Sorry! You need to login to view this page.";
         return View("Message");
         //return RedirectToAction("Login", "Account");
     }
     else if (!Navigator.UserRoleValidation(Session, "manager"))
     {
         @ViewBag.Message = "Access Denied !   You are not allowed to visit this page.";
         return View("Message");
         //return RedirectToAction("Login", "Account");
     }
     User user = ((User)Session["user"]);
     ASCommonDAL.ScheduleInterviewToDB(interviewModel, user);
     @ViewBag.Layout = "~/Views/Shared/_LayoutPageManager.cshtml";
     @ViewBag.Message = "Interview Scheduled for Job - [" + interviewModel.JobId + "] " + interviewModel.JobDesc + ".";
     return View("Message");
 }
 public ActionResult ScheduleInterviewDialog(JobModel jobModel)
 {
     if (!Navigator.IsUserLoggedIn(Session))
     {
         @ViewBag.Message = "Sorry! You need to login to view this page.";
         return PartialView("_PartialMessage");
         //return RedirectToAction("Login", "Account");
     }
     else if (!Navigator.UserRoleValidation(Session, "manager"))
     {
         @ViewBag.Message = "Access Denied !   You are not allowed to visit this page.";
         return PartialView("_PartialMessage");
         //return RedirectToAction("Login", "Account");
     }
     InterviewModel model = new InterviewModel();
     model.JobId = jobModel.JobId;
     model.JobDesc = jobModel.JobDesc.Replace(Environment.NewLine, "");
     @ViewBag.Layout = "~/Views/Shared/_LayoutPageManager.cshtml";
     @ViewBag.Controller = "Admin";
     return PartialView("../Staff/_PartialScheduleInterview", model);
 }
 public ActionResult ScheduleInterview(InterviewModel interviewModel)
 {
     if (!Navigator.IsUserLoggedIn(Session))
     {
         @ViewBag.Message = "Sorry! You need to login to continue.";
         return View("Message");
         //return RedirectToAction("Login", "Account");
     }
     else if (!Navigator.UserRoleValidation(Session, "staff"))
     {
         @ViewBag.Message = "Access Denied !   You are not allowed to continue.";
         return View("Message");
         //return RedirectToAction("Login", "Account");
     }
     else if (!Navigator.IsStaffAllowed(Session, "RightToSchedule"))
     {
         @ViewBag.Layout = "~/Views/Shared/_LayoutPageStaff.cshtml";
         @ViewBag.Message = "User Rights Denied! You don't have permission for this.";
         return View("Message");
         //return RedirectToAction("Login", "Account");
     }
     User user = ((User)Session["user"]);
     ASCommonDAL.ScheduleInterviewToDB(interviewModel, user);
     @ViewBag.Layout = "~/Views/Shared/_LayoutPageStaff.cshtml";
     @ViewBag.Message = "Interview Scheduled for Job - [" + interviewModel.JobId + "] " + interviewModel.JobDesc + ".";
     return View("Message");
 }