public override bool Validate() { ErrorCollection.Clear(); if (string.IsNullOrWhiteSpace(Entity.Title)) { ErrorCollection.Add(nameof(Entity.Title), "Must not be empty."); } if (string.IsNullOrWhiteSpace(Entity.Description)) { ErrorCollection.Add(nameof(Entity.Description), "Must not be empty."); } if (Entity.Genres.Count < 1) { ErrorCollection.Add(nameof(Entity.Genres), "Genres count must not be less than 1, select more please!"); } if (Entity.Authors.Count < 1) { ErrorCollection.Add(nameof(Entity.Authors), "Authors count must not be less than 1, select more please!"); } if (string.IsNullOrEmpty(Entity.PictureName)) { ErrorCollection.Add(nameof(Entity.PictureName), "Book image must not be enmpty. Please load image!"); } return(base.Validate()); }
public void Save(ApplicationSettings applicationSettings) { try { _errors.Clear(); _jsonSerializationService.WriteToJsonFile(applicationSettings.SettingsFile, applicationSettings, false); _applicationSettings = applicationSettings; } catch (Exception ex) { _log.ErrorFormat(Program.GetLogErrorFormat(), ex.Message, ex.StackTrace, MethodBase.GetCurrentMethod().Name); _errors.Add(new Error() { Description = "There was a problem saving the Application Settings File" }); } }
/// <summary> /// Clear Grid and Listbox /// </summary> /// <returns></returns> /// 2019/07/13, Vinoth N, Initial Version private void Clear() { LineCollection.Clear(); DetailCollection.Clear(); ErrorCollection.Clear(); counterStatus.Content = ""; b_Download.IsEnabled = false; tbk_counter.Text = "0"; }
public override bool Validate() { ErrorCollection.Clear(); if (string.IsNullOrWhiteSpace(Entity.FirstName)) { ErrorCollection.Add(nameof(Entity.FirstName), "Must not be empty."); } if (string.IsNullOrWhiteSpace(Entity.LastName)) { ErrorCollection.Add(nameof(Entity.LastName), "Must not be empty."); } return(base.Validate()); }
/// <summary> /// Clears this instance. /// </summary> public void Clear() { ErrorCollection.Clear(); }