Пример #1
0
 public void deleteEmployee(Int32 _code)
 {
     using (DataAcc.HR_DeptEntities context = new DataAcc.HR_DeptEntities())
     {
         var per = context.Employees.Where(p => p.emp_code == _code).First();
         context.DeleteObject(per);
         context.SaveChanges();
     }
 }
Пример #2
0
        public List <String> getDepartment()
        {
            List <String> myList = new List <String>();

            DataAcc.HR_DeptEntities obj = new DataAcc.HR_DeptEntities();
            foreach (var d in obj.Departments)
            {
                myList.Add(d.dept_name.Trim());
            }
            return(myList);
        }
Пример #3
0
 public void Update(Int32 _code, String _name, String _designation, String depnm)
 {
     using (DataAcc.HR_DeptEntities obj = new DataAcc.HR_DeptEntities())
     {
         var emp = obj.Employees.Where(x => x.emp_code == _code).First();
         emp.emp_name        = _name;
         emp.emp_designation = _designation;
         emp.dept_code       = converterDep(depnm);
         obj.SaveChanges();
     }
 }
Пример #4
0
        public List<String> getDepartment()
        {
            List<String> myList = new List<String>();

            DataAcc.HR_DeptEntities obj = new DataAcc.HR_DeptEntities();
            foreach (var d in obj.Departments)
            {
                myList.Add(d.dept_name.Trim());

            }
            return myList;
        }
Пример #5
0
 public bool validateDept(String deptN)
 {
     using (DataAcc.HR_DeptEntities obj = new DataAcc.HR_DeptEntities())
     {
         bool flag   = false;
         var  result = from d in obj.Departments select d;
         foreach (var e in result)
         {
             if (deptN.ToLower().Equals(e.dept_name.ToLower()))
             {
                 flag = true;
             }
         }
         return(flag);
     }
 }
Пример #6
0
        public void getEmployee(Int32 _emp_code)
        {
            using (DataAcc.HR_DeptEntities objE = new DataAcc.HR_DeptEntities())
            {
                var result = from d in objE.sp_search_emp(_emp_code)
                             select d;

                foreach (var t in result)
                {
                    _Name           = t.emp_name;
                    _Designation    = t.emp_designation;
                    _deptName       = t.dept_name;
                    _yearsOfService = Convert.ToInt32(t.Years_of_service);
                }
            }
        }
Пример #7
0
        public void AddEmployee()
        {
            using (DataAcc.HR_DeptEntities myEnt = new DataAcc.HR_DeptEntities())
            {
                DataAcc.Employee newEmployee = new DataAcc.Employee()
                {
                    emp_code           = _Code,
                    emp_name           = _Name,
                    emp_designation    = _Designation,
                    emp_date_appointed = _Date_Appointed,
                    dept_code          = _dept_Code
                };

                myEnt.AddToEmployees(newEmployee);
                myEnt.SaveChanges();
            }
        }
Пример #8
0
 public void searchEmp(Int32 _empCode)
 {
     using (DataAcc.HR_DeptEntities empObj = new DataAcc.HR_DeptEntities())
     {
         var result = from p in empObj.Employees
                      where (p.emp_code) == _empCode
                      select p;
         foreach (var e in result)
         {
             if (e.emp_code == _empCode)
             {
                 _Name        = e.emp_name;
                 _Designation = e.emp_designation;
                 _dept_Code   = Convert.ToInt32(e.dept_code);
             }
         }
     }
 }
Пример #9
0
        public bool validateDept(String deptN)
        {
            using (DataAcc.HR_DeptEntities obj = new DataAcc.HR_DeptEntities())
            {
                bool flag = false;
                var result = from d in obj.Departments select d;
                foreach (var e in result)
                {
                    if (deptN.ToLower().Equals(e.dept_name.ToLower()))
                    {
                        flag = true;
                    }

                }
                return flag;
                            
            }

            
        }
Пример #10
0
        public Boolean validateEmpCode(Int32 _code)
        {
            using (DataAcc.HR_DeptEntities myEnt = new DataAcc.HR_DeptEntities())
            {
                var result = from p in myEnt.Employees
                             select p;

                bool found = false;

                foreach (var d in result)
                {
                    if (d.emp_code == _code)
                    {
                        found = true;
                    }
                }

                return(found);
            }
        }
Пример #11
0
        public void AddEmployee()
        {
            using (DataAcc.HR_DeptEntities myEnt = new DataAcc.HR_DeptEntities())
            {
                DataAcc.Employee newEmployee = new DataAcc.Employee()
                {

                    emp_code = _Code,
                    emp_name = _Name,
                    emp_designation = _Designation,
                    emp_date_appointed = _Date_Appointed,
                    dept_code = _dept_Code
                };

                myEnt.AddToEmployees(newEmployee);
                myEnt.SaveChanges();
            }
        }
Пример #12
0
 public void deleteEmployee(Int32 _code)
 {
     using (DataAcc.HR_DeptEntities context = new DataAcc.HR_DeptEntities())
     {
         var per = context.Employees.Where(p => p.emp_code == _code).First();
         context.DeleteObject(per);
         context.SaveChanges();
     }
 }
Пример #13
0
        public void searchEmp(Int32 _empCode)
        {
            using (DataAcc.HR_DeptEntities empObj = new DataAcc.HR_DeptEntities())
            {

                var result = from p in empObj.Employees
                             where (p.emp_code) == _empCode
                             select p;
                foreach (var e in result)
                {
                    if (e.emp_code == _empCode)
                    {

                        _Name = e.emp_name;
                        _Designation = e.emp_designation;
                        _dept_Code = Convert.ToInt32(e.dept_code);
                    }

                }


            }
        }
Пример #14
0
 public void getEmployee(Int32 _emp_code)
 {
     using (DataAcc.HR_DeptEntities objE = new DataAcc.HR_DeptEntities())
     {
         var result = from d in objE.sp_search_emp(_emp_code)
                      select d;
       
         foreach (var t in result)
         {
             _Name = t.emp_name;
             _Designation = t.emp_designation;
             _deptName = t.dept_name;
             _yearsOfService = Convert.ToInt32(t.Years_of_service);
         }
        
     }
 }
Пример #15
0
 public void Update(Int32 _code, String _name, String _designation, String depnm)
 {
     using (DataAcc.HR_DeptEntities obj = new DataAcc.HR_DeptEntities())
     {
         var emp = obj.Employees.Where(x => x.emp_code == _code).First();
         emp.emp_name = _name;
         emp.emp_designation = _designation;
         emp.dept_code = converterDep(depnm);
         obj.SaveChanges();
     }
 }
Пример #16
0
        public Boolean validateEmpCode(Int32 _code)
            {
                using(DataAcc.HR_DeptEntities myEnt = new DataAcc.HR_DeptEntities())
                {
                    var result = from p in myEnt.Employees
                                 select p;

                    bool found = false;

                    foreach(var d in result)
                    {
                        if(d.emp_code == _code)
                        {
                            found = true;
                            
                        }
                    }

                    return found;
                }
            }