Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Created by SharpDevelop.
- * User: User
- * Date: 01.10.2016
- * Time: 20:12
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
- using System;
- namespace EMPLOYEE
- {
- /// <summary>
- /// Description of Employee.
- /// </summary>
- public class Employee : User
- {
- DateTime employment_date;
- string specialty;
- protected static string check_specialty(string check_str)
- {
- if (String.IsNullOrEmpty(check_str))
- {
- throw new ArgumentException("Должность или специальность не может быть null или пустой строкой");
- }
- char[] arname = check_str.ToCharArray();
- for (int i = 1; i < arname.Length; i++)
- {
- arname[i] = char.ToLower(arname[i]);
- }
- arname[0] = char.ToUpper(arname[0]);
- return new string(arname);
- }
- static DateTime check_employment_date(DateTime date, int age)
- {
- if (date > DateTime.Now)
- {
- throw new ArgumentException("Дата не может быть в будущем");
- }
- if (GetYear(date) > age)
- {
- throw new ArgumentException("Дата такова, что стаж больше возраст человека");
- }
- return date;
- }
- public int Work_experience
- {
- get
- {
- return GetYear(employment_date);
- }
- }
- public DateTime Employment_date
- {
- get
- {
- return employment_date;
- }
- set
- {
- employment_date = check_employment_date(value, Age);
- }
- }
- public string Specialty
- {
- get
- {
- return specialty;
- }
- set
- {
- specialty = check_specialty(value);
- }
- }
- public Employee(string specialty, DateTime employment_date ,string name, string surname, string middle_name, DateTime date_of_birth)
- : base(name, surname, middle_name, date_of_birth)
- {
- Employment_date = employment_date;
- Specialty = specialty;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement