Exemplo n.º 1
0
        private void Buscar()
        {
            int total = 0;

            try
            {
                IChofer  chofer = ChoferFactory.GetChofer();
                DsChofer ds     = chofer.GetChoferesDataSet();

                string filtro = "LegajoSITT LIKE '" + this.legajo + "%' AND Nombre LIKE '" + this.nombre + "%'";
                DsChofer.DatosRow[] drLista = (DsChofer.DatosRow[])ds.Datos.Select(filtro);
                total = drLista.Length;

                if (total > 0)
                {
                    if (total == 1)
                    {
                        DsChofer.DatosRow dr = drLista[0];
                        this.txtLegajo.Text   = dr.LegajoSITT;
                        this.txtNombre.Text   = dr.Nombre;
                        this.txtChoferID.Text = dr.ChoferID.ToString();

                        this.txtErrorMsg.Text    = "";
                        this.txtOpen.Text        = "";
                        this.txtSoloLectura.Text = this.soloLectura;
                    }
                    else
                    {
                        this.txtLegajo.Text = this.legajo;
                        this.txtNombre.Text = this.nombre;

                        this.txtOpen.Text          = "S";
                        this.txtFiltro.Text        = this.filtroEspecial;
                        this.txtAgenciaActual.Text = this.agenciaActual;
                        this.txtSoloLectura.Text   = this.soloLectura;
                    }
                }
                else
                {
                    this.txtLegajo.Text      = "";
                    this.txtChoferID.Text    = "";
                    this.txtErrorMsg.Text    = "No se encontraron datos.";
                    this.txtOpen.Text        = "";
                    this.txtSoloLectura.Text = this.soloLectura;
                }
            }
            catch (Exception ex)
            {
                this.txtErrorMsg.Text = "Error al consultar datos de agencias: " + ex.Message;
            }
        }
        private void dtgChoferes_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                int indice = e.Item.DataSetIndex;
                BindGrid();

                DsChofer.DatosRow[] drLista = (DsChofer.DatosRow[])dtgChoferes.DataSource;

                if (drLista == null)
                {
                    return;
                }

                if (drLista.Length == 0)
                {
                    return;
                }

                DsChofer.DatosRow dr = drLista[indice];

                if (dr == null)
                {
                    return;
                }

                string legajo   = dr.LegajoSITT;
                string nombre   = dr.Nombre;
                int    choferID = dr.ChoferID;

                StringBuilder scriptString = new StringBuilder();
                scriptString.Append("<script language='javascript'>\n");
                scriptString.Append("window.dialogArguments.Legajo = '" + legajo.ToString() + "';\n");
                scriptString.Append("window.dialogArguments.Nombre = '" + nombre + "';\n");
                scriptString.Append("window.dialogArguments.ChoferID = '" + choferID + "';\n");
                scriptString.Append("window.returnValue = true;\n");
                scriptString.Append("window.close();\n");
                scriptString.Append("</script>");

                Page.RegisterClientScriptBlock("scriptModalChofer", scriptString.ToString());
            }
        }
Exemplo n.º 3
0
        public void Consultar()
        {
            DsChofer     ds        = new DsChofer();
            SqlParameter pChoferID = new SqlParameter("@ChoferID", this.ChoferID);

            if (ChoferID != 0)
            {
                Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure, "ChoferONE", pChoferID);
            }


            if (ds.Datos.Rows.Count > 0)
            {
                DsChofer.DatosRow dr = (DsChofer.DatosRow)ds.Datos.Rows[0];
                //if (dr.IsPrimerNombreNull())
                this.Nombre = dr.IsNombreNull()?"": dr.Nombre.Trim();
                //else
                //this.Nombre = dr.IsPrimerNombreNull()?"": dr.PrimerNombre;
                this.Apellido   = dr.IsApellidoNull() ? ""  : dr.Apellido;
                this.LegajoSITT = dr.LegajoSITT;
            }
        }