Exemplo n.º 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         List<ListItem> selectedItems = rblPerfiles.Items.ToList().Where(item => item.Selected == true).ToList();
         List<ROLUSUARIO> rolesAsignados = new List<ROLUSUARIO>();
         ROLUSUARIO rol = null;
         USUARIO usuarioSeleccionado=Session["UsuarioBuscado"] as USUARIO;
         IUsuarios negocio = new BusinessLogic();
         selectedItems.ForEach(item =>
         {
             rol = new ROLUSUARIO
             {
                 IDROLUSUARIO=Guid.NewGuid(),
                 IDROL=new Guid(item.Value),
                 IDUSUARIO = usuarioSeleccionado.IDUSUARIO
             };
             rolesAsignados.Add(rol);
         });
         negocio.AsignaUsuarioRol(rolesAsignados);
         Response.Redirect("~/ui/MantenimientoUsuarios.aspx");
     }
     catch (Exception ex)
     {
         MostrarError(ex.Message);
     }
 }
 protected void btnBorrarCiudad_Click(object sender, EventArgs e)
 {
     CheckBox chkBorrar = null;
     IUbicacion bdd = new BusinessLogic();
     UBICACIONGEOGRAFICA ubicacionTodelete = null;
     Ubicacion ubicacionSelected = null;
     List<Ubicacion> ciudades = Session["ciudades"] as List<Ubicacion>;
     List<UBICACIONGEOGRAFICA> regiones = bdd.GetRegiones();
     gridCiudades.Rows.ToList().ForEach(row =>
     {
         chkBorrar = row.FindControl("chkBorrar") as CheckBox;
         if (chkBorrar.Checked)
         {
             ubicacionSelected = ciudades.FirstOrDefault(x => x.Nombre == row.Cells[3].Text);
             ubicacionTodelete = new UBICACIONGEOGRAFICA
             {
                 IDUBICACION = ubicacionSelected.IdUbicacion,
                 NOMBREUBICACION = ubicacionSelected.Nombre,
                 ESBORRADOUBICACION = true,
                 IDPADRE = regiones.FirstOrDefault(x => x.NOMBREUBICACION == ubicacionSelected.Region) != null ? regiones.FirstOrDefault(x => x.NOMBREUBICACION == ubicacionSelected.Region).IDPADRE : null
             }.MarkAsModified();
             bdd.SaveUbicacion(ubicacionTodelete);
         }
     });
 }
