示例#1
0
 public override void OkButtonClick(object sender, EventArgs e)
 {
     Person = new Person
     {
         DbLocation = databasesComboBox.SelectedItem.ToString(),
         Name = NameTextBox.Text,
         SirName = sirNameTextBox.Text,
         BirthDate = dateTimePicker1.Value
     };
     DialogResult = DialogResult.OK;
 }
        public void AddPerson(Person objectToAdd, string dataBaseName)
        {
            UniversityContext context;

            switch (dataBaseName)
            {
                case "MsSqlFirstDatabase":
                    context = m_firstUniversityContext;
                    break;
                case "MsSqlSecondDatabse":
                    context = m_thirdUniversityContext;
                    break;
                default:
                    return;
            }
            context.Persons.Add(objectToAdd);
            context.SaveChanges();
        }
 public void AddPerson(Person baseObject)
 {
     m_client.AddPerson(baseObject, baseObject.DbLocation);
 }