private void MenuItemCopyKalaNameArabi_Click(object sender, Telerik.Windows.RadRoutedEventArgs e) { Darkhastha2 currentRow = (Darkhastha2)GridViewDarkhastha.SelectedItem; if (currentRow != null) { Clipboard.SetText(currentRow.DarkhastName.Replace("ی", "ي").Replace("ک", "ك"), TextDataFormat.UnicodeText); } else { DialogBoxOk dialogBoxOk = new DialogBoxOk(); dialogBoxOk.Message = "ابتدا یک درخواست را انتخاب کنید"; dialogBoxOk.ShowDialog(); } }
private void ButtonDeleteDastgahName_Click(object sender, RoutedEventArgs e) { DialogBoxConfrimDelete dialogBoxConfrimDelete = new DialogBoxConfrimDelete(); dialogBoxConfrimDelete.Message = "آیا از حذف این دستگاه اطمینان دارید؟"; dialogBoxConfrimDelete.ShowDialog(); if (dialogBoxConfrimDelete.DialogResult == true) { Bakhshha bakhsh = (Bakhshha)ComboBoxBakhshName2.SelectedItem; Dastgahha dastgah = (Dastgahha)ComboBoxDastgahName.SelectedItem; var darkhastQuery = from darkhast in Entities.Darkhasthas where darkhast.DastgahGUID == dastgah.DastgahGUID select darkhast; if (darkhastQuery.Any()) { DialogBoxOk dialogBoxOk2 = new DialogBoxOk(); dialogBoxOk2.Message = "این دستگاه قبلا در درخواست ها استفاده شده است و نمی توانید آن را حذف کنید.فقط می توانید آن را ویرایش کنید"; dialogBoxOk2.ShowDialog(); return; } var deleteQuery = from d in Entities.Dastgahhas where d.BakhshGUID == bakhsh.BakhshGUID && d.DastgahGUID == dastgah.DastgahGUID select d; Entities.Dastgahhas.DeleteObject(((Dastgahha)deleteQuery.FirstOrDefault())); Entities.SaveChanges(); LoadComboBoxDastgahName(); DialogBoxOk dialogBoxOk = new DialogBoxOk(); dialogBoxOk.Message = "دستگاه حذف شد"; dialogBoxOk.ShowDialog(); } }