private static void InitRepository() { storage = new Storage(); Number number1 = new Number(1234560); Number number2 = new Number(1234561); Number number3 = new Number(1234562); Number number4 = new Number(1234563); Number number5 = new Number(1234564); Number number6 = new Number(1234565); storage.PutEntity(number1); storage.PutEntity(number2); storage.PutEntity(number3); storage.PutEntity(number4); storage.PutEntity(number5); storage.PutEntity(number6); Tarif tarif1 = new Tarif(1, "junior", 50, 100, 1, 0.5); Tarif tarif2 = new Tarif(2, "midle", 100, 1000, 1, 0.5); Tarif tarif3 = new Tarif(3, "senior", 200, 10000, 1, 0.5); storage.PutEntity(tarif1); storage.PutEntity(tarif2); storage.PutEntity(tarif3); Client client = new Client(number1, tarif1); storage.PutEntity(client); }
public bool RegisterClient(int number, int tarifId) { Tarif tarif = tarifService.Read(tarifId); if (tarif == null) { return(false); } Number numberEntity = numberService.Read(number); if (numberEntity == null || !numberEntity.IsAvailible) { return(false); } return(clientService.Create(new Client(numberEntity, tarif)) > 0); }
public bool ChangeClientTarif(int number, int tarifId) { Tarif tarif = tarifService.Read(tarifId); if (tarif == null) { return(false); } Number numberEntity = numberService.Read(number); if (numberEntity == null || !numberEntity.IsAvailible) { return(false); } Client client = clientService.Read(number); if (client == null) { return(false); } client.Tarif = tarif; return(clientService.Update(client.GetId(), client)); }
public Client(Number number, Tarif tarif) { this.number = number; this.tarif = tarif; }