private void EditRule_Click(object sender, RoutedEventArgs e) { BillingDataDataContext db = new BillingDataDataContext(); if (CostingRuleGrid.Visibility == Visibility.Visible && CostingRuleGrid.SelectedItem != null) { if (MessageBox.Show("Do you Want edit this Rule", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { CostingRule dcr = (CostingRule)CostingRuleGrid.SelectedItem; AddRule win = new AddRule(dcr.Id); win.Closed += win_Closed; win.Show(); CostingRuleGrid.SelectedItem = null; } } if (ServiceRuleGrid.Visibility == Visibility.Visible && ServiceRuleGrid.SelectedItem != null) { if (MessageBox.Show("Do you Want edit this Rule", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { ServiceRule dcr = (ServiceRule)ServiceRuleGrid.SelectedItem; AddServiceRule win = new AddServiceRule(dcr.Id); win.Closed += win_Closed; win.Show(); ServiceRuleGrid.SelectedItem = null; } } db.SubmitChanges(); }
private void AddRuleButton_Click(object sender, RoutedEventArgs e) { if (CostingRuleRadio.IsChecked == true) { AddRule window = new AddRule(new BillingDataDataContext().Quotations.Where(x => x.CLCODE == ((Client)this.ClientCombo.SelectedItem).CLCODE).FirstOrDefault()); window.Closed += addRulwWindow_Closed; window.Show(); } if (ServiceRuleRadio.IsChecked == true) { AddServiceRule window = new AddServiceRule(new BillingDataDataContext().Quotations.Where(x => x.CLCODE == ((Client)this.ClientCombo.SelectedItem).CLCODE).FirstOrDefault()); window.Closed += ServiceRuleWindowClosed; window.Show(); } }