private void buttonLogin_Click(object sender, EventArgs e)
        {
            Login job = new Login();

            job.Username = textUserName.Text;
            job.Password = textPassword.Text;

            List <CandidateEmployee> AllCandidate = candidatedbhelper.GetAllCandidates();
            int count = 0;

            foreach (CandidateEmployee item in AllCandidate)
            {
                if (item.Email == job.Username && item.Epassword == job.Password)
                {
                    LoginID = item.ECandidateID;
                    count   = 1;
                    this.Hide();
                    CandidatePanal jobopen = new CandidatePanal();
                    jobopen.Show();
                }
            }
            if (count != 1)
            {
                MessageBox.Show("invalid login");
                CandidateLogin cd = new CandidateLogin();
                this.Hide();
                cd.Show();
            }
        }
示例#2
0
 public ActionResult Login(Login model)
 {
     if (ModelState.IsValid)
     {
         if (model.LoginAs == "Candidate")
         {
             List <CandidateEmployee> candidatelist = candidatedbhelper.GetAllCandidates();
             foreach (CandidateEmployee item in candidatelist)
             {
                 if (item.Email == model.Username && item.Epassword == model.Password)
                 {
                     FormsAuthentication.SetAuthCookie(model.Username, false);
                     return(RedirectToAction("Index", "NucesJob"));
                 }
             }
             ViewBag.Issuccess = "Wrong UserName or Password";
             return(View());
         }
         else
         {
             List <Employee> employeelist = employeedbhelper.GetAllEmployee();
             foreach (Employee item in employeelist)
             {
                 if (item.Email == model.Username && item.Epassword == model.Password)
                 {
                     FormsAuthentication.SetAuthCookie(model.Username, false);
                     return(RedirectToAction("Index", "NucesJob"));
                 }
             }
             ViewBag.Issuccess = "Wrong UserName or Password";
             return(View());
         }
     }
     else
     {
         ModelState.AddModelError("", "Invalid Data");
         return(View());
     }
 }