private void btn_Delete_Click_1(object sender, RoutedEventArgs e) { if (grd_BehaviourJudgment.SelectedItem != null) { behaviorJudgment = (BehaviorJudgment)grd_BehaviourJudgment.SelectedItem; MessageBoxResult result= MessageBox.Show("هل انت متأكد من حذف " + behaviorJudgment.Name, "حذف حكم النشاط", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { behaviorJudgmentDomain.Delete(behaviorJudgment); if (behaviorJudgmentDomain.ActionState.Status == Common.Enums.ActionStatusEnum.NoError) { MessageBox.Show("تم الحذف بنجاح", "حذف حكم النشاط", MessageBoxButton.OK, MessageBoxImage.Information); behaviorJudgmentList.Remove(behaviorJudgment); grd_BehaviourJudgment.ItemsSource = null; grd_BehaviourJudgment.ItemsSource = behaviorJudgmentList; Clear(); } else { MessageBox.Show(behaviorJudgmentDomain.ActionState.Result, "حذف حكم النشاط", MessageBoxButton.OK, MessageBoxImage.Error); Clear(); } } } }
private void grd_BehaviourJudgment_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (grd_BehaviourJudgment.SelectedItem != null) { behaviorJudgment = (BehaviorJudgment)grd_BehaviourJudgment.SelectedItem; txt_Description.Text = behaviorJudgment.Description; txt_EnglishDescription.Text = behaviorJudgment.DescriptionEnglish; txt_EnglishName.Text = behaviorJudgment.NameEnglish; txt_Name.Text = behaviorJudgment.Name; txt_Value.Text = behaviorJudgment.Value.ToString(); } }
private void Clear() { txt_Description.Text = string.Empty; txt_EnglishDescription.Text = string.Empty; txt_EnglishName.Text = string.Empty; txt_Err_Description.Text = string.Empty; txt_Err_EnglishDescription.Text = string.Empty; txt_Err_EnglishName.Text = string.Empty; txt_Err_Name.Text = string.Empty; txt_Err_Value.Text = string.Empty; txt_Name.Text = string.Empty; txt_Value.Text = string.Empty; behaviorJudgment = new BehaviorJudgment(); }