static void Main(string[] args) { Console.WriteLine("Enter number from 1 to 100"); int number; InvalidRangeException<int> exception = new InvalidRangeException<int>("The number must be from 1 to 100", 1,100); number = int.Parse(Console.ReadLine()); try { if (number < 1 || number > 100) throw exception; else Console.WriteLine("The number is ok!"); } catch { throw exception; } DateTime date1= new DateTime(1980,1,1); DateTime date2= new DateTime(2013,12,31); InvalidRangeException<DateTime> DateTimeException= new InvalidRangeException<DateTime>("The date must be from 1.1.1980 to 31.12.2013", date1, date2); DateTime date = DateTime.Parse(Console.ReadLine()); try { if (date < date1 || date > date2) throw exception; else Console.WriteLine("The date is ok!"); } catch { throw DateTimeException; } }
static int ReadNumber(int start, int end) { InvalidRangeException <int> intRange = new InvalidRangeException <int>() { RangeStart = start, RangeEnd = end }; Console.WriteLine($"Input a number between {intRange.RangeStart} - {intRange.RangeEnd}"); int number = Int32.Parse(Console.ReadLine()); try { if (number < intRange.RangeStart || number > intRange.RangeEnd) { throw intRange; } } catch (InvalidRangeException <int> e) { Console.WriteLine(e.Message); throw; } return(number); }
static void Main() { // Creating an exception for int InvalidRangeException<int> exceptionInt = new InvalidRangeException<int>(1, 100, "not in the interval [1,100]."); int[] arrayInt = new int[6] { -17, 14, 26, 89, 1112,25252 }; foreach (int c in arrayInt) { try { if ((c < exceptionInt.Start) || (c > exceptionInt.End)) throw exceptionInt; } catch (InvalidRangeException<int> exc) { Console.WriteLine("{0} is {1}", c, exc.ErrorMessage); } } // Creating an exception for DateTime InvalidRangeException<DateTime> exceptionDate = new InvalidRangeException<DateTime>(new DateTime(1980, 1, 1), new DateTime(2013, 12, 31), "not in the required interval"); DateTime[] arrayDates = new DateTime[3] { new DateTime(1456, 11, 12), new DateTime(1990, 12, 24), new DateTime(2014, 1, 1) }; foreach (DateTime c in arrayDates) { try { if ((DateTime.Compare(c, exceptionDate.Start) < 0) || (DateTime.Compare(c, exceptionDate.End) > 0)) throw exceptionDate; } catch (InvalidRangeException<DateTime> exc) { Console.WriteLine("{0}.{1}.{2} is {3}", c.Day, c.Month, c.Year, exc.ErrorMessage); } } }
public static void Main() { InvalidRangeException<int> intException = new InvalidRangeException<int>("You have to enter number between 1 and 100", 1, 100); Console.WriteLine("Enter a number: "); int number = int.Parse(Console.ReadLine()); if (number < intException.RangeStart || number > intException.RangeEnd) { throw intException; } string startDate = "1.1.1980"; string endDate = "31.12.2013"; InvalidRangeException<DateTime> dateException = new InvalidRangeException<DateTime>("You have to enter a date between 1.1.1920 and 31.12.2013", DateTime.Parse(startDate), DateTime.Parse(endDate)); Console.WriteLine("Ënter a date in format dd.mm.yyyy: "); string date = Console.ReadLine(); DateTime checkDate = DateTime.Parse(date); if (checkDate < dateException.RangeStart || checkDate > dateException.RangeEnd) { throw dateException; } }
static void Main(string[] args) { InvalidRangeException <int> integerException = new InvalidRangeException <int>("Value must be in range 1 - 100", 1, 100); InvalidRangeException <DateTime> dateException = new InvalidRangeException <DateTime>("Date must be between 1.1.1980 and 31.12.2013", new DateTime(1980, 1, 1), new DateTime(2013, 12, 31)); Console.WriteLine("Please enter 3 values between 1 and 100 (if you don't want errors)"); for (int i = 0; i < 3; i++) { int number = int.Parse(Console.ReadLine()); if (number < integerException.Min || number > integerException.Max) { throw integerException; } } Console.WriteLine("Please enter 3 dates between 01.01.1980 and 31.12.2013"); for (int i = 0; i < 3; i++) { DateTime date = DateTime.Parse(Console.ReadLine()); if (date < dateException.Min || date > dateException.Max) { throw dateException; } } }
static void Main() { InvalidRangeException<int> intExeption = new InvalidRangeException<int>("The range is not valid must be between[1, 100]!", 1, 100); for (int i = 0; i < 3; i++) { Console.WriteLine("Enter range in the interval [0,100]:"); int range = int.Parse(Console.ReadLine()); if (range<intExeption.Start|| range>intExeption.End) { throw intExeption; } } string aaa = "asdf"; int sss=aaa.Length; Console.WriteLine(sss); // string startDate="1/1/1980"; // string endDate="1/1/2013"; // InvalidRangeException<DateTime> dateExpection = // new InvalidRangeException<DateTime>("The date is not valid it must be in the interval [1/1/1980, 1/1/2013]!" // ,DateTime.Parse(startDate),DateTime.Parse(endDate)); // for (int i = 0; i < 3; i++) // { // Console.WriteLine("Enter a date in the format: yyyy,mm.dd! Which is:[1/1/1980, 1/1/2013]"); // string date = Console.ReadLine(); // DateTime theDate = DateTime.Parse(date); // if (theDate.Year<dateExpection.Start.Year || theDate.Year>dateExpection.End.Year) // { // throw dateExpection; // } // } }
static void Main(string[] args) { InvalidRangeException<int> integerException = new InvalidRangeException<int>("Value must be in range 1 - 100", 1, 100); InvalidRangeException<DateTime> dateException = new InvalidRangeException<DateTime>("Date must be between 1.1.1980 and 31.12.2013", new DateTime(1980,1,1), new DateTime(2013,12,31)); Console.WriteLine("Please enter 3 values between 1 and 100 (if you don't want errors)"); for (int i = 0; i < 3; i++) { int number = int.Parse(Console.ReadLine()); if (number < integerException.Min || number > integerException.Max) { throw integerException; } } Console.WriteLine("Please enter 3 dates between 01.01.1980 and 31.12.2013"); for (int i = 0; i < 3; i++) { DateTime date = DateTime.Parse(Console.ReadLine()); if (date < dateException.Min || date > dateException.Max) { throw dateException; } } }
private static void DateTimeExample() { DateTime startDate = new DateTime(1980, 1, 1); DateTime endDate = new DateTime(2013, 12, 31); // DateTime example: InvalidRangeException<DateTime> invalidDateTimeException = new InvalidRangeException<DateTime>("Date isn't in correct range from 1.1.1980 to 31.12.2013", startDate, endDate); Console.Write("Enter some date in format d.m.yyyy from 1.1.1980 to 31.12.2013: "); string datePattern = "m.d.yyyy"; string input = Console.ReadLine(); DateTime yourDate; DateTime.TryParseExact(input, datePattern, CultureInfo.InvariantCulture, DateTimeStyles.None, out yourDate); if (yourDate < invalidDateTimeException.Start || yourDate > invalidDateTimeException.End) { throw invalidDateTimeException; } else { Console.WriteLine("Your date is in correct format!"); } }
public static void IntTest() { Console.Write("Write number: "); int number = int.Parse(Console.ReadLine()); InvalidRangeException <int> ire = new InvalidRangeException <int>("Accepted range is between 1 and 100!", 1, 100); if (number < ire.Start || number > ire.End) { throw ire; } }
public static void DateTest() { Console.Write("Enter date in format dd.mm.yyyy: "); DateTime date = DateTime.ParseExact(Console.ReadLine(), "dd.mm.yyyy", CultureInfo.InvariantCulture); InvalidRangeException <DateTime> ire = new InvalidRangeException <DateTime>("Accepted range is between 1.1.1980 and 31.12.2013!", DateTime.Parse("01.01.1980"), DateTime.Parse("31.12.2013")); if (date.Year < ire.Start.Year || date.Year > ire.End.Year) { throw ire; } }
static void Main(string[] args) { InvalidRangeException<int> intException = new InvalidRangeException<int>("Incorect. Enter a valid integer number.", 1, 100); InvalidRangeException<DateTime> dateException = new InvalidRangeException<DateTime>("Incorect. Enter a valid date.", new DateTime(1980, 1, 1), new DateTime(2013, 12, 31)); Console.WriteLine("Enter a number."); try { int num = int.Parse(Console.ReadLine()); if (num < intException.Start || num > intException.End) { throw intException; } else { Console.WriteLine("Correct number."); } DateTime date = new DateTime(2014, 1, 1); Console.WriteLine("Date to check: {0}", date); if (date < dateException.Start || date > dateException.End) { throw dateException; } else { Console.WriteLine("Correct date."); } } catch (InvalidRangeException<int> ire) { Console.WriteLine(ire.Message); } catch (InvalidRangeException<DateTime> ire) { Console.WriteLine(ire.Message); } catch (System.Exception) { Console.WriteLine("Something went wrong. Please try again."); } }
private static void IntExample() { // Int Example: InvalidRangeException<int> invalidIntException = new InvalidRangeException<int>("Enter number in the range from 0 to 100!", 0, 100); Console.Write("Enter some number in range from 0 to 100: "); int number = int.Parse(Console.ReadLine()); if (number < invalidIntException.Start || number > invalidIntException.End) { throw invalidIntException; } else { Console.WriteLine("Your number is in correct format."); } }
public static void Main(string[] args) { DateTime date = DateTime.Now; Console.WriteLine(date); InvalidRangeException<int> intOutOfRangeException = new InvalidRangeException<int>("Enter number from 1 to 100!", 1, 100); for (int i = 0; i < 10; i++) { int number = int.Parse(Console.ReadLine()); if (number < intOutOfRangeException.MinValue || number > intOutOfRangeException.MaxValue) { throw intOutOfRangeException; } else { Console.WriteLine("Correct number: {0}", number); } } string someDate = "23/6/2008"; string otherDate = "12/9/2012"; InvalidRangeException<DateTime> outOfRangeDateTimeException = new InvalidRangeException<DateTime>( string.Format("Insert date from {0} to {1}", someDate, otherDate), DateTime.Parse(someDate), DateTime.Parse(otherDate)); for (int i = 0; i < 10; i++) { Console.WriteLine("Insert date:"); DateTime myDate = DateTime.Parse(Console.ReadLine()); if (myDate.Year < outOfRangeDateTimeException.MinValue.Year || myDate.Year > outOfRangeDateTimeException.MaxValue.Year) { throw outOfRangeDateTimeException; } else { Console.WriteLine("Correct date!"); } } }
static void Main(string[] args) { int[] arrInt = new int[] { 1, 5, 6, 200, 3 }; // create new exeption for int InvalidRangeException<int> intEx = new InvalidRangeException<int>("invalid data", 1, 100); try { foreach (var number in arrInt) { if (number < intEx.RangeDown || number > intEx.RangeUp) { throw intEx; } } } catch (InvalidRangeException<int> msg) { Console.WriteLine(msg); } //create new exeption for date time DateTime[] arrDateTime = new DateTime[] { new DateTime(1980,1,11), new DateTime(2000,2,14), new DateTime(2013,1,8), new DateTime(2014,12,31), }; InvalidRangeException<DateTime> dateTimeExeption = new InvalidRangeException<DateTime>("Invalid date", new DateTime(1980, 1, 1), new DateTime(2013, 12, 31)); try { foreach (var date in arrDateTime) { if (date.CompareTo(dateTimeExeption.RangeDown) < 0 || date.CompareTo(dateTimeExeption.RangeUp) > 0) { throw dateTimeExeption; } } } catch (InvalidRangeException<DateTime> msg) { Console.WriteLine(msg); } }
static void Main() { DateTime t = DateTime.Now; Console.WriteLine(t); InvalidRangeException <int> someIntExeption = new InvalidRangeException <int>("The have to enter a number in the range from 0 do 100!", 1, 100); Console.WriteLine("Enter 5 numbers from 0 do 100:"); for (int i = 0; i < 5; i++) { int number = int.Parse(Console.ReadLine()); if (number < someIntExeption.Start || number > someIntExeption.End) { throw someIntExeption; } else { Console.WriteLine("The number is correct!"); } } string startDate = "1/1/1980"; string endDate = "1/1/2013"; InvalidRangeException <DateTime> someDateExpection = new InvalidRangeException <DateTime>("The date isn't in the correct range from 1980 to 2013!" , DateTime.Parse(startDate), DateTime.Parse(endDate)); Console.WriteLine("Enter 5 dates in the specified format: dd.mm.yyyy!(from 1980 to 2013)"); for (int i = 0; i < 5; i++) { string date = Console.ReadLine(); DateTime someDate = DateTime.Parse(date); if (someDate.Year < someDateExpection.Start.Year || someDate.Year > someDateExpection.End.Year) { throw someDateExpection; } else { Console.WriteLine("The date is correct!"); } } }
static void Main() { // numbers cheker InvalidRangeException<int> someIntExeption = new InvalidRangeException<int>("Numbers must be from 0 do 100!", 1, 100); Console.WriteLine("Enter 3 numbers to check:"); for (int i = 0; i < 3; i++) { int number = int.Parse(Console.ReadLine()); if (number < someIntExeption.Start || number > someIntExeption.End) { throw someIntExeption; } else { Console.WriteLine("The number is correct!"); } } // date checker string startDate = "1/1/1980"; string endDate = "31/12/2013"; InvalidRangeException<DateTime> someDateExpection = new InvalidRangeException<DateTime>("The date must be in the range from 1980 to 2013!", DateTime.Parse(startDate), DateTime.Parse(endDate)); Console.WriteLine("Enter 2 dates to check:"); for (int i = 0; i < 3; i++) { string date = Console.ReadLine(); DateTime someDate = DateTime.Parse(date); if (someDate.Year < someDateExpection.Start.Year || someDate.Year > someDateExpection.End.Year) { throw someDateExpection; } else { Console.WriteLine("The date is correct!"); } } }
static void Main(string[] args) { int number = 101; if (number > 100 || number < 1) { Console.WriteLine(new InvalidRangeException<int>(1, 100).CustomMessage); } DateTime wrongDate = new DateTime(2015, 5, 12); DateTime minDate = new DateTime(1980, 1, 1); DateTime maxDate = new DateTime(2013, 12, 31); if (wrongDate < minDate || wrongDate > maxDate) { InvalidRangeException<DateTime> ex = new InvalidRangeException<DateTime>(minDate, maxDate); Console.WriteLine(ex.CustomMessage); } }
static void Main() { DateTime t = DateTime.Now; Console.WriteLine(t); InvalidRangeException<int> someIntExeption = new InvalidRangeException<int>("The have to enter a number in the range from 0 do 100!", 1, 100); Console.WriteLine("Enter 5 numbers from 0 do 100:"); for (int i = 0; i < 5; i++) { int number = int.Parse(Console.ReadLine()); if (number < someIntExeption.Start || number > someIntExeption.End) { throw someIntExeption; } else { Console.WriteLine("The number is correct!"); } } string startDate = "1/1/1980"; string endDate = "1/1/2013"; InvalidRangeException<DateTime> someDateExpection = new InvalidRangeException<DateTime>("The date isn't in the correct range from 1980 to 2013!" , DateTime.Parse(startDate), DateTime.Parse(endDate)); Console.WriteLine("Enter 5 dates in the specified format: dd.mm.yyyy!(from 1980 to 2013)"); for (int i = 0; i < 5; i++) { string date = Console.ReadLine(); DateTime someDate = DateTime.Parse(date); if (someDate.Year < someDateExpection.Start.Year || someDate.Year > someDateExpection.End.Year) { throw someDateExpection; } else { Console.WriteLine("The date is correct!"); } } }
public static void Test_01() { Console.WriteLine(); var min = DateTime.ParseExact("01-01-1980", "dd-MM-yyyy", null); var max = DateTime.ParseExact("31-12-2013", "dd-MM-yyyy", null); var teste = new InvalidRangeException <DateTime>("unsuccessful", DateTime.ParseExact("01-01-1980", "dd-MM-yyyy", null), DateTime.ParseExact("31-12-2013", "dd-MM-yyyy", null)); var test = DateTime.Parse("1.1.1975"); try { Validate.ValidateDataInRange(test, min, max); } catch (InvalidRangeException <DateTime> e) { Console.WriteLine(e.Message); } }
static void Main() { DateTime t = DateTime.Now; InvalidRangeException<int> intException = new InvalidRangeException<int>("Number in rage 1-100!", 1, 100); Console.WriteLine("Enter 3 numbers from 1 do 100:"); for (int i = 0; i < 3; i++) { int number = int.Parse(Console.ReadLine()); if (number < intException.Start || number > intException.End) { throw intException; } else { Console.WriteLine("correct!"); } } string startDate = "1/1/1980"; string endDate = "1/1/2013"; InvalidRangeException<DateTime> DateExcepction = new InvalidRangeException<DateTime>("Date in range 1980-2013" , DateTime.Parse(startDate), DateTime.Parse(endDate)); Console.WriteLine("Enter 3 dates in the format: dd.mm.yyyy!(from 1980 to 2013)"); for (int i = 0; i < 3; i++) { string date = Console.ReadLine(); DateTime TheDate = DateTime.Parse(date); if (TheDate.Year < DateExcepction.Start.Year || TheDate.Year > DateExcepction.End.Year) { throw DateExcepction; } else { Console.WriteLine("correct!"); } } }
static void Main() { // Integer exception //InvalidRangeException<int> integerException = new InvalidRangeException<int>("Our of range exception", -100, 100); //int[] numbers = { 4, 32, -100, 100, 500}; //for (int i = 0; i < numbers.Length; i++) //{ // if (numbers[i] < integerException.Start || numbers[i] > integerException.End) // { // throw integerException; // } // else // { // Console.WriteLine(numbers[i]); // } //} // DateTime exception InvalidRangeException<DateTime> dateException = new InvalidRangeException<DateTime> ("Invalid date", new DateTime(1980, 1, 1), new DateTime(2013, 12, 31)); DateTime[] dates = { new DateTime(1990, 3, 5), new DateTime(1999, 5, 21), new DateTime(2013, 12, 30), new DateTime(2014, 2, 2), new DateTime(2000, 1, 1), }; for (int i = 0; i < dates.Length; i++) { if (dates[i].Year < dateException.Start.Year || dates[i].Year > dateException.End.Year) { throw dateException; } else { Console.WriteLine(dates[i]); } } }
static void Main() { InvalidRangeException<int> customIntExcepton = new InvalidRangeException<int>("Invalid range!", 1, 100); InvalidRangeException<DateTime> customDateTimeExcepton = new InvalidRangeException<DateTime> ( "Invalid range!", new DateTime(1980, 1, 1), new DateTime(2013, 12, 31) ); try { EnterNumber(); EnterDate(); } catch(Exception e) { Console.WriteLine(e.Message); } }
static void Main(string[] args) { DateTime minDate = DateTime.Parse("1/1/1980"); DateTime maxDate = new DateTime(2013, 12, 31); Exception intRange1 = new InvalidRangeException<int>(1, 100); Exception dateRange1 = new InvalidRangeException<DateTime>("Some custom message...", minDate, maxDate); Console.Write("Enter a number between 1 and 100: "); int input1 = int.Parse(Console.ReadLine()); try { if (input1 > 100 || input1 < 0) { throw intRange1; } } catch (Exception e) { Console.WriteLine(e.Message); } Console.Write("Enter date between 1/1/1980 and 31/12/2013: "); DateTime input2 = DateTime.Parse(Console.ReadLine()); try { if (input2 < minDate || input2 > maxDate) { throw dateRange1; } } catch (Exception e) { Console.WriteLine(e.Message); } }
static void Main(string[] args) { InvalidRangeException<int> intException = new InvalidRangeException<int>("Value has to be in range [1..100]!", 1, 100); InvalidRangeException<DateTime> dateException = new InvalidRangeException<DateTime>("Date must be in range [1.1.1980..31.12.2013]!", new DateTime(1980, 1, 1), new DateTime(2013, 12, 31)); Console.Write("Enter number: "); int number = int.Parse(Console.ReadLine()); if (number < intException.Min || number > intException.Max) { throw intException; } Console.WriteLine(); Console.Write("Enter date: "); DateTime date = DateTime.Parse(Console.ReadLine()); if (date < dateException.Min || date > dateException.Max) { throw dateException; } }
static void Main() { //[1-100] //dates [1.1.1980....31.12.2013] InvalidRangeException<int> except = new InvalidRangeException<int>("The number is out of the necessary range!", 1, 100); Console.WriteLine("Set numbers from 0 - 100:"); for (int i = 0; i < 3; i++) { int number = int.Parse(Console.ReadLine()); if (number < except.Start || number > except.End) { throw except; } else Console.WriteLine("Valid number!"); } string startDate = "1/1/1980"; string endDate = "31/12/2013"; InvalidRangeException<DateTime> exceptTime = new InvalidRangeException<DateTime>("The date don't apply for the search", DateTime.Parse(startDate), DateTime.Parse(endDate)); Console.WriteLine("Insert date for searching in dates [1.1.1980....31.12.2013]"); for (int i = 0; i < 3; i++) { DateTime date = DateTime.Parse(Console.ReadLine()); if (date.Year < exceptTime.Start.Year || date.Year > exceptTime.End.Year) { throw exceptTime; } else Console.WriteLine("The date exist"); } }
static void Main(string[] args) { Console.WriteLine("===================================MACNINE======================================"); Machine firstRvdMachine = new Machine("Horizontal_RVD", "RVD_DPC", "23143LKDP"); firstRvdMachine.PrintInfo(); Machine firstErosionMachine = new Machine("Erosion_300ET", "Erosion", "54658LKDP"); Machine firstComputerMachine = new Machine("Pravec_16", "Computer", "54645LKDP"); Machine secondRvdMachine = new Machine("Vertical_RVD", "RVD_DPC", "23343LKDP"); Machine secondErosionMachine = new Machine("Erosion_200ET", "Erosion", "54658LKDP"); Machine secondComputerMachine = new Machine("Pravec_32", "Computer", "11645LKDP"); Machine thirdRvdMachine = new Machine("TwoHeads_RVD", "RVD_DPC", "24443LKDP"); Machine thirdErosionMachine = new Machine("Erosion_100ET", "Erosion", "54448LKDP"); Machine thirdComputerMachine = new Machine("Samsung", "Computer", "43445LKDP"); Console.WriteLine(); Console.WriteLine("===============================LIST<MACHINES>==================================="); List<Machine> RVDMachines= new List<Machine>(); RVDMachines.Add(firstRvdMachine); RVDMachines.Add(secondRvdMachine); RVDMachines.Add(thirdRvdMachine); Console.WriteLine("ALL RVD MACHINES"); Console.WriteLine(RVDMachines[0].Name); Console.WriteLine(RVDMachines[1].Name); Console.WriteLine(RVDMachines[2].Name); List<Machine> ErosionMachines= new List<Machine>(); ErosionMachines.Add(firstErosionMachine); ErosionMachines.Add(secondErosionMachine); ErosionMachines.Add(thirdErosionMachine); List<Machine> allFirmMachines = new List<Machine>(); allFirmMachines.Add(firstRvdMachine); allFirmMachines.Add(secondRvdMachine); allFirmMachines.Add(thirdRvdMachine); allFirmMachines.Add(firstErosionMachine); allFirmMachines.Add(secondErosionMachine); allFirmMachines.Add(thirdErosionMachine); List<Machine> computerMachines= new List<Machine>(); computerMachines.Add(firstComputerMachine); computerMachines.Add(secondComputerMachine); computerMachines.Add(thirdComputerMachine); Console.WriteLine(); Console.WriteLine("=====================TOOL======================================================="); Tool firstBrekableTool = new Tool("litleBreakTool", "Breakable", "53455LKDP"); firstBrekableTool.PrintInfo(); Tool firstDimensionableTool = new Tool("HightPreciseTool", "Dimensionable", "33455LKDP"); Tool secondBrekableTool = new Tool("BigBreakTool", "Breakable", "533335LKDP"); Tool secondDimensionableTool = new Tool("LowPreciseTool", "Dimensionable", "33335LKDP"); Console.WriteLine(); Console.WriteLine("================================LIST<TOOLS>====================================="); List<Tool> breakableTools = new List<Tool>(); breakableTools.Add(firstBrekableTool); breakableTools.Add(secondBrekableTool); Console.WriteLine("ALL BREAKABLE TOOLS"); Console.WriteLine(breakableTools[0].Name); Console.WriteLine(breakableTools[1].Name); List<Tool> dimensionableTools = new List<Tool>(); dimensionableTools.Add(firstDimensionableTool); dimensionableTools.Add(secondDimensionableTool); Console.WriteLine(); Console.WriteLine("===============================WORKER==========================================="); Worker firstRVDWorker = new Worker("Ivan Ivanov", "Trakiq 71", 'm',"6611224455", "82-33-22", 4, 200, "Technical" , "RVD_DCP", 3.0); firstRVDWorker.PrintInfo(); Console.WriteLine("This worker Gain for the mounth is:"+firstRVDWorker.GainCalculating()); Worker firstErosionWorker = new Worker("Petkan Ivanov", "Trakiq 41", 'm', "6601224485", "82-63-92", 8, 200 , "Technical", "Erosion", 2.0); Worker firstComputerWorker = new Worker("Jordan Jordanov", "Trakiq 91", 'm', "6701225495", "82-69-96", 9, 200 , "IT", "Computer", 4.0); Worker secondRVDWorker = new Worker("Dimitar Petrov", "Trakiq 101", 'm', "6912624485", "82-73-22", 7, 190, "Technical" , "RVD_DCP", 3.0); Worker secondErosionWorker = new Worker("Dimitar Dimitrov", "Trakiq 51", 'm', "8601020485", "82-93-32", 2, 200 , "Technical", "Erosion", 2.0); Worker secondComputerWorker = new Worker("Simo Somovov", "Trakiq 11", 'm', "6901125995", "82-99-66", 9, 200 , "IT", "Computer", 4.0); Console.WriteLine(); Worker monitorRVDWorker = new Worker("Kolio Burov", "Trakiq 201", 'm', "5911124785", "82-13-92", 13, 230 , "Technical", "RVD_CDP", 5.0); Worker monitorErosionWorker = new Worker("Kiril Kotev", "Trakiq 86", 'm', "6601120795", "82-13-92", 11, 230 , "Technical", "Erosion", 5.0); Worker monitorComputerWorker = new Worker("Lilian Somov", "Trakiq 19", 'm', "6201005095", "82-19-16", 17, 230 , "IT", "Computer", 4.0); Console.WriteLine(); Console.WriteLine("========================LIST<worker>============================================"); List<Worker> technicalSectionWorkers = new List<Worker>(); technicalSectionWorkers.Add(firstRVDWorker); technicalSectionWorkers.Add(secondRVDWorker); technicalSectionWorkers.Add(monitorRVDWorker); technicalSectionWorkers.Add(firstErosionWorker); technicalSectionWorkers.Add(secondErosionWorker); technicalSectionWorkers.Add(monitorErosionWorker); technicalSectionWorkers.Add(firstComputerWorker); technicalSectionWorkers.Add(secondComputerWorker); technicalSectionWorkers.Add(monitorComputerWorker); List<Worker> ITSectionWorkers = new List<Worker>(); ITSectionWorkers.Add(firstComputerWorker); ITSectionWorkers.Add(secondComputerWorker); ITSectionWorkers.Add(monitorComputerWorker); Console.WriteLine("ALL IT SECTION WORKERS"); Console.WriteLine(ITSectionWorkers[0].Name); Console.WriteLine(ITSectionWorkers[1].Name); Console.WriteLine(ITSectionWorkers[2].Name); List<Worker> allWorkers = new List<Worker>(); allWorkers.Add(firstRVDWorker); allWorkers.Add(secondRVDWorker); allWorkers.Add(monitorRVDWorker); allWorkers.Add(firstErosionWorker); allWorkers.Add(secondErosionWorker); allWorkers.Add(monitorErosionWorker); allWorkers.Add(firstComputerWorker); allWorkers.Add(secondComputerWorker); allWorkers.Add(monitorComputerWorker); Console.WriteLine("=================================PRODUCTS======================================="); Product firstProduct = new Product("Big Form for Casket", 1000, 200, 20000, Matirial.iron); firstProduct.PrintInfo(); Console.WriteLine(); Console.WriteLine("The Gain from firstProduct= " + firstProduct.CalculatingProductGain()); Product secondProduct = new Product("Normal Form for Casket", 800, 180, 17000, Matirial.iron); Product thirdProduct = new Product("Little Form for Casket", 600, 150, 13000, Matirial.pigIron); Console.WriteLine(); Console.WriteLine("=================================STORES========================================="); Store firstStore = new Store("For Products", firstErosionWorker); firstStore.PrintInfo(); Store secondStore = new Store("For Dimensionable Tools ", firstErosionWorker); Store thirdStore = new Store("For Brekable Tools", firstRVDWorker); Console.WriteLine(); Console.WriteLine("==============================MACHINE TYPE======================================"); MachinesType firstMachineType = new MachinesType("RVD_DCP", monitorRVDWorker, RVDMachines); firstMachineType.PrintInfo(); MachinesType secondMachineType = new MachinesType("Erosion",monitorErosionWorker, ErosionMachines); MachinesType thirdMachineType = new MachinesType("Computer", monitorComputerWorker, computerMachines); Console.WriteLine(); Console.WriteLine("==============================TOOLS TYPE========================================"); ToolsType firstToolsType = new ToolsType("Breakable Tools Type", breakableTools); firstToolsType.PrintInfo(); ToolsType secondToolsType = new ToolsType("Dimensionable Tools Type", dimensionableTools); secondToolsType.PrintInfo(); Console.WriteLine(); Console.WriteLine("===============================SECTIONS========================================="); Section firstSection = new Section("Technical", technicalSectionWorkers, monitorRVDWorker); firstSection.PrintInfo(); Console.WriteLine(); Console.WriteLine("==============================FIRM=============================================="); Worker theOwner = new Worker("Todor Kolev","Trakiq 342",'m',"6603225578","82-77-88",22,250,null,null,10.0); MachinalEngineeringFirm someFirm=new MachinalEngineeringFirm("Lidia Dako Plast","Trakiq 432" ,"Forms for Plastic products",theOwner,allWorkers,allFirmMachines,new GiveTakeForMounthDeclare(4000,40000)); someFirm.PrintInfo(); Console.WriteLine(); Console.WriteLine("====================GIVE TAKE MONEY FROM THE FIRM FOR THE MOUNTH================"); someFirm.TheDeclaration = new GiveTakeForMounthDeclare(5000, 50000); Console.WriteLine(someFirm.TheDeclaration); Console.WriteLine(); Console.WriteLine("=====================EVENT TEST================================================="); BossMood bossMoodToday = new BossMood(5); bossMoodToday.Normal += (sender, eventInfo) => { Console.WriteLine("Congratulations we made a good job tomorow will have ADVANCE money"); }; bossMoodToday.Advance += (sender, eventInfo) => { Console.WriteLine("Congratulations we made a good job tomorow will have ADVANCE money"); }; bossMoodToday.SaturdayWork += (sender, eventInfo) => { Console.WriteLine("We work slow so this SATURDAY we will work"); }; Console.WriteLine("=================CHECK INVALID RANGE EXCEPTION CLASS============================"); InvalidRangeException<int> intExeption = new InvalidRangeException<int>("The range is not valid must be between[3, 50]!", 3, 50); someFirm.Owner.Name = "sdfadafaffgdfghdfhhhh"; if (someFirm.Owner.Name.Length < intExeption.Start || someFirm.Owner.Name.Length > intExeption.End) { throw intExeption; } else { Console.WriteLine(someFirm.Owner.Name); } //IImportantMassegable keyboard = new KeyBoard(); //keyboard.Advance += (sender, eventInfo) => //{ // Console.WriteLine("Congratulations we made a good job tomorow will have ADVANCE money"); //}; //keyboard.SaturdayWork += (sender, eventInfo) => //{ // Console.WriteLine("We work slow so this SATURDAY we will work"); //}; }