Example #1
0
        private void btn_new_Click(object sender, EventArgs e)
        {
            newRequest f = new newRequest();

            f.editMode = false;
            f.ShowDialog();
            UpdateDgv();
        }
Example #2
0
        private void btn_edit_Click(object sender, EventArgs e)
        {
            newRequest f = new newRequest();

            var cr = dgv_clients.SelectedCells[0].OwningRow;

            MessageBox.Show(cr.Cells[0].Value.ToString());
            MessageBox.Show(senders.Find(x => x.name == cr.Cells[0].Value.ToString()).passport.ToString());
            MessageBox.Show(cr.Cells[1].Value.ToString());
            MessageBox.Show(cities.Find(x => x.name == cr.Cells[1].Value.ToString()).index.ToString());
            MessageBox.Show(cr.Cells[2].Value.ToString());
            MessageBox.Show(pTypes.Find(x => x.id == payments.Find(x1 => x1.idSt == shipments.Find(x2 => x2.type == cr.Cells[3].Value.ToString()).idP).idPt).type.ToString());
            MessageBox.Show(cr.Cells[3].Value.ToString());
            MessageBox.Show(cr.Cells[4].Value.ToString());
            MessageBox.Show(cr.Cells[5].Value.ToString());
            MessageBox.Show(cities.Find(x => x.name == cr.Cells[5].Value.ToString()).index.ToString());
            MessageBox.Show(cities.Find(x => x.name == cr.Cells[5].Value.ToString()).address.ToString());

            f.dgv_clients.Rows.Clear();
            f.idZ = requests[cr.Index].id;
            f.idP = recipients.Find(x => x.name == cr.Cells[4].Value.ToString()).id;
            f.idK = senders.Find(x => x.name == cr.Cells[0].Value.ToString()).id;
            f.idD = shipments.Find(x => x.type == cr.Cells[3].Value.ToString()).id;
            f.dgv_clients.Rows.Add(new object[]
            {
                cr.Cells[0].Value,
                senders.Find(x => x.name == cr.Cells[0].Value.ToString()).passport,
                cr.Cells[1].Value,
                cities.Find(x => x.name == cr.Cells[1].Value.ToString()).index,
                null,
                null,
                null,
                //cr.Cells[2].Value,
                //pTypes.Find(x => x.id == payments.Find(x1 => x1.idSt == shipments.Find(x2 => x2.type == cr.Cells[3].Value.ToString()).idP).idPt).id-1,
                //cr.Cells[3].Value,
                cr.Cells[4].Value,
                cr.Cells[5].Value,
                cities.Find(x => x.name == cr.Cells[5].Value.ToString()).index,
                cities.Find(x => x.name == cr.Cells[5].Value.ToString()).address
            });

            f.editMode = true;
            f.ShowDialog();
            UpdateDgv();
        }