private void FillFieldLabResults() { const string METHOD_NAME = "FillFieldLabResults"; try { int cropYear = CropYear; int fieldID = 0; int divHeight = 120; divFieldLabResultsEmpty.Attributes.Add("class", "DisplayOff"); divFieldLabResultsEmpty.InnerHtml = ""; if (grdFieldResults.SelectedRow != null) { fieldID = Convert.ToInt32(grdFieldResults.SelectedRow.Cells[0].Text.Replace(BLANK_CELL, "")); } using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { ArrayList labs = WSCField.SoilSampleLabGetByField(conn, fieldID, cropYear); // Do we have any valid data? If not show warning. if (labs.Count == 1) { SoilSampleLabState lab = (SoilSampleLabState)labs[0]; if (lab.SoilSampleLabID == 0 && fieldID > 0) { divFieldLabResultsEmpty.Attributes.Add("class", "WarnNoData"); divFieldLabResultsEmpty.InnerHtml = "No soil sample labs are assigned to the selected field " + "in crop year " + cropYear.ToString(); } } else { divHeight += 17 * (labs.Count + 1); } string style = "BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; OVERFLOW: auto; BORDER-LEFT: black 1px solid; WIDTH: 935px; BORDER-BOTTOM: black 1px solid; HEIGHT: " + divHeight.ToString() + "px;"; divFieldLabs.Attributes.Add("style", style); grdFieldLabResults.SelectedIndex = -1; grdFieldLabResults.DataSource = labs; grdFieldLabResults.DataBind(); } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
private void FillOtherLabResults() { const string METHOD_NAME = "FillOtherLabResults"; try { int shid = SHID; int cropYear = CropYear; int divHeight = 160; divOtherLabResultsEmpty.Attributes.Add("class", "DisplayOff"); divOtherLabResultsEmpty.InnerHtml = ""; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { ArrayList labs = WSCField.SoilSampleLabGetByGrower(conn, shid, cropYear); // Do we have any valid data? If not show warning. if (labs.Count == 1) { SoilSampleLabState lab = (SoilSampleLabState)labs[0]; if (lab.SoilSampleLabID == 0 && shid > 0) { divOtherLabResultsEmpty.Attributes.Add("class", "WarnNoData"); divOtherLabResultsEmpty.InnerHtml = "No soil sample labs are assigned to SHID " + shid.ToString() + " in crop year " + cropYear.ToString(); } } else { divHeight += 17 * (labs.Count + 1); } string style = "BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; OVERFLOW: auto; BORDER-LEFT: black 1px solid; WIDTH: 935px; BORDER-BOTTOM: black 1px solid; HEIGHT: " + divHeight.ToString() + "px;"; divOtherLabs.Attributes.Add("style", style); grdOtherLabResults.SelectedIndex = -1; grdOtherLabResults.DataSource = labs; grdOtherLabResults.DataBind(); } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }