GetValue() public method

public GetValue ( int ordinal ) : object
ordinal int
return object
Ejemplo n.º 1
0
 private void RellenaEtiquetasPlaceHolder()
 {
     if (this.idindicator.HasValue)
     {
         try
         {
             using (Clases.cKPI_INDICATOR_ETIQUETAS objEtiquetas = new Clases.cKPI_INDICATOR_ETIQUETAS())
             {
                 objEtiquetas.indicatorid = this.idindicator.Value;
                 System.Data.DataTableReader dtrValores = objEtiquetas.ObtenerDatos().CreateDataReader();
                 while (dtrValores.Read())
                 {
                     HyperLink NuevoEnlace = new HyperLink();
                     NuevoEnlace.Text        = dtrValores.GetValue(2).ToString();
                     NuevoEnlace.NavigateUrl = "~/search.aspx?tagstring=" + dtrValores.GetValue(2).ToString();
                     NuevoEnlace.CssClass    = "tag";
                     PlaceHolderEtiquetas.Controls.Add(NuevoEnlace);
                 }
             }
         }
         catch (Exception excp)
         {
             ExceptionUtility.LogException(excp, "Error en la función << RellenaEtiquetasPlaceHolder() >>");
         }
         finally
         {
             if (PlaceHolderEtiquetas.Controls.Count > 0)
             {
                 lbNumEtiquetasNoEditable.Text = PlaceHolderEtiquetas.Controls.Count.ToString();
             }
             else
             {
                 PanelEtiquetasNoEditable.Visible = false;
             }
         }
     }
     else
     {
         Response.Redirect("~/errors/notfound.aspx");
     }
 }
        public void GetValue_ValidColumnIdentifiers_ReturnsCorrectType()
        {
            using (var dr = new DataTableReader(_dt1)) {
                dr.Read();
                Assert.AreEqual(1, dr.GetValue<int>("id"), "ID");
                Assert.AreEqual(1L, dr.GetValue<long>("id"), "ID as long");
                Assert.AreEqual(1, dr.GetValue<ushort>("id"), "ID as short");
                Assert.AreEqual(1, dr.GetValue<byte>("id"), "ID as byte");

                Assert.AreEqual(new DateTime(2011, 03, 31, 18, 22, 13), dr.GetValue<DateTime>("time"), "Time");
                Assert.AreEqual(70.41f, dr.GetValue<decimal>("amount"), "Amount");
                Assert.AreEqual("Kaffe", dr.GetValue<string>("description"), "Description");
            }
        }
Ejemplo n.º 3
0
    private void RellenaEtiquetasEditables()
    {
        if (this.idindicator.HasValue)
        {
            string sComa        = string.Empty;
            string sKeywords    = string.Empty;
            int    NumEtiquetas = 0;

            try
            {
                using (Clases.cKPI_INDICATOR_ETIQUETAS objEtiquetas = new Clases.cKPI_INDICATOR_ETIQUETAS())
                {
                    objEtiquetas.indicatorid = this.idindicator.Value;
                    System.Data.DataTableReader dtrValores = objEtiquetas.ObtenerDatos().CreateDataReader();
                    while (dtrValores.Read())
                    {
                        sKeywords += sComa + dtrValores.GetValue(2).ToString();
                        sComa      = ", ";
                        NumEtiquetas++;
                    }
                }
            }
            catch (Exception excp)
            {
                ExceptionUtility.LogException(excp, "Error en la función << RellenaEtiquetasEditables() >>");
            }
            finally
            {
                txtEtiquetasEditable.Text   = sKeywords;
                Page.MetaKeywords           = sKeywords;
                lbNumEtiquetasEditable.Text = NumEtiquetas.ToString();
            }
        }
        else
        {
            Response.Redirect("~/errors/notfound.aspx");
        }
    }