Example #1
0
        private void changeGroupBoxVisibility(int option)
        {
            switch (option)
            {
            case 0:
            {
                pnlFindClient.Visible  = true;
                pnlGiveService.Visible = false;
                dgvHD.Enabled          = true;
                break;
            }

            case 1:
            {
                pnlFindClient.Visible  = false;
                pnlGiveService.Visible = false;
                dgvHD.Enabled          = false;

                string date = CCFBGlobal.NullToBlank(dgvHD.SelectedRows[0].Cells["clmExpiration"].Value);
                break;
            }

            case 2:
            {
                dgvHD.Enabled          = false;
                pnlFindClient.Visible  = false;
                pnlGiveService.Visible = true;
                break;
            }
            }
        }
Example #2
0
        /// <summary>
        /// Loads the DataGrid from the DataRows that are passed to the funtion
        /// </summary>
        /// <param name="drows">The Array of DataRows to load the data from</param>
        private void loadList(DataRow[] drows)
        {
            tbFindName.Text = "";
            lastSearchText  = "";
            dgvBackpack.Rows.Clear();
            progressBar1.Value = 0;
            progressBar1.Show();
            tbFindName.Visible = false;
            Application.DoEvents();
            progressBar1.Maximum = rowCount;

            DateTime toCheck = new DateTime(Convert.ToInt32(cboYear.SelectedItem),
                                            Convert.ToInt32(cboMonth.SelectedIndex + 1), 1);

            for (int i = 0; i < drows.Length; i++)
            {
                dgvBackpack.Rows.Add();

                if (Convert.ToInt32(drows[i]["Backpack"]) == 0)
                {
                    dgvBackpack.Rows[i].DefaultCellStyle.ForeColor = Color.Red;
                }
                else if (Convert.ToInt32(drows[i]["Inactive"]) == 1)
                {
                    dgvBackpack.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                    dgvBackpack.Rows[i].DefaultCellStyle.BackColor = Color.White;
                }

                dgvBackpack["clmHHID", i].Value       = drows[i]["HouseholdID"];
                dgvBackpack["clmName", i].Value       = drows[i]["colNameLF"];
                dgvBackpack["clmAddress", i].Value    = drows[i]["Address"];
                dgvBackpack["clmAptNum", i].Value     = dtbl.Rows[i]["AptNbr"];
                dgvBackpack["clmExpiration", i].Value = convertToShortDate(
                    CCFBGlobal.NullToBlank(drows[i]["BackpackExpiration"]));
                if (dgvBackpack["clmExpiration", i].Value.ToString() != "" &&
                    (DateTime)drows[i]["BackpackExpiration"] < toCheck)
                {
                    dgvBackpack["clmExpiration", i].Style.BackColor = Color.Yellow;
                }
                dgvBackpack["clmMethod", i].Value      = drows[i]["Route"];
                dgvBackpack["clmMethodAsInt", i].Value = drows[i]["RouteAsInt"];
                dgvBackpack["clmDateServed", i].Value  = convertToShortDate(
                    CCFBGlobal.NullToBlank(drows[i]["BackpackSvcDate"]));
                dgvBackpack["clmLbs", i].Value                 = CCFBGlobal.NullToBlank(drows[i]["Lbs"]);
                dgvBackpack["clmHHMemID", i].Value             = CCFBGlobal.NullToBlank(drows[i]["hhmID"]);
                dgvBackpack.Rows[i].Cells["colNameLF"].Value   = drows[i]["colNameLF"].ToString().ToUpper().Trim();
                dgvBackpack.Rows[i].Cells["colNameFL"].Value   = drows[i]["colNameFL"].ToString().ToUpper().Trim();
                dgvBackpack.Rows[i].Cells["clmBackpack"].Value = drows[i]["Backpack"];
                dgvBackpack.Rows[i].Cells["clmLogID"].Value    = drows[i]["LogId"];
                progressBar1.PerformStep();
            }

            rowIndex             = 0;
            progressBar1.Value   = 0;
            progressBar1.Visible = false;
            tbFindName.Visible   = true;
        }
Example #3
0
 private void btnSetPassword_Click(object sender, EventArgs e)
 {
     tbPassword1.Text       = "";
     tbPassword2.Text       = "";
     lblUsername.Text       = CCFBGlobal.NullToBlank(dataGridViewUsers.CurrentRow.Cells[0].Value);
     pannelPassword.Visible = true;
     btnSetPassword.Visible = false;
     btnDelete.Enabled      = false;
     tbPassword1.Focus();
 }
Example #4
0
        private void changeGroupBoxVisibility(int option)
        {
            switch (option)
            {
            case 0:
            {
                gbFindClient.Visible   = true;
                gbRenewExpDate.Visible = false;
                gbNewService.Visible   = false;
                cboYear.Enabled        = true;
                cboMonth.Enabled       = true;
                btnRefreshList.Enabled = true;
                dgvCSFP.Enabled        = true;
                break;
            }

            case 1:
            {
                gbFindClient.Visible   = false;
                gbNewService.Visible   = false;
                gbRenewExpDate.Visible = true;
                cboYear.Enabled        = false;
                cboMonth.Enabled       = false;
                btnRefreshList.Enabled = false;
                dgvCSFP.Enabled        = false;

                string date = CCFBGlobal.NullToBlank(dgvCSFP.SelectedRows[0].Cells["clmExpiration"].Value);

                if (date != "")
                {
                    dtpExpDate.Value = DateTime.Parse(date);
                }

                chkCSFP.Checked = (bool)dgvCSFP.SelectedRows[0].Cells["clmCSFP"].Value;
                break;
            }

            case 2:
            {
                cboYear.Enabled        = false;
                cboMonth.Enabled       = false;
                btnRefreshList.Enabled = false;
                dgvCSFP.Enabled        = false;
                gbFindClient.Visible   = false;
                gbNewService.Visible   = true;
                gbRenewExpDate.Visible = false;
                tbLbsCSFP.Text         = dfltCsfpLbs.ToString();
                dtpSvcDate.Value       = svcDate;
                break;
            }
            }
        }
Example #5
0
        private void changeGroupBoxVisibility(int option)
        {
            switch (option)
            {
            case 0:
            {
                gbRenewExpDate.Visible = false;
                gbNewService.Visible   = false;
                cboYear.Enabled        = true;
                cboMonth.Enabled       = true;
                btnRefreshList.Enabled = true;
                dgvBackpack.Enabled    = true;
                break;
            }

            case 1:
            {
                gbNewService.Visible   = false;
                gbRenewExpDate.Visible = true;
                cboYear.Enabled        = false;
                cboMonth.Enabled       = false;
                btnRefreshList.Enabled = false;
                dgvBackpack.Enabled    = false;

                string date = CCFBGlobal.NullToBlank(dgvBackpack.SelectedRows[0].Cells["clmExpiration"].Value);

                if (date != "")
                {
                    dtpExpDate.Value = DateTime.Parse(date);
                }

                chkBackpack.Checked = (bool)dgvBackpack.SelectedRows[0].Cells["clmBackpack"].Value;
                break;
            }

            case 2:
            {
                cboYear.Enabled        = false;
                cboMonth.Enabled       = false;
                btnRefreshList.Enabled = false;
                dgvBackpack.Enabled    = false;
                gbNewService.Visible   = true;
                gbRenewExpDate.Visible = false;
                //tbLbsBackpack.Text = CCFBPrefs.BackpackLbsPerUnit * cls  .ToString();
                dtpSvcDate.Value = svcDate;
                break;
            }
            }
        }
Example #6
0
        private void dataGridViewUsers_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            int rowIndex = dataGridViewUsers.CurrentRow.Index;

            if (dataGridViewUsers.CurrentRow.Cells["clmId"].Value != null)
            {
                clsUsers.SetDataValue(rowIndex, "UserRole", dataGridViewUsers.CurrentRow.Cells[1].Value.ToString());

                clsUsers.SetDataValue(rowIndex, "UserName", dataGridViewUsers.CurrentRow.Cells[0].Value.ToString());

                clsUsers.update();
            }
            else
            {
                switch (e.ColumnIndex)
                {
                case 0:
                {
                    newUserName = CCFBGlobal.NullToBlank(dataGridViewUsers.Rows[rowIndex].Cells[0].Value);
                    if (newUserName == "")
                    {
                        if (MessageBox.Show("Do you want me to delete this row?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            dataGridViewUsers.Rows.RemoveAt(rowIndex);
                        }
                    }
                    dataGridViewUsers.Rows[rowIndex].Cells[1].Value = CCFBGlobal.nameUserRole_Intake;
                    break;
                }

                default:
                {
                    newUserRole = dataGridViewUsers.Rows[rowIndex].Cells[1].GetEditedFormattedValue
                                      (rowIndex, DataGridViewDataErrorContexts.LeaveControl).ToString();
                    break;
                }
                }
                pannelPassword.Visible = true;
                btnSetPassword.Visible = false;
                btnDelete.Enabled      = false;
                tbPassword1.Focus();
            }
        }
        /// <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;
        }
Example #8
0
        private void changeGroupBoxVisibility(int option)
        {
            string tmpdate = "";

            switch (option)
            {
            case 0:
            {
                gbFilter.Visible       = true;
                gbRenewExpDate.Visible = false;
                gbNewService.Visible   = false;
                cboYear.Enabled        = true;
                cboMonth.Enabled       = true;
                btnRefreshList.Enabled = true;
                dgvCSFP.Enabled        = true;
                break;
            }

            case 1:
            {
                gbFilter.Visible       = false;
                gbNewService.Visible   = false;
                gbRenewExpDate.Visible = true;
                cboYear.Enabled        = false;
                cboMonth.Enabled       = false;
                btnRefreshList.Enabled = false;
                dgvCSFP.Enabled        = false;

                tmpdate = CCFBGlobal.NullToBlank(dgvCSFP.SelectedRows[0].Cells["CSFPExpiration"].Value);

                if (tmpdate != "")
                {
                    dtpExpDate.Value = DateTime.Parse(tmpdate);
                }
                else
                {
                    dtpExpDate.Value = DateTime.Parse(DateTime.Today.ToShortDateString());
                }
                chkCSFP.Checked = (bool)dgvCSFP.SelectedRows[0].Cells["clmCSFP"].Value;
                break;
            }

            case 2:
            {
                cboYear.Enabled        = false;
                cboMonth.Enabled       = false;
                btnRefreshList.Enabled = false;
                dgvCSFP.Enabled        = false;
                gbFilter.Visible       = false;
                gbNewService.Visible   = true;
                gbRenewExpDate.Visible = false;
                tbLbsCSFP.Text         = CCFBPrefs.CSFPLbsPerService.ToString();
                dtpSvcDate.Value       = svcDate;
                tmpdate = CCFBGlobal.NullToBlank(dgvCSFP.SelectedRows[0].Cells["clmDateServed"].Value);

                if (tmpdate != "")
                {
                    dtpSvcDate.Value = DateTime.Parse(tmpdate);
                }
                else
                {
                    dtpSvcDate.Value = DateTime.Parse(DateTime.Today.ToShortDateString());
                }
                break;
            }
            }
            Application.DoEvents();
        }