Example #1
0
 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;
     }
     //
     // si llega aquí está autorizado
     permiso = CntLainsaSci.GetPermiso(usuario.GrupoUsuario, "Dispositivogrid", 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;
     // Si esto no va antes de DispositivoID tendrás problemas.
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
         caller = caller.Replace("'", "");
     }
     // Mirar si se ha pasado una Instalacion
     if (Request.QueryString["RevisionId"] != null)
     {
         instalacion = CntLainsaSci.GetInstalacion(int.Parse(Request.QueryString["RevisionId"]), ctx);
         CargarInstalaciones(instalacion);
     }
     else
     {
         CargarInstalaciones(null);
     }
     if (Request.QueryString["DispositivoPadreId"] != null)
     {
         dispositivoPadre = CntLainsaSci.GetDispositivo(int.Parse(Request.QueryString["DispositivoPadreId"]), ctx);
         instalacion      = CntLainsaSci.GetInstalacion(dispositivoPadre.Instalacion.InstalacionId, ctx);
         CargaInstalacion(instalacion);
     }
     // Is it a new record or not?
     if (Request.QueryString["DispositivoId"] != null)
     {
         dispositivo      = CntLainsaSci.GetDispositivo(int.Parse(Request.QueryString["DispositivoId"]), ctx);
         dispositivoPadre = dispositivo.DispositivoPadre;
         // comprobamos los resumenes
         CntLainsaSci.CrearResumenesRevision(dispositivo, ctx);
         LoadData(dispositivo);
         newRecord = false;
     }
     else
     {
         CargarFunciones(null);
         CargarEstados(null);
         CargarTipos(0);
         //CargarModelos(0); // de momento los modelos dependen de los tipos
         CargarFabricantes(0);
         CargarAgentesExtintores(0);
         if (instalacion == null && usuario.Instalacion != null)
         {
             instalacion = usuario.Instalacion;
             CargaInstalacion(instalacion);
         }
     }
     if (Request.QueryString["Modo"] != null)
     {
         modo = Request.QueryString["Modo"];
         if (modo == "S")
         {
             // en silencio
             btnAccept.Visible = false;
         }
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }
Example #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;
     }
     // si llega aquí está autorizado
     permiso = CntLainsaSci.GetPermiso(usuario.GrupoUsuario, "dispositivogrid", ctx);
     //usuario.GrupoTrabajo = CntLainsaSci.GetGrupoTrabajo(1, 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["InTab"] != null)
     {
         mode = Request.QueryString["InTab"];
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     if (Request.QueryString["DispositivoId"] != null)
     {
         dispositivo = CntLainsaSci.GetDispositivo(int.Parse(Request.QueryString["DispositivoId"]), ctx);
         if (dispositivo != null)
         {
             RadGrid1.Columns.FindByDataField("dispositivo.Nombre").Visible = false;
         }
     }
     if (Request.QueryString["ProgramaId"] != null)
     {
         programa = CntLainsaSci.GetPrograma(int.Parse(Request.QueryString["ProgramaId"]), ctx);
         if (programa != null)
         {
             // Modificar la altura del grid para que quepan otros
             RadGrid1.PageSize       = 7;
             RadGrid1.ShowGroupPanel = false;
         }
     }
     if (Request.QueryString["InFrame"] != null)
     {
         if (Request.QueryString["InFrame"] == "S")
         {
             crear = false;
         }
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }
    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;
        }
        // si llega aquí está autorizado
        permiso = CntLainsaSci.GetPermiso(Usuario.GrupoUsuario, "DispositivoGrid", 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();");
        }
        if (Request.QueryString["Mode"] != null)
        {
            mode = Request.QueryString["Mode"];
        }
        if (Request.QueryString["Caller"] != null)
        {
            caller = Request.QueryString["Caller"];
            if (caller.Equals("DispositivoTab"))
            {
                RadTabStrip1.Tabs[1].Visible = false;
                this.Title = String.Format("Accesorio");
            }
        }
        if (Request.QueryString["DispositivoId"] != null)
        {
            dispositivoId = int.Parse(Request.QueryString["DispositivoId"]);
            Dispositivo dispositivo = CntLainsaSci.GetDispositivo(dispositivoId, ctx);
            if (caller.Equals("DispositivoTab"))
            {
                this.Title = String.Format("Accesorio: {0}", dispositivo.Nombre);
            }
            else
            {
                this.Title = String.Format("Dispositivo: {0}", dispositivo.Nombre);
            }
        }
        else
        {
            CntWinWeb.OcultarPestanyas(RadTabStrip1);
        }
        if (Request.QueryString["InstalacionId"] != null)
        {
            instalacionId = int.Parse(Request.QueryString["InstalacionId"]);
        }

        if (Request.QueryString["DispositivoPadreId"] != null)
        {
            dispositivoPadreId = int.Parse(Request.QueryString["DispositivoPadreId"]);
        }
    }
    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;
        }
        if (Request.QueryString["Informe"] != null)
        {
            informe = Request.QueryString["Informe"];
        }

        if (Request.QueryString["ProgramaId"] != null)
        {
            programa = CntLainsaSci.GetPrograma(int.Parse(Request.QueryString["ProgramaId"]), ctx);
            if (programa != null)
            {
                switch (informe)
                {
                case "RptPrograma2":
                    RptPrograma2 rptPrograma2 = new RptPrograma2(programa.ProgramaId, ctx);
                    ReportViewer1.Report = rptPrograma2;
                    break;

                case "RptRevisionFormulario":
                    RptRevisionFormulario rptRF = new RptRevisionFormulario(programa, ctx);
                    ReportViewer1.Report = rptRF;
                    break;
                }
            }
            newRecord = false;
        }
        if (Request.QueryString["EmpresaId"] != null)
        {
            empresa = CntLainsaSci.GetEmpresa(int.Parse(Request.QueryString["EmpresaId"]), ctx);
            if (empresa != null)
            {
                desdeFecha = DateTime.Parse(Request.QueryString["DesdeFecha"]);
                hastaFecha = DateTime.Parse(Request.QueryString["HastaFecha"]);
                switch (informe)
                {
                case "RptResumenEmpresaInstalacion":
                    RptResumenEmpresaInstalacion rpt = new RptResumenEmpresaInstalacion(desdeFecha, hastaFecha, empresa.EmpresaId, -1, ctx);
                    ReportViewer1.Report = rpt;
                    break;

                case "RptFacturableEmpresaInstalacion":
                    RptFacturableEmpresaInstalacion rpt2 = new RptFacturableEmpresaInstalacion(desdeFecha, hastaFecha, empresa.EmpresaId, -1, ctx);
                    ReportViewer1.Report = rpt2;
                    break;
                }
            }
        }
        // control de skin
        if (Session["Skin"] != null)
        {
            RadSkinManager1.Skin = Session["Skin"].ToString();
        }
    }
