Example #1
0
        private void EditGrantProposal(object sender, MouseButtonEventArgs e)
        {
            int      index;
            DataGrid dg = sender as DataGrid;

            if (dg.SelectedIndex != -1)
            {
                GrantProposalGrid p = (GrantProposalGrid)dg.SelectedItems[0]; // OR:  Patient p = (Patient)dg.SelectedItem;
                if (p.GrantStatus == "Accepted")
                {
                    index = 1;
                }
                else if (p.GrantStatus == "Not Accepted")
                {
                    index = 2;
                }
                else
                {
                    index = 0;
                }

                Models.FCS_DBModel db  = new Models.FCS_DBModel();
                EditGrantProposals dgp = new EditGrantProposals(p);
                dgp.ShowDialog();
                dgp.text_GrantName.IsEnabled = false;
                if (index == 1 || index == 2)
                {
                    dgp.combobox_Status.IsEnabled = false;
                }
                dgp.combobox_Status.SelectedIndex = index;
            }
            Refresh_Grant_Proposal(sender, e);
        }
Example #2
0
        public EditGrantProposals(GrantProposalGrid p)
        {
            GrantName       = p.GrantName;
            GrantProposalID = p.GrantProposalID;
            DonorID         = p.DonorID;

            InitializeComponent();

            IEnumerable <string> statusItems = new List <string>()
            {
                "Pending", "Accepted", "Not Accepted"
            };

            combobox_Status.ItemsSource = statusItems;

            Models.FCS_DBModel db = new Models.FCS_DBModel();
            var query             = (from o in db.Donors
                                     where o.DonorType == "Organization" || o.DonorType == "Government"
                                     orderby o.OrganizationName
                                     select o.OrganizationName).ToList();

            combobox_Organization.ItemsSource = query;

            combobox_Status.Text       = p.GrantStatus;
            combobox_Organization.Text = p.OrganizationName;
            text_GrantName.Focus();
        }