Exemplo n.º 1
0
 private void loadList(string testId, bool disableSelect)
 {
     loadingListView = disableSelect;
     lvServiceItems.ListViewItemSorter = null;
     lvServiceItems.Items.Clear();
     //Application.DoEvents();
     for (int i = 0; i < clsSvcItems.RowCount; i++)
     {
         ListViewItem lvi = new ListViewItem(CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_SvcCategory
                                                                       , Convert.ToInt32(clsSvcItems.GetDataValue("ItemType", i).ToString())));
         lvi.Name = clsSvcItems.GetDataValue("ItemKey", i).ToString();
         lvi.SubItems.Add(clsSvcItems.GetDataValue("ItemDesc", i).ToString());
         lvi.SubItems.Add(clsSvcItems.GetDataValue("LbsPerItem", i).ToString());
         lvi.SubItems.Add(clsSvcItems.GetDataValue("ItemKey", i).ToString());
         lvi.UseItemStyleForSubItems = false;
         lvi.SubItems[3].ForeColor   = Color.Blue;
         setlvServicesImage(clsSvcItems.GetDataValueBool("NotAvailable", i), lvi);
         lvServiceItems.Items.Add(lvi);
         Application.DoEvents();
     }
     if (testId != "")
     {
         lvServiceItems.Items[testId].Selected = true;
     }
     else if (lvServiceItems.Items.Count > 0)
     {
         loadingListView = false;
         lvServiceItems.Items[0].Selected = true;
     }
     lvServiceItems.ListViewItemSorter = lvColSorter;
     loadingListView = false;
 }
Exemplo n.º 2
0
        }                       // end of DisplayControls

        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Special handling is required to display the TypeCode value in the DataGridView. This
        /// method provides the necessary processing to the base class.
        /// </summary>
        //-----------------------------------------------------------------------------------------
        public override bool DisplayGridLineSpecial(int a_dataSetRow, int a_gridRow)
        {
            string rcdType = CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_VolType
                                                       , Convert.ToInt16(DataSetValue(a_dataSetRow, COLUMN_RCD_TYPE))); // Get the ID from DataSet row.

            gridEditVol[COLUMN_GRID_RCD_TYPE, a_gridRow].Value = rcdType;
            return(rcdType.Length > 0);
        }                       // end of DisplayGridLineSpecial
