// Path To Photo public static void EditPathToPhoto(string personName, string newFileNameNoExtens) { var oldPathToPhoto = PersonObject.GetLink(personName)?.PathToPhoto; if (oldPathToPhoto == null) { return; } var fileInfo = new FileInfo(oldPathToPhoto); var newFilePath = fileInfo.DirectoryName + "\\" + newFileNameNoExtens + fileInfo.Extension; if (personName != null && DataBaseLevel.ContainsNameKey(personName)) { PersonObject.GetLink(personName).PathToPhoto = newFilePath; } }
public static bool EditPersonalNumber(string namePerson, string newNumber) { var isExist = FindByPersonalNumber(DataBaseLevel.GetPersonsList(), newNumber, out _); if (isExist) { MessageBox.Show($@"Такой номер уже назначен клиенту: {namePerson}", @"Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } else if (string.IsNullOrEmpty(newNumber)) { // MessageBox.Show($@"Личный номер удалён", @"Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Information); PersonObject.GetLink(namePerson).IdString = string.Empty; return(false); } PersonObject.GetLink(namePerson).IdString = newNumber; return(true); }