Example #5
0
 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;
         CargaOperario(Usuario);
     }
     //
     // si llega aquí está autorizado
     permiso = CntLainsaSci.GetPermiso(Usuario.GrupoUsuario, "RevisionGrid", 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;
     if (Request.QueryString["InTab"] != null)
     {
         inTab = Request.QueryString["InTab"];
     }
     // Si esto no va antes de RevisionID tendrás problemas.
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
         caller = caller.Replace("'", "");
     }
     if (Request.QueryString["DispositivoId"] != null)
     {
         dispositivo         = CntLainsaSci.GetDispositivo(int.Parse(Request.QueryString["DispositivoId"]), ctx);
         txtDispositivo.Text = dispositivo.Nombre;
     }
     // Is it a new record or not?
     if (Request.QueryString["RevisionId"] != null)
     {
         revision    = CntLainsaSci.GetRevision(int.Parse(Request.QueryString["RevisionId"]), ctx);
         dispositivo = revision.Dispositivo;
         LoadData(revision);
         this.Title = String.Format("Revision: ");
         newRecord  = false;
     }
     else
     {
         CargarTiposAnomalia(null);
     }
     if (Request.QueryString["Modo"] != null)
     {
         modo = Request.QueryString["Modo"];
         if (modo == "S")
         {
             // en silencio
             btnAccept.Visible      = false;
             btnSustitucion.Visible = false;
         }
     }
     //if (revision.Estado == "PROGRAMADA")
     //    crearPlantilla();
     //else if (revision.Estado == "REALIZADA")
     //    cargarPlantilla();
     cargarPlantilla();
 }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     CntWinWeb.TranslateRadGridFilters(RadGrid1);
 }
    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;
        }
        //
        // si llega aquí está autorizado
        permiso = CntLainsaSci.GetPermiso(usuario.GrupoUsuario, "repositoriotmpform", 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;
        if (Request.QueryString["InTab"] != null)
        {
            inTab = Request.QueryString["InTab"];
        }
        // Si esto no va antes de DocumentoID tendrás problemas.
        if (Request.QueryString["Caller"] != null)
        {
            caller = Request.QueryString["Caller"];
            caller = caller.Replace("'", "");
        }
        // Mirar si se ha pasado una empresa
        if (Request.QueryString["EmpresaId"] != null)
        {
            empresa = CntLainsaSci.GetEmpresa(int.Parse(Request.QueryString["EmpresaId"]), ctx);
            CargaEmpresa(empresa);
        }
        if (Request.QueryString["InstalacionId"] != null)
        {
            instalacion = CntLainsaSci.GetInstalacion(int.Parse(Request.QueryString["InstalacionId"]), ctx);
            CargaInstalacion(instalacion);
        }
        if (Request.QueryString["TipoDispositivoId"] != null)
        {
            tipo = CntLainsaSci.GetTipoDispositivo(int.Parse(Request.QueryString["TipoDispositivoId"]), ctx);
            CargaTipo(tipo);
        }
        if (Request.QueryString["Nombre"] != null)
        {
            nombre = Request.QueryString["Nombre"];
            nombre.Replace("'", "");
            fileName = nombre;
        }
        // MIrar si se ha pasado una instalacion
        if (Request.QueryString["RevisionId"] != null)
        {
            instalacion = CntLainsaSci.GetInstalacion(int.Parse(Request.QueryString["RevisionId"]), ctx);
            CargaInstalacion(instalacion);
        }

        // Is it a new record or not?
        if (Request.QueryString["DocumentoId"] != null)
        {
            documento = CntLainsaSci.GetDocumento(int.Parse(Request.QueryString["DocumentoId"]), ctx);
            LoadData(documento);
            this.Title = String.Format("Documento: {0}", documento.Nombre);
            newRecord  = false;
        }
        else
        {
            // cunado se crea uno nuevo se cargan todas las categorias
            CargaCategorias();
            txtNombre.Text = fileName;
        }
        if (Request.QueryString["FileName"] != null)
        {
            fileName = Request.QueryString["FileName"];
            //CargaAutomatica(fileName);
        }
        // control de skin
        if (Session["Skin"] != null)
        {
            RadSkinManager1.Skin = Session["Skin"].ToString();
        }
    }