Exemplo n.º 3
0
 private void SchoolSupplyPickupTicket_Load(object sender, EventArgs e)
 {
     tbID.Text      = clsClient.clsHH.ID.ToString();
     lblHHName.Text = clsClient.clsHH.Name;
     chkSchoolSupplyFlag.Checked = clsClient.clsHH.SchSupplyFlag;
     cboPickupPerson.Text        = clsClient.clsHH.SchSupplyPickupPerson;
     cboRegistration.Text        = CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_SchSupplyRegistration, clsClient.clsHH.SchSupplyRegistration);
     loadHHMems(true);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Loads the Donation Log with the Donations for the selected date
        /// </summary>
        private void loadDonationLogList()
        {
            lvFoodDonations.Items.Clear();
            double totLbs = 0;
            int    totCnt = 0;

            btnEditDnrTrx.Text     = "";
            btnEditDnrTrx.Enabled  = false;
            btnDeleteTrx.Text      = "";
            btnDeleteTrx.Enabled   = false;
            btnShowDnrHist.Text    = "";
            btnShowDnrHist.Enabled = false;
            if (dateIndex >= 0)
            {
                ListViewItem lvItm;
                currentlogdate = donationDates[dateIndex];
                for (int i = 0; i < clsFoodDonations.RowCount; i++)
                {
                    clsFoodDonations.setDataRow(i);
                    lvItm      = new ListViewItem();
                    lvItm.Name = clsFoodDonations.TrxID.ToString();
                    lvItm.Text = (i + 1).ToString();
                    lvItm.SubItems.Add(clsFoodDonations.TrxDate.ToShortDateString());
                    lvItm.SubItems.Add(CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_Donation, clsFoodDonations.DonationType));
                    clsDonors.find(clsFoodDonations.DonorID);
                    if (clsDonors.ID != clsFoodDonations.DonorID)
                    {
                        clsDonors.openWhere("");
                        clsDonors.find(clsFoodDonations.DonorID);
                    }
                    if (clsDonors.ID == clsFoodDonations.DonorID)
                    {
                        lvItm.SubItems.Add(clsDonors.Name);
                    }
                    else
                    {
                        lvItm.SubItems.Add("ID " + clsFoodDonations.DonorID.ToString());
                    }
                    lvItm.SubItems.Add(String.Format("{0:0,0}", clsFoodDonations.Pounds));
                    lvItm.SubItems.Add(clsFoodDonations.Notes);
                    lvItm.SubItems.Add(CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_FoodClass, clsFoodDonations.FoodClass));
                    lvItm.SubItems.Add(clsFoodDonations.FoodCode);
                    lvItm.SubItems.Add(clsFoodDonations.DonorID.ToString());
                    lvItm.SubItems.Add(clsFoodDonations.TrxID.ToString());
                    lvFoodDonations.Items.Add(lvItm);
                    totCnt++;
                    totLbs += clsFoodDonations.Pounds;
                }
                tbTotalCount.Text = CCFBGlobal.formatNumberWithCommas(totCnt);
                tbTotalLbs.Text   = String.Format("{0:0,0}", totLbs);
            }
            else
            {
                clsFoodDonations.open(0);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Loads the Donor log listView with the donoations for the
        /// Selected donor
        /// </summary>
        private void loadDonorLogList()
        {
            double totLbs = 0;
            int    totCnt = 0;

            lvDonorHistory.Items.Clear();
            Application.DoEvents();
            ListViewItem lvItm;

            string donorWhereClause = " WHERE DonorID=" + donorID.ToString();

            switch (cboDonorPeriod.SelectedIndex)
            {
            case 0: donorWhereClause += CCFBGlobal.SQLDateRangeCurMonth();   break;

            case 1: donorWhereClause += CCFBGlobal.SQLDateRangePrevMonth();  break;

            case 2: donorWhereClause += CCFBGlobal.SQLDateRangeLast90Days(); break;

            case 3: donorWhereClause += CCFBGlobal.SQLDateRangeCurYear();    break;

            case 4: donorWhereClause += CCFBGlobal.SQLDateRangePrevYear();   break;

            case 5: break;

            default: donorWhereClause += DateRangeCustom();                   break;
            }

            clsFDHist.openWhere(donorWhereClause);

            for (int i = 0; i < clsFDHist.RowCount; i++)
            {
                clsFDHist.setDataRow(i);
                lvItm = new ListViewItem((i + 1).ToString());
                lvItm.SubItems.Add(CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_Donation, clsFDHist.DonationType));
                lvItm.SubItems.Add(clsFDHist.TrxDate.ToShortDateString());
                lvItm.SubItems.Add(String.Format("{0:0,0}", clsFDHist.Pounds));
                lvItm.SubItems.Add(clsFDHist.Notes);
                lvItm.SubItems.Add(CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_FoodClass, clsFDHist.FoodClass));
                lvItm.SubItems.Add(clsFDHist.FoodCode);
                lvItm.SubItems.Add(clsFDHist.TrxID.ToString());
                lvDonorHistory.Items.Add(lvItm);

                totCnt++;
                totLbs += clsFDHist.Pounds;
            }
            tbDonorCnt.Text = CCFBGlobal.formatNumberWithCommas(totCnt);
            tbDonorLbs.Text = String.Format("{0:0,0}", totLbs);
        }
