public void LinkToEmployee() { TBikeDAL MyDAL = new TBikeDAL(); int index = dataGrid1.Items.IndexOf(dataGrid1.CurrentItem); DataTable ResultTable = MyDAL.ShowAllEmployeeDetails(); if (index == -1) { index = 0; } else { string id = Convert.ToString(ResultTable.Rows[index]["EmployeeID"]); string self = Convert.ToString(ResultTable.Rows[index]["Username"]); if (id != null) { if (RankID >= 4 || self == username) { EmployeeModify emp = new EmployeeModify(); emp.PopulateDataFromLogin(username); emp.populateEmployee(id); emp.ShowDialog(); } else { PopWindow pop = new PopWindow(ImageType.Warning, "Error", "Rank too low to access this service", "Alright"); pop.ShowDialog(); } } } }
public void UpdateEmployee(EmployeeModify employee, long id) { EmployeeEntity employeeEntity = _employeeRepo.GetEmployeeByIdWithRelations(id); EmployeeEntity updatedEntity = _employeeMapper.UpdateEmployeeEntityByEmployeeModify(employee, employeeEntity); _genericRepo.Update(updatedEntity); }
public EmployeeEntity UpdateEmployeeEntityByEmployeeModify(EmployeeModify employee, EmployeeEntity employeeEntity) { employeeEntity.Name = employee.Name == employeeEntity.Name ? employeeEntity.Name : employee.Name; employeeEntity.Surname = employee.Surname == employeeEntity.Surname ? employeeEntity.Surname : employee.Surname; employeeEntity.DateBirth = employee.DateBirth == employeeEntity.DateBirth ? employeeEntity.DateBirth : employee.DateBirth; employeeEntity.AddressEntity = _addressService.GetAddressEntityByDto(employee.Address); employeeEntity.UserEntity = _userMapper.UpdateUserEntityByUserModify(employee.User, employeeEntity.UserEntity); return(employeeEntity); }
public EmployeeEntity EmployeeModifyToEmployeeEntity(EmployeeModify employee) { return(new EmployeeEntity() { Name = employee.Name, Surname = employee.Surname, DateBirth = employee.DateBirth, AddressEntity = _addressService.GetAddressEntityByDto(employee.Address), UserEntity = _userMapper.UserModifyToUserEntity(employee.User) }); }
public void Update(long id, [FromBody] EmployeeModify employee) { _employeeService.UpdateEmployee(employee, id); }
public void Create([FromBody] EmployeeModify employee) { _employeeService.CreateEmployee(employee); }
public void CreateEmployee(EmployeeModify employee) { EmployeeEntity employeeEntity = _employeeMapper.EmployeeModifyToEmployeeEntity(employee); _genericRepo.Insert(employeeEntity); }