Exemplo n.º 3
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         IUsuarios negocio = new BusinessLogic();
         USUARIO usuario = new USUARIO();
         UsuarioAutenticado respuesta = null;
         usuario.USUARIO1 = txtUsuario.Text;
         usuario.CLAVE = txtClave.Text.EncriptarMD5();
         respuesta = negocio.Autenticar(usuario);
         if (respuesta==null)
         {
             MostrarError("Usuario o contraseña no validos");
             return;
         }
         if (respuesta.Usuario.NOMBRECOMPLETO == Constants.NOMBRE_USUARION_ADMIN || (respuesta.Usuario.FechaCaducidad != null && respuesta.Usuario.FechaCaducidad.Value > DateTime.Now.Date))
         {
             Session.Add("Usuario", respuesta.Usuario);
             Session.Add("Menu", respuesta.Menu);
             Response.Redirect("~/ui/Entrada.aspx");
         }
         else
             throw new Exception("El usuario no esta vigente");
     }
     catch (Exception ex)
     {
         MostrarError(ex.Message);
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {

                IProductos bdd = new BusinessLogic();
                MovimientoProductos selectMovimiento = Session["selectMovimiento"] as MovimientoProductos;
                MOVIMIENTOSUBPRODUCTO moviento = selectMovimiento.Movimiento;
                HISTORICOPRECIO historico = selectMovimiento.Historico;
                moviento.CODIGOPRODUCTOLABORATORIO = txtCodigoProducto.Text;
                moviento.FECHALANZAMIENTO = (DateTime)wdpFechaLanzamiento.Value;
                moviento.ESNUEVO = chkEsNuevo.Checked;
                moviento = moviento.MarkAsModified();
                historico.PRECIO = decimal.Parse(txtPrecio.Text);
                historico = historico.MarkAsModified();
                bdd.SaveHistorico(historico);
                bdd.SaveMovimientoProducto(moviento);
                Response.Redirect("~/ui/MovimientoProducto.aspx");
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text = ex.Message;
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// carga los catalogos de la base de datos
 /// </summary>
 private void ConsultarCatalogo(Catalogos catalogo)
 {
     ICatalogos negocio = new BusinessLogic();
     List<CATALOGO> resultado = negocio.ObtenerCatalogo(catalogo);
     string nombrecatalogo="Catalogo" + catalogo.ToString().ToLower();
     Session.Add(nombrecatalogo, resultado);
 }
 protected void btnBorrarRegion_Click(object sender, EventArgs e)
 {
     CheckBox chkBorrar = null;
     List<Ubicacion> regiones = Session["regiones"] as List<Ubicacion>;
     List<UBICACIONGEOGRAFICA> paises = Session["paises"] as List<UBICACIONGEOGRAFICA>;
     UBICACIONGEOGRAFICA ubicacionTodelete = null;
     Ubicacion ubicacionSelected=null;
     IUbicacion bdd = new BusinessLogic();
     gridRegiones.Rows.ToList().ForEach(row =>
     {
         chkBorrar = row.FindControl("chkBorrar") as CheckBox;
         if (chkBorrar.Checked)
         {
             ubicacionSelected=regiones.FirstOrDefault(x => x.Nombre==row.Cells[3].Text);
             ubicacionTodelete = new UBICACIONGEOGRAFICA
             {
                 IDUBICACION = ubicacionSelected.IdUbicacion,
                 NOMBREUBICACION = ubicacionSelected.Nombre,
                 CATEGORIAUBICACION = Constants.TIPO_UBICACION_REGION,
                 ESBORRADOUBICACION = true,
                 IDPADRE = paises.FirstOrDefault(x => x.NOMBREUBICACION == ubicacionSelected.Pais) != null ? paises.FirstOrDefault(x => x.NOMBREUBICACION == ubicacionSelected.Pais).IDPADRE : null
             }.MarkAsModified();
             bdd.SaveUbicacion(ubicacionTodelete);
         }
     });
     Response.Redirect("~/ui/MantenimientoUbicacion.aspx");
 }
Exemplo n.º 7
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         ICorporaciones bdd = new BusinessLogic();
         objCorp = Session["selectedCorp"] as CORPORACION;
         if (objCorp == null)
             objCorp = new CORPORACION();
         else
         {
             objCorp = objCorp.MarkAsModified();
             Session.Remove("selectedCorp");
         }
         if (string.IsNullOrEmpty(txtNombre.Text)) throw new Exception("Escriba el nombre");
         if (string.IsNullOrEmpty(txtAbreviatura.Text)) throw new Exception("Escriba la abreviatura");
         objCorp.ABREVIATURACORPORACION = txtAbreviatura.Text;
         objCorp.NOMBRECORPORACION = txtNombre.Text;
         bdd.SaveCorporacion(objCorp);
         Response.Redirect("~/ui/MantenimientoCorpLab.aspx");
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
         lblError.Visible = true;
     }
 }
Exemplo n.º 8
0
 protected void btnPublicar_Click(object sender, EventArgs e)
 {
     try
     {
         List<LABORATORIO> laboratorios = Session["laboratorios"] as List<LABORATORIO>;
         Guid idLaboratorio = Guid.Empty;
         DateTime fechaInicio;
         IVentas bdd = new BusinessLogic();
         CheckBox chkPublicar = null;
         fechaInicio = (DateTime)Session["fechaInicio"];
         bdd.PublicarVentas(fechaInicio);
         GridCiclos.Rows.ToList().ForEach(row =>
         {
             chkPublicar = row.FindControl("chkPublicar") as CheckBox;
             if (chkPublicar.Checked)
             {
                 idLaboratorio = laboratorios.FirstOrDefault(lab => lab.NOMBRELABORATORIO == row.Cells[1].Text).IDLABORATORIO;
                 //if (fechaFin.Month != DateTime.Now.Month - 1) throw new Exception("Solo se puede publicar las ventas del ciclo actual");
                 bdd.ActualizarVentas(idLaboratorio, fechaInicio);
             }
         });
         GridCiclos.DataSource = null;
         GridCiclos.DataBind();
         Response.Redirect("~/ui/VerificarVentas.aspx");
     }
     catch (Exception ex)
     {
         lblError.Visible = true;
         lblError.Text = ex.Message;
     }
 }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                IProductos bdd = new BusinessLogic();
                MOVIMIENTOSUBPRODUCTO movimiento = new MOVIMIENTOSUBPRODUCTO();
                HISTORICOPRECIO historico = new HISTORICOPRECIO();
                movimiento.CODIGOSUBPRODUCTO = Guid.NewGuid();
                movimiento.IDSUBPRODUCTO = new Guid(ddlSubProducto.SelectedValue);
                movimiento.IDLABORATORIO = new Guid(ddlLaboratorios.SelectedValue);
                movimiento.ESNUEVO = chkEsNuevo.Checked;
                movimiento.FECHALANZAMIENTO = (DateTime)wdpFechaLanzamiento.Value;
                movimiento.CODIGOPRODUCTOLABORATORIO = txtCodigo.Text;

                historico.IDHISTORICOPRECIO = Guid.NewGuid();
                historico.CODIGOSUBPRODUCTO = movimiento.CODIGOSUBPRODUCTO;
                historico.FECHAHISTORICOPRECIO = DateTime.Now;
                historico.PRECIO = decimal.Parse(txtPrecio.Text);

                movimiento.HISTORICOPRECIO.Add(historico);

                bdd.SaveMovimientoProducto(movimiento);

                Response.Redirect("~/ui/MovimientoProducto.aspx");

            }
            catch (Exception ex)
            {

                lblError.Visible = true;
                lblError.Text = ex.Message;
            }
        }
