protected void rdcCategoria_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
 {
     if (e.Value != "")
     {
         Categoria categoria = CntLainsaSci.GetCategoria(int.Parse(e.Value), ctx);
         CargaSubcategorias(categoria);
     }
 }
Exemple #2
0
 string caller       = ""; // who's calling the grid form
 #endregion
 #region Init, load, unload events
 protected void Page_Init(object sender, EventArgs e)
 {
     // it gets an appropiate context (LainsaSciCTX -> web.config)
     ctx = new LainsaSci("LainsaSciCTX");
     // verify if a Usuario is logged
     Usuario = CntWinWeb.IsSomeoneLogged(this, ctx);
     if (Usuario == null)
     {
         Response.Redirect("Default.aspx");
     }
     else
     {
         Session["UsuarioId"] = Usuario.UsuarioId;
     }
     //
     permiso = CntLainsaSci.GetPermiso(Usuario.GrupoUsuario, "Subcategoriagrid", ctx);
     if (permiso == null)
     {
         RadNotification1.Text = String.Format("<b>{0}</b><br/>{1}",
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "Warning"),
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "NoPermissionsAssigned"));
         RadNotification1.Show();
         RadAjaxManager1.ResponseScripts.Add("closeWindow();");
     }
     CntWinWeb.TranslateRadGridFilters(RadGrid1);
     if (Request.QueryString["Mode"] != null)
     {
         mode = Request.QueryString["Mode"];
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     if (Request.QueryString["CategoriaId"] != null)
     {
         categoria = CntLainsaSci.GetCategoria(int.Parse(Request.QueryString["CategoriaId"]), ctx);
         if (categoria != null)
         {
             RadGrid1.Columns.FindByDataField("Categoria.Nombre").Visible = false;
         }
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }
 protected void Page_Init(object sender, EventArgs e)
 {
     // it gets an appropiate context (LainsaSciCTX -> web.config)
     ctx = new LainsaSci("LainsaSciCTX");
     // verify if a Usuario is logged
     usuario = CntWinWeb.IsSomeoneLogged(this, ctx);
     if (usuario == null)
     {
         Response.Redirect("Default.aspx");
     }
     else
     {
         Session["UsuarioId"] = usuario.UsuarioId;
     }
     //
     permiso = CntLainsaSci.GetPermiso(usuario.GrupoUsuario, "categoriagrid", ctx);
     if (permiso == null)
     {
         RadNotification1.Text = String.Format("<b>{0}</b><br/>{1}",
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "Warning"),
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "NoPermissionsAssigned"));
         RadNotification1.Show();
         RadAjaxManager1.ResponseScripts.Add("closeWindow();");
     }
     btnAccept.Visible = permiso.Modificar;
     // load the combo
     // Is it a new record or not?
     if (Request.QueryString["CategoriaId"] != null)
     {
         categoria = CntLainsaSci.GetCategoria(int.Parse(Request.QueryString["CategoriaId"]), ctx);
         LoadData(categoria);
         newRecord = false;
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        // we only process commands with a datasource (our image buttons)
        if (e.CommandSource == null)
        {
            return;
        }
        string typeOfControl = e.CommandSource.GetType().ToString();

        if (typeOfControl.Equals("System.Web.UI.WebControls.ImageButton"))
        {
            int         id   = 0;
            ImageButton imgb = (ImageButton)e.CommandSource;
            if (imgb.ID != "New" && imgb.ID != "Exit")
            {
                id = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][e.Item.OwnerTableView.DataKeyNames[0]].ToString());
            }
            switch (imgb.ID)
            {
            case "Select":
                break;

            case "Edit":
                break;

            case "Delete":
                try
                {
                    Categoria p = CntLainsaSci.GetCategoria(id, ctx);
                    CntLainsaSci.CTXEliminar(p, ctx);
                    CntLainsaSci.CTXGuardar(ctx);
                    RefreshGrid(true);
                }
                catch (Exception ex)
                {
                    ControlDeError(ex);
                }
                break;
            }
        }
    }
