Ejemplo n.º 1
0
        private void fillForm()
        {
            tssStatus.Text = "Loading";
            tsslblMsg.Text = "";
            Application.DoEvents();
            string val = "";

            clsFT.openForADate(curSvcDisplayDate, "");
            int totEntries  = 0;
            int totStdLbs   = 0;
            int totOtherLbs = 0;
            int totTEFAP    = 0;
            int totSuppl    = 0;
            int totBaby     = 0;

            int infants  = 0;
            int yth      = 0;
            int teens    = 0;
            int eighteen = 0;
            int adlt     = 0;
            int senr     = 0;
            int totFam   = 0;

            dgvFT.Rows.Clear();

            DataGridViewRow dvr;
            int             rowCount = 0;

            for (int i = 0; i < clsFT.RowCount; i++)
            {
                try
                {
                    clsFT.setDataRow(i);
                    infants     = clsFT.Infants;
                    yth         = clsFT.Youth;
                    teens       = clsFT.Teens;
                    eighteen    = clsFT.Eighteen;
                    adlt        = clsFT.Adults;
                    senr        = clsFT.Seniors;
                    totFam      = clsFT.TotalFamily;
                    totStdLbs   = clsFT.LbsStd;
                    totOtherLbs = clsFT.LbsOther;
                    totTEFAP    = clsFT.LbsCommodity;
                    totSuppl    = clsFT.LbsSupplemental;
                    totBaby     = clsFT.LbsBabySvc;
                    totEntries++;

                    //Grid View
                    dgvFT.Rows.Add();
                    dvr     = dgvFT.Rows[rowCount];
                    dvr.Tag = clsFT.TrxId;

                    string tmp;

                    foreach (DataGridViewColumn dgvCol in dgvFT.Columns)
                    {
                        if (dgvCol.DataPropertyName != null && dgvCol.DataPropertyName != "")
                        {
                            tmp = "";
                            switch (dgvCol.CellType.Name)
                            {
                            case "DataGridViewTextBoxCell":
                                switch (dgvCol.DataPropertyName.ToLower())
                                {
                                case "familysize":
                                    if (clsFT.Infants > 0)
                                    {
                                        if (clsFT.Infants == 1)
                                        {
                                            val = "1 infant";
                                        }
                                        else
                                        {
                                            val = clsFT.Infants.ToString() + " infants";
                                        }
                                        CCFBGlobal.AppendTextWithComma(ref tmp, val);
                                    }
                                    if (clsFT.Youth > 0)
                                    {
                                        if (clsFT.Youth == 1)
                                        {
                                            val = "1 child";
                                        }
                                        else
                                        {
                                            val = clsFT.Youth.ToString() + " children";
                                        }
                                        CCFBGlobal.AppendTextWithComma(ref tmp, val);
                                    }
                                    if (clsFT.Teens + clsFT.Eighteen > 0)
                                    {
                                        if (clsFT.Teens + clsFT.Eighteen == 1)
                                        {
                                            val = " 1 teen";
                                        }
                                        else
                                        {
                                            val = (clsFT.Teens + clsFT.Eighteen).ToString() + " teens";
                                        }
                                        CCFBGlobal.AppendTextWithComma(ref tmp, val);
                                    }
                                    if (clsFT.Adults > 0)
                                    {
                                        if (clsFT.Adults == 1)
                                        {
                                            val = "1 adult";
                                        }
                                        else
                                        {
                                            val = clsFT.Adults.ToString() + " adults";
                                        }
                                        CCFBGlobal.AppendTextWithComma(ref tmp, val);
                                    }
                                    if (clsFT.Seniors > 0)
                                    {
                                        if (clsFT.Seniors == 1)
                                        {
                                            val = "1 senior";
                                        }
                                        else
                                        {
                                            val = clsFT.Seniors.ToString() + " seniors";
                                        }
                                        CCFBGlobal.AppendTextWithComma(ref tmp, val);
                                    }
                                    tmp = tmp.Replace(",", "\r\n");
                                    break;

                                case "foodsvclist":
                                    tmp = clsFT.FoodSvcList.Replace(",", "\r\n");
                                    break;

                                default:
                                    dvr.Cells[dgvCol.HeaderCell.ColumnIndex].Value = clsFT.GetDataString(dgvCol.DataPropertyName);
                                    break;
                                }
                                break;

                            default:
                                break;
                            }
                            if (tmp != "")
                            {
                                dvr.Cells[dgvCol.HeaderCell.ColumnIndex].Value = tmp;
                            }
                        }
                        dvr.Cells[dgvCol.HeaderCell.ColumnIndex].Style.ForeColor = Color.Black;
                    }
                    rowCount++;
                }
                catch (Exception ex)
                {
                    CCFBGlobal.appendErrorToErrorReport("", ex.GetBaseException().ToString());
                }
                if (rowCount > 0)
                {
                    dgvFT.CurrentCell = dgvFT[dgvFT.Columns["colHHID"].Index, 0];
                    dgvFT.Focus();
                    dgvFT.ClearSelection();
                }
            }
        }