Exemplo n.º 1
0
        void ManageToolStripMenuItemClick(object sender, EventArgs e)
        {
            PeopleListDialog dlg2 = new PeopleListDialog();

            if (dlg2.ShowDialog() == DialogResult.OK)
            {
                ManagePeopleDialog dlg = new ManagePeopleDialog();

                ListView.SelectedListViewItemCollection list = dlg2.listView1.SelectedItems;
                ListViewItem item = list[0];
                dlg.firstname.Text        = item.SubItems[0].Text;
                dlg.lastname.Text         = item.SubItems[1].Text;
                dlg.dateTimePicker1.Value = DateTime.Parse(item.SubItems[2].Text);
                dlg.city.Text             = item.SubItems[3].Text;
                dlg.address.Text          = item.SubItems[4].Text;;
                IEnumerable <Lender> result = from Lender i in DBConnection.Instance.DB where i.FirstName.Equals(item.SubItems[0].Text) && i.LastName.Equals(item.SubItems[1].Text) select i;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    foreach (Lender it in result)
                    {
                        it.FirstName = dlg.firstname.Text;
                        it.LastName  = dlg.lastname.Text;
                        it.BirthDate = dlg.dateTimePicker1.Value;
                        it.City      = dlg.city.Text;
                        it.Address   = dlg.address.Text;
                        DBConnection.Instance.DB.Store(it);
                    }
                }
            }
        }
Exemplo n.º 2
0
		void ManageToolStripMenuItemClick(object sender, EventArgs e)
		{
			PeopleListDialog dlg2 = new PeopleListDialog();
			if (dlg2.ShowDialog() == DialogResult.OK)
			{
				
				ManagePeopleDialog dlg = new ManagePeopleDialog();
				
				ListView.SelectedListViewItemCollection list = dlg2.listView1.SelectedItems;
				ListViewItem item = list[0];
				dlg.firstname.Text = item.SubItems[0].Text;
				dlg.lastname.Text = item.SubItems[1].Text;
				dlg.dateTimePicker1.Value = DateTime.Parse(item.SubItems[2].Text);
				dlg.city.Text = item.SubItems[3].Text;
				dlg.address.Text = item.SubItems[4].Text;;
				IEnumerable<Lender> result = from Lender i in DBConnection.Instance.DB where i.FirstName.Equals(item.SubItems[0].Text) && i.LastName.Equals(item.SubItems[1].Text) select i;
				if (dlg.ShowDialog() == DialogResult.OK)		
				{
					foreach(Lender it in result){
					it.FirstName = dlg.firstname.Text;
					it.LastName = dlg.lastname.Text;
					it.BirthDate = dlg.dateTimePicker1.Value;
					it.City = dlg.city.Text;
					it.Address = dlg.address.Text;
					DBConnection.Instance.DB.Store(it);
					}
			
				}
					
				}
			}