Example #8
0
    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;
        }
        if (Request.QueryString["Informe"] != null)
        {
            informe = Request.QueryString["Informe"];
            switch (informe)
            {
            case "RptInventario":
                RptInventario rptInventario = new RptInventario();
                this.Title = "Inventario por instalacion";
                if (usuario.Empresa != null)
                {
                    rptInventario.ReportParameters["Empresa"].Value   = usuario.Empresa.EmpresaId;
                    rptInventario.ReportParameters["Empresa"].Visible = false;
                }
                ReportViewer1.Report = rptInventario;
                break;

            case "RptIncidenciaEmpresa":
                RptIncidenciaEmpresa rptIncidenciaEmpresa = new RptIncidenciaEmpresa();
                this.Title = "Incidencias por empresa";
                if (usuario.Empresa != null)
                {
                    rptIncidenciaEmpresa.ReportParameters["Empresa"].Value   = usuario.Empresa.EmpresaId;
                    rptIncidenciaEmpresa.ReportParameters["Empresa"].Visible = false;
                }
                ReportViewer1.Report = rptIncidenciaEmpresa;
                break;
            }
        }
        if (Request.QueryString["Observaciones"] != null)
        {
            observaciones = Request.QueryString["Observaciones"];
        }
        if (Request.QueryString["FechaActa"] != null)
        {
            fechaActa = DateTime.Parse(Request.QueryString["FechaActa"]);
        }
        if (Request.QueryString["ActaNumero"] != null)
        {
            actaNumero = Request.QueryString["ActaNumero"];
        }
        if (Request.QueryString["TecnicoResponsable"] != null)
        {
            Usuario usu = CntLainsaSci.GetUsuario(int.Parse(Request.QueryString["TecnicoResponsable"]), ctx);
            tecnicoResponsable = usu.Nombre;
        }
        if (Request.QueryString["InstalacionId"] != null)
        {
            instalacion = CntLainsaSci.GetInstalacion(int.Parse(Request.QueryString["InstalacionId"]), ctx);
            if (instalacion == null)
            {
                empresa = CntLainsaSci.GetEmpresa(int.Parse(Request.QueryString["EmpresaId"]), ctx);
            }

            if (instalacion != null || empresa != null)
            {
                switch (informe)
                {
                case "RptActa":
                    // este informe es especial y en realidad es un book
                    Plantilla    plantilla        = CntLainsaSci.GetPlantilla(1, ctx); // la primera plantilla es la de acta.
                    string       numeroAutorizado = ConfigurationManager.AppSettings["NumeroAutorizado"];
                    string       contenido        = String.Format(plantilla.Contenido, numeroAutorizado, tecnicoResponsable, actaNumero, fechaActa);
                    ReportBook   reportBook       = new ReportBook();
                    RptCartaActa rptCartaActa     = new RptCartaActa(contenido);
                    reportBook.Reports.Add(rptCartaActa);
                    if (instalacion != null)
                    {
                        RptInformeActa rptInformeActa = new RptInformeActa(instalacion, observaciones, actaNumero, fechaActa, tecnicoResponsable, ctx);
                        reportBook.Reports.Add(rptInformeActa);
                    }
                    else
                    {
                        RptInformeActaEmpresa rptInformeActaEmpresa = new RptInformeActaEmpresa(empresa, observaciones, actaNumero, fechaActa, tecnicoResponsable, ctx);
                        reportBook.Reports.Add(rptInformeActaEmpresa);
                    }
                    ReportViewer1.Report = reportBook;
                    break;
                }
            }
        }
        else if (Request.QueryString["ProgramaId"] != null)
        {
            programa = CntLainsaSci.GetPrograma(int.Parse(Request.QueryString["ProgramaId"]), ctx);
            if (programa != null)
            {
                switch (informe)
                {
                case "RptPrograma2":
                    RptPrograma2 rptPrograma2 = new RptPrograma2(programa.ProgramaId, ctx);
                    ReportViewer1.Report = rptPrograma2;
                    break;

                case "RptRevisionFormulario":
                    RptRevisionFormulario rptRF = new RptRevisionFormulario(programa, ctx);
                    ReportViewer1.Report = rptRF;
                    break;

                case "RptInformePlanta":
                    RptInformePlanta rptIP = new RptInformePlanta(programa, ctx);
                    ReportViewer1.Report = rptIP;
                    break;
                }
            }
            newRecord = false;
        }
        else if (Request.QueryString["EmpresaId"] != null)
        {
            empresa = CntLainsaSci.GetEmpresa(int.Parse(Request.QueryString["EmpresaId"]), ctx);

            if (empresa != null)
            {
                desdeFecha = DateTime.Parse(Request.QueryString["DesdeFecha"]);
                hastaFecha = DateTime.Parse(Request.QueryString["HastaFecha"]);
                switch (informe)
                {
                case "RptResumenEmpresaInstalacion":
                    RptResumenEmpresaInstalacion rpt = new RptResumenEmpresaInstalacion(desdeFecha, hastaFecha, empresa.EmpresaId, int.Parse(Request.QueryString["InstId"]), ctx);
                    ReportViewer1.Report = rpt;
                    break;

                case "RptFacturableEmpresaInstalacion":
                    RptFacturableEmpresaInstalacion rpt2 = new RptFacturableEmpresaInstalacion(desdeFecha, hastaFecha, empresa.EmpresaId, int.Parse(Request.QueryString["InstId"]), ctx);
                    ReportViewer1.Report = rpt2;
                    break;

                case "RptResumenEmpresaTipoDispositivo":
                    RptResumenEmpresaTipoDispositivo rptT = new RptResumenEmpresaTipoDispositivo(desdeFecha, hastaFecha, empresa.EmpresaId, int.Parse(Request.QueryString["TipoDispId"]), ctx);
                    ReportViewer1.Report = rptT;
                    break;

                case "RptFacturableEmpresaTipoDispositivo":
                    RptFacturableEmpresaTipoDispositivo rptT2 = new RptFacturableEmpresaTipoDispositivo(desdeFecha, hastaFecha, empresa.EmpresaId, int.Parse(Request.QueryString["TipoDispId"]), ctx);
                    ReportViewer1.Report = rptT2;
                    break;

                case "RptResumenEmpresa":
                    RptResumenEmpresa rptE = new RptResumenEmpresa(desdeFecha, hastaFecha, empresa.EmpresaId, int.Parse(Request.QueryString["InstId"]), int.Parse(Request.QueryString["TipoDispId"]), ctx);
                    ReportViewer1.Report = rptE;
                    break;

                case "RptFacturableEmpresa":
                    RptFacturableEmpresa rptE2 = new RptFacturableEmpresa(desdeFecha, hastaFecha, empresa.EmpresaId, int.Parse(Request.QueryString["InstId"]), int.Parse(Request.QueryString["TipoDispId"]), ctx);
                    ReportViewer1.Report = rptE2;
                    break;
                }
            }
        }
        else if (Request.QueryString["Filtro"] != null)
        {
            List <string> filtro   = (List <string>)Session["Filtro"];
            string        consulta = "";
            switch (informe)
            {
            case "RptConsultaRevision":
                if (Request.QueryString["mode"].ToString() == "G")
                {
                    RptConsultaRevisionGeneral cr = new RptConsultaRevisionGeneral(filtro);
                    ReportViewer1.Report = cr;
                }
                break;

            case "RptConsultaDispositivos":
                consulta = "Consulta dispositivos. ";
                if (Session["Consulta"] != null)
                {
                    consulta += (string)Session["Consulta"];
                }
                this.Title = consulta;

                if (Request.QueryString["mode"].ToString() == "D")
                {
                    RptConsultaDispositivos cd = new RptConsultaDispositivos(filtro, consulta);
                    ReportViewer1.Report = cd;
                }
                else
                {
                    RptConsultaDispositivosGeneral cd = new RptConsultaDispositivosGeneral(filtro, consulta);
                    ReportViewer1.Report = cd;
                }
                break;

            case "RptInfConsultaRevision":
                IList <Revision> lr = new List <Revision>();
                foreach (string rid in filtro)
                {
                    lr.Add(CntLainsaSci.GetRevision(int.Parse(rid), ctx));
                }
                consulta = "Consulta revisiones";
                if (Session["Consulta"] != null)
                {
                    consulta = (string)Session["Consulta"];
                }
                this.Title = consulta;
                RptInfConsultaRevision icr = new RptInfConsultaRevision(lr, consulta);
                ReportViewer1.Report = icr;
                break;
            }
        }
        // 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;
     }
     //
     // si llega aquí está autorizado
     permiso = CntLainsaSci.GetPermiso(usuario.GrupoUsuario, "sustituciongrid", 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;
     // Si esto no va antes de SustitucionDispositivoID tendrás problemas.
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
         caller = caller.Replace("'", "");
     }
     // Esto es cuando es llamada desde una revisión
     if (Request.QueryString["RevisionId"] != null)
     {
         revision = CntLainsaSci.GetRevision(int.Parse(Request.QueryString["RevisionId"]), ctx);
         if (revision != null)
         {
             Title = String.Format("Sustitución [REV]: {0:dd/MM/yyyy} {1}",
                                   revision.FechaPlanificada,
                                   CntLainsaSci.GetNomLargo(revision.Dispositivo));
             rdcDispositivoOriginal.Items.Clear();
             rdcDispositivoOriginal.Items.Add(new RadComboBoxItem(CntLainsaSci.GetNomLargo(revision.Dispositivo),
                                                                  revision.Dispositivo.DispositivoId.ToString()));
             rdcDispositivoOriginal.SelectedValue = revision.Dispositivo.DispositivoId.ToString();
             Session["DispositivoOriginal"]       = revision.Dispositivo;
         }
     }
     // Is it a new record or not?
     if (Request.QueryString["SustitucionId"] != null)
     {
         sustitucion = CntLainsaSci.GetSustitucion(int.Parse(Request.QueryString["SustitucionId"]), ctx);
         LoadData(sustitucion);
         newRecord = false;
     }
     else
     {
         newRecord = true;
         CargarUsuarios(null);
         CargarEstados("");
     }
 }
    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;
        }
        // si llega aquí está autorizado
        permiso = CntLainsaSci.GetPermiso(usuario.GrupoUsuario, "dispositivogrid", 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["InTab"] != null)
        {
            inTab = Request.QueryString["InTab"];
        }
        if (Request.QueryString["Caller"] != null)
        {
            caller = Request.QueryString["Caller"];
        }
        if (Request.QueryString["LL"] != null)
        {
            LL = "2";
            if (Session["DispositivoOriginal"] != null)
            {
                dispositivoOriginal = (Dispositivo)Session["DispositivoOriginal"];
            }
        }
        if (Request.QueryString["RevisionId"] != null)
        {
            instalacion = CntLainsaSci.GetInstalacion(int.Parse(Request.QueryString["RevisionId"]), ctx);
            if (instalacion != null)
            {
                RadGrid1.Columns.FindByDataField("Instalacion.Nombre").Visible = false;
            }
        }
        if (Request.QueryString["DispositivoId"] != null)
        {
            dispositivo = CntLainsaSci.GetDispositivo(int.Parse(Request.QueryString["DispositivoId"]), ctx);
            if (dispositivo != null)
            {
                RadGrid1.Columns.FindByDataField("Instalacion.Nombre").Visible         = false;
                RadGrid1.Columns.FindByDataField("Instalacion.Empresa.Nombre").Visible = false;
            }
        }
    }
