private void ContinueButton_Click(object sender, RoutedEventArgs e) { string reason = cmbReason.SelectedValue == null ? "" : cmbReason.SelectedValue.ToString(); if (reason == "0") { DialogParameters param = new DialogParameters(); param.Header = "Reason to Remove is required"; param.Content = "Please select a Reason to Remove the item."; RadWindow.Alert(param); } else if (reason == "1" && String.IsNullOrEmpty(txtReason.Text)) { DialogParameters param = new DialogParameters(); param.Header = "Deletion Comments Required"; param.Content = "Please enter Deletion Comments."; RadWindow.Alert(param); } else if (!string.IsNullOrWhiteSpace(reason)) { _mrsClient.DeleteProductCompleted += delegate(object o, DeleteProductCompletedEventArgs es) { if (es.Error == null) { if (es.Result != null) { RadWindow window = this.ParentOfType <RadWindow>(); if (window != null) { window.DialogResult = true; window.Close(); } } } else { ExceptionHandler.PopUpErrorMessage(es.Error, "DeleteProductCompleted"); } }; foreach (EstimateDetails ed in pag) { _mrsClient.DeleteProductAsync(ed.EstimateRevisionDetailsId, txtReason.Text, int.Parse(cmbReason.SelectedValue.ToString()), (App.Current as App).CurrentUserId); } } }