Beispiel #1
0
        private void szerkesztés_Click(object sender, EventArgs e)
        {
            int    kod = 0, ar = 0, keszl = 0, katkod = 0, Tvonkod = 0;
            string nev = "", mert = "";
            bool   Tegalizalte = false;

            DateTime Tszavido = new DateTime();

            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                kod      = Convert.ToInt32(row.Cells[0].Value.ToString());
                nev      = row.Cells[1].Value.ToString();
                ar       = Convert.ToInt32(row.Cells[2].Value.ToString());
                keszl    = Convert.ToInt32(row.Cells[3].Value.ToString());
                mert     = row.Cells[4].Value.ToString();
                katkod   = Convert.ToInt32(row.Cells[5].Value.ToString());
                Tvonkod  = Convert.ToInt32(row.Cells[6].Value.ToString());
                Tszavido = Convert.ToDateTime(row.Cells[7].Value);

                if (row.Cells[8].Value.ToString() == "True")
                {
                    Tegalizalte = true;
                }
                else
                {
                    Tegalizalte = false;
                }
            }

            Termekek t       = new Termekek(kod, nev, ar, keszl, mert, katkod, Tvonkod, Tszavido, Tegalizalte);
            mod      modosit = new mod(t);

            if (modosit.ShowDialog() != DialogResult.None)
            {
                foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                {
                    row.Cells[0].Value = t.getTkod();
                    row.Cells[1].Value = t.getTnev();
                    row.Cells[2].Value = t.getTar();
                    row.Cells[3].Value = t.getTkeszl();
                    row.Cells[4].Value = t.getTmert();
                    row.Cells[5].Value = t.getTkatkod();
                    row.Cells[6].Value = t.getTvonkod();
                    row.Cells[7].Value = t.getTszavido();

                    bool eg = false;
                    eg = t.getTegalizalt();
                    MessageBox.Show(eg.ToString());
                    if (eg == true)
                    {
                        row.Cells[8].Value = true;
                    }
                    else
                    {
                        row.Cells[8].Value = false;
                    }
                }
            }

            dataGridView1.ReadOnly = false;
            mentés.Visible         = true;
        }
Beispiel #2
0
        private void új_Click(object sender, EventArgs e)
        {
            Termekek t   = new Termekek();
            mod      mod = new mod(t);


            if (mod.ShowDialog() == DialogResult.OK)
            {
                int i = 0;

                while (i < dataGridView1.Rows.Count - 1)
                {
                    dataGridView1.Rows[i].Selected = false;

                    i++;
                }


                dataGridView1.Rows[dataGridView1.Rows.Count - 2].Selected = true;
                DataRow rw = termekek.NewRow();
                foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                {
                    /*row.Cells[0].Value = t.getTkod();
                     *
                     * row.Cells[1].Value = t.getTnev();
                     *
                     * row.Cells[2].Value = t.getTar();
                     *
                     * row.Cells[3].Value = t.getTkeszl();
                     * row.Cells[4].Value = t.getTmert();
                     * row.Cells[5].Value = t.getTkatkod();
                     *
                     *
                     * rw[0] = row.Cells[0].Value;
                     * rw[1] = row.Cells[1].Value;
                     * rw[2] = row.Cells[2].Value;
                     * rw[3] = row.Cells[3].Value;
                     * rw[4] = row.Cells[4].Value;
                     * rw[5] = row.Cells[5].Value;*/

                    rw[0] = t.getTkod();
                    rw[1] = t.getTnev();
                    rw[2] = t.getTar();
                    rw[3] = t.getTkeszl();
                    rw[4] = t.getTmert();
                    rw[5] = t.getTkatkod();
                    rw[6] = t.getTvonkod();
                    rw[7] = t.getTszavido();
                    rw[8] = t.getTegalizalt();
                }


                termekek.Rows.Add(rw);
            }


            /*int bi = 0;
             * while(bi<termekek.Rows.Count)
             * {
             *  MessageBox.Show(termekek.Rows[bi].ToString());
             *  bi++;
             *
             * }*/



            beallitvezerloketujfelvitelkor();
            int sor = dataGridView1.Rows.Count - 1;

            lettmodositva = true;

            dataGridView1.FirstDisplayedScrollingRowIndex = sor;
            dataGridView1.Columns[0].ReadOnly             = true;
        }