public ConfirmLoginModel LoginValidator(LoginModel loginModel)
        {
            SqlCommand        sda;
            SqlConnection     con    = new SqlConnection(GetConnectionString());
            ConfirmLoginModel result = new ConfirmLoginModel();

            if (con.State != ConnectionState.Open)
            {
                con.Open();
            }
            sda = new SqlCommand(commonThings.loginValidator, con);
            SqlParameter p1 = new SqlParameter("@userName", loginModel.userName);
            SqlParameter p2 = new SqlParameter("@password", loginModel.password);

            sda.Parameters.Add(p1);
            sda.Parameters.Add(p2);

            SqlDataReader dr = sda.ExecuteReader();

            if (dr.Read())
            {
                result.userName       = Convert.ToString(dr[0]);
                result.userType       = Convert.ToString(dr[1]);
                result.userDepartment = Convert.ToString(dr[2]);
                con.Close();
            }
            return(result);
        }
        public ActionResult Login(LoginModel loginModel)
        {
            ConfirmLoginModel confirmLoginModels = bussines.LoginValidator(loginModel);

            if (confirmLoginModels.userType == "Staff")
            {
                Session["StaffName"]       = confirmLoginModels.userName;
                Session["StaffDepartment"] = confirmLoginModels.userDepartment;
                return(RedirectToAction("TaskDetailsTest", "Staff"));
            }
            else if (confirmLoginModels.userType == "Super Visor")
            {
                Session["SuperVisorName"]       = confirmLoginModels.userName;
                Session["SuperVisorDepartment"] = confirmLoginModels.userDepartment;
                return(RedirectToAction("FlightsPage", "SuperVisor"));
            }
            else if (confirmLoginModels.userType == "Manager")
            {
                Session["ManagerName"] = confirmLoginModels.userName;
                return(RedirectToAction("FlightsPage", "Manager"));
            }
            else
            {
                ViewBag.Message = "Sorry we dont find you";
                return(View());
            }
        }