コード例 #1
0
ファイル: Department.cs プロジェクト: glow-purple/lab2
 public Department(DepartmentType type, PhoneNumber phone)
 {
     Type      = type;
     Name      = type.ToString();
     Phone     = phone;
     Employees = new List <Employee>();
     Id        = type.ToString().Substring(0, 1);
 }
コード例 #2
0
ファイル: Department.cs プロジェクト: glow-purple/lab2
 public Department(string name)
 {
     Type  = (DepartmentType)Enum.Parse(typeof(DepartmentType), name, true);
     Phone = new PhoneNumber();
     Name  = Type.ToString();
 }
コード例 #3
0
 /// <summary>
 /// Конвертировать тип цвета печати в версию для приложения
 /// </summary>
 public static DepartmentTypeApp ToApplication(DepartmentType departmentType) =>
 Enum.TryParse(departmentType.ToString(), true, out DepartmentTypeApp departmentTypeApplication) ?
 departmentTypeApplication :
 throw new FormatException(nameof(departmentType));