public int AddEmployee(Company company, Employee employee, string role, string comment) { if (employee == null) { throw new ArgumentNullException(nameof(employee)); } if (company == null) { throw new ArgumentNullException(nameof(company)); } return(ExecuteFaultHandledOperation(() => { var ep_data = new EntityPersonData() { EntityKey = company.CompanyKey, EntityTypeKey = 1, PersonKey = employee.PersonKey, PersonTypeKey = (int)employee.CompanyRoleType, PersonRole = role, Comment = comment, StartDate = employee.StartDate, EndDate = employee.EndDate, EntityPersonKey = employee.EntityPersonKey }; return _entity_person_repository.Insert(ep_data); })); }
public int EmployeeSave(Account account, AccountPerson employee, string role, string comment) { if (account == null) { throw new ArgumentNullException(nameof(account)); } if (employee == null) { throw new ArgumentNullException(nameof(employee)); } return(ExecuteFaultHandledOperation(() => { var person = _pers_es.Map(employee); person.PersonKey = employee.PersonKey; int person_key = _person_repo.Insert(person); //Log.Debug($"{person.PersonLastName} Employee Comment: {employee.Comment}"); EntityPersonData ep_data = new EntityPersonData() { EntityKey = account.AccountKey, EntityTypeKey = 3, PersonKey = person_key, PersonTypeKey = (int)QIQOPersonType.AccountContact, //employee.PersonTypeData.PersonTypeKey, PersonRole = employee.RoleInCompany, Comment = employee.Comment, StartDate = employee.StartDate, EndDate = employee.EndDate, EntityPersonKey = employee.EntityPersonKey }; int ep_ret = _entity_person_repo.Insert(ep_data); return person_key; })); }