/// <summary> /// Checks a few Entrys from the two different selected Rows /// and gives a Message if there are fundamental differences. /// </summary> private void CompareContacts() { if (m_BS_Cao.Current != null) { cToolbox m_objTool = new cToolbox(); string[] foo2; foo2 = m_objTool.SplitName(((DataRowView)m_BS_Cao.Current)["NAME1"].ToString()); if (foo2[1] != ((DataRowView)m_BS_Sugar.Current)["last_name"].ToString()) { DialogResult dr = MessageBox.Show("Unterschiedliche Datenstze festgestellt (Nachname).\n Datenstze Konsolidieren?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { this.frmMain.DatensatzLadenPrivate(); } } else if (((DataRowView)m_BS_Cao.Current)["STRASSE"].ToString() != ((DataRowView)m_BS_Sugar.Current)["primary_address_street"].ToString()) { DialogResult dr = MessageBox.Show("Unterschiedliche Datenstze festgestellt (Strasse).\n Datenstze Konsolidieren?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { this.frmMain.DatensatzLadenPrivate(); } } else if (((DataRowView)m_BS_Cao.Current)["TELE1"].ToString() != ((DataRowView)m_BS_Sugar.Current)["phone_home"].ToString()) { DialogResult dr = MessageBox.Show("Unterschiedliche Datenstze festgestellt (Telefon).\n Datenstze Konsolidieren?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { this.frmMain.DatensatzLadenPrivate(); } } else { this.frmMain.DatensatzLadenPrivate(); } } else { MessageBox.Show("Es muss mindestens ein Cao Datensatz ausgewhlt sein!"); } }
/// <summary> /// Fills all the textfields with values from the current /// selected DataRow out of the BindingSource. (tblSearch*Contacts) /// </summary> public void DatensatzLadenPrivate() { tabMain.SelectedTab = tabContacts; #region snippet, obsolete /* snippet: * textBox.DataBindings.Add("Text", ds.Tables["Products"], "ProductName"); */ //txtName.DataBindings.Add( //m_DS.Tables[m_const_strCaoTableSearchHuman].Rows[0]; //txtName.Text = m_DS.Tables[m_const_strCaoTableSearchAll].Rows[0][1].ToString //txtName.DataBindings.Add(m_BS); //MessageBox.Show(m_BS.Position.ToString()); //MessageBox.Show(m_DS.Tables[m_const_strCaoTableSearchAll].Rows[m_BS.Position]["Name1"].ToString()); //if (m_BS.Current != null) // MessageBox.Show( ((DataRowView)m_BS.Current)["Name1"].ToString()); #endregion if (m_BS_CaoSearchContacts.Current != null) { //tabCompanies. //set searchtext to personen tstxtSuchePrivat.Text = "Personen..."; #region Convert the name filed into two fields using CToolbox cToolbox m_objTool = new cToolbox(); string[] foo2; foo2 = m_objTool.SplitName(((DataRowView)m_BS_CaoSearchContacts.Current)["NAME1"].ToString()); txtVorname.Text = foo2[0]; txtName.Text = foo2[1]; #endregion #region fill cbos and set them to the right index // set cboCaoVersand to the right index int VerdsandId = 0; VerdsandId = Convert.ToInt32(((DataRowView)m_BS_CaoSearchContacts.Current)["KUN_LIEFART"]); cboCaoVersand.SelectedIndex = VerdsandId - 1; //set cboCaoZahlart to the right index int ZahlartId = 0; ZahlartId = Convert.ToInt32(((DataRowView)m_BS_CaoSearchContacts.Current)["KUN_ZAHLART"]); cboCaoZahlart.SelectedIndex = ZahlartId - 1; #endregion /* Fills in all the textfield using databinding object casted into a datarowview */ txtName2.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["NAME2"].ToString(); txtName3.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["NAME3"].ToString(); cboAnrede.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["ANREDE"].ToString(); txtStrasse1.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["STRASSE"].ToString(); txtPLZ.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["PLZ"].ToString(); txtOrt.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["ORT"].ToString(); txtWebpage.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["INTERNET"].ToString(); txtEmail.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["EMAIL"].ToString(); txtFax.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["FAX"].ToString(); txtMobile.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["FUNK"].ToString(); txtPhon2.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["TELE2"].ToString(); txtPhone1.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["TELE1"].ToString(); cboCaoBriefanrede.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["BRIEFANREDE"].ToString(); txtCaoZahlungsziel.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["BRT_TAGE"].ToString(); dtpKunSeit.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["KUN_SEIT"].ToString(); //dtpGebDatum.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["KUN_GEBDATUM"].ToString(); dtpGebDatum.Value = Convert.ToDateTime(((DataRowView)m_BS_CaoSearchContacts.Current)["KUN_GEBDATUM"]); txtBemerkung.Text = ((DataRowView)m_BS_CaoSearchContacts.Current)["INFO"].ToString(); //((DataRowView)m_BS_CaoSearchContacts.Current)["INFO"] = txtBemerkung.Text; //txtSugarZugewiesenAn.Text = ((DataRowView)m_BS.Current)[].ToString(); txtSugarLand.Text = ((DataRowView)m_BS_SugarSearchContacts.Current)["primary_address_country"].ToString(); txtSugarLeadSource.Text = ((DataRowView)m_BS_SugarSearchContacts.Current)["lead_source"].ToString(); txtSugarAbteilung.Text = ((DataRowView)m_BS_SugarSearchContacts.Current)["department"].ToString(); txtSugarTitle.Text = ((DataRowView)m_BS_SugarSearchContacts.Current)["title"].ToString(); } //((DataRowView)m_BS.Current)["NAME1"] = txtName.Text; //((DataRowView)m_BS_Sugar.Current)["last_name"] = //m_BS.Current }