Example #11
0
    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;
        }
        //
        // si llega aquí está autorizado
        permiso = CntLainsaSci.GetPermiso(usuario.GrupoUsuario, "Modelogrid", 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;
        // Si esto no va antes de ModeloDispositivoID tendrás problemas.
        if (Request.QueryString["Caller"] != null)
        {
            caller = Request.QueryString["Caller"];
            caller = caller.Replace("'", "");
        }
        if (Request.QueryString["TipoId"] != null)
        {
            tipo = CntLainsaSci.GetTipoDispositivo(int.Parse(Request.QueryString["TipoId"]), ctx);
            rdcTipo.Items.Clear();
            rdcTipo.Items.Add(new RadComboBoxItem(tipo.Nombre, tipo.TipoId.ToString()));
            rdcTipo.SelectedValue = tipo.TipoId.ToString();
            imgTipo.Enabled       = false;
            rdcTipo.Enabled       = false;
            if (tipo.Empresa != null)
            {
                rdcEmpresa.Items.Clear();
                rdcEmpresa.Items.Add(new RadComboBoxItem(tipo.Empresa.Nombre, tipo.Empresa.EmpresaId.ToString()));
                rdcEmpresa.SelectedValue = tipo.Empresa.EmpresaId.ToString();
                imgEmpresa.Enabled       = false;
                rdcEmpresa.Enabled       = false;
            }
            if (tipo.Instalacion != null)
            {
                rdcInstalacion.Items.Clear();
                rdcInstalacion.Items.Add(new RadComboBoxItem(tipo.Instalacion.Nombre, tipo.Instalacion.InstalacionId.ToString()));
                rdcInstalacion.SelectedValue = tipo.Instalacion.InstalacionId.ToString();
                imgInstalacion.Enabled       = false;
                rdcInstalacion.Enabled       = false;
            }
        }

        // Is it a new record or not?
        if (Request.QueryString["ModeloId"] != null)
        {
            modeloDispositivo = CntLainsaSci.GetModeloDispositivo(int.Parse(Request.QueryString["ModeloId"]), ctx);
            LoadData(modeloDispositivo);
            newRecord = false;
        }
        else
        {
            newRecord = true;
            if (usuario.Empresa != null)
            {
                rdcEmpresa.Items.Clear();
                rdcEmpresa.Items.Add(new RadComboBoxItem(usuario.Empresa.Nombre, usuario.Empresa.EmpresaId.ToString()));
                rdcEmpresa.SelectedValue = usuario.Empresa.EmpresaId.ToString();
                imgEmpresa.Enabled       = false;
                rdcEmpresa.Enabled       = false;
            }
            if (usuario.Instalacion != null)
            {
                rdcInstalacion.Items.Clear();
                rdcInstalacion.Items.Add(new RadComboBoxItem(usuario.Instalacion.Nombre, usuario.Instalacion.InstalacionId.ToString()));
                rdcInstalacion.SelectedValue = usuario.Instalacion.InstalacionId.ToString();
                imgInstalacion.Enabled       = false;
                rdcInstalacion.Enabled       = false;
            }
        }
        // control de skin
        if (Session["Skin"] != null)
        {
            RadSkinManager1.Skin = Session["Skin"].ToString();
        }
    }
