public void BindCategoryRating(string InspectionID, string CheckListIDs) { try { JavaScriptSerializer j = new JavaScriptSerializer(); dsCat = objInsp.GetCategoryRating(InspectionID, CheckListIDs); if (dsCat.Tables[0].Rows.Count > 0) { // dsCat.Tables[0]. for (int i = 0; i < dsCat.Tables[0].Rows.Count; i++) { item = new CatRating(); item.RNO = dsCat.Tables[0].Rows[i][0].ToString(); item.Description = dsCat.Tables[0].Rows[i][2].ToString(); item.LastReport = dsCat.Tables[0].Rows[i][3].ToString(); item.ThisReport = dsCat.Tables[0].Rows[i][4].ToString(); item.Rating = dsCat.Tables[0].Rows[i][5].ToString(); lstRate.Add(item); } string js4 = "drawChartSummaryRating(" + j.Serialize(lstRate) + ");"; ScriptManager.RegisterStartupScript(this, this.GetType(), "CatRatingChart", js4, true); } } catch (Exception ex) { throw ex; } }
public void BindCategoryRating(string InspectionID, string CheckListIDS) { try { ViewState["info"] = null; dsCat = objInsp.GetCategoryRating(InspectionID); if (dsCat.Tables[0].Rows.Count > 0) { grdCatRating.DataSource = dsCat.Tables[0]; grdCatRating.DataBind(); //updSubCat.Update(); DataSet dsRatingByVal = new DataSet(); dsRatingByVal.Clear(); for (int i = 0; i < grdCatRating.Rows.Count; i++) { if (grdCatRating.Rows[i].Cells[4].Text != " " && grdCatRating.Rows[i].Cells[4].Text.Trim() != "") { dsRatingByVal = objInsp.GetRatingsByValue(Convert.ToString(Math.Round(Convert.ToDecimal(grdCatRating.Rows[i].Cells[4].Text)))); if (dsRatingByVal.Tables[0].Rows.Count > 0) { Label lblRate = (Label)grdCatRating.Rows[i].Cells[5].FindControl("lblCatRating"); if (lblRate.Text == dsRatingByVal.Tables[0].Rows[0][1].ToString()) { grdCatRating.Rows[i].Cells[5].Attributes.Add("style", "background-color:" + dsRatingByVal.Tables[0].Rows[0][3].ToString()); } } } } grdCatRating.FooterRow.Cells[2].Text = dsCat.Tables[1].Rows[0][2].ToString(); grdCatRating.FooterRow.Cells[3].Text = dsCat.Tables[1].Rows[0][3].ToString(); grdCatRating.FooterRow.Cells[4].Text = dsCat.Tables[1].Rows[0][4].ToString(); grdCatRating.FooterRow.Cells[5].Text = dsCat.Tables[1].Rows[0][5].ToString(); grdCatRating.FooterRow.Cells[2].HorizontalAlign = HorizontalAlign.Left; grdCatRating.FooterRow.Cells[3].HorizontalAlign = HorizontalAlign.Center; grdCatRating.FooterRow.Cells[4].HorizontalAlign = HorizontalAlign.Center; grdCatRating.FooterRow.Cells[5].HorizontalAlign = HorizontalAlign.Center; updCat.Update(); } } catch (Exception ex) { throw ex; } }