private void buttonLogin_Click(object sender, EventArgs e)
        {
            List <Employee> AllEmployee = empdbhelper.GetAllEmployee();
            int             flag        = 0;

            foreach (Employee item in AllEmployee)
            {
                if (item.Email == textEmail.Text && item.Epassword == textPassword.Text)
                {
                    flag = 1;
                    break;
                }
            }
            if (flag == 1)
            {
                this.Hide();
                EmployeePanel jobopen = new EmployeePanel();
                jobopen.ShowDialog();
            }
            else
            {
                MessageBox.Show("invalid login");
                EmployeeLogin cd = new EmployeeLogin();
                this.Hide();
                cd.ShowDialog();
            }
        }
Пример #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());
     }
 }