Exemplo n.º 6
0
        public void fillEditFields(string itemDescr)
        {
            btnPost.Focus();
            //tbVoucherType.Text = clsVoucher.ClientType.ToString();
            tbVoucherId.Text = clsVoucher.TrxId.ToString();
            tbTrxDate.Text   = clsVoucher.TrxDate.ToLongDateString(); // clsVoucher.TrxDate.ToShortDateString();
            if (clsVoucher.TrxId > 0)
            {
                dtpTrxDate.Value = clsVoucher.TrxDate;
            }
            foreach (TextBox tb in pnlDemographics.Controls.OfType <TextBox>())
            {
                tb.Text = clsVoucher.GetDataValue(tb.Tag.ToString()).ToString();
            }
            foreach (CheckBox chk in pnlDemographics.Controls.OfType <CheckBox>())
            {
                chk.Checked = (bool)clsVoucher.GetDataValue(chk.Tag.ToString());
            }

            tbNotes.Text           = clsVoucher.Notes;
            tbVoucherType.Text     = itemDescr;
            cboHHCat.SelectedValue = clsVoucher.ClientType.ToString();
            lblAmt.Text            = CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_VoucherType, clsVItems.VoucherType);
            oriAmt = clsVoucher.Amount;
            switch (clsVItems.VoucherType)
            {
            case 0:
                tbQty.Text    = clsVoucher.Amount.ToString();
                tbQty.Visible = true;
                break;

            case 1:
                tbQty.Text    = Convert.ToInt32(clsVoucher.Amount).ToString();
                tbQty.Visible = true;
                break;

            case 2:
                tbQty.Text    = Convert.ToInt32(clsVoucher.Amount).ToString();
                tbQty.Visible = false;
                break;

            default:
                tbQty.Text    = clsVoucher.Amount.ToString();
                tbQty.Visible = true;
                break;
            }
        }
Exemplo n.º 7
0
        }                       // end of DisplayControls

        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Special handling is required to display the TypeCode value in the DataGridView. This
        /// method provides the necessary processing to the base class.
        /// </summary>
        //-----------------------------------------------------------------------------------------
        public override bool DisplayGridLineSpecial(int a_dataSetRow, int a_gridRow)
        {
            string rcdType = CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_Donation
                                                       , Convert.ToInt16(DataSetValue(a_dataSetRow, COLUMN_DefaultDonationType))); // Get the ID from DataSet row.

            gridEditDonor[COLUMN_GRID_DFLTDONATETYPE, a_gridRow].Value = rcdType;

            rcdType = CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_Donor
                                                , Convert.ToInt16(DataSetValue(a_dataSetRow, COLUMN_RCD_TYPE))); // Get the ID from DataSet row.
            gridEditDonor[COLUMN_GRID_RCD_TYPE, a_gridRow].Value = rcdType;

            if (Convert.ToBoolean(DataSetValue(a_dataSetRow, COLUMN_INACTIVE)) == true)
            {
                gridEditDonor.Rows[a_gridRow].DefaultCellStyle.ForeColor = Color.Red;
            }
            return(rcdType.Length > 0);
        }                       // end of DisplayGridLineSpecial
