Example #1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            Model.mCMGPerson person = new Model.mCMGPerson(new CMGPerson());
            person.RecordCreatedUser = "******";
            person.RecordCreatedDate = DateTime.Now;
            dlgCMGPerson dialog = new dlgCMGPerson(person);
            bool?        result = dialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                entities.CMGPersons.Add(person.m_Person);
                try
                {
                    entities.SaveChanges();
                    personList.Add(person);
                    person.AllChanged();
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.Message, "Exception");
                }
            }
            else
            {
            }
        }
Example #2
0
 private void cMGPersonDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     Model.mCMGPerson person = cMGPersonDataGrid.SelectedItem as Model.mCMGPerson;
     if (person != null)
     {
         dlgCMGPerson dialog = new dlgCMGPerson(person);
         bool?        result = dialog.ShowDialog();
         if (result.HasValue && result.Value)
         {
             entities.SaveChanges();
         }
         else
         {
             entities.Entry(person.m_Person).Reload();
         }
         person.AllChanged();
     }
 }
Example #3
0
 public dlgCMGPerson(Model.mCMGPerson person)
 {
     DataContext = person;
     InitializeComponent();
 }