Exemplo n.º 10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                IUbicacion bdd = new BusinessLogic();
                UBICACIONGEOGRAFICA objUbicacion = null;
                if (Session["paisSeleccionado"] != null)
                {
                    objUbicacion = Session["paisSeleccionado"] as UBICACIONGEOGRAFICA;
                    objUbicacion = objUbicacion.MarkAsModified();
                }
                else
                {
                    objUbicacion = new UBICACIONGEOGRAFICA();
                    objUbicacion.IDUBICACION = Guid.NewGuid();
                    objUbicacion = objUbicacion.MarkAsAdded();
                }

                objUbicacion.NOMBREUBICACION = txtNombre.Text;
                objUbicacion.CATEGORIAUBICACION = Constants.TIPO_UBICACION_PAIS;
                bdd.SaveUbicacion(objUbicacion);
                Response.Redirect("~/ui/MantenimientoUbicacion.aspx");
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text = ex.Message;
            }
        }
Exemplo n.º 11
0
 protected void btnBorrarPais_Click(object sender, EventArgs e)
 {
     CheckBox chkBorrar = null;
     UBICACIONGEOGRAFICA paisSeleccionado = null;
     List<UBICACIONGEOGRAFICA> paises = Session["paises"] as List<UBICACIONGEOGRAFICA>;
     IUbicacion bdd = new BusinessLogic();
     try
     {
         gridPaises.Rows.ToList().ForEach(row =>
         {
             chkBorrar = row.FindControl("chkBorrar") as CheckBox;
             if (chkBorrar.Checked)
             {
                 paisSeleccionado = paises.FirstOrDefault(x => x.NOMBREUBICACION == row.Cells[2].Text);
                 paisSeleccionado.ESBORRADOUBICACION = true;
                 paisSeleccionado = paisSeleccionado.MarkAsModified();
                 bdd.SaveUbicacion(paisSeleccionado);
             }
         });
         Response.Redirect("~/ui/MantenimientoUbicacion.aspx");
     }
     catch (Exception ex)
     {
         ShowErrorsPaises(ex.Message);
     }
 }
Exemplo n.º 12
0
 public void BorrarCatalogoTest()
 {
     BusinessLogic target = new BusinessLogic(); // TODO: Initialize to an appropriate value
     CATALOGO catalogo = null; // TODO: Initialize to an appropriate value
     target.BorrarCatalogo(catalogo);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Exemplo n.º 13
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (dtpCaducidad.Value == null) throw new Exception("Escoja una fecha");
         ILaboratorios bdd = new BusinessLogic();
         IUsuarios userBdd = new BusinessLogic();
         LABORATORIO laboratorioConsultado=bdd.ObtenerLaboratorioPorNombre(ddlLaboratorio.Text);
         USUARIO userToSave = new USUARIO
         {
             IDUSUARIO = Guid.NewGuid(),
             IDLABORATORIO = laboratorioConsultado != null ? laboratorioConsultado.IDLABORATORIO : Guid.Empty,
             NOMBRECOMPLETO = txtNombre.Text,
             USUARIO1 = txtUsuario.Text,
             FechaCreacion=DateTime.Now.Date,
             FechaCaducidad=(DateTime)dtpCaducidad.Value,
             CLAVE=txtClaveRepeat.Text.EncriptarMD5()
         };
         userBdd.CrearUsuario(userToSave);
         lblErrores.Visible = true;
         Response.Redirect("~/ui/MantenimientoUsuarios.aspx");
     }
     catch (Exception ex)
     {
         lblErrores.Visible = true;
         lblErrores.Text = ex.Message;
     }
 }
