public void cargarListaFamilia(string query) { List <Familia> listaFamilia = FamiliaBLL.GetFamiliaListForSearch(query); if (listaFamilia.Count > 0) { errorFamilia.Visible = false; } else { errorFamilia.Visible = true; } ListaFamiliaGridView.DataSource = listaFamilia; ListaFamiliaGridView.DataBind(); }
public void cargarDatosFamilia() { Familia theData = null; bool existeImagen = false; try { theData = FamiliaBLL.GetFamiliaById(Convert.ToInt32(FamiliaIdHiddenField.Value)); if (theData == null) { Response.Redirect("~/Administracion/Inventario/Familia/ListaFamilia.aspx"); } if (theData.FamiliaId != 0) { descripcionTextBox.Text = theData.Descripcion; List <Imagen> listaImagen = ImagenBLL.GetImagenListForSearch(""); if (listaImagen.Count >= 0) { for (int i = 0; i < listaImagen.Count; i++) { if (listaImagen[i].ImagenId == theData.ImagenId) { SelecteImage.ImageUrl = "~/img/ImgRestaurante/" + listaImagen[i].Titulo; ImagenIdHiddenField.Value = listaImagen[i].ImagenId.ToString(); subirImagen.Visible = false; cancelarImagen.Visible = true; existeImagen = true; } } } if (!existeImagen) { cancelarImagen.Visible = false; } SaveFamiliaButton.Visible = false; UpdateFamiliaButton.Visible = true; } } catch { log.Error("Error al obtener la información de la familia"); } }
protected void ListaProductosGridView_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { string numeroIdFamilia = e.Row.Cells[7].Text; int id = Convert.ToInt32(numeroIdFamilia); Familia listaFamilia = FamiliaBLL.GetFamiliaById(id); e.Row.Cells[7].Text = listaFamilia.Descripcion; } } catch (Exception ex) { log.Error("Error al conseguir la descripcion de la familia", ex); } }
public List <IFamPat> UsuarioTraerPermisos(string email, int IdUsuario) { FamiliaBLL ManagerFamilia = new FamiliaBLL(); try { List <IFamPat> unasFamilias; //Primero traigo los permisos directos que tiene usuario (Familias y Patentes) unasFamilias = _DalUsuario.UsuarioTraerPermisos(email, IdUsuario); //Segundo veo si aquellos permisos (1), tienen subpermisos (Familias y/o Patentes) y los agrego. La variable unasFamilias se modifica en las funciones de la BLL y DAL directamente. ManagerFamilia.FamiliaTraerSubPermisos(unasFamilias); return(unasFamilias); } catch (Exception es) { ServicioLog.CrearLog(es, "UsuarioTraerPermisos", email, (IdUsuario).ToString()); throw; } }
public bool Autenticar(string[] losPermisosARevisar) { UsuarioEntidad usuarioAutenticado = new UsuarioEntidad(); usuarioAutenticado = (UsuarioEntidad)Current.Session["Usuario"]; if (usuarioAutenticado != null) { foreach (string unTag in losPermisosARevisar) { if (usuarioAutenticado.Permisos.Exists(x => x.NombreIFamPat == unTag)) { return(true); } } return(FamiliaBLL.BuscarPermiso(usuarioAutenticado.Permisos, losPermisosARevisar)); } return(false); }
public bool Autenticar(string elPermiso) { UsuarioEntidad usuarioAutenticado = new UsuarioEntidad(); usuarioAutenticado = (UsuarioEntidad)Current.Session["Usuario"]; string[] PermisosPagina = { elPermiso }; if (usuarioAutenticado != null) { if (usuarioAutenticado.Permisos.Exists(x => x.NombreIFamPat == elPermiso)) { return(true); } if (FamiliaBLL.BuscarPermiso(usuarioAutenticado.Permisos, PermisosPagina)) { return(true); } } return(false); }
protected void ListaFamiliaGridView_RowCommand(object sender, GridViewCommandEventArgs e) { int familiaId = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Eliminar") { try { FamiliaBLL.DeleteFamilia(familiaId); cargarListaFamilia(""); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorAlert", "alert('No se puede eliminar por que esta familia esta siendo utilizado');", true); log.Error("Error al eliminar la Familia con el id '" + familiaId + "'", ex); } } if (e.CommandName == "Editar") { Session["FamiliaId"] = familiaId; Response.Redirect("~/Administracion/Inventario/Familia/RegistrarFamilia.aspx"); } }
private void btnPermisoBuscar_Click_1(object sender, EventArgs e) { try { if (Convert.ToInt32(cbPermisosUsuario.SelectedValue) != 0) { DataTable dtPosee = new DataTable(); dtPosee.Columns.Add("Id"); dtPosee.Columns.Add("Nombre"); Usuario usuarioSelect = UsuarioBLL.GetAdapted(Convert.ToInt32(this.cbPermisosUsuario.SelectedValue)); //If (usuarioSelect.Nombre <> Me.User.Nombre) Then // usuarioSelect.GestionarPermisos() //End If foreach (Permiso idi in usuarioSelect.FamiliasFinales) { DataRow drPosee = dtPosee.NewRow(); drPosee[0] = idi.IdFamiliaElement; drPosee[1] = idi.Nombre; dtPosee.Rows.Add(drPosee); } this.listFamiliaContiene.DataSource = dtPosee; this.listFamiliaContiene.ValueMember = "Id"; this.listFamiliaContiene.DisplayMember = "Nombre"; DataTable dtNoPosee = new DataTable(); dtNoPosee.Columns.Add("Id"); dtNoPosee.Columns.Add("Nombre"); List <Familia> auxNoPosee = FamiliaBLL.GetAllAdapted(); // fijarse bien List <Familia> auxNP = new List <Familia>(); foreach (Familia anp in auxNoPosee) { bool existeFamilia = false; foreach (Permiso anf in usuarioSelect.FamiliasFinales) { if ((anp.Nombre == anf.Nombre)) { existeFamilia = true; } } if (!(existeFamilia)) { auxNP.Add(anp); } } auxNoPosee = auxNP; foreach (Familia idi in auxNoPosee) { DataRow drPosee = dtNoPosee.NewRow(); drPosee[0] = idi.IdFamiliaElement; drPosee[1] = idi.Nombre; dtNoPosee.Rows.Add(drPosee); } this.listFamiliaNoContiene.DataSource = dtNoPosee; this.listFamiliaNoContiene.ValueMember = "Id"; this.listFamiliaNoContiene.DisplayMember = "Nombre"; this.pnlFamilia.Enabled = true; //Patentes a cargar --> posee PAT DataTable dtPoseePAT = new DataTable(); dtPoseePAT.Columns.Add("Id"); dtPoseePAT.Columns.Add("Nombre"); DataRow drPoseePAT = dtPoseePAT.NewRow(); this.listPatenteContiene.DataSource = dtPoseePAT; this.listPatenteContiene.ValueMember = "Id"; this.listPatenteContiene.DisplayMember = "Nombre"; //Solo para cargar listbox de patentes que Posee actual DataTable dtPoseePATAct = new DataTable(); dtPoseePATAct.Columns.Add("Id"); dtPoseePATAct.Columns.Add("Nombre"); foreach (Permiso idi in usuarioSelect.PatentesFinales) { DataRow drTienePAT = dtPoseePATAct.NewRow(); drTienePAT[0] = idi.IdFamiliaElement; drTienePAT[1] = idi.Nombre; dtPoseePATAct.Rows.Add(drTienePAT); } this.listPatenteContieneACT.DataSource = dtPoseePATAct; this.listPatenteContieneACT.ValueMember = "Id"; this.listPatenteContieneACT.DisplayMember = "Nombre"; //Patentes que NO Posee y estan Disponibles(Todas las patentes) DataTable dtNoPoseePAT = new DataTable(); dtNoPoseePAT.Columns.Add("Id"); dtNoPoseePAT.Columns.Add("Nombre"); List <Patente> auxNoPoseePAT = PatenteBLL.GetAllAdapted(); // fijarse bien List <Patente> auxNPPAT = new List <Patente>(); foreach (Patente anpPAT in auxNoPoseePAT) { bool existeFamilia = false; foreach (Familia anfPAT in usuarioSelect.FamiliasFinales) { if ((anpPAT.Nombre == anfPAT.Nombre)) { existeFamilia = true; } } if (!(existeFamilia)) { auxNPPAT.Add(anpPAT); } } auxNoPoseePAT = auxNPPAT; foreach (Patente idi in auxNoPoseePAT) { DataRow drNOPoseePAT = dtNoPoseePAT.NewRow(); drNOPoseePAT[0] = idi.IdFamiliaElement; drNOPoseePAT[1] = idi.Nombre; dtNoPoseePAT.Rows.Add(drNOPoseePAT); } this.listPatenteNoContiene.DataSource = dtNoPoseePAT; this.listPatenteNoContiene.ValueMember = "Id"; this.listPatenteNoContiene.DisplayMember = "Nombre"; //cargar el puesto que ocupa this.tbSector.Text = usuarioSelect.Sector.Descripcion; } else { MessageBox.Show("Seleccione un usuario.", "Residica", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); //MessageBox.Show(MsgSeleccioneUsuario, MsgInforme); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Residica", MessageBoxButtons.OK, MessageBoxIcon.Error); } }