public void SetDefaultValuesFromEmployee(HREmployeeDisciplinesInfo objEmployeeDisciplinesInfo, HREmployeesInfo objEmployeesInfo) { HRDisciplinesInfo objDisciplinesInfo = (HRDisciplinesInfo)MainObject; objEmployeeDisciplinesInfo.FK_HREmployeeID = objEmployeesInfo.HREmployeeID; objEmployeeDisciplinesInfo.HREmployeeDisciplineValue = objDisciplinesInfo.HRDisciplineValue; objEmployeeDisciplinesInfo.HREmployeeNo = objEmployeesInfo.HREmployeeNo; objEmployeeDisciplinesInfo.HREmployeeCardNumber = objEmployeesInfo.HREmployeeCardNumber; objEmployeeDisciplinesInfo.HREmployeeDisciplineDate = objDisciplinesInfo.HRDisciplineFromDate; }
public void AddEmployee() { DisciplineEntities entity = (DisciplineEntities)CurrentModuleEntity; List <HREmployeesInfo> employeesList = entity.EmployeesList.Where(o1 => entity.EmployeeDisciplinesList.FirstOrDefault(o2 => o2.FK_HREmployeeID == o1.HREmployeeID) == null).ToList(); guiSearchEmployee guiSearchEmployee = new guiSearchEmployee(employeesList); guiSearchEmployee.Module = this; if (guiSearchEmployee.ShowDialog() == DialogResult.OK) { List <HREmployeesInfo> result = (List <HREmployeesInfo>)guiSearchEmployee.SelectedObjects; foreach (HREmployeesInfo objEmployeesInfo in result) { HREmployeeDisciplinesInfo objEmployeeDisciplinesInfo = new HREmployeeDisciplinesInfo(); entity.SetDefaultValuesFromEmployee(objEmployeeDisciplinesInfo, objEmployeesInfo); entity.EmployeeDisciplinesList.Add(objEmployeeDisciplinesInfo); } entity.EmployeeDisciplinesList.GridControl.RefreshDataSource(); } }