예제 #1
0
        private void btnGrabar_Click(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            try
            {
                ICategoriaPerfil categoriaPerfil = CategoriaPerfilFactory.GetCategoriaPerfil();

                categoriaPerfil.CategoriaPerfilID = Utiles.Validaciones.obtieneEntero(this.txtCategoriaPerfilID.Text);
                categoriaPerfil.Descripcion       = this.txtCategoria.Text;

                categoriaPerfil.Guardar();

                this.txtCategoria.Text         = "";
                this.txtCategoriaPerfilID.Text = "";
                BindGrid(0);
            }
            catch (Exception ex)
            {
                ((SisPacK.ErrorWeb) this.phErrores.Controls[0]).setMensaje(ex.Message);
            }
        }
예제 #2
0
        private void LlenarCombo()
        {
            // obtengo todas las categorias y lleno el combo
            ICategoriaPerfil categoriaPerfil = CategoriaPerfilFactory.GetCategoriaPerfil();

            this.cmbCategoria.DataSource = categoriaPerfil.GetCategoriaPerfilByDescripcionDataSet();
            this.cmbCategoria.DataBind();
            this.cmbCategoria.Items.Insert(0, new ListItem("Todos", "0"));
        }
예제 #3
0
        private void LlenarCombos()
        {
            // obtengo todas las categorias y lleno el combo
            ICategoriaPerfil categoriaPerfil = CategoriaPerfilFactory.GetCategoriaPerfil();

            this.cmbCategoriaPerfil.DataSource = categoriaPerfil.GetCategoriaPerfilByDescripcionDataSet();;
            this.cmbCategoriaPerfil.DataBind();

            // obtengo todos los estados y lleno el combo
            IEstadoUsuarioPerfil  estadoUsuarioPerfil = EstadoUsuarioPerfilFactory.GetEstadoUsuarioPerfil();
            DsEstadoUsuarioPerfil ds = estadoUsuarioPerfil.GetEstadoUsuarioPerfilDataSet();

            this.cmbEstado.DataSource = ds.Datos.Select("EstadoUsuarioPerfilID <> 3", "Descripcion");
            this.cmbEstado.DataBind();
        }
예제 #4
0
        private void BindGrid(int currentPage)
        {
            // configuro la grilla como chica, con el campo clave ChoferID
            SisPackController.AdministrarGrillas.Configurar(grdCategoriaPerfil, "CategoriaPerfilID", 10);

            // creo un objeto Pais
            ICategoriaPerfil categoriaPerfil = CategoriaPerfilFactory.GetCategoriaPerfil();

            // seteo los datos que estan en la pagina
            categoriaPerfil.Descripcion = this.txtCategoria.Text;

            // consulto los equipos que coincidan con el id ingresado
            grdCategoriaPerfil.DataSource = categoriaPerfil.GetCategoriaPerfilByDescripcionDataSet();

            // actualizo la grilla
            grdCategoriaPerfil.CurrentPageIndex = currentPage;
            grdCategoriaPerfil.DataBind();
        }
예제 #5
0
        private void grdCategoriaPerfil_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            // creo el objeto categoriaPerfil
            this.txtCategoria.Text = "";
            BindGrid(0);
            ICategoriaPerfil categoriaPerfil = CategoriaPerfilFactory.GetCategoriaPerfil();

            categoriaPerfil.CategoriaPerfilID = Convert.ToInt32(grdCategoriaPerfil.DataKeys[(int)e.Item.ItemIndex]);

            DsCategoriaPerfil ds = (DsCategoriaPerfil)grdCategoriaPerfil.DataSource;

            DsCategoriaPerfil.DatosRow[] dr = (DsCategoriaPerfil.DatosRow[])ds.Datos.Select("CategoriaPerfilID = " + categoriaPerfil.CategoriaPerfilID);

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

            this.txtCategoriaPerfilID.Text = dr[0].CategoriaPerfilID.ToString();
            this.txtCategoria.Text         = dr[0].Descripcion;
        }
예제 #6
0
        private void grdCategoriaPerfil_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            this.BindGrid(0);
            // Obtengo el dataset de la grilla
            DsCategoriaPerfil ds = (DsCategoriaPerfil)grdCategoriaPerfil.DataSource;

            // Obtengo la fila que se va a eliminar
            DsCategoriaPerfil.DatosRow dr = (DsCategoriaPerfil.DatosRow)ds.Datos.Rows[e.Item.DataSetIndex];
            // Creo el objeto y le seteo el id
            ICategoriaPerfil categoriaPerfil = CategoriaPerfilFactory.GetCategoriaPerfil();

            categoriaPerfil.CategoriaPerfilID = dr.CategoriaPerfilID;
            // Lo elimino
            try
            {
                categoriaPerfil.Eliminar();
            }
            catch (Exception ex)
            {
                ((ErrorWeb)phErrores.FindControl("Error")).setMensaje(TraducirTexto(ex.Message));
            }
            // Actualizo la grilla
            this.BindGrid(0);
        }