Exemple #1
0
 private void Classifies_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (Classifies.SelectedItem != null)
     {
         FundClassify fundClassify = (FundClassify)Classifies.SelectedItem;
         ClassifyName.Text  = fundClassify.FundClassify1;
         IsInCome.IsChecked = fundClassify.IncomeOrPay;
     }
 }
Exemple #2
0
 private void buttonAdd_Click(object sender, RoutedEventArgs e)
 {
     if (String.IsNullOrEmpty(ClassifyName.Text))
     {
         MessageBox.Show("请输入经费类别", "错误");
         return;
     }
     else
     {
         var pc = dataContext.FundClassify.Count(p => p.FundClassify1.Equals(ClassifyName.Text.Trim()));
         if (pc > 0)
         {
             MessageBox.Show("已存在相同经费类别", "错误");
             return;
         }
         FundClassify fundClassify = new FundClassify();
         fundClassify.FundClassify1 = ClassifyName.Text.Trim();
         fundClassify.IncomeOrPay   = IsInCome.IsChecked;
         dataContext.FundClassify.InsertOnSubmit(fundClassify);
         dataContext.SubmitChanges();
         dataContext            = new DataClassesProjectClassifyDataContext();
         Classifies.DataContext = dataContext.FundClassify;
     }
 }