Exemplo n.º 14
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            LABORATORIO laboratorio = new LABORATORIO();
            ILaboratorios bdd = new BusinessLogic();
            ListaLaboratorio selectedLab = Session["selectedLab"] as ListaLaboratorio;
            if (Session["selectedLab"] != null)
            {
                laboratorio.IDLABORATORIO = selectedLab.IdLaboratorio;
                laboratorio = laboratorio.MarkAsModified();
            }
            else
            {
                laboratorio.IDLABORATORIO = Guid.NewGuid();
                laboratorio = laboratorio.MarkAsAdded();
            }

            Guid idCorporacion = new Guid(ddlCorporacion.SelectedValue);
            if (idCorporacion == Guid.Empty)
                laboratorio.IDCORPORACION = null;
            else
                laboratorio.IDCORPORACION = idCorporacion;

            laboratorio.IDUBICACION = new Guid(ddlUbicacion.SelectedValue);
            laboratorio.DIRECCION = txtDireccion1.Text;
            laboratorio.DIRECCION2 = txtDireccion2.Text;
            laboratorio.NOMBRELABORATORIO = txtNombre.Text;
            laboratorio.OBSERVACION = txtObservacion.Text;
            laboratorio.ORIGEN = ddlOrigen.Text;
            laboratorio.TELEFONO = txtTelefono.Text;
            laboratorio.ABREVIATURALABORATORIO = txtAbreviatura.Text;
            bdd.SaveLaboratorio(laboratorio);
            Response.Redirect("~/ui/MantenimientoCorpLab.aspx");
        }
Exemplo n.º 15
0
 /// <summary>
 /// Carga los laboratorios
 /// </summary>
 private void CargarLaboratorio()
 {
     ILaboratorios bdd = new BusinessLogic();
     _laboratorios = bdd.ObtenerLaboratorio();
     ddlLaboratorio.DataSource = _laboratorios;
     ddlLaboratorio.DataTextField = "NOMBRELABORATORIO";
     ddlLaboratorio.DataBind();
 }
Exemplo n.º 16
0
 private void CargarLaboratorios()
 {
     ILaboratorios bdd = new BusinessLogic();
     List<LABORATORIO> laboratorios = bdd.ObtenerLaboratorio();
     ddlLaboratorios.DataSource = laboratorios;
     ddlLaboratorios.DataTextField = "NOMBRELABORATORIO";
     ddlLaboratorios.DataValueField = "IDLABORATORIO";
     ddlLaboratorios.DataBind();
 }
Exemplo n.º 17
0
 private void CargarPaises()
 {
     IUbicacion bdd = new BusinessLogic();
     List<UBICACIONGEOGRAFICA> ubicaciones = bdd.GetPaises();
     ddlPais.DataSource = ubicaciones;
     ddlPais.DataTextField = "NOMBREUBICACION";
     ddlPais.DataValueField = "IDUBICACION";
     ddlPais.DataBind();
 }
Exemplo n.º 18
0
 private void CargarRegiones()
 {
     IUbicacion bdd = new BusinessLogic();
     List<UBICACIONGEOGRAFICA> ciudades = bdd.GetRegiones();
     ddlRegiones.DataSource = ciudades;
     ddlRegiones.DataTextField = "NOMBREUBICACION";
     ddlRegiones.DataValueField = "IDUBICACION";
     ddlRegiones.DataBind();
 }
Exemplo n.º 19
0
 private void LlenarComboMenus()
 {
     IMenus bdd = new BusinessLogic();
     List<MENU> menus = bdd.GetMenusSinPadres();
     ddlPadreMenu.DataSource = menus;
     ddlPadreMenu.DataTextField = "DESCRIPCIONMENU";
     ddlPadreMenu.DataValueField = "IDMENU";
     ddlPadreMenu.DataBind();
 }
Exemplo n.º 20
0
 /// <summary>
 /// Carga las ubicaciones
 /// </summary>
 private void CargarUbicacion()
 {
     IUbicacion bdd = new BusinessLogic();
     List<UBICACIONGEOGRAFICA> ciudades = bdd.GetCiudades();
     ddlUbicacion.DataSource = ciudades;
     ddlUbicacion.DataTextField = "NOMBREUBICACION";
     ddlUbicacion.DataValueField = "IDUBICACION";
     ddlUbicacion.DataBind();
     Session.Add("ciudades", ciudades);
 }
