private void EditGrant(object sender, MouseButtonEventArgs e)
		{
			var db = new FCS_DBModel();
			
			try
			{
				DataGrid dg = sender as DataGrid;

				GrantsDataGrid p = (GrantsDataGrid)dg.SelectedItems[0]; // OR:  Patient p = (Patient)dg.SelectedItem;
				UpdateGrant up = new UpdateGrant(p);
				//Grant prop ID & donation ID with expense
				//p.DonationID
				var expenseTotal = (from ex in db.Expenses
									where ex.DonationID == p.DonationID
									select ex).Count();
				if (expenseTotal > 0) { up.DonAmount.IsEnabled = false; up.AmountRem.IsEnabled = false; }
				up.DonationDate.SelectedDate = p.DonationDate;
				up.DonationExpiration.SelectedDate = p.ExpirationDate;
				up.ShowDialog();
			}
			catch (Exception error)
			{
			}

			Refresh_GrantGrid(sender, e);
		}
Exemple #2
0
        private void EditGrant(object sender, MouseButtonEventArgs e)
        {
            var db = new FCS_DBModel();

            try
            {
                DataGrid dg = sender as DataGrid;

                GrantsDataGrid p  = (GrantsDataGrid)dg.SelectedItems[0];                // OR:  Patient p = (Patient)dg.SelectedItem;
                UpdateGrant    up = new UpdateGrant(p);
                //Grant prop ID & donation ID with expense
                //p.DonationID
                var expenseTotal = (from ex in db.Expenses
                                    where ex.DonationID == p.DonationID
                                    select ex).Count();
                if (expenseTotal > 0)
                {
                    up.DonAmount.IsEnabled = false; up.AmountRem.IsEnabled = false;
                }
                up.DonationDate.SelectedDate       = p.DonationDate;
                up.DonationExpiration.SelectedDate = p.ExpirationDate;
                up.ShowDialog();
            }
            catch (Exception error)
            {
            }

            Refresh_GrantGrid(sender, e);
        }