Beispiel #1
0
        private void TxbTipo_Leave(object sender, EventArgs e)
        {
            if (this.TxbTipo.Text.Trim().Length > 0)
            {
                SqlParameter[] Parametros_ConsultaTipo = new SqlParameter[4];
                Parametros_ConsultaTipo[0] = new SqlParameter("@Op", "TiposEspe");
                Parametros_ConsultaTipo[1] = new SqlParameter("@ParametroChar", this.TxbTipo.Text.Trim());
                Parametros_ConsultaTipo[2] = new SqlParameter("@ParametroInt", "0");
                Parametros_ConsultaTipo[3] = new SqlParameter("@ParametroNuemric", "0.0");

                ConsultaEntidades Maestro     = new ConsultaEntidades();
                Ent_TiposMineral  ReaderTipos = new Ent_TiposMineral();
                ReaderTipos = Maestro.TiposMineral("SpConsulta_Tablas", Parametros_ConsultaTipo);

                if (ReaderTipos.Codigo != null)
                {
                    this.TxbNombreTipo.Text = ReaderTipos.Nombre;
                    this.IdTipo             = ReaderTipos.Id;
                }
                else
                {
                    this.TxbTipo.Text       = "";
                    this.TxbNombreTipo.Text = "";
                }
            }

            #region Marcando los Check del arbol que cumplan la condicion
            if (this.TxbTipo.Text.Trim().Length > 0 && this.TxbOrigen.Text.Trim().Length > 0)
            {
                SqlParameter[] Parametros = new SqlParameter[4];
                Parametros[0] = new SqlParameter("@Op", "ConsultaTipoOrigen");
                Parametros[1] = new SqlParameter("@ParametroChar", "");
                Parametros[2] = new SqlParameter("@ParametroInt", this.IdTipo);
                Parametros[3] = new SqlParameter("@ParametroNuemric", this.IdOrigen);
                ConsultaEntidades Maestro = new ConsultaEntidades();
                List <Ent_RelacionTipoOrigenDestino> ListaTipo = new List <Ent_RelacionTipoOrigenDestino>();
                ListaTipo = Maestro.TipoOrigenDestino("SpConsulta_Tablas", Parametros);

                foreach (Ent_RelacionTipoOrigenDestino item in ListaTipo)
                {
                    string Tag       = item.CodigoDestino;
                    bool   EstadoTag = item.Estado;
                    foreach (TreeNode tree in this.TreeDestinos.Nodes)
                    {
                        if (tree.Tag.ToString().Trim() == Tag.Trim())
                        {
                            tree.Checked = EstadoTag;
                        }
                    }
                }
            }
            #endregion
        }