Ejemplo n.º 1
0
        /* private void Start_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
         {

             txtROCEnd.DisplayDateEnd = new DateTime(2200, 1, 1);
             txtROCEnd.DisplayDateStart = txtROCStart.SelectedDate;
         }
         private void End_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
         {
             txtROCStart.DisplayDateStart = new DateTime(1900, 1, 1);
             txtROCStart.DisplayDateEnd = txtROCEnd.SelectedDate;
         }*/


        private void dtgList_CellClick(object sender, EventArgs e)
        {
            try
            {


                int pos = dtgList.CurrentRow.Index;

                if (pos < Grant.GrantDT.Rows.Count)
                {
                    String GrantCOde = dtgList.CurrentRow.Cells[0].Value.ToString();

                    curGrant = new Grant(GrantCOde);
                    //curJour = Journal.JournalDS[pos]; //this was if i was using a list
                }

                setDataSource();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
Ejemplo n.º 2
0
        /* private void Start_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
         {

             txtROCEnd.DisplayDateEnd = new DateTime(2200, 1, 1);
             txtROCEnd.DisplayDateStart = txtROCStart.SelectedDate;
         }
         private void End_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
         {
             txtROCStart.DisplayDateStart = new DateTime(1900, 1, 1);
             txtROCStart.DisplayDateEnd = txtROCEnd.SelectedDate;
         }*/


        private void dtgList_CellClick(object sender, EventArgs e)
        {
            try
            {

                if (rbGrants.IsChecked == true)
                {
                    int pos = dtgList.CurrentRow.Index;

                    if (pos < Grant.GrantDT.Rows.Count)
                    {
                        String GrantCOde = dtgList.CurrentRow.Cells[0].Value.ToString();

                        curGrant = new Grant(GrantCOde);
                        //curJour = Journal.JournalDS[pos]; //this was if i was using a list
                    }
                    btnUpdate.Visibility = Visibility.Visible;
                    rbAgencies.IsEnabled = true;
                    rbUsers.IsEnabled = true;
                    setDataSource();
                }
                else
                    if (rbAgencies.IsChecked == true)
                    {
                        int pos = dtgList.CurrentRow.Index;
                        //        txtGagenID.SetBinding(TextBlock.TextProperty, "AgencyID");
                        if (pos < FundAgency.FundingDT.Rows.Count)
                        {
                            String agencyID = dtgList.CurrentRow.Cells[0].Value.ToString();

                            curGrant.getfund(agencyID);
                            //curFund = new FundAgency(agencyID);
                            //curJour = Journal.JournalDS[pos]; //this was if i was using a list
                        }

                        setDataSource();

                    }
                    else
                        if (rbUsers.IsChecked == true)
                        {
                            int pos = dtgList.CurrentRow.Index;
                            //        txtGagenID.SetBinding(TextBlock.TextProperty, "AgencyID");
                            if (pos < RegisteredUser.UserDT.Rows.Count)
                            {
                                String userid = dtgList.CurrentRow.Cells[0].Value.ToString();

                                curGrant.getuser(userid);
                                //curFund = new FundAgency(agencyID);
                                //curJour = Journal.JournalDS[pos]; //this was if i was using a list
                            }

                            setDataSource();
                        }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Oh no!!", "Broken");
            }

        }
Ejemplo n.º 3
0
        private void btnAgDel_Click(object sender, RoutedEventArgs e)
        {
            /* if (Checknull(txtAgID) == false)
             {
                 MessageBox.Show("Please ENTER the AgencyID of the funding agency you wish to remove.");
             }
             else*/
            {
                if (!curGrant.isExceptionFree())
                    throw new Exception("Cannot save to the database while there are errors on the form");

                Grant G = new Grant();
                G.Delete(int.Parse(txtGcode.Text));
                MessageBox.Show("Grant Removed", "~Removed~");
                
                txtGcode.Text = "";
                txtGsysID.Text = "";
                txtGamount.Text = "";
                dPGstart.Text = "";
                dPGend.Text = "";
                txtGsub.Text = "";
                txtGagenName.Text = "";

                rbAgencies.IsEnabled = false;
                rbUsers.IsEnabled = false;
                rbGrants.IsEnabled = true;

                rbGrants.IsChecked = true;
                SearchGrants();

            }
        }
Ejemplo n.º 4
0
        private void btnAgAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {

                {
                    if (!curGrant.isExceptionFree())
                        throw new Exception("Cannot save to the database while there are errors on the form");

                    Grant NewOne = new Grant();
                    NewOne.Add(txtGsysID.Text, txtGamount.Text, dPGstart.Text, dPGend.Text, txtGagenID.Text, txtGsub.Text, txtGagenName.Text);
                    MessageBox.Show("Grant Added", "~Added~");
                    
                    txtGcode.Text = "";
                    txtGsysID.Text = "";
                    txtGamount.Text = "";
                    dPGstart.Text = "";
                    dPGend.Text = "";
                    txtGagenID.Text = "";
                    txtGsub.Text = "";
                    txtGagenName.Text = "";

                    rbAgencies.IsEnabled = false;
                    rbUsers.IsEnabled = false;
                    rbGrants.IsEnabled = true;

                    //rbAgencies.IsChecked = true;
                    //rbAgencies.IsChecked = false;

                    //rbUsers.IsChecked = true;
                    //rbUsers.IsChecked = false;


                    rbGrants.IsChecked = true;
                    SearchGrants();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 5
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {


            curGrant = new Grant();
            setGrantDataSource();
            txtGcode.Text = "";
            txtGsysID.Text = "";
            txtGamount.Text = "";
            dPGstart.Text = "";
            dPGend.Text = "";
            txtGsub.Text = "";
            txtGagenID.Text = "";
            txtGagenName.Text = "";

            rbAgencies.IsEnabled = true;
            rbUsers.IsEnabled = true;
            rbGrants.IsEnabled = false;
            rbUsers.IsChecked = true;
            btnUpdate.Visibility = Visibility.Hidden;


        }