Exemple #5
0
    protected void CargarDocumentosCategoria(RadTreeNode node)
    {
        if (node.Category != "Categoria")
        {
            return;
        }
        Categoria categoria = CntLainsaSci.GetCategoria(int.Parse(node.Value), ctx);

        if (categoria == null)
        {
            return;
        }
        node.Nodes.Clear();
        foreach (Documento documento in CntLainsaSci.GetDocumentos(categoria, uex, ctx))
        {
            RadTreeNode childNode = new RadTreeNode(documento.Nombre);
            childNode.Category = "Documento";
            childNode.Value    = documento.DocumentoId.ToString();
            childNode.ImageUrl = "imagenes/document_16.png";
            node.Nodes.Add(childNode);
        }
    }
 protected void UnloadData(Documento documento)
 {
     documento.Nombre  = txtNombre.Text;
     documento.Empresa = CntLainsaSci.GetEmpresa(int.Parse(rdcEmpresa.SelectedValue), ctx);
     if (rdcInstalacion.SelectedValue != "")
     {
         documento.Instalacion = CntLainsaSci.GetInstalacion(int.Parse(rdcInstalacion.SelectedValue), ctx);
     }
     if (rdcTipo.SelectedValue != "")
     {
         documento.TipoDispositivo = CntLainsaSci.GetTipoDispositivo(int.Parse(rdcTipo.SelectedValue), ctx);
     }
     documento.Categoria = CntLainsaSci.GetCategoria(int.Parse(rdcCategoria.SelectedValue), ctx);
     if (rdcSubcategoria.SelectedValue != "")
     {
         documento.Subcategoria = CntLainsaSci.GetSubcategoria(int.Parse(rdcSubcategoria.SelectedValue), ctx);
     }
     if (dtFecha.SelectedDate != null)
     {
         documento.Fecha = (DateTime)dtFecha.SelectedDate;
     }
     documento.Comentarios = rdeComentarios.Content;
 }
 protected void Page_Init(object sender, EventArgs e)
 {
     // it gets an appropiate context (LainsaSciCTX -> web.config)
     ctx = new LainsaSci("LainsaSciCTX");
     // verify if a Usuario is logged
     uex = CntLainsaSci.GetUsuarioExtranet((int)Session["UsuarioExtranetId"], ctx);
     if (uex == null)
     {
         Response.Redirect("Default.aspx");
     }
     // si llega aquí está autorizado
     if (Request.QueryString["EmpresaId"] != null)
     {
         empresaId = int.Parse(Request.QueryString["EmpresaId"]);
         empresa   = CntLainsaSci.GetEmpresa(empresaId, ctx);
     }
     if (Request.QueryString["CategoriaId"] != null)
     {
         categoriaId = int.Parse(Request.QueryString["CategoriaId"]);
         categoria   = CntLainsaSci.GetCategoria(categoriaId, ctx);
     }
     if (Request.QueryString["InstalacionId"] != null)
     {
         instalacionId = int.Parse(Request.QueryString["InstalacionId"]);
         instalacion   = CntLainsaSci.GetInstalacion(instalacionId, ctx);
     }
     if (Request.QueryString["SubCategoriaId"] != null)
     {
         subCategoriaId = int.Parse(Request.QueryString["SubCategoriaId"]);
         subCategoria   = CntLainsaSci.GetSubcategoria(subCategoriaId, ctx);
     }
     if (Request.QueryString["REVISION"] != null)
     {
         revisables = true;
     }
 }
Exemple #8
0
 protected void UnloadData(Subcategoria Subcategoria)
 {
     Subcategoria.Nombre    = txtNombre.Text;
     Subcategoria.Categoria = CntLainsaSci.GetCategoria(int.Parse(rdcCategoria.SelectedValue), ctx);
 }