private void BtnAddPerson_Click(object sender, EventArgs e)
        {
            var addForm = new FrmNewPerson(Person);

            if (addForm.ShowDialog() == DialogResult.OK)
            {
                Person = addForm.Person;
                TxtRecipientName.Text = Person.Name;
                BtnContinue.Enabled   = true;
                useNewPerson          = true;
            }
        }
示例#2
0
        private void BtnNewAccount_Click(object sender, EventArgs e)
        {
            var dialog = new FrmNewPerson();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var person = dialog.Person;
                person.Save();

                var data    = Encoding.ASCII.GetBytes("action=ModifyPermission&id=" + person.PeopleID + "&modification=Add");
                var request = WebRequest.Create(Program.URL + "/functions/artQuery.php");
                request.ContentLength = data.Length;
                request.ContentType   = "application/x-www-form-urlencoded";
                request.Method        = "POST";
                using (var stream = request.GetRequestStream())
                    stream.Write(data, 0, data.Length);

                var response = (HttpWebResponse)request.GetResponse();
                var results  = new StreamReader(response.GetResponseStream()).ReadToEnd();

                LstPeople.SelectedItems.Clear();
                var item = new ListViewItem {
                    Text = person.PeopleID.ToString()
                };
                item.SubItems.Add(person.FirstName);
                item.SubItems.Add(person.LastName);
                item.SubItems.Add(person.Email);
                if (!string.IsNullOrEmpty(person.Phone1))
                {
                    item.SubItems.Add(person.Phone1 + " (" + person.Phone1Type + ")");
                }
                else
                {
                    item.SubItems.Add("");
                }
                item.Tag      = person;
                item.Selected = true;
                LstPeople.Items.Add(item);
                LstPeople.ListViewItemSorter = new ListViewItemComparer(SortColumn, SortAscend);
                LstPeople.Sort();
                item.Focused = true;
            }
        }