Exemplo n.º 21
0
 /// <summary>
 /// Carga las corporaciones
 /// </summary>
 private void CargarCorporacion()
 {
     ICorporaciones bdd = new BusinessLogic();
     List<CORPORACION> corporaciones = bdd.ObtenerCorporaciones();
     ddlCorporacion.DataSource = corporaciones;
     ddlCorporacion.DataTextField = "NOMBRECORPORACION";
     ddlCorporacion.DataValueField = "IDCORPORACION";
     ddlCorporacion.DataBind();
     Session.Add("corporaciones", corporaciones);
 }
Exemplo n.º 22
0
 protected void btnGuardar_Click(object sender, EventArgs e)
 {
     IUsuarios bdd = new BusinessLogic();
     USUARIO userToModify = Session["userToModify"] as USUARIO;
     userToModify.NOMBRECOMPLETO = txtNomCompleto.Text;
     userToModify.USUARIO1 = txtNomUsuario.Text;
     userToModify.FechaCaducidad = (DateTime)dtpCaducidad.Value;
     bdd.SaveUsuario(userToModify);
     Response.Redirect("~/ui/MantenimientoUsuarios.aspx");
 }
Exemplo n.º 23
0
 protected void btnObtenerSubProductos_Click(object sender, EventArgs e)
 {
     IProductos bdd = new BusinessLogic();
     Guid idSubProducto = new Guid(ddlProductos.SelectedValue);
     List<SubProductos> subProductos = bdd.GetSubProductsByProduct(idSubProducto);
     ddlSubProducto.DataSource = subProductos;
     ddlSubProducto.DataValueField = "IdSubProducto";
     ddlSubProducto.DataTextField = "Presentacion";
     ddlSubProducto.DataBind();
 }
Exemplo n.º 24
0
 public void CrearCatalogoTest()
 {
     BusinessLogic target = new BusinessLogic(); // TODO: Initialize to an appropriate value
     CATALOGO catalogo = new CATALOGO(); // TODO: Initialize to an appropriate value
     catalogo.IDCATALAGO = Guid.NewGuid();
     catalogo.DESCRIPCIONCATALOGO = "Catalogo Demo";
     catalogo.TABLA = "Demo";
     target.CrearCatalogo(catalogo);
     Assert.AreNotEqual(catalogo,new CATALOGO());
 }
Exemplo n.º 25
0
 private void CargarMenus()
 {
     IMenus bdd = new BusinessLogic();
     List<MENU> menus = bdd.GetMenusConPadres();
     menus.RemoveAt(0);
     menus = menus.OrderBy(x => x.DESCRIPCIONMENU).ToList();
     chkMenus.DataSource = menus;
     chkMenus.DataTextField = "DESCRIPCIONMENU";
     chkMenus.DataValueField = "IDMENU";
     chkMenus.DataBind();
 }
