BLL.Transferencias.Buscar C# (CSharp) Метод

Buscar() публичный Метод

public Buscar ( int IdBuscado ) : bool
IdBuscado int
Результат bool
        public override bool Buscar(int IdBuscado)
        {
            DataTable dt = new DataTable();
            ConexionDb conexion = new ConexionDb();

            dt = conexion.ObtenerDatos(String.Format("select * from Transferencias where TransferenciaId = {0}", TransferenciaId));

            if (dt.Rows.Count>0)
            {
                this.Fecha = dt.Rows[0]["Fecha"].ToString();
                this.CuentaOrigenId = (int)dt.Rows[0]["CuentaOrigenId"];
                this.CuentaDestinoId = (int)dt.Rows[0]["CuentaDestinoId"];
                this.Monto = (double)dt.Rows[0]["Monto"];
                this.Observacion = dt.Rows[0]["Observacion"].ToString();
                this.UsuarioId = (int)dt.Rows[0]["UsuarioId"];
            }
            return dt.Rows.Count > 0;
        }

Usage Example

        protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!IsPostBack)
            {
                Cuentas cuenta = new Cuentas();
                CuentaOrigenDropDownList.DataSource = cuenta.Listado(" * ", "1=1", "");
                CuentaOrigenDropDownList.DataTextField = "Descripcion";
                CuentaOrigenDropDownList.DataValueField = "CuentaId";
                CuentaOrigenDropDownList.DataBind();

                CuentaDestinoDropDownList.DataSource = cuenta.Listado(" * ", "CuentaId <> " + CuentaOrigenDropDownList.SelectedValue, "");
                CuentaDestinoDropDownList.DataTextField = "Descripcion";
                CuentaDestinoDropDownList.DataValueField = "CuentaId";
                CuentaDestinoDropDownList.DataBind();
                int id;
                Transferencias tran = new Transferencias();
                if (Request.QueryString["id"] != null)
                {
                   int.TryParse (Request.QueryString["id"].ToString(),out id);

                    if (id > 0)
                    {
                        if (!tran.Buscar(id))
                        {
                            Utilitarios.ShowToastr(this.Page, "Registro no encontrado.", "Error", "Error");
                            Limpiar();
                        }
                        else
                        {
                            Llenar(tran);
                        }

                    }
                }
            }

        }
All Usage Examples Of BLL.Transferencias::Buscar