public static void ReallocateInterviewerInDB(InterviewerModel model)
        {
            SqlConnection con = DBUtils.getDBConnection();
            con.Open();
            SqlCommand command;

            foreach (var item in model.Jobs)
            {
                if (item.Checked)
                {
                    command = new SqlCommand("INSERT INTO dbo.InterviewerJob (interviewer_username, job_id ) values ('" + model.SelectedInterviewer + "', '" + item.JobId + "' );", con);
                    command.ExecuteNonQuery();
                }

            }
            con.Close();
        }
 public ActionResult ManageInterviewer(InterviewerModel model)
 {
     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");
     }
     if (model.NewInterviewer)
     {
         InterviewerDAL.SetInterviewerInDB(model);
     }
     else
     {
         InterviewerDAL.ReallocateInterviewerInDB(model);
     }
     @ViewBag.Layout = "~/Views/Shared/_LayoutPageManager.cshtml";
     @ViewBag.Message = "Interviewer Allocated.";
     return View("Message");
 }
        public ActionResult ManageInterviewer()
        {
            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");
            }

            InterviewerModel model = new InterviewerModel();
            model.Jobs = InterviewerDAL.GetSelectJobsForReleasingResult();
            model.ListOfInterviewers = InterviewerDAL.GetListOfInterviewers();
            return View(model);
        }
        public static void SetInterviewerInDB(InterviewerModel model)
        {
            SqlConnection con = DBUtils.getDBConnection();
            con.Open();
            SqlCommand command;

            string hashPassword = StringUtils.GetMD5Hash(StringUtils.Reverse(model.Password));
            command = new SqlCommand("INSERT INTO dbo.Users (username, password, role, account_act_date, name, state) VALUES ('" + model.UserName + "', '" + hashPassword + "', 'interviewer', '" + DateTime.Now.ToShortDateString() + "', '" + model.Name + "', 'Active');", con);
            command.ExecuteNonQuery();

            foreach (var item in model.Jobs)
            {
                if (item.Checked)
                {
                    command = new SqlCommand("INSERT INTO dbo.InterviewerJob (interviewer_username, job_id ) values ('" + model.UserName + "', '" + item.JobId + "' );", con);
                    command.ExecuteNonQuery();
                }

            }
            con.Close();
        }