private bool SaveChanges() { SaveButton.Focus(); video.Artist = video.Artist.Trim(); video.Album = video.Album.Trim(); video.Title = video.Title.Trim(); video.DownloadName = video.DownloadName.Trim(); video.DownloadUrl = video.DownloadUrl.Trim(); video.BuyUrl = video.BuyUrl.Trim(); ErrorText.Text = ""; if (TitleText.Text.Length == 0) { ErrorText.Text = "Title is required."; return(false); } if (business.IsTitleDuplicate(video)) { ErrorText.Text = "Artist and title already exist in the database."; return(false); } // Only update EditedOn when directly editing from the Edit window. if (!isPopup) { video.EditedOn = DateTime.UtcNow; } ratingBusiness.UpdateChanges(); business.Save(); isFormSaved = true; // Update grid when in popup mode. Otherwise Callback is called in Window_Closing. if (isPopup) { callback(video); } return(true); }
private bool SaveChanges() { SaveButton.Focus(); video.Artist = video.Artist.Trim(); video.Album = video.Album.Trim(); video.Title = video.Title.Trim(); video.DownloadName = video.DownloadName.Trim(); video.DownloadUrl = video.DownloadUrl.Trim(); video.BuyUrl = video.BuyUrl.Trim(); ErrorText.Text = ""; if (TitleText.Text.Length == 0) { ErrorText.Text = "Title is required."; return(false); } if (business.IsTitleDuplicate(video)) { ErrorText.Text = "Artist and title already exist in the database."; return(false); } if (!isUrlValid && StartDownloadCheckBox.IsChecked == true) { ErrorText.Text = "Please enter a valid URL"; return(false); } if (SessionCore.Instance.Business.DownloadManager.IsDownloadDuplicate(video.DownloadUrl)) { ErrorText.Text = "You are already downloading this video."; return(false); } video.EditedOn = DateTime.UtcNow; business.Save(); return(true); }