private void GetDetails(long id) { string output = "The USDA has not made the details of this inspection public.<br/> You can request the information here: <a href=" + "\"http://www.aphis.usda.gov/foia/\"" + ">FOIA Request</a>"; using (var insp = new InspectionContext()) { var qry = from i in insp.inspectionDetails where i.InspectionID == id orderby i.USDACertificateNumber descending select i; if (qry.Count() > 0) { StringBuilder sb = new StringBuilder(); sb.AppendLine("<br/><br/>"); sb.AppendLine("<table><tr><th>AWA Section</th><th>Section Description</th></tr>"); foreach (var item in qry) { sb.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", item.CFRCitationSection, item.NCICFRCitationDescription ); } sb.AppendLine("</table>"); sb.Append("<br/><br/>"); sb.Append("<b>For detailed information of these violations you can view the inspecting officer's notes by searching for this license on the <a href=" + "\"http://acissearch.aphis.usda.gov/LPASearch/faces/CustomerSearch.jspx \"" + ">USDA Site</a>.</b>"); sb.Append("<br/><br/>"); output = sb.ToString(); } } lblDetails.Text = output; }
private void GetStatusInfo(string txtLic) { lblOutput.Text = "No information about this license is in our database. <br/>You may be able to obtain more information here: <br/><br/><a href=" + "\"http://acissearch.aphis.usda.gov/LPASearch/faces/CustomerSearch.jspx \"" + ">acissearch</a>"; using (var insp = new InspectionContext()) { // Get the Customer Number for this licensee var qryCustNum = from ic in insp.Status where ic.USDACertificateNumber == txtLic orderby ic.USDACertificateNumber descending select ic; foreach(var CN in qryCustNum){ var qry = from i in insp.Status where i.CustomerNumber == CN.CustomerNumber orderby i.USDACertificateNumber descending select i; if (qry.Count() >= 1) { StringBuilder sb = new StringBuilder(); sb.AppendLine("<br/><br/>"); sb.AppendLine("<table>"); if (qry.Count() == 1) { foreach (var item in qry) { sb.AppendFormat("<tr><td>The license {0} was issued on {1} and as of {3} has a status of {2} </td></tr>", item.USDACertificateNumber, CleanDate(item.USDACertificateBeginDate), item.USDACertificateCurrentStatus, CleanDate(item.USDACertificateCurrentStatusDate)); } } else { sb.AppendFormat("<tr><td>The licensee has multiple licenses.</td></tr>"); string strStatus = ""; foreach (var item in qry) { switch (item.USDACertificateCurrentStatus.TrimStart().TrimEnd()) { case "CANCELLED": strStatus = "<font color=\"red\"><b>CANCELLED</b><font>"; break; case "REVOKED": strStatus = "<font color=\"red\"><b>REVOKED</b><font>"; break; default: strStatus = item.USDACertificateCurrentStatus; break; } sb.AppendFormat("<tr><td>The license {0} was issued on {1} and as of {3} has a status of {2} </td></tr>", item.USDACertificateNumber, item.USDACertificateBeginDate, strStatus, item.USDACertificateCurrentStatusDate); } } sb.AppendLine("</table>"); lblOutput.Text = sb.ToString(); } } } }
private void GetInspectionInfo(string p) { string output = "No Inspections were found for this Licensee.<br/> <br/> Check <a href=status.aspx?id=" + p.Trim() +">here</a> for information we may have on this licensee, or you may obtain more information here: <a href=" + "\"http://acissearch.aphis.usda.gov/LPASearch/faces/CustomerSearch.jspx \"" + ">acissearch</a>"; using (var insp = new InspectionContext()) { Response.Write(p + "<br/>"); var qry = from i in insp.inspections where i.USDACertificateNumber == p.Trim() orderby i.InspectionDate descending select i; string HTMLOut = ""; long inspID = 0; string what = ""; long howmany = 0; if (qry.Count() > 0) { Response.Write("<br> COUNT: " + qry.Count().ToString() + "<br>"); IntroBlurb.Style.Add("display", "none"); Instructions.InnerText = "Results for License: " + p.Trim(); HTMLOut = "<table>"; HTMLOut += "<tr><td>Check <a href=\"status.aspx?id=" + p.Trim() + "\">here</a> for information we may have on this licensee</td></tr>"; HTMLOut +="<tr><td> </td></tr>"; foreach (var item in qry) { //inspID = Int64.Parse(item.InspectionID.ToString()); if (item.CountCitations == 0) { HTMLOut +="<tr><td>The " + CleanDate(item.InspectionDate) + " inspection had no violations.</td></tr><br/>"; HTMLOut += "<tr><td> </td></tr>"; } else { if (item.InspectionInventoryAnimalsCommonName == "") { HTMLOut +="<tr class=\"warn\"><td><a href=\"details.aspx?id="+ item.InspectionID.ToString() + "\">Inspection</a> was attempted on " + CleanDate(item.InspectionDate) + " but access was not possible.</td></tr>"; HTMLOut += "<tr><td> </td></tr>"; } else { if (inspID != item.InspectionID) { howmany = Int64.Parse(item.CountCitations.ToString()); what = item.InspectionInventoryCount.ToString() + " " + Pluralize(Int32.Parse(item.InspectionInventoryCount.ToString()), item.InspectionInventoryAnimalsCommonName); HTMLOut += "<tr><td>The " + CleanDate(item.InspectionDate) + " <a href=\"details.aspx?id=" + item.InspectionID.ToString() + " \">Inspection</a> showed " + item.CountCitations.ToString() + " violation(s) on " + what + ".</td></tr>"; HTMLOut += "<tr><td> </td></tr>"; }else{ what += " and " + item.InspectionInventoryCount.ToString() + " " + Pluralize(Int32.Parse(item.InspectionInventoryCount.ToString()), item.InspectionInventoryAnimalsCommonName); HTMLOut += "<tr><td>The " + CleanDate(item.InspectionDate) + " <a href=\"details.aspx?id=" + item.InspectionID.ToString() + " \">Inspection</a> showed " + item.CountCitations.ToString() + " violation(s) on " + what + ".</td></tr>"; HTMLOut += "<tr><td> </td></tr>"; } } inspID = Int64.Parse(item.InspectionID.ToString()); } } HTMLOut += "</table>"; output = HTMLOut; } } lblInspection.Text = output; }