/// <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; }