public void Change_Contract_of_Employment() { string sParameter, sCheckingParameter; sCheckingParameter = F.sText( "Enter the registration number of the employee whose contract requires a change", "The Registration Number have to consist of 4 or more number!", "^[0-9]{4,}$" ); sParameter = RegistrationNumberToChangeDataCheck(sCheckingParameter); Person SearchedPerson = EmployeeList.Find(number => number.sRegNumber == sParameter); if (SearchedPerson != null) { char Option; Console.WriteLine("Choose Contract Type: "); Console.WriteLine("Selecting anything apart given options will result in personal choose contract type option [by hand]"); Console.WriteLine("1.B2B"); Console.WriteLine("2.Trial"); Console.WriteLine("3.Fixed - term contract"); Option = Console.ReadKey(true).KeyChar; string sNewContractType = ""; switch (Option) { case '1': sNewContractType = "B2B"; break; case '2': sNewContractType = "Trial"; break; case '3': sNewContractType = "Fixed - term contract"; break; default: sNewContractType = F.sText( "Contract type", "Contract type may not contain characters other than letters!", "^[a-zA-Z]+(\\s?\\-?[a-zA-Z]*)*$" ); break; } string sNewDateOfConclusion = F.DateOf( "Conclusion" ); int iNewTimeContract = F.iNumber( "Contract time", "The Contract Time may not contain characters other than numbers!", "^[0-9]+$" ); ContractOfEmployment newContractOfEmployment = new ContractOfEmployment(sNewDateOfConclusion, sNewContractType, iNewTimeContract); EmployeeList.Add(new Person(SearchedPerson.sName, SearchedPerson.sSurname, SearchedPerson.sRegNumber, SearchedPerson.Address, SearchedPerson.sDateOfBrith, newContractOfEmployment)); EmployeeList.Remove(SearchedPerson); } }
public Person(string sName, string sSurname, string sRegNumber, Address Address, string sDateOfBrith, ContractOfEmployment ContractOfEmployment) { this.sName = sName; this.sSurname = sSurname; this.sRegNumber = sRegNumber; this.Address = Address; this.sDateOfBrith = sDateOfBrith; this.ContractOfEmployment = ContractOfEmployment; }
public HumanResources() { Address newAddress0001 = new Address("Fioletowa", 69, "70-781", "Szczecin"); Address newAddress0002 = new Address("Okrezna", 46, "74-320", "Barlinek"); Address newAddress0003 = new Address("ks.Boguslawa X", 43, "70-441", "Szczecin"); ContractOfEmployment newContractOfEmployment = new ContractOfEmployment("15-01-2020", "UoP", 36); EmployeeList.Add(new Person("Pawel", "Cybulski", "0001", newAddress0001, "30-09-1998", newContractOfEmployment) ); EmployeeList.Add(new Person("Kamil", "Blaz", "0002", newAddress0002, "09-07-1998", newContractOfEmployment) ); EmployeeList.Add(new Person("Szymon", "Lesisz", "0003", newAddress0003, "20-09-1999", newContractOfEmployment) ); }
public void Hire_an_Employee() { string sName_F, sSurname_F, sRegNumber_F, sDateOfBirth_F, sDateOfConclusion_F, sContractType_F, sStreet_F, sPostalAddress_F, sCity_F, sRegNumberToCheck_F; int iContractTime_F, iHouseNumber_F; Console.WriteLine("--- Personal Data ---"); sName_F = F.sText( "Name", "Name cannot contain characters other than letters!", "^[a-zA-Z]+(\\s?\\-?[a-zA-Z]*)*$" ); sSurname_F = F.sText( "Surname", "Surname cannot contain characters other than letters!", "^[a-zA-Z]+(\\s?\\-?[a-zA-Z]*)*$" ); sRegNumberToCheck_F = F.sText( "Registration Number", "The Registration Number have to consist of 4 or more number!", "^[0-9]{4,}$" ); sRegNumber_F = RegistrationNumberCheck(sRegNumberToCheck_F); sDateOfBirth_F = F.DateOf( "Birth" ); Console.WriteLine("--- Address ---"); sStreet_F = F.sText( "Street", "The Street must not contain other signs than letters!", "^[a-zA-Z]+(\\s?\\-?[a-zA-Z]*)*$" ); iHouseNumber_F = F.iNumber( "House Number", "The House Number cannot contain characters other than numbers!", "^[0-9]+$" ); sPostalAddress_F = F.sText( "Postal Address (XX-XXX)", "Postal Address have to contain " + "-" + " and cannot contain characters other than numbers!", "^[0-9]{2}-[0-9]{3}$" ); sCity_F = F.sText( "City", "The City must not contain other signs than letters!", "^[a-zA-Z]+(\\s?\\-?[a-zA-Z]*)*$" ); Console.WriteLine("--- Contract---"); sDateOfConclusion_F = F.DateOf( "Conclusion" ); char Option; Console.WriteLine("Choose Contract Type: "); Console.WriteLine("Selecting anything apart given options will result in personal choose contract type option [by hand]"); Console.WriteLine("1.B2B"); Console.WriteLine("2.Trial"); Console.WriteLine("3.Fixed - term contract"); Option = Console.ReadKey(true).KeyChar; sContractType_F = ""; switch (Option) { case '1': sContractType_F = "B2B"; break; case '2': sContractType_F = "Trial"; break; case '3': sContractType_F = "Fixed - term contract"; break; default: sContractType_F = F.sText( "Contract type", "Contract type may not contain characters other than letters!", "^[a-zA-Z]+(\\s?\\-?[a-zA-Z]*)*$" ); break; } iContractTime_F = F.iNumber( "Contract time", "The Contract Time may not contain characters other than numbers!", "^[0-9]+$" ); Address newAddress = new Address( sStreet_F, iHouseNumber_F, sPostalAddress_F, sCity_F ); ContractOfEmployment newContractOfEmployment = new ContractOfEmployment( sDateOfConclusion_F, sContractType_F, iContractTime_F ); EmployeeList.Add( new Person( sName_F, sSurname_F, sRegNumber_F, newAddress, sDateOfBirth_F, newContractOfEmployment ) ); }