Example #1
0
 static public HREntities getEntity()
 {
     if (ob == null)
     {
         ob = new HREntities();
         ob.Configuration.ProxyCreationEnabled = false;
     }
     return(ob);
 }
Example #2
0
 // =================================Entity===============================//
 public bool CheckID(Employees employeesId)
 {
     using (HREntities db = new HREntities())
     {
         if (db.Staffs.Any(p => p.ID == employeesId.ID))
         {
             return(true);
         }
         return(false);
     }
 }
Example #3
0
 public Staff InsertInfor(Employees employinfor)
 {
     using (HREntities db = new HREntities())
     {
         Staff employee = new Staff();
         employee.ID         = employinfor.ID;
         employee.Name       = employinfor.Name;
         employee.Department = employinfor.Department;
         employee.Salary     = en.Encrypt(employinfor.Salary);
         db.Staffs.Add(employee);
         db.SaveChanges();
         return(employee);
     }
 }
Example #4
0
        public List <Employees> GetAllInfor()
        {
            List <Employees> employeesList = new List <Employees>();


            using (HREntities db = new HREntities())
            {
                var staff = db.Staffs.ToList();
                foreach (var item in staff)
                {
                    employeesList.Add(new Employees
                    {
                        ID         = item.ID,
                        Name       = item.Name,
                        Department = item.Department,
                        Salary     = de.Decrypt(item.Salary)
                    });
                }
            }

            return(employeesList);
        }