protected void RefreshGrid(bool rebind)
 {
     RadGrid1.DataSource = CntInforme.GetProgramacionInformes(ctx);
     if (rebind)
     {
         RadGrid1.Rebind();
     }
 }
Exemplo n.º 2
0
    protected void btnLanzador_Click(object sender, EventArgs e)
    {
        int pT = 0; // primary total
        int pV = 0; // primary value
        int pP = 0; // primary percent

        int sT = 0; // secondary total
        int sV = 0; // secondary value
        int sP = 0; // secondary percent
        // this happens for every company
        RadProgressContext context = RadProgressContext.Current;

        sT = ctx.Empresas.Count();
        context.SecondaryTotal       = pT;
        context.CurrentOperationText = "Generando los informes y documentos...";
        string repodir = ConfigurationManager.AppSettings["Repositorio"];

        IList <NombreInforme> nombres = CntInforme.GetNombresDeInforme();

        pT = nombres.Count;
        foreach (Empresa empresa in ctx.Empresas)
        {
            sV++;
            sP = (int)(decimal)((sV / sT) * 100.0);
            context.SecondaryValue   = sV;
            context.SecondaryPercent = sP;
            // por cada instalacion hay que sacar el informe
            foreach (Instalacion instalacion in empresa.Instalaciones)
            {
                pV = 0;
                foreach (NombreInforme ninf in nombres)
                {
                    pV++;
                    pP = (int)(decimal)((pV / pT) * 100.0);
                    context.PrimaryValue   = pV;
                    context.PrimaryPercent = pP;

                    CntInforme.ElaborarInformesProgramados((DateTime)rdtFecha.SelectedDate, ninf.Informe, instalacion, repodir, ctx);
                }
            }
        }

        //Documentos de las Revisiones y Dispositivos por filtro

        foreach (Filtro filtro in usuario.Filtros)
        {
            if (filtro.Tipo == "Revision" || filtro.Tipo == "Dispositivo")
            {
                AplicarFiltro(filtro, filtro.Tipo);
                CrearInforme(filtro, repodir);
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["ProgramacionInformeId"] != null)
         {
             prgInf = CntInforme.GetProgramacionInforme(int.Parse(Request.QueryString["ProgramacionInformeId"]), ctx);
             CargaControles(prgInf);
         }
         else
         {
             CargaControles(null);
         }
     }
 }
    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
                {
                    ProgramacionInforme p = CntInforme.GetProgramacionInforme(id, ctx);
                    foreach (InformeProgramado ip in p.InformeProgramados)
                    {
                        ip.ProgramacionInforme = null;
                    }
                    CntLainsaSci.CTXEliminar(p, ctx);
                    CntLainsaSci.CTXGuardar(ctx);
                    RefreshGrid(true);
                }
                catch (Exception ex)
                {
                    ControlDeError(ex);
                }
                break;
            }
        }
    }
 protected void CargarInformes(string informe)
 {
     // limpiamos y cargamos
     rdcInforme.Items.Clear();
     foreach (NombreInforme ninf in CntInforme.GetNombresDeInforme())
     {
         rdcInforme.Items.Add(new RadComboBoxItem(ninf.Nombre, ninf.Informe));
     }
     if (informe != null)
     {
         rdcInforme.SelectedValue = informe;
     }
     else
     {
         rdcInforme.Items.Add(new RadComboBoxItem(" ", ""));
         rdcInforme.SelectedValue = "";
     }
 }