コード例 #1
0
        private void button1_ausAlterBestellung_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            bool isAdresseSelected    = this.adressenDataGridView.SelectedRows.Count == 1;
            bool isBestellungSelected = this.bestellungenDataGridView.SelectedRows.Count == 1;

            if (isAdresseSelected && isBestellungSelected)
            {
                var datarow = this.adressenDataGridView.CurrentRow;
                DAL.DataSet1.AdressenRow row = (DAL.DataSet1.AdressenRow)((DataRowView)datarow.DataBoundItem).Row;

                var adressRow = this.adressenDataGridView.CurrentRow;

                neueBestellung.Adresse = Helper.Jsons.datagridrowToJson(adressRow);

                neueBestellung.ErstelltVon   = Environment.UserName;
                neueBestellung.Datum         = DateTime.Now;
                neueBestellung.Firmenname    = row.Firmenname;
                neueBestellung.Email1Adresse = row.Email1Adresse == null ? "" : row.Email1Adresse;
                neueBestellung.AdressID      = row.ID;

                //  neueBestellung.Email2Adresse = row.Email2Adresse == null ? "" : row.Email2Adresse;
                //adressRow.Cells[0].Value.ToString();

                string dieVorlage = this.bestellungenDataGridView.CurrentRow.Cells["speicherortDataGridViewTextBoxColumn"].Value.ToString();

                if (File.Exists(dieVorlage))
                {
                    // hier wird die Bestellung auch gespeichert
                    Helper.ExcelHelper.createNewExcelFromOldone(neueBestellung, dieVorlage);
                    try
                    {
                        System.Diagnostics.Process.Start(neueBestellung.Speicherort);
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message.Contains("Netzwerk"))
                        {
                            System.Diagnostics.Process.Start(neueBestellung.Speicherort.Replace("PRINTUMSERVER", "192.168.26.250"));
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Die Vorlage existiert nicht (mehr).");
                }



                this.Close();
            }

            else
            {
                MessageBox.Show("Bitte eine Adresse UND eine alte Bestellung auswählen");
            }

            this.Cursor = Cursors.Default;
        }
コード例 #2
0
        private void NeueBestellung(object sender, EventArgs e, bool IsEnglich)
        {
            this.Cursor = Cursors.WaitCursor;

            bool isAdresseSelected = this.adressenDataGridView.SelectedRows.Count == 1;

            if (isAdresseSelected)
            {
                var adressRow = this.adressenDataGridView.CurrentRow;
                DAL.DataSet1.AdressenRow row = (DAL.DataSet1.AdressenRow)((DataRowView)adressRow.DataBoundItem).Row;


                neueBestellung.Adresse = Helper.Jsons.datagridrowToJson(adressRow);

                neueBestellung.ErstelltVon = Environment.UserName;
                neueBestellung.Datum       = DateTime.Now;
                neueBestellung.Firmenname  = row.Firmenname;

                neueBestellung.Email1Adresse = row.Email1Adresse == null ? "" : row.Email1Adresse;
                //  neueBestellung.Email2Adresse = row.Email2Adresse == null ? "" : row.Email2Adresse;
                neueBestellung.AdressID = row.ID;

                Helper.ExcelHelper.createNewExcel(neueBestellung, IsEnglich);

                // Excel öffnen
                try
                {
                    System.Diagnostics.Process.Start(neueBestellung.Speicherort);
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("Netzwerk"))
                    {
                        System.Diagnostics.Process.Start(neueBestellung.Speicherort.Replace("PRINTUMSERVER", "192.168.26.250"));
                    }
                    else
                    {
                        Helper.LogHelper.WriteDebugLog(ex.ToString());
                    }
                }

                this.Close();
            }
            else
            {
                MessageBox.Show("Bitte eine Adresse auswählen");
            }


            this.Cursor = Cursors.Default;
        }
コード例 #3
0
        private void AdresseWaehlenUndSchliessen()
        {
            var rows = this.adressenDataGridView.SelectedRows;

            if (rows.Count > 0)
            {
                try
                {
                    var bounditem = rows[0].DataBoundItem;
                    var rowview   = ((DataRowView)bounditem).Row;
                    this.rrrow = (DAL.DataSet1.AdressenRow)rowview;

                    this.DialogResult = DialogResult.OK;
                    this.Close();

                    //var L05 = Application.OpenForms["Lieferschein05_neuerLS"] as Lieferschein05_neuerLS;

                    //if (L05 != null)
                    //{
                    //   // var rrrow = (DAL.DataSet1.AdressenRow)rowview;
                    //    L05.Adressenrow = this.rrrow;
                    //}

                    //var R05 = Application.OpenForms["Rechnung05_neueRE"] as Rechnung05_neueRE;

                    //if (R05 != null)
                    //{
                    //   // var rrrow = (DAL.DataSet1.AdressenRow)rowview;
                    //    R05.Adressenrow = this.rrrow;
                    //}
                }
                catch (Exception ex)
                {
                    var name = "bla";
                }
                finally
                {
                    this.Close();
                }
            }
        }
