本文整理汇总了C#中IEmployee.isValid方法的典型用法代码示例。如果您正苦于以下问题:C# IEmployee.isValid方法的具体用法?C# IEmployee.isValid怎么用?C# IEmployee.isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEmployee
的用法示例。
在下文中一共展示了IEmployee.isValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: saveEmployee
public IEmployee saveEmployee(IEmployee employee)
{
if (!employee.isValid())
throw new ArgumentException("Please fill out all necessary information.");
if (employee.GetType() == typeof(Director)) {
Director d = (Director)employee;
DIRECTOR director = new DIRECTOR {
DIRECTOR_ID = d.ID,
START_DATE = d.StartDate,
END_DATE = null
};
return saveDirector(director);
}
if (employee.GetType() == typeof(GroupManager)) {
GroupManager m = (GroupManager)employee;
GROUP_MANAGER manager = new GROUP_MANAGER {
MANAGER_ID = m.ID,
GROUP_ID = (Int16)m.GroupID,
DIRECTOR_ID = m.DirectorID,
START_DATE = m.StartDate,
END_DATE = null
};
return saveManager(manager);
} else {
Employee e = (Employee)employee;
EMPLOYEE emp = new EMPLOYEE {
EMPLOYEE_ID = e.ID,
GROUP_MANAGER_START = e.GroupManagerID,
START_DATE = e.StartDate,
END_DATE = null
};
return saveUser(emp);
}
}