public Employee Login(string employnumber , string pass)
        {
            Employee el = new Employee();

            List<Employee> le = dcsd.Employees.Where(e => e.EmployeeNumber.Equals(employnumber)).ToList();
            if (le.Count == 1)
            {

                if (le.FirstOrDefault().EmployeeNumber.Equals(employnumber) && pass.Equals(mahoa_giaima.giaiMa(le.FirstOrDefault().Password)))

                {
                    el = le.FirstOrDefault();
                    HttpContext.Current.Session["username"] = employnumber;
                }
                else
                {
                    el = null;
                }
            }
            else
            {
                el = null;
            }
            return el;
        }
        public ActionResult Login(FormCollection formvalue)
        {
            Employee el = new Employee();
            el = de.Login(formvalue["EmployeeNumber"].ToString(), formvalue["Password"].ToString());
            if(! ModelState.IsValid)
            {
                 return View();
            }

            if ( el == null)
               {
               ViewData["kq"] = "Not found account";
               return View();
               }
            Session["Employee"] = el;

            return RedirectToAction("myrequest10");
        }
 public void ThemTK(string EmployeeNumber, string fullname, DateTime datebuild, DateTime dateBirth, string email, string address, string phone, string images, int roleid, string password, string RegistrationNumber)
 {
     Employee e = new Employee();
         e.EmployeeNumber = EmployeeNumber;
         e.FullName = fullname;
         e.DateBuild = datebuild;
         e.DateBirth = dateBirth;
         e.Email = email;
         e.Address = address;
         e.Phone = phone;
         e.Images = images;
         e.RoleId = roleid;
         e.Password = password;
         e.RegistrationNumber = RegistrationNumber;
         dcs.Employees.InsertOnSubmit(e);
         dcs.SubmitChanges();
 }
 partial void DeleteEmployee(Employee instance);
 partial void UpdateEmployee(Employee instance);
 partial void InsertEmployee(Employee instance);
		private void detach_Employees(Employee entity)
		{
			this.SendPropertyChanging();
			entity.Role = null;
		}
		private void attach_Employees(Employee entity)
		{
			this.SendPropertyChanging();
			entity.Role = this;
		}