Exemple #1
0
 public List <Employee> GetEmployeeByManagerId(int id)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         return(departmentContext.Employees.Where(u => u.ManagerId == id).ToList());
     }
 }
Exemple #2
0
 public IEnumerable <Employee> GetEmployee()
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         return(departmentContext.Employees.Include("Designation").Include("Department").Include("Manager").ToList());
     }
 }
Exemple #3
0
 public Manager EditManager(int ManagerId)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         return(departmentContext.Managers.Find(ManagerId));
     }
 }
Exemple #4
0
 public Employee EditEmployee(int EmployeeId)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         return(departmentContext.Employees.Find(EmployeeId));
     }
 }
Exemple #5
0
 public Designation EditDesignation(int DesignationId)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         return(departmentContext.Designations.Find(DesignationId));
     }
 }
Exemple #6
0
 public IEnumerable <Manager> GetManager()
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         return(departmentContext.Managers.ToList());
     }
 }
Exemple #7
0
 public IEnumerable <Department> GetDepartment()
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         return(departmentContext.Departments.ToList());
     }
 }
Exemple #8
0
 public int SetEmployeeId(string EmployeeEmail)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         Employee employee = departmentContext.Employees.Where(x => x.EmployeeEmail == EmployeeEmail).SingleOrDefault();
         return(employee.EmployeeId);
     }
 }
Exemple #9
0
 public void AddAccount(Account account)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         departmentContext.Accounts.Add(account);
         departmentContext.SaveChanges();
     }
 }
Exemple #10
0
 public void AddEmployeeList(Employee employee)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         departmentContext.Employees.Add(employee);
         departmentContext.SaveChanges();
     }
 }
Exemple #11
0
 public void AddDepartmentList(Department department)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         departmentContext.Departments.Add(department);
         departmentContext.SaveChanges();
     }
 }
Exemple #12
0
        public Department EditDepartment(int DepartmentId)

        {
            using (LeaveDBContext departmentContext = new LeaveDBContext())
            {
                return(departmentContext.Departments.Find(DepartmentId));
            }
        }
Exemple #13
0
 public string GetEmployeeNameByGmail(string Gmail)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         Employee employee = departmentContext.Employees.Where(u => u.EmployeeEmail == Gmail).SingleOrDefault();
         return(employee.EmployeeName);
     }
 }
Exemple #14
0
 public void AddLeaveRequest(Leave leaveRequest)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         departmentContext.LeaveRequest.Add(leaveRequest);
         departmentContext.SaveChanges();
     }
 }
Exemple #15
0
 public void UpdateDesignation(Designation designation)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         departmentContext.Entry(designation).State = System.Data.Entity.EntityState.Modified;
         departmentContext.SaveChanges();
     }
 }
Exemple #16
0
 public void AddDesignationList(Designation designation)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         departmentContext.Designations.Add(designation);
         departmentContext.SaveChanges();
     }
 }
Exemple #17
0
 public string GetEmployeeNameById(int Id)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         Employee employee = departmentContext.Employees.Where(u => u.EmployeeId == Id).SingleOrDefault();
         return(employee.EmployeeName);
     }
 }
Exemple #18
0
 public void UpdateEmployee(Employee employee)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         departmentContext.Entry(employee).State = System.Data.Entity.EntityState.Modified;
         departmentContext.SaveChanges();
     }
 }
Exemple #19
0
 public int GetManagerIdByName(string Name)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         Manager manager = departmentContext.Managers.Where(u => u.ManagerName == Name).FirstOrDefault();
         return(manager.ManagerId);
     }
 }
Exemple #20
0
 public void DeleteDesignation(int DesignationId)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         Designation designation = departmentContext.Designations.Find(DesignationId);
         departmentContext.Designations.Remove(designation);
         departmentContext.SaveChanges();
     }
 }
Exemple #21
0
 public void DeleteEmployee(int EmployeeId)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         Employee employee = departmentContext.Employees.Find(EmployeeId);
         departmentContext.Employees.Remove(employee);
         departmentContext.SaveChanges();
     }
 }
Exemple #22
0
 public void DeclineRequest(int LeaveId)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         var leaveRequest = departmentContext.LeaveRequest.Find(LeaveId);
         leaveRequest.Status = "Declined";
         departmentContext.SaveChanges();
     }
 }
Exemple #23
0
 public void DeleteDepartment(int DepartmentId)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         Department department = departmentContext.Departments.Find(DepartmentId);
         departmentContext.Departments.Remove(department);
         departmentContext.SaveChanges();
     }
 }
Exemple #24
0
 public void AddManagerList(Manager manager)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         //SqlParameter sql = new SqlParameter("@ManagerName", manager.ManagerName);
         //int count = departmentContext.Database.ExecuteSqlCommand("Manager_Insert @ManagerName", sql);
         departmentContext.Managers.Add(manager);
         departmentContext.SaveChanges();
     }
 }
Exemple #25
0
 public void DeleteManager(int ManagerId)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         //SqlParameter sql = new SqlParameter("@ManagerId", ManagerId);
         //int count = departmentContext.Database.ExecuteSqlCommand("Manager_Delete @ManagerId", sql);
         Employee employee = departmentContext.Employees.Find(ManagerId);
         departmentContext.Employees.Remove(employee);
         departmentContext.SaveChanges();
     }
 }
Exemple #26
0
 public void UpdateManager(Manager manager)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         //SqlParameter sql = new SqlParameter("@ManagerId", manager.ManagerId);
         //SqlParameter sqlName = new SqlParameter("@ManagerName", manager.ManagerName);
         //var data = departmentContext.Database.ExecuteSqlCommand("Manager_Update @ManagerId,@ManagerName", sql, sqlName);
         //int count = departmentContext.Database.ExecuteSqlCommand("Manager_Update @ManagerId", sql);
         departmentContext.Entry(manager).State = System.Data.Entity.EntityState.Modified;
         departmentContext.SaveChanges();
     }
 }
Exemple #27
0
 public Account CheckLogin(Account account)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         Account user = departmentContext.Accounts.Where(u => u.UserName == account.UserName && u.Password == account.Password).SingleOrDefault();
         if (user != null)
         {
             return(user);
         }
         else
         {
             return(null);
         }
     }
 }
Exemple #28
0
 public List <Leave> GetLeaveRequestByManager(List <Employee> employee)
 {
     using (LeaveDBContext departmentContext = new LeaveDBContext())
     {
         List <Leave> list = new List <Leave>();
         foreach (Employee details in employee)
         {
             List <Leave> leave = departmentContext.LeaveRequest.Where(u => u.EmployeeId == details.EmployeeId && u.Status == "Pending").ToList();
             foreach (Leave leaves in leave)
             {
                 list.Add(leaves);
             }
         }
         return(list);
     }
 }
Exemple #29
0
        public IEnumerable <Designation> GetDesignation()
        {
            LeaveDBContext departmentContext = new LeaveDBContext();

            return(departmentContext.Designations.ToList());
        }