Interaction logic for AddNewGrant.xaml
상속: System.Windows.Window
예제 #1
0
        private void Update_Grant_Proposal(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(text_GrantName.Text))
            {
                MessageBox.Show("Please enter a name for the grant.");
                return;
            }

            if (combobox_Organization.Text == "")
            {
                MessageBox.Show("Please select an organization.");
            }

            string GrantStatus = combobox_Status.SelectedValue.ToString();

            //MessageBox.Show(GrantStatus + "\n" + "\n" + GrantName + "\n" + OrganizationName);

            Models.FCS_DBModel db = new Models.FCS_DBModel();
            var grantproposal     = (from p in db.GrantProposals
                                     where p.GrantProposalID == GrantProposalID
                                     select p).First();

            grantproposal.GrantName = GrantName;
            if (combobox_Status.IsEnabled == true)
            {
                grantproposal.GrantStatus = GrantStatus;
                db.SaveChanges();
                if (GrantStatus == "Accepted")
                {
                    ///OPEN ANOTHER WINDOW TO ADD THIS PROPOSAL TO DONATION & PURPOSE TABLE
                    AddNewGrant adg = new AddNewGrant(DonorID, GrantProposalID);
                    adg.ShowDialog();
                }
                this.Close();
            }
            else
            {
                db.SaveChanges();
            }
        }
		private void Update_Grant_Proposal(object sender, RoutedEventArgs e)
        {
			if (string.IsNullOrEmpty(text_GrantName.Text))
			{
				MessageBox.Show("Please enter a name for the grant.");
				return;
			}

			if (combobox_Organization.Text == "")
			{
				MessageBox.Show("Please select an organization.");
			}

            string GrantStatus = combobox_Status.SelectedValue.ToString();
            //MessageBox.Show(GrantStatus + "\n" + "\n" + GrantName + "\n" + OrganizationName);

            Models.FCS_DBModel db = new Models.FCS_DBModel();
            var grantproposal = (from p in db.GrantProposals
                                    where p.GrantProposalID == GrantProposalID
                                    select p).First();
            grantproposal.GrantName = GrantName;
            if (combobox_Status.IsEnabled == true)
            {

                grantproposal.GrantStatus = GrantStatus;
                db.SaveChanges();
                if (GrantStatus == "Accepted")
                {
                    ///OPEN ANOTHER WINDOW TO ADD THIS PROPOSAL TO DONATION & PURPOSE TABLE
                    AddNewGrant adg = new AddNewGrant(DonorID, GrantProposalID);
                    adg.ShowDialog();
                }
                this.Close();
            }
            else
            {
                db.SaveChanges();
            }
        }