void btnSave_Click(object sender, RoutedEventArgs e) { try { // An import folder cannot be both the drop source and the drop destination if (chkDropDestination.IsChecked.HasValue && chkDropSource.IsChecked.HasValue && chkDropDestination.IsChecked.Value && chkDropSource.IsChecked.Value) { MessageBox.Show(JMMServer.Properties.Resources.ImportFolders_SameFolder, JMMServer.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); return; } // The import folder location cannot be blank. Enter a valid path on OMM Server if (string.IsNullOrEmpty(txtImportFolderLocation.Text)) { MessageBox.Show(JMMServer.Properties.Resources.ImportFolders_BlankImport, JMMServer.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtImportFolderLocation.Focus(); return; } Contract_ImportFolder contract = new Contract_ImportFolder(); if (importFldr.ImportFolderID == 0) { contract.ImportFolderID = null; } else { contract.ImportFolderID = importFldr.ImportFolderID; } contract.ImportFolderName = "NA"; contract.ImportFolderLocation = txtImportFolderLocation.Text.Trim(); contract.IsDropDestination = chkDropDestination.IsChecked.Value ? 1 : 0; contract.IsDropSource = chkDropSource.IsChecked.Value ? 1 : 0; contract.IsWatched = chkIsWatched.IsChecked.Value ? 1 : 0; JMMServiceImplementation imp = new JMMServiceImplementation(); Contract_ImportFolder_SaveResponse response = imp.SaveImportFolder(contract); if (!string.IsNullOrEmpty(response.ErrorMessage)) { MessageBox.Show(response.ErrorMessage, JMMServer.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } ServerInfo.Instance.RefreshImportFolders(); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } this.DialogResult = true; this.Close(); }
public Contract_ImportFolder ToContract() { Contract_ImportFolder contract = new Contract_ImportFolder(); contract.ImportFolderID = this.ImportFolderID; contract.ImportFolderType = this.ImportFolderType; contract.ImportFolderLocation = this.ImportFolderLocation; contract.ImportFolderName = this.ImportFolderName; contract.IsDropSource = this.IsDropSource; contract.IsDropDestination = this.IsDropDestination; contract.IsWatched = this.IsWatched; return(contract); }