public void updateEmployee(Employee employee, Image photo, Image aadharimg, Image pancardimg) { byte[] photo1 = null; if (photo != null) { photo1 = imageToByteArray(photo); } byte[] aadhar1 = null; if (aadharimg != null) { aadhar1 = imageToByteArray(aadharimg); } byte[] pancard1 = null; if (pancardimg != null) { pancard1 = imageToByteArray(pancardimg); } suyogRepository = new SuyogRepository(); Employee oldEmployee = suyogRepository.Employees.Find(employee.employeeId); oldEmployee.employeeName = employee.employeeName; oldEmployee.employeeAddress = employee.employeeAddress; oldEmployee.dob = employee.dob; oldEmployee.doj = employee.doj; oldEmployee.mobile = employee.mobile; oldEmployee.aadhar = employee.aadhar; oldEmployee.pancard = employee.pancard; oldEmployee.photo = photo1; oldEmployee.aadharimg = aadhar1; oldEmployee.pancardimg = pancard1; suyogRepository.SaveChanges(); }
public void addAdvance(int employeeId, string employeeName, string mon, int advance, DateTime date) { repository = new SuyogRepository(); salaryAdvance = new SalaryAdvance(employeeId, employeeName, mon, 0, advance, date); repository.SalaryAdvances.Add(salaryAdvance); repository.SaveChanges(); }
public Employee addEmployee(string employeeName, string employeeAddress, DateTime dob, DateTime doj, string mobile, string aadhar, string pancard, Image photo, Image aadharimg, Image pancardimg) { byte[] photo1 = null; if (photo != null) { photo1 = imageToByteArray(photo); } byte[] aadhar1 = null; if (aadharimg != null) { aadhar1 = imageToByteArray(aadharimg); } byte[] pancard1 = null; if (pancardimg != null) { pancard1 = imageToByteArray(pancardimg); } Employee employee = new Employee(employeeName, employeeAddress, dob.Date, doj.Date, mobile, aadhar, pancard, photo1, aadhar1, pancard1); suyogRepository = new SuyogRepository(); employee = suyogRepository.Employees.Add(employee); suyogRepository.SaveChanges(); return(employee); }
public void deleteEmployee(int empId) { suyogRepository = new SuyogRepository(); var std = suyogRepository.Employees.Find(empId); suyogRepository.Employees.Remove(std); suyogRepository.SaveChanges(); }
public List <EmployeeDto> displayEmployeeNames() { suyogRepository = new SuyogRepository(); return(suyogRepository.Employees.Select(x => new EmployeeDto() { employeeName = x.employeeName }).ToList()); }
public List <SalaryDto> GetSalary(Employee emp) { repository = new SuyogRepository(); List <SalaryDto> list = new List <SalaryDto>(); list = repository.SalaryAdvances .Where(x => x.advance == 0 && x.employeeId == emp.employeeId) .Select(x => new SalaryDto { id = x.id, employeeId = x.employeeId, employeeName = x.employeeName, month = x.month, salary = x.salary, dateOfSalary = x.dateOfSalary }).ToList(); return(list); }
public Employee displayEmployeeById(int id) { suyogRepository = new SuyogRepository(); return(suyogRepository.Employees.Find(id)); }
public List <Employee> DisplayEmployees() { suyogRepository = new SuyogRepository(); return(suyogRepository.Employees.ToList()); }
public void deleteSalaryAdvance(int id) { repository = new SuyogRepository(); salaryAdvance = repository.SalaryAdvances.Find(id); repository.SalaryAdvances.Remove(salaryAdvance); }