Exemple #1
0
        private void AddAddressBtn_Click(object sender, EventArgs e)
        {
            var         id    = Guid.Empty;
            AddressForm objUI = new AddressForm(id);

            objUI.ShowDialog();
            ResetDataTable();
        }
Exemple #2
0
        private void UpdateSelectedAddressFromDataGrid(int rowIndex)
        {
            Guid        id    = Guid.Parse(AddressListDataTable[0, rowIndex].Value.ToString());
            AddressForm objUI = new AddressForm(id);

            objUI.ShowDialog();
            try
            {
                AddressListDataTable.Rows.RemoveAt(rowIndex);
                Entities.Address addr = Repositories.Addresses.Read(id);
                AddressListDataTable.Rows.Insert(rowIndex - 1, addr.ToArray());
            } catch (ArgumentOutOfRangeException)
            {
                Entities.Address addr  = Repositories.Addresses.Read(id);
                List <string>    cells = addr.ToArray().ToList();
                cells.Add("Edit");
                cells.Add("Delete");
                cells.Add("Select");
                AddressListDataTable.Rows.Add(cells.ToArray());
            }
        }