コード例 #4
0
        private void adressenDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var datarow = this.adressenDataGridView.CurrentRow;

            DAL.DataSet1.AdressenRow row = (DAL.DataSet1.AdressenRow)((DataRowView)datarow.DataBoundItem).Row;

            string txt = "AdressID: " + row.AdressID + Environment.NewLine;

            txt += " Firmenname: " + row.Firmenname + Environment.NewLine;
            //  txt += "ID: " + row.ID + Environment.NewLine;
            txt += "Name: " + row.Name + Environment.NewLine;
            txt += "JobTitle: " + row.JobTitle + Environment.NewLine;
            //         txt += "Ort: " + row.Ort + Environment.NewLine;
            txt += "Strasse: " + row.Strasse + Environment.NewLine;
            //          txt += "PLZ: " + row.PLZ + Environment.NewLine;
            txt += "PLZundORT: " + row.PLZundORT + Environment.NewLine;
            txt += "Land: " + row.Land + Environment.NewLine;
            txt += "Email1Adresse: " + row.Email1Adresse + Environment.NewLine;
            txt += "ZuHaendenVon: " + row.ZuHaendenVon + Environment.NewLine;
            txt += "Telefon1: " + row.Telefon1 + Environment.NewLine;
            txt += "Matchcode: " + row.Matchcode + Environment.NewLine;

            MessageBox.Show(txt);
        }
コード例 #5
0
        private void dieInfoAdressenAuslesen()
        {
            this.dataSet1.Adressen.Clear();

            foreach (var adr in this.alleAdressen)
            {
                DAL.DataSet1.AdressenRow row = this.dataSet1.Adressen.NewAdressenRow();

                try
                {
                    string nachname = (adr.Surname == null) ? "" : adr.Surname;
                    string vorname  = (adr.GivenName == null) ? "" : adr.GivenName;

                    row.Name = (vorname.Count() > 0) ? vorname + " " + nachname : nachname;

                    row.Firmenname = (adr.CompanyName == null) ? "" : adr.CompanyName;


                    row.businessHomePage = (adr.BusinessHomePage == null) ? "" : adr.BusinessHomePage;
                    row.FileAs           = (adr.FileAs == null) ? "" : adr.FileAs;
                    row.ID       = adr.Id.UniqueId;
                    row.JobTitle = (adr.JobTitle == null) ? "" : adr.JobTitle;

                    if (adr.DisplayName != null)
                    {
                        adr.DisplayName  = (adr.GivenName == null) ? "" : adr.GivenName + " ";
                        adr.DisplayName += (adr.Surname == null) ? "" : adr.Surname;
                    }


                    row.Matchcode = row.Firmenname + ", " + "(" + row.Name + "), ";

                    PhysicalAddressEntry entry;
                    PhysicalAddressKey   key = PhysicalAddressKey.Business;
                    if (adr.PhysicalAddresses.TryGetValue(key, out entry))
                    {
                        row.Strasse   = (entry.Street == null) ? "" : entry.Street;
                        row.Ort       = (entry.City == null) ? "" : entry.City;
                        row.PLZ       = (entry.PostalCode == null) ? "" : entry.PostalCode;
                        row.Land      = (entry.CountryOrRegion == null) ? "" : entry.CountryOrRegion;
                        row.PLZundORT = row.PLZ + " " + row.Ort;

                        row.Matchcode += row.PLZundORT;
                    }



                    EmailAddress    eAdress1;
                    EmailAddressKey eKey1 = EmailAddressKey.EmailAddress1;
                    if (adr.EmailAddresses.TryGetValue(eKey1, out eAdress1))
                    {
                        row.Email1Adresse = eAdress1.Address;
                    }
                    else
                    {
                        row.Email1Adresse = "";
                    }

                    EmailAddress    eAdress2;
                    EmailAddressKey eKey2 = EmailAddressKey.EmailAddress2;
                    if (adr.EmailAddresses.TryGetValue(eKey2, out eAdress2))
                    {
                        row.Email2Adresse = eAdress2.Address;
                    }
                    else
                    {
                        row.Email2Adresse = "";
                    }
                    StringList _categories = (adr.Categories == null) ? new StringList() : adr.Categories;
                }
                catch (Exception ex)
                {
                    Helper.LogHelper.WriteDebugLog(ex.ToString());
                }


                this.dataSet1.Adressen.AddAdressenRow(row);
            }
        }
