Exemplo n.º 1
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            FormForAdd form = new FormForAdd(user, index);
            form.ShowDialog();

            if (form.DialogResult == DialogResult.OK)
            {
                user.contacts = new List<Contact>();
                foreach (Contact ct in form.list.contacts)
                {
                    user.contacts.Add(ct);
                }
            }

            form.list.contacts.Sort();

            dgUsers = createDataGridView();

            for (int i = 0; i < form.list.contacts.Count; i++)
            {
                dgUsers.Rows.Add();
                dgUsers.Rows[i].Cells[0].Value = form.list.contacts[i].surname + " " + form.list.contacts[i].name + " " + form.list.contacts[i].patronymic;
                StringBuilder sb = new StringBuilder();
                foreach (PhoneNumber number in user.contacts[i].numbers)
                {
                    sb.Append(number.ToString() + " ");
                }
                dgUsers.Rows[i].Cells[1].Value = sb;
            }
        }
Exemplo n.º 2
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            FormForAdd form = new FormForAdd(user, index);

            form.ShowDialog();

            if (form.DialogResult == DialogResult.OK)
            {
                user.contacts = new List <Contact>();
                foreach (Contact ct in form.list.contacts)
                {
                    user.contacts.Add(ct);
                }
            }

            form.list.contacts.Sort();

            dgUsers = createDataGridView();

            for (int i = 0; i < form.list.contacts.Count; i++)
            {
                dgUsers.Rows.Add();
                dgUsers.Rows[i].Cells[0].Value = form.list.contacts[i].surname + " " + form.list.contacts[i].name + " " + form.list.contacts[i].patronymic;
                StringBuilder sb = new StringBuilder();
                foreach (PhoneNumber number in user.contacts[i].numbers)
                {
                    sb.Append(number.ToString() + " ");
                }
                dgUsers.Rows[i].Cells[1].Value = sb;
            }
        }