Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- String RecordType = "Vacancy";
- Record softwareEngineerVacancy = new Record("SoftwareEngineer0001", RecordType);
- Record frontEndEngineerVacancy = new Record("FrontEndEngineer0020", RecordType);
- NotifyManager.Notify += DisplayMessage;
- NotifyManager.SubmitForApproval(softwareEngineerVacancy.Id);
- NotifyManager.Approve(softwareEngineerVacancy.Id);
- NotifyManager.SubmitForApproval(frontEndEngineerVacancy.Id);
- NotifyManager.Reject(frontEndEngineerVacancy.Id);
- }
- private static void DisplayMessage(string message)
- {
- Console.WriteLine(message);
- }
- public class NotifyManager {
- public delegate void NotifyManagerHandler(string message);
- public static event NotifyManagerHandler Notify;
- public static void SubmitForApproval(string id)
- {
- Notify?.Invoke($"Submitted for approval Vacancy: {id}");
- }
- public static void Approve(string id)
- {
- Notify?.Invoke($"Approved Record: {id}");
- }
- public static void Reject(string id)
- {
- Notify?.Invoke($"Reject Record: {id}");
- }
- }
- public class Record
- {
- public String Id { get; private set; }
- public String Type { get; private set; }
- public Record(String Id, String Type)
- {
- this.Id = Id;
- this.Type = Type;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement