コード例 #1
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;
                        }
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Retrives all distinct values for a given column Name in the Household Table
        /// </summary>
        /// <param name="colName">The Name of the Column to get distincts for</param>
        private void getDistints(string colName)
        {
            bLoadingCombo = true;
            cboFilter.Items.Clear();
            cboFilter.Items.Add("No Filter");
            cboFilter.SelectedIndex = 0;

            //Gets And Adds to the filter combo the distinct values of the column from the household table
            Donors clsDonor    = new Donors(CCFBGlobal.connectionString);
            string whereClause = "";

            if (chkIncludeInactive.Checked == false)
            {
                whereClause = " WHERE Inactive=0 ";
            }
            clsDonor.getDistincts(colName, whereClause);
            string sVal = "";

            System.Collections.ArrayList typesDonor = CCFBGlobal.TypeCodesArray(CCFBGlobal.parmTbl_Donor);
            int iD = 0;

            for (int i = 0; i < clsDonor.RowCount; i++)
            {
                sVal = clsDonor.DSet.Tables[0].Rows[i][0].ToString();
                if (colName == "RcdType")
                {
                    iD   = Convert.ToInt32(sVal);
                    sVal = CCFBGlobal.formatNumberWithLeadingZero(iD);
                    for (int j = 0; j < typesDonor.Count; j++)
                    {
                        parmType pt = (parmType)typesDonor[j];
                        if (pt.ID == iD)
                        {
                            sVal += " = " + pt.LongName; break;
                        }
                    }
                }
                cboFilter.Items.Add(sVal + new String((char)32, (30 - sVal.Length)) + "[ " + clsDonor.DSet.Tables[0].Rows[i][1].ToString() + " ]");
            }
            bLoadingCombo = false;
        }
コード例 #3
0
        /// <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;
            }
        }
コード例 #4
0
 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(), "");
         }
     }
 }