Example #12
0
 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, "repositoriotmpform", 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();");
     }
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
     }
     if (Request.QueryString["FileName"] != null)
     {
         fileName = Request.QueryString["FileName"];
     }
     if (Request.QueryString["DocumentoId"] != null)
     {
         documentoId = int.Parse(Request.QueryString["DocumentoId"]);
     }
     if (Request.QueryString["EmpresaId"] != null)
     {
         empresa = CntLainsaSci.GetEmpresa(int.Parse(Request.QueryString["EmpresaId"]), ctx);
     }
     if (Request.QueryString["Nombre"] != null)
     {
         nombre = Request.QueryString["Nombre"];
     }
     if (Request.QueryString["InstalacionId"] != null)
     {
         instId      = int.Parse(Request.QueryString["InstalacionId"]);
         instalacion = CntLainsaSci.GetInstalacion(instId, ctx);
         if (instalacion != null)
         {
             empresa = CntLainsaSci.GetEmpresa(instalacion.Empresa.EmpresaId, ctx);
         }
     }
     if (Request.QueryString["TipoDispositivoId"] != null)
     {
         tId  = int.Parse(Request.QueryString["TipoDispositivoId"]);
         tipo = CntLainsaSci.GetTipoDispositivo(tId, ctx);
         if (tipo != null)
         {
             empresa = CntLainsaSci.GetEmpresa(tipo.Empresa.EmpresaId, ctx);
         }
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }
Example #13
0
 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;
     }
     //
     // si llega aquí está autorizado
     permiso = CntLainsaSci.GetPermiso(usuario.GrupoUsuario, "terminalgrid", 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;
     // Si esto no va antes de TerminalID tendrás problemas.
     if (Request.QueryString["Caller"] != null)
     {
         caller = Request.QueryString["Caller"];
         caller = caller.Replace("'", "");
     }
     // Mirar si se ha pasado una Instalacion
     if (Request.QueryString["EmpresaId"] != null)
     {
         empresa = CntLainsaSci.GetEmpresa(int.Parse(Request.QueryString["EmpresaId"]), ctx);
         CargarEmpresas(empresa);
     }
     else
     {
         CargarEmpresas(null);
     }
     // Is it a new record or not?
     if (Request.QueryString["TerminalId"] != null)
     {
         terminal = CntLainsaSci.GetTerminal(int.Parse(Request.QueryString["TerminalId"]), ctx);
         LoadData(terminal);
         newRecord = false;
     }
     else
     {
         CargarTipo("");
         if (empresa != null)
         {
             CargarEmpresas(empresa);
         }
         else
         {
             CargarEmpresas(null);
         }
     }
     // control de skin
     if (Session["Skin"] != null)
     {
         RadSkinManager1.Skin = Session["Skin"].ToString();
     }
 }