Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 private void btnContactDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         Database.tblContact c = (Database.tblContact)tblContactBindingSource.Current;
         if (c != null)
         {
             dataContext.tblContact.DeleteOnSubmit(c);
             dataContext.SubmitChanges(System.Data.Linq.ConflictMode.FailOnFirstConflict);
         }
     }
     catch (SqlException exception)
     {
         if (exception.Number == 547)
         {
             DevExpress.XtraEditors.XtraMessageBox.Show("Datensatz wird noch von anderer Stelle referenziert und kann daher nicht gelöscht werden.", "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             DevExpress.XtraEditors.XtraMessageBox.Show(exception.ToString(), "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     finally
     {
         LoadData();
     }
 }
Exemplo n.º 3
0
 private void pictureEdit1_EditValueChanged(object sender, EventArgs e)
 {
     if (((PictureEdit)sender).EditValue is Image)
     {
         Database.tblContact c = (Database.tblContact)tblContactBindingSource.Current;
         c.Picture = Wookie.Tools.Image.Converter.GetBinaryFromImage(((PictureEdit)sender).EditValue as Image);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Adds a new contact to the datasource.
        /// </summary>
        private void AddContact()
        {
            this.ucDefault1.PostEditor();
            Database.tblContact contact = new Database.tblContact();
            contact.FKContactData = this.modulData.FKExternal;

            int datasourceindex = this.tblContactBindingSource.Add(contact);

            gridView2.FocusedRowHandle = gridView2.GetRowHandle(datasourceindex);
        }
Exemplo n.º 5
0
        private void EditContact()
        {
            Database.tblContact c = (Database.tblContact)tblContactBindingSource.Current;
            if (c == null)
            {
                return;
            }

            navigationFrame1.SelectedPage = navEdit;
            ucContactEdit.Edit(c);
        }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
        private void RefreshDataOnScreen()
        {
            Database.tblContact c = (Database.tblContact)tblContactBindingSource.Current;
            if (c != null)
            {
                if (this.gridView1.GetSelectedRows().Count() > 0)
                {
                    this.gridView1.RefreshRow(this.gridView1.GetSelectedRows()[0]);
                }

                this.lblName.Text  = ((string)(c.Surname + " " + c.Middlename)).Trim() + " " + c.Name;
                this.lblTitel.Text = ((string)(c.Title));

                tblContactCommunicationBindingSource.DataSource = c;
                gridView2.BestFitColumns(true);
            }
            else
            {
                this.lblName.Text  = "Name";
                this.lblTitel.Text = "Title";

                tblContactCommunicationBindingSource.DataSource = null;
            }
        }