/// <summary>
        /// Constructor for the FoodDonations Form
        /// </summary>
        public FoodDonationsForm()
        {
            InitializeComponent();
            spltctrlDailyLog.Visible = true;
            spltctrlEdit.Visible     = false;

            //clsParmDonationType.openAll();      //Open all parm data for Donations
            clsDonors.openWhere("");                //Opens all Donors
            //clsParmFoodClass.openAll();         //Opens all Food Classes for Donations

            frmEditDonors = new EditDonorForm(CCFBGlobal.connectionString, true);
            //cboDisplayType.SelectedIndex = 0;
            cboDisplayType.SelectedIndex = Convert.ToInt32(Registry.GetValue(CCFBGlobal.registryKeyCurrentUser, constDisplayType, 0));

            fillCombos(); //Fills the combo boxes for Donation Type and Class

            dtDonationDate.Value = DateTime.Today;
            //Adds each text bos to the collection for easy use later
            foreach (TextBox tb in spltctrlEdit.Panel1.Controls.OfType <TextBox>())
            {
                tbList.Add(tb);
            }
            if (donationDates.Count == 0)
            {
                setupDatesToDisplay();
            }

            tbName.BackColor             = Color.White;
            tbDonorID.BackColor          = Color.White;
            cboDonorPeriod.SelectedIndex = 2;
            bNormalMode = true;
        }
        /// <summary>
        /// Constructor for the FoodDonations Form
        /// </summary>
        public CashDonationsForm()
        {
            InitializeComponent();
            gbDnrHist.SetBounds(0, 0, 1000, Height - 25);
            gbDailyLog.SetBounds(0, 0, 1000, Height - 25);
            gbLogEntry.SetBounds(5, 0, 744, 256);
            gbDnrHist.Visible  = false;
            gbDailyLog.Visible = true;
            gbLogEntry.Visible = false;

            //clsParmDonationType.openAll();      //Open all parm data for Donations
            clsDonors.openWhere("");                //Opens all Donors
            //clsParmFoodClass.openAll();         //Opens all Food Classes for Donations

            frmEditDonors = new EditDonorForm(CCFBGlobal.connectionString, true);

            LoadcboYear();
            cboReportMonth.SelectedIndex = DateTime.Today.Month - 1;


            //Adds each text bos to the collection for easy use later
            foreach (TextBox tb in gbLogEntry.Controls.OfType <TextBox>())
            {
                tbList.Add(tb);
            }

            tbName.BackColor             = Color.White;
            tbDonorID.BackColor          = Color.White;
            cboDonorPeriod.SelectedIndex = 2;
            bNormalMode = true;
        }
        /// <summary>
        /// Constructor for the FoodDonations Form
        /// </summary>
        public CashDonationsForm()
        {
            InitializeComponent();
            spltcontLog.Visible  = true;
            spltcontEdit.Visible = false;

            //clsParmDonationType.openAll();      //Open all parm data for Donations
            clsDonors.openWhere("");                //Opens all Donors
            //clsParmFoodClass.openAll();         //Opens all Food Classes for Donations

            frmEditDonors = new EditDonorForm(CCFBGlobal.connectionString, true);

            LoadcboYear();
            cboReportMonth.SelectedIndex = DateTime.Today.Month - 1;


            //Adds each text boxes to the collection for easy use later
            foreach (TextBox tb in spltcontEdit.Panel1.Controls.OfType <TextBox>())
            {
                tbList.Add(tb);
            }
            pnlEntryDate.SetBounds(pnlPeriod.Left, pnlPeriod.Top, pnlPeriod.Width, pnlPeriod.Height);
            cboDisplayType.SelectedIndex = 1;
            tbName.BackColor             = Color.White;
            tbDonorID.BackColor          = Color.White;
            cboDonorPeriod.SelectedIndex = 2;
            bNormalMode = true;
        }
        /// <summary>
        /// Retrives and loads the donors into the Store Combo Box
        /// </summary>
        private void LoadcboDonor()
        {
            Donors clsDonors = new Donors(CCFBGlobal.connectionString);

            cboStore.Items.Clear();

            if (donorID > -1)
            {
                clsDonors.openWhere(" Where ID=" + donorID.ToString());
            }
            else
            {
                clsDonors.openWhere(" Where DefaultDonationType=6");
            }

            for (int i = 0; i < clsDonors.RowCount; i++)
            {
                clsDonors.setDataRow(i);
                parmType clsPT = new parmType(clsDonors.ID, clsDonors.Name, i, clsDonors.Name);
                listDonors.Add(clsPT);
            }

            try
            {
                clsDonors.setDataRow(0);
                cboStore.DataSource           = listDonors;
                cboStore.DisplayMember        = "LongName";
                cboStore.ValueMember          = "UID";
                cboStore.SelectedIndex        = 0;
                cboDonationType.SelectedValue = clsDonors.DefaultDonationType.ToString();
            }
            catch { }

            if (donorID > -1)
            {
                cboStore.Enabled = false;
            }
        }
