public void Edit(Database.tblContact contact) { if (contact == null) { return; } dataContext = new Database.ContactDataContext(modulData.SqlConnection); tlkpContactPrefixBindingSource.DataSource = dataContext.tlkpContactPrefix; tlkpContactCommunicationTypeBindingSource.DataSource = dataContext.tlkpContactCommunicationType; tlkpCityBindingSource.DataSource = dataContext.tlkpCity; tlkpFederalStateBindingSource.DataSource = dataContext.tlkpFederalState; tlkpCountryBindingSource.DataSource = dataContext.tlkpCountry; tlkpContactCommunicationCategoryBindingSource.DataSource = dataContext.tlkpContactCommunicationCategory; tblContactBindingSource.DataSource = from row in dataContext.tblContact where row.PKContact == contact.PKContact select row; tblContactCommunicationBindingSource.DataSource = dataContext.tblContactCommunication; LoadImageComboBoxItems(); gridView1.BestFitColumns(true); tblContactBindingSource.MoveFirst(); }
/// <summary> /// Load data from database using a new data context. /// </summary> private void LoadDataFromDatabase() { this.dataContext = new Database.ContactDataContext(this.modulData.SqlConnection); this.ucDefault1.DataContext = this.dataContext; this.tlkpCityBindingSource.DataSource = this.dataContext.tlkpCity; this.tlkpContactAddressTypeBindingSource.DataSource = this.dataContext.tlkpContactAddressType; this.tlkpContactPrefixBindingSource.DataSource = this.dataContext.tlkpContactPrefix; this.tlkpFederalStateBindingSource.DataSource = this.dataContext.tlkpFederalState; this.tlkpCountryBindingSource.DataSource = this.dataContext.tlkpCountry; this.tlkpContactCommunicationCategoryBindingSource.DataSource = this.dataContext.tlkpContactCommunicationCategory; this.tlkpContactCommunicationTypeBindingSource.DataSource = this.dataContext.tlkpContactCommunicationType; this.tblContactBindingSource.DataSource = from row in this.dataContext.tblContact where row.FKContactData == this.modulData.FKExternal select row; }
private void ucDefault1_BeforeDataLoad(object sender, EventArgs e) { if (modulData.FKSelected == null) { return; } this.dataContext = new Database.ContactDataContext(modulData.SqlConnection); this.ucDefault1.DataContext = this.dataContext; var result = from row in dataContext.tblContactAppointment where modulData.FKSelected.Contains(row.FKContact) select row; this.tblContactAppointmentBindingSource.DataSource = result; this.LoadImageComboBoxItems(); StatusBarChanged?.Invoke(new StatusBarEventArgs(System.String.Format("{0} Datensätze geladen", this.tblContactAppointmentBindingSource.Count))); }
private void LoadData() { dataContext = new Database.ContactDataContext(modulData.SqlConnection); tlkpCityBindingSource.DataSource = dataContext.tlkpCity; tlkpContactPrefixBindingSource.DataSource = dataContext.tlkpContactPrefix; tlkpFederalStateBindingSource.DataSource = dataContext.tlkpFederalState; tlkpCountryBindingSource.DataSource = dataContext.tlkpCountry; tlkpContactCommunicationTypeBindingSource.DataSource = dataContext.tlkpContactCommunicationType; tlkpContactCommunicationCategoryBindingSource.DataSource = dataContext.tlkpContactCommunicationCategory; //tblContactCommunicationBindingSource.DataSource = dataContext.tblContact; tblContactBindingSource.DataSource = from row in dataContext.tblContact where row.FKContactData == modulData.FKExternal select row; // gridView1.BestFitColumns(true); //gridView2.BestFitColumns(true); tblContactBindingSource.MoveFirst(); }
public void New() { dataContext = new Database.ContactDataContext(modulData.SqlConnection); tlkpContactPrefixBindingSource.DataSource = dataContext.tlkpContactPrefix; tlkpContactCommunicationTypeBindingSource.DataSource = dataContext.tlkpContactCommunicationType; tblContactCommunicationBindingSource.DataSource = dataContext.tblContactCommunication; tlkpCityBindingSource.DataSource = dataContext.tlkpCity; tlkpFederalStateBindingSource.DataSource = dataContext.tlkpFederalState; tlkpCountryBindingSource.DataSource = dataContext.tlkpCountry; LoadImageComboBoxItems(); Database.tblContact c = new Database.tblContact(); c.FKContactData = modulData.FKExternal; tblContactBindingSource.DataSource = c; dataContext.tblContact.InsertOnSubmit(c); gridView1.BestFitColumns(true); tblContactBindingSource.MoveFirst(); }