コード例 #6
0
        private void dieInfoAdressenAuslesen()
        {
            this.dataSet1.Adressen.Clear();

            foreach (var adr in this.alleAdressen)
            {
                DAL.DataSet1.AdressenRow row = this.dataSet1.Adressen.NewAdressenRow();


                try
                {
                    string nachname = (adr.Surname == null) ? "" : adr.Surname;
                    row.Nachname = nachname;
                    string vorname = (adr.GivenName == null) ? "" : adr.GivenName;
                    row.Vorname = vorname;

                    if (adr.Categories.Count > 0)
                    {
                        string categories = "";

                        foreach (var item in adr.Categories)
                        {
                            categories += item + " ";
                        }
                        row.Categories = categories;
                    }


                    row.Name = (vorname.Count() > 0) ? vorname + " " + nachname : nachname;

                    row.Firmenname = (adr.CompanyName == null) ? "" : adr.CompanyName;


                    row.businessHomePage = (adr.BusinessHomePage == null) ? "" : adr.BusinessHomePage;
                    row.FileAs           = (adr.FileAs == null) ? "" : adr.FileAs;
                    row.ID       = adr.Id.UniqueId;
                    row.JobTitle = (adr.JobTitle == null) ? "" : adr.JobTitle;

                    if (adr.DisplayName != null)
                    {
                        adr.DisplayName  = (adr.GivenName == null) ? "" : adr.GivenName + " ";
                        adr.DisplayName += (adr.Surname == null) ? "" : adr.Surname;
                    }


                    row.Matchcode = row.Firmenname + ", " + "(" + row.Name + "), ";

                    PhysicalAddressEntry entry;
                    PhysicalAddressKey   key = PhysicalAddressKey.Business;
                    if (adr.PhysicalAddresses.TryGetValue(key, out entry))
                    {
                        row.Strasse   = (entry.Street == null) ? "" : entry.Street;
                        row.Ort       = (entry.City == null) ? "" : entry.City;
                        row.PLZ       = (entry.PostalCode == null) ? "" : entry.PostalCode;
                        row.Land      = (entry.CountryOrRegion == null) ? "" : entry.CountryOrRegion;
                        row.PLZundORT = row.PLZ + " " + row.Ort;

                        row.Matchcode += row.PLZundORT;
                    }


                    //PhysicalAddressEntry pEntry;
                    //PhysicalAddressKey pKey = PhysicalAddressKey.Business;
                    //if (adr.PostalAddressIndex.HasValue)
                    //{
                    //    row.Strasse = (entry.Street == null) ? "" : entry.Street;
                    //    row.Ort = (entry.City == null) ? "" : entry.City;
                    //    row.PLZ = (entry.PostalCode == null) ? "" : entry.PostalCode;
                    //    row.Land = (entry.CountryOrRegion == null) ? "" : entry.CountryOrRegion;
                    //    row.PLZundORT = row.PLZ + " " + row.Ort;

                    //    row.Matchcode += row.PLZundORT;
                    //}


                    EmailAddress    eAdress1;
                    EmailAddressKey eKey1 = EmailAddressKey.EmailAddress1;
                    if (adr.EmailAddresses.TryGetValue(eKey1, out eAdress1))
                    {
                        row.Email1Adresse = eAdress1.Address;
                    }
                    else
                    {
                        row.Email1Adresse = "";
                    }

                    EmailAddress    eAdress2;
                    EmailAddressKey eKey2 = EmailAddressKey.EmailAddress2;
                    if (adr.EmailAddresses.TryGetValue(eKey2, out eAdress2))
                    {
                        row.Email2Adresse = eAdress2.Address;
                    }
                    else
                    {
                        row.Email2Adresse = "";
                    }

                    string         buissnessNr = "";
                    PhoneNumberKey pKey        = PhoneNumberKey.BusinessPhone;
                    if (adr.PhoneNumbers.TryGetValue(pKey, out buissnessNr))
                    {
                        row.Telefon1 = buissnessNr;
                    }
                    else
                    {
                        row.Telefon1 = "";
                    }

                    string         mobileNR = "";
                    PhoneNumberKey mKey     = PhoneNumberKey.MobilePhone;
                    if (adr.PhoneNumbers.TryGetValue(mKey, out mobileNR))
                    {
                        row.TelefonMobile = mobileNR;
                    }
                    else
                    {
                        row.Telefon1 = "";
                    }
                }
                catch (Exception ex)
                {
                    Helper.LogHelper.WriteDebugLog(ex.ToString());
                }


                this.dataSet1.Adressen.AddAdressenRow(row);
            }
        }