Exemplo n.º 26
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         IGrupoTerapeutico gruposbb = new BusinessLogic();
         grupos = gruposbb.GetGrupos();
         aplicacion = Session["Catalogo" + Catalogos.APLICACIONPRODUCTO.ToString().ToLower()] as List<CATALOGO>;
         formaProducto = Session["Catalogo" + Catalogos.FORMAPRODUCTO.ToString().ToLower()] as List<CATALOGO>;
         tipoMercado = Session["Catalogo" + Catalogos.TIPOMERCADO.ToString().ToLower()] as List<CATALOGO>;
         tipoProducto = Session["Catalogo" + Catalogos.TIPOPRODUCTO.ToString().ToLower()] as List<CATALOGO>;
         SubProductos subProductoSeleccionado = Session["subProductoSeleccionado"] as SubProductos;
         ISubProductos bdd = new BusinessLogic();
         SUBPRODUCTO subProducto = null;
         Guid idProducto = Guid.Empty;
         if (subProductoSeleccionado == null)
         {
             subProducto = new SUBPRODUCTO();
             subProducto.IDSUBPRODUCTO = Guid.NewGuid();
             subProducto = subProducto.MarkAsAdded();
             PRODUCTO selectedProduct = Session["selectedProduct"] as PRODUCTO;
             idProducto = selectedProduct.IDPRODUCTO;
         }
         else
         {
             subProducto = bdd.ObtenerSubProductoById(subProductoSeleccionado.IdSubProducto);
             subProducto = subProducto.MarkAsModified();
             idProducto = subProductoSeleccionado.IdProducto;
         }
         subProducto.IDPRODUCTO = idProducto;
         subProducto.IDGRUPO = grupos.FirstOrDefault(x => x.NOMBREGRUPOTER == ddlGrupoTerapeutico.SelectedValue).IDGRUPO;
         subProducto.IDAPLICACION = aplicacion.FirstOrDefault(x => x.DESCRIPCIONCATALOGO == ddlAplicacion.SelectedValue).IDCATALAGO;
         subProducto.IDFORMAPROD = formaProducto.FirstOrDefault(x => x.DESCRIPCIONCATALOGO == ddlForma.SelectedValue).IDCATALAGO;
         subProducto.IDTIPOMERCADO = tipoMercado.FirstOrDefault(x => x.DESCRIPCIONCATALOGO == ddlTipoMercado.SelectedValue).IDCATALAGO;
         subProducto.IDTIPOPRODUCTO = tipoProducto.FirstOrDefault(x => x.DESCRIPCIONCATALOGO == ddlTipoProducto.SelectedValue).IDCATALAGO;
         subProducto.PRESENTACION = txtPresentacion.Text;
         subProducto.CONCENTRACION = string.IsNullOrEmpty(txtConcentracion.Text) ? 0 : double.Parse(txtConcentracion.Text);
         subProducto.UNIDAD = txtUnidad.Text;
         subProducto.CANTIDAD = string.IsNullOrEmpty(txtCantidad.Text) ? short.Parse("0") : short.Parse(txtCantidad.Text);
         subProducto.PRINCIPIOACTIVO = txtPrincipio.Text;
         subProducto.INDICACIONESDEUSO = txtIndicaciones.Text;
         if (ValidarFormulario(subProducto))
             bdd.SaveSubProducto(subProducto);
         Response.Redirect("~/ui/MantenimientoProducto.aspx");
     }
     catch (Exception ex)
     {
         lblError.Visible = true;
         lblError.Text = ex.Message;
     }
 }
Exemplo n.º 27
0
 private void CargarRoles(bool loadFromSession)
 {
     List<ROL> roles = null;
     if (loadFromSession)
     {
         roles = Session["roles"] as List<ROL>;
     }
     else
     {
         IUsuarios bdd = new BusinessLogic();
         roles = bdd.ObtenerRoles();
         Session.Add("roles", roles);
     }
     GridRoles.DataSource = roles;
     GridRoles.DataBind();
 }
Exemplo n.º 28
0
 private void CargarGrid(bool loadFromSession)
 {
     List<MovimientoProductos> movimientos = null;
     if (loadFromSession)
     {
         movimientos = Session["movimientos"] as List<MovimientoProductos>;
     }
     else
     {
         IProductos bdd = new BusinessLogic();
         movimientos = bdd.GetMovimientoProductos();
         Session.Add("movimientos", movimientos);
     }
     GridMovimientos.DataSource = movimientos;
     GridMovimientos.DataBind();
 }
Exemplo n.º 29
0
 protected void btnBorrar_Click(object sender, EventArgs e)
 {
     CheckBox checkBorrado;
     IProductos bdd = new BusinessLogic();
     List<PRODUCTO> products = Session["products"] as List<PRODUCTO>;
     PRODUCTO selectedProduct = null;
     GridProducts.Rows.ToList().ForEach(row =>
     {
         checkBorrado = row.FindControl("chkBorrar") as CheckBox;
         if (checkBorrado.Checked)
         {
             selectedProduct = products.FirstOrDefault(product => product.NOMBREPRODUCTO == row.Cells[4].Text);
             selectedProduct.ESBORRADOPRODUCTO = true;
             bdd.SaveProducto(selectedProduct);
         }
     });
 }
Exemplo n.º 30
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ROL rol = null;
     IUsuarios bdd = new BusinessLogic();
     if (Session["rolSelected"] != null)
     {
         rol = Session["rolSelected"] as ROL;
         rol = rol.MarkAsModified();
     }
     else
     {
         rol = new ROL();
         rol.IDROL = Guid.NewGuid();
     }
     rol.DESCRIPCIONROL = txtDescripcion.Text;
     bdd.SaveRol(rol);
     Response.Redirect("~/ui/MantenimientoPerfiles.aspx");
 }