示例#5
0
        private void LoadDonorLabelNames()
        {
            Donors clsDonors = new Donors(CCFBGlobal.connectionString);
            int    donorid   = 0;

            foreach (Label lbl in grpbxDonors.Controls.OfType <Label>())
            {
                switch (lbl.Tag.ToString())
                {
                case "DonorId01": donorid = CCFBPrefs.DonorId01; break;

                case "DonorId02": donorid = CCFBPrefs.DonorId02; break;

                case "DonorId03": donorid = CCFBPrefs.DonorId03; break;

                case "DonorId04": donorid = CCFBPrefs.DonorId04; break;

                case "DonorId05": donorid = CCFBPrefs.DonorId05; break;

                case "DonorId06": donorid = CCFBPrefs.DonorId06; break;

                case "DonorId07": donorid = CCFBPrefs.DonorId07; break;

                case "DonorId08": donorid = CCFBPrefs.DonorId08; break;

                case "DonorId09": donorid = CCFBPrefs.DonorId09; break;

                case "DonorId10": donorid = CCFBPrefs.DonorId10; break;

                default: break;
                }
                lbl.Text = ".....";
                if (donorid > 0)
                {
                    clsDonors.openWhere("Id = " + donorid.ToString());
                    if (clsDonors.RowCount > 0)
                    {
                        if (clsDonors.ID == donorid)
                        {
                            lbl.Text = clsDonors.Name;
                        }
                    }
                }
            }
        }
示例#6
0
        /// <summary>
        /// Constructor for the FoodDonations Form
        /// </summary>
        public FoodDonationsForm()
        {
            InitializeComponent();
            gbDnrHist.SetBounds(0, 0, 1000, Height - 25);
            gbDailyLog.SetBounds(0, 0, 1000, Height - 25);
            gbLogEntry.SetBounds(5, 0, 744, 256);
            gbDnrHist.Visible  = false;
            gbDailyLog.Visible = true;
            gbLogEntry.Visible = false;

            //clsParmDonationType.openAll();      //Open all parm data for Donations
            clsDonors.openWhere("");                //Opens all Donors
            //clsParmFoodClass.openAll();         //Opens all Food Classes for Donations

            frmEditDonors = new EditDonorForm(CCFBGlobal.connectionString, true);

            //Gets all distinct Donation Dates in Database
            clsFoodDonations.openDistinctDonationDates();

            //Fills the combo boxes for Donation Type and Class
            fillCombos();

            //Fills a collection with the ditinct Donation Dates
            fillDonationDates();

            //Loads the Donation Log For the current date in the ListView
            loadDonationLogList();

            //Adds each text bos to the collection for easy use later
            foreach (TextBox tb in gbLogEntry.Controls.OfType <TextBox>())
            {
                tbList.Add(tb);
            }

            tbName.BackColor             = Color.White;
            tbDonorID.BackColor          = Color.White;
            cboDonorPeriod.SelectedIndex = 2;
            bNormalMode = true;
        }
 private void tbDonor_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Return)
     {
         TextBox tb      = (TextBox)sender;
         int     donorid = 0;
         if (tb.Text != "")
         {
             try
             {
                 donorid = Convert.ToInt32(tb.Text);
                 Donors clsDonors = new Donors(CCFBGlobal.connectionString);
                 clsDonors.openWhere(" Where Id = " + donorid.ToString());
                 if (clsDonors.RowCount > 0)
                 {
                     if (clsDonors.ID == donorid)
                     {
                         filllblDonor(tb.Tag.ToString(), clsDonors.Name);
                         CCFBPrefs.SaveValue(tb.Tag.ToString(), donorid.ToString());
                         dataChanged = true;
                     }
                 }
                 else
                 {
                     donorid = 0;
                 }
             }
             catch (FormatException ex)
             {
                 MessageBox.Show("Invalid number entered.\r\nThis will be ignored");
             }
         }
         if (donorid == 0)
         {
             filllblDonor(tb.Tag.ToString(), "");
         }
     }
 }