private void button1_speichern_Click(object sender, EventArgs e)
        {
            Ausliefer06_Positionen f6 = Application.OpenForms["Ausliefer06_Positionen"] as Ausliefer06_Positionen;

            var dgv = this.artikelDataGridView;

            if (dgv != null)
            {
                var bs = dgv.DataSource as BindingSource;
                if (bs != null)
                {
                    var curr = bs.Current as DataRowView;
                    if (curr != null)
                    {
                        var row = curr.Row as DAL.DataSet1.ArtikelRow;
                        if (row != null)
                        {
                            f6.selectedArtikel = row;

                            f6.selectedPosition.ArtikeID            = row.ArtikelID;
                            f6.selectedPosition.Artikelnummer       = row.IsArtikelnummerNull() ? null : row.Artikelnummer;
                            f6.selectedPosition.Beschreibung        = row.IsBeschreibungNull() ? null : row.Beschreibung;
                            f6.selectedPosition.BeschreibungEnglish = row.IsBeschreibungEnglishNull() ? null : row.BeschreibungEnglish;
                            f6.selectedPosition.Einheit             = row.IsEinheitNull() ? null : row.Einheit;
                            f6.selectedPosition.Preis         = row.IsPreisNull() ? new decimal(0) : row.Preis;
                            f6.selectedPosition.Mengeneinheit = row.IsMengeneinheitNull() ? null : row.Mengeneinheit;


                            int pos = 0;
                            Int32.TryParse(this.textBox1.Text, out pos);
                            f6.selectedPosition.PositionNr = pos;

                            int anzahl = 1;
                            Int32.TryParse(this.textBox3_anzahl.Text, out anzahl);
                            f6.selectedPosition.Anzahl = anzahl;



                            this.DialogResult = DialogResult.OK;
                        }
                    }
                }
            }
            this.Close();
        }
Exemple #2
0
        private void artikelDataGridView_DoubleClick(object sender, EventArgs e)
        {
            f6 = Application.OpenForms["Ausliefer06_Positionen"] as Ausliefer06_Positionen;

            var dgv = sender as DataGridView;

            if (dgv != null)
            {
                var bs = dgv.DataSource as BindingSource;
                if (bs != null)
                {
                    var curr = bs.Current as DataRowView;
                    if (curr != null)
                    {
                        var row = curr.Row as DAL.DataSet1.ArtikelRow;
                        if (row != null)
                        {
                            f6.selectedArtikel = row;
                        }
                    }
                }
            }
            this.Close();
        }