Exemplo n.º 1
0
        private void editToolStripMenuItem1_Click(object sender, EventArgs e)
        {  //address
            int rowIndex = customerAddressesDataGridView.Rows.GetFirstRow(DataGridViewElementStates.Selected);

            if (rowIndex > -1)
            {
                List <string> cellList = new List <string>();

                for (int i = 0; i < customerAddressesDataGridView.Rows[rowIndex].Cells.Count; i++)
                {
                    if (customerAddressesDataGridView.Rows[rowIndex].Cells[i].Value != null)
                    {
                        cellList.Add(customerAddressesDataGridView.Rows[rowIndex].Cells[i].Value.ToString());
                    }
                    else
                    {
                        cellList.Add(string.Empty);
                    }
                }

                int index = 0;
                if (int.TryParse(cellList[0], out index))
                {
                    foreach (var adress in (new AddressController()).Addresses)
                    {
                        if (adress.AddressID == index)
                        {
                            EditAddressData editAddressData = new EditAddressData(adress);
                            editAddressData.ShowDialog();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void editToolStripMenuItem1_Click(object sender, EventArgs e)
        {  //address
            int rowIndex = customerAddressesDataGridView.Rows.GetFirstRow(DataGridViewElementStates.Selected);

            if (rowIndex > -1)
            {
                List<string> cellList = new List<string>();

                for (int i = 0; i < customerAddressesDataGridView.Rows[rowIndex].Cells.Count; i++)
                {
                    if (customerAddressesDataGridView.Rows[rowIndex].Cells[i].Value != null)
                    {
                        cellList.Add(customerAddressesDataGridView.Rows[rowIndex].Cells[i].Value.ToString());
                    }
                    else
                    {
                        cellList.Add(string.Empty);
                    }
                }

                int index = 0;
                if (int.TryParse(cellList[0], out index))
                {
                    foreach (var adress in (new AddressController()).Addresses)
                    {
                        if (adress.AddressID == index)
                        {
                            EditAddressData editAddressData = new EditAddressData(adress);
                            editAddressData.ShowDialog();
                        }
                    }
                }
            }
        }