protected void Guardar(object sender, EventArgs e)
        {
            int idCategoria = 0;

            if (ddlCategoriaAdd.SelectedValue == "Otro")
            {
                categoria nuevo = new categoria()
                {
                    nombre      = txtCatAddOtro.Text,
                    descripcion = txtCatAddOtro.Text,
                    id_empresa  = ObjUsuario.Id_empresa
                };

                Capa_Datos.CRUD.Add_Fila(nuevo);

                List <categoria> ListaCategoria = new List <categoria>();
                ListaCategoria = Mgr_Categoria.Get_Categoria(txtCatAddOtro.Text);

                foreach (var item in ListaCategoria)
                {
                    idCategoria = item.id_categorias;
                }
            }
            else
            {
                idCategoria = Convert.ToInt32(ddlCategoriaAdd.SelectedValue);
            }

            int IdUsuario = 0;

            if (ObjUsuario.isResponsable())
            {
                IdUsuario = ObjUsuario.Id_usuario;
            }
            else
            {
                IdUsuario = Convert.ToInt32(ddlUsuAdd.SelectedValue);
            }

            alarma nuevoAlarma = new alarma()
            {
                descripcion   = txtDescripcion.Text,
                fecha         = Convert.ToDateTime(txtFecha.Text),
                prioridad     = ddlPrioridadAdd.SelectedValue,
                id_categorias = idCategoria,
                id_usuario    = IdUsuario
            };

            ObjUsuario.Error = Capa_Datos.CRUD.Add_Fila(nuevoAlarma);

            Modal.MostrarAlertaAdd(phAlerta, divAlerta, lbAlerta, ObjUsuario.Error, txtBuscar);
            CargarListas();
            LlenarGridView();
        }
 protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
 {
     if (ObjUsuario != null)
     {
         if (ObjUsuario.isAdmEmp_DptoSeg() || ObjUsuario.isAdmEmp_DptoSalud())
         {
             GridView1.Columns[4].Visible = false;
             GridView1.Columns[5].Visible = false;
         }
         if (ObjUsuario.isAdm_SucSeg() || ObjUsuario.isAdm_SucSalud() || ObjUsuario.isResponsable())
         {
             GridView1.Columns[4].Visible = false;
             GridView1.Columns[5].Visible = false;
         }
     }
 }
 protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
 {
     ObjUsuario = Utilidades.ValidarSesion(HttpContext.Current.User.Identity as FormsIdentity, this);
     if (ObjUsuario.isAdmEmp_DptoSeg() || ObjUsuario.isAdm_SucSeg() || ObjUsuario.isAdmEmp_DptoSalud() ||
         ObjUsuario.isAdm_SucSalud() || ObjUsuario.isResponsable())
     {
         if (e.Row.RowType == DataControlRowType.Header)
         {
             e.Row.Cells[5].Visible = false;
             e.Row.Cells[6].Visible = false;
         }
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             e.Row.Cells[5].Visible = false;
             e.Row.Cells[6].Visible = false;
         }
     }
 }
        private void LlenarGridView()
        {
            int IdEmpresa  = Mgr_Empresa.Set_IdEmpresa(ObjUsuario, Convert.ToInt32(ViewState["empresa"]));
            int IdSucursal = Mgr_Sucursal.Set_IdSucursal(ObjUsuario, Convert.ToInt32(ViewState["sucursal"]));
            int IdUsuario  = 0;

            if (ObjUsuario.isResponsable())
            {
                IdUsuario = ObjUsuario.Id_usuario;
            }

            Mgr_GestionLaboral.Grid_GestionLaboral(GridView1,
                                                   IdEmpresa,
                                                   IdSucursal,
                                                   Convert.ToInt32("0" + ViewState["TipoGestion"]),
                                                   string.Empty + ViewState["FechaInicio"],
                                                   string.Empty + ViewState["FechaFin"],
                                                   string.Empty + ViewState["search"],
                                                   IdUsuario);
        }
        protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (ObjUsuario != null)
            {
                if (ObjUsuario.isAdm_Sucursal())
                {
                    #region codigo

                    if (e.Row.RowType == DataControlRowType.Header)
                    {
                        e.Row.Cells[5].Visible = false;
                    }
                    if (e.Row.RowType == DataControlRowType.DataRow)
                    {
                        e.Row.Cells[1].RowSpan = 3;
                        e.Row.Cells[5].Visible = false;
                    }
                    #endregion
                }
                if (ObjUsuario.isAdmEmp_DptoSalud() || ObjUsuario.isAdmEmp_DptoSeg() || ObjUsuario.isAdm_SucSalud() ||
                    ObjUsuario.isAdm_SucSeg() || ObjUsuario.isResponsable())
                {
                    #region codigo
                    if (e.Row.RowType == DataControlRowType.Header)
                    {
                        e.Row.Cells[4].Visible = false;
                        e.Row.Cells[5].Visible = false;
                    }
                    if (e.Row.RowType == DataControlRowType.DataRow)
                    {
                        e.Row.Cells[4].Visible = false;
                        e.Row.Cells[5].Visible = false;
                    }
                    #endregion
                }
            }
        }
 protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
 {
     if (ObjUsuario != null)
     {
         if (ObjUsuario.isAdm_Sucursal() || ObjUsuario.isAdm_SucSalud() || ObjUsuario.isAdm_SucSeg() || ObjUsuario.isResponsable())
         {
             #region codigo
             GridView1.Columns[4].Visible = false;
             GridView1.Columns[5].Visible = false;
             #endregion
         }
     }
 }
Exemple #7
0
        public static int Set_IdSucursal(Model_UsuarioSistema ObjUsuario, int valor)
        {
            int IdSucursal = 0;

            if (ObjUsuario.isAdm_Sucursal() || ObjUsuario.isAdm_SucSeg() || ObjUsuario.isAdm_SucSalud() || ObjUsuario.isResponsable())
            {
                IdSucursal = ObjUsuario.Id_sucursal;
            }
            else
            {
                IdSucursal = valor;
            }

            return(IdSucursal);
        }
 protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
 {
     if (ObjUsuario != null)
     {
         if (ObjUsuario.isAdmEmp_DptoSalud() || ObjUsuario.isAdm_SucSalud() || ObjUsuario.isResponsable())
         {
             if (e.Row.RowType == DataControlRowType.Header)
             {
                 e.Row.Cells[6].Visible  = false;
                 e.Row.Cells[8].Visible  = false;
                 e.Row.Cells[9].Visible  = false;
                 e.Row.Cells[10].Visible = false;
             }
             if (e.Row.RowType == DataControlRowType.DataRow)
             {
                 e.Row.Cells[6].Visible  = false;
                 e.Row.Cells[8].Visible  = false;
                 e.Row.Cells[9].Visible  = false;
                 e.Row.Cells[10].Visible = false;
             }
         }
     }
 }