Exemplo n.º 8
0
        /// <summary>
        /// Loads the Donation Log with the Donations for the selected date
        /// </summary>
        private void loadDonationLogList()
        {
            double totLbs = 0;
            int    totCnt = 0;

            lvFoodDonations.Items.Clear();
            ListViewItem lvItm;

            btnEditDnrTrx.Text     = "";
            btnEditDnrTrx.Enabled  = false;
            btnDeleteTrx.Text      = "";
            btnDeleteTrx.Enabled   = false;
            btnShowDnrHist.Text    = "";
            btnShowDnrHist.Enabled = false;

            for (int i = 0; i < clsFoodDonations.RowCount; i++)
            {
                clsFoodDonations.setDataRow(i);
                lvItm      = new ListViewItem();
                lvItm.Name = clsFoodDonations.TrxID.ToString();
                lvItm.Text = (i + 1).ToString();
                lvItm.SubItems.Add(CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_Donation, clsFoodDonations.DonationType));
                clsDonors.find(clsFoodDonations.DonorID);
                lvItm.SubItems.Add(clsDonors.Name);
                lvItm.SubItems.Add(clsFoodDonations.Pounds.ToString());
                lvItm.SubItems.Add(clsFoodDonations.Notes);
                lvItm.SubItems.Add(CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_FoodClass, clsFoodDonations.FoodClass));
                lvItm.SubItems.Add(clsFoodDonations.FoodCode);
                lvItm.SubItems.Add(clsFoodDonations.DonorID.ToString());
                lvItm.SubItems.Add(clsFoodDonations.TrxID.ToString());
                lvFoodDonations.Items.Add(lvItm);
                totCnt++;
                totLbs += clsFoodDonations.Pounds;
            }
            tbTotalCount.Text = totCnt.ToString();
            tbTotalLbs.Text   = totLbs.ToString();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Clears Datagrid and Loads the Clients
        /// </summary>
        public void loadList()
        {
            bNormalMode     = false;
            tbFindName.Text = "";
            lastSearchText  = "";
            ClearHeader();
            dgvClientList.Rows.Clear();
            progressBar1.Value   = 0;
            progressBar1.Maximum = 100;
            progressBar1.Show();
            tbFindName.Visible = false;
            Application.DoEvents();

            clsClient.openWhere(sWhereClause + includeInactive + sOrderBy);
            progressBar1.Maximum = clsClient.RowCount;

            for (int i = 0; i < clsClient.RowCount; i++)
            {
                dgvClientList.Rows.Add();

                if ((bool)clsClient.DSet.Tables[0].Rows[i]["HHInactive"] == true)
                {
                    dgvClientList.Rows[i].DefaultCellStyle.ForeColor = Color.Maroon;
                }
                else if (Convert.ToBoolean(CCFBGlobal.NullToZero(clsClient.DSet.Tables[0].Rows[i]["Inactive"])) == true)
                {
                    dgvClientList.Rows[i].DefaultCellStyle.ForeColor = Color.DarkViolet;
                }
                else
                {
                    dgvClientList.Rows[i].DefaultCellStyle.ForeColor = Color.Black;
                }
                if (clsClient.DSet.Tables[0].Rows[i][firstColName] == DBNull.Value)
                {
                    dgvClientList.Rows[i].Cells["colName"].Value = clsClient.DSet.Tables[0].Rows[i]["Name"].ToString();
                }
                else
                {
                    dgvClientList.Rows[i].Cells["colName"].Value = clsClient.DSet.Tables[0].Rows[i][firstColName].ToString();
                }
                dgvClientList.Rows[i].Cells["clmCity"].Value = clsClient.DSet.Tables[0].Rows[i]["City"].ToString();
                if (clsClient.DSet.Tables[0].Rows[i]["ID"].ToString() == "")
                {
                    dgvClientList.Rows[i].Cells["clmID"].Value = "0";
                }
                else
                {
                    dgvClientList.Rows[i].Cells["clmID"].Value = clsClient.DSet.Tables[0].Rows[i]["ID"].ToString();
                }
                dgvClientList.Rows[i].Cells["clmZip"].Value        = clsClient.DSet.Tables[0].Rows[i]["Zipcode"].ToString();
                dgvClientList.Rows[i].Cells["clmHHID"].Value       = clsClient.DSet.Tables[0].Rows[i]["HHId"].ToString();
                dgvClientList.Rows[i].Cells["clmPhone"].Value      = clsClient.DSet.Tables[0].Rows[i]["Phone"].ToString();
                dgvClientList.Rows[i].Cells["clmAddress"].Value    = clsClient.DSet.Tables[0].Rows[i]["Address"].ToString();
                dgvClientList.Rows[i].Cells["clmHeadHH"].Value     = CCFBGlobal.NullToBlank(clsClient.DSet.Tables[0].Rows[i]["HeadHH"].ToString());
                dgvClientList.Rows[i].Cells["clmClientType"].Value = CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_Client, Convert.ToInt32(clsClient.DSet.Tables[0].Rows[i]["ClientType"]));
                dgvClientList.Rows[i].Cells["colHHName"].Value     = clsClient.DSet.Tables[0].Rows[i]["Name"].ToString();
                dgvClientList.Rows[i].Cells["colNameLF"].Value     = clsClient.DSet.Tables[0].Rows[i]["colNameLF"].ToString().ToUpper().Trim();
                dgvClientList.Rows[i].Cells["colNameFL"].Value     = clsClient.DSet.Tables[0].Rows[i]["colNameFL"].ToString().ToUpper().Trim();
                if (clsClient.DSet.Tables[0].Rows[i]["LatestService"].ToString() != "")
                {
                    dgvClientList.Rows[i].Cells["clmLatestService"].Value =
                        clsClient.DSet.Tables[0].Rows[i].Field <DateTime>("LatestService").ToShortDateString();
                }
                else
                {
                    dgvClientList.Rows[i].Cells["clmLatestService"].Value = "";
                }

                progressBar1.PerformStep();
            }

            //Fills the textbox's for the current selected client
            rowIndex = 0;
            fillTextBoxes();
            progressBar1.Value   = 0;
            progressBar1.Visible = false;
            tbFindName.Visible   = true;
            bNormalMode          = true;
            rowCount             = dgvClientList.RowCount;
        }
        public void createReport(Client clsClient)
        {
            Application m_oExcelApp;
            _Workbook   m_oBook;
            _Worksheet  m_oSheet;

            int    eRow         = 7;
            object saveAs       = "";
            string templatePath = "";
            string savePath     = CCFBGlobal.pathExe + "SchoolSupply\\PickupTickets" + DateTime.Today.Year.ToString() + "\\";

            m_oExcelApp         = new Application();
            m_oExcelApp.Visible = true;
            m_oSheet            = null;
            object missing = Type.Missing;

            CCFBGlobal.verifyPath(savePath);
            saveAs = savePath + "HhID" + CCFBGlobal.formatNumberWithSixLeadingZeros(clsClient.clsHH.ID) + ".xlsx";

            templatePath = CCFBGlobal.pathTemplates + "NCCFBSchoolSupplyPickupTicket.xlsx";

            //Object oTemplatePath = templatePath;

            try
            {
                m_oBook = m_oExcelApp.Workbooks.Open(templatePath
                                                     , XlUpdateLinks.xlUpdateLinksNever, false, missing, missing, missing, true, missing, missing, true
                                                     , missing, missing, false, missing, XlCorruptLoad.xlNormalLoad);

                Debug.Print(m_oBook.Sheets.Count.ToString());

                m_oSheet = (_Worksheet)m_oBook.Sheets[1];


                //m_oSheet.Cells[4, 2] = CCFBPrefs.FoodBankName;
                m_oSheet.Cells[3, 2] = clsClient.clsHH.ID.ToString();
                m_oSheet.Cells[4, 5] = clsClient.clsHH.SchSupplyPickupPerson;
                for (int i = 0; i < clsClient.clsHHmem.RowCount; i++)
                {
                    clsClient.clsHHmem.SetRecord(i);
                    if (clsClient.clsHHmem.Inactive == false && clsClient.clsHHmem.SchSupply == true)
                    {
                        eRow++;
                        m_oSheet.Cells[eRow, 1] = clsClient.clsHHmem.Name;
                        m_oSheet.Cells[eRow, 4] = clsClient.clsHHmem.Grade.ToString();
                        m_oSheet.Cells[eRow, 5] = clsClient.clsHHmem.Age.ToString();
                        m_oSheet.Cells[eRow, 6] = clsClient.clsHHmem.Sex;
                        m_oSheet.Cells[eRow, 7] = CCFBGlobal.LongNameFromId(CCFBGlobal.parmTbl_SchSupplySchool, clsClient.clsHHmem.SchSupplySchool);
                    }
                }
                if (File.Exists(saveAs.ToString()) == true)
                {
                    File.Delete(saveAs.ToString());
                }
                m_oBook.SaveAs(saveAs, XlFileFormat.xlWorkbookDefault, missing,
                               missing, true, false, XlSaveAsAccessMode.xlShared, missing, false, missing, missing, true);

                m_oExcelApp.Quit();
                System.Runtime.InteropServices.Marshal.ReleaseComObject(m_oExcelApp);
                m_oSheet    = null;
                m_oBook     = null;
                m_oExcelApp = null;
                error       = false;

                CCFBGlobal.openDocumentOutsideCCFB(saveAs.ToString());
            }
            catch (Exception ex)
            {
                m_oExcelApp.Quit();
                System.Runtime.InteropServices.Marshal.ReleaseComObject(m_oExcelApp);
                CCFBGlobal.appendErrorToErrorReport("", ex.GetBaseException().ToString());
                error       = true;
                m_oSheet    = null;
                m_oBook     = null;
                m_oExcelApp = null;
                //MessageBox.Show("Error accessing Excel: " + ex.ToString());
            }
        }