コード例 #1
0
ファイル: ContactsVM.cs プロジェクト: karashak1/fallCSharp
 public ContactsVM()
 {
     _DB = new ContactsContext();
     soapClient = new SoapService.SoapServiceClient();
     Contacts = new ObservableCollection<Contact>();
     Addresses = new ObservableCollection<Address>();
     Companies = new ObservableCollection<Company>();
     AddressIDs = new ObservableCollection<int>();
     /* Old save command
     SaveCommand = new DelegateCommand(() => {
         _DB.SaveChanges();
     });
      */
     SaveCommand = new DelegateCommand(() => {
         foreach (var x in Contacts) {
             soapClient.AddContact(x);
         }
         soapClient.Save();
     });
     /*old Add Contact
     AddContactCommand = new DelegateCommand(() => {
         ViewingContact = new Contact();
         Contacts.Add(ViewingContact);
         _DB.Contacts.Add(VewingContact);
     });
      */
     AddContactCommand = new DelegateCommand(() => {
         ViewingContact = new Contact();
         Contacts.Add(ViewingContact);
         //soapClient.AddContactAsync(ViewingContact);
     });
     AddCompanyCommand = new DelegateCommand(() => {
         ViewingCompany = new Company();
         Companies.Add(ViewingCompany);
         _DB.Companies.Add(ViewingCompany);
     });
     AddAddressCommand = new DelegateCommand(() => {
         ViewingAddress = new Address();
         Addresses.Add(ViewingAddress);
         _DB.Addresses.Add(ViewingAddress);
     });
     DeleteContactCommand = new DelegateCommand(() => {
         _DB.Contacts.Remove(ViewingContact);
         Contacts.Remove(ViewingContact);
     });
     DeleteCompanyCommand = new DelegateCommand(() => {
         _DB.Contacts.Remove(ViewingContact);
         Contacts.Remove(ViewingContact);
     });
     DeleteAddressCommand = new DelegateCommand(() => {
         _DB.Contacts.Remove(ViewingContact);
         Contacts.Remove(ViewingContact);
     });
     AddContactMethodCommand = new DelegateCommand(() => {
         var cm = new ContactMethod();
         ViewingContact.ContactMethods.Add(cm);
     });
     init();
 }
コード例 #2
0
 partial void DeleteContact(Contact instance);
コード例 #3
0
 partial void UpdateContact(Contact instance);
コード例 #4
0
 partial void InsertContact(Contact instance);
コード例 #5
0
 /// <summary>
 /// Create a new Contact object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="created_at">Initial value of the created_at property.</param>
 /// <param name="updated_at">Initial value of the updated_at property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="email">Initial value of the Email property.</param>
 public static Contact CreateContact(global::System.Int32 id, global::System.DateTime created_at, global::System.DateTime updated_at, global::System.String firstName, global::System.String lastName, global::System.String email)
 {
     Contact contact = new Contact();
     contact.Id = id;
     contact.created_at = created_at;
     contact.updated_at = updated_at;
     contact.FirstName = firstName;
     contact.LastName = lastName;
     contact.Email = email;
     return contact;
 }
コード例 #6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Contacts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToContacts(Contact contact)
 {
     base.AddObject("Contacts", contact);
 }
コード例 #7
0
 public void AddContact(Contact contact)
 {
     db.Contacts.Add(contact);
 }