public void AddClient() { bool oshibka = false; if (CityName == null) { oshibka = true; OshibkaGorod = "Выберете город!"; RaisePropertyChanged(() => OshibkaGorod); } if ((ClientName == null) || (ClientName == "")) { oshibka = true; OshibkaClientName = "Введите Ф.И.О."; RaisePropertyChanged(() => OshibkaClientName); } else { OshibkaClientName = ""; RaisePropertyChanged(() => OshibkaClientName); } if ((ClientPhone == null) || (ClientPhone == "")) { oshibka = true; OshibkaPhone = "Введите телефон"; RaisePropertyChanged(() => OshibkaPhone); } else { OshibkaPhone = ""; RaisePropertyChanged(() => OshibkaPhone); } if (DateDay < 1 || DateDay > 31 || DateMounth < 1 || DateMounth > 12 || DateYear < 2000 || DateYear > 2020) { oshibka = true; OshibkaDate = "Введите дату"; RaisePropertyChanged(() => OshibkaDate); } else { OshibkaDate = ""; RaisePropertyChanged(() => OshibkaDate); } if (!oshibka & CanAddClient()) { SpisokZamerov.Add(new ZamerList(_cityName.CityName, ClientName, ClientPhone, DateDay, DateMounth, DateYear)); int r = CityList.IndexOf(CityName); CityList[r].DateOfZamer[DateDay - 1, DateMounth - 1, DateYear - 2000].ClientList.Add(new Client(ClientName, ClientPhone)); ZapolnenieKolichestvaZamerov(); } }
private void ZapolnenieZamerList() { for (int z = 0; z < 19; z++) { for (int y = 0; y < 12; y++) { for (int x = 0; x < 30; x++) { foreach (CityModel city in CityList) { if (city.DateOfZamer[x, y, z].ClientList.Count != 0) { foreach (Client client in city.DateOfZamer[x, y, z].ClientList) { SpisokZamerov.Add(new ZamerList(city.CityName, client.ClientName, client.ClientPhone, x + 1, y + 1, z + 2000)); } } } } } } }