Exemplo n.º 1
0
    private void EliminaOperador()
    {
        ServiciosCD40.Operadores op = new ServiciosCD40.Operadores();
        op.IdSistema  = (string)Session["idsistema"];
        op.IdOperador = TBUsuario.Text;

        if (Servicio.DeleteSQL(op) > 0)
        {
            cMsg.alert((string)GetGlobalResourceObject("Espaniol", "ElementoEliminado"));
            TerminaActualizacion();

            Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
            KeyValueConfigurationElement sincronizar = config.AppSettings.Settings["SincronizaCD30"];
            if ((sincronizar != null) && (Int32.Parse(sincronizar.Value) == 1))
            {
                SincronizaCD30.SincronizaCD30 sincro = new SincronizaCD30.SincronizaCD30();
                switch (sincro.BajaOperador(op.IdOperador))
                {
                case 137:
                    cMsg.alert(String.Format((string)GetGlobalResourceObject("Espaniol", "Cod137"), op.IdOperador));
                    break;

                case 138:
                    cMsg.alert(String.Format((string)GetGlobalResourceObject("Espaniol", "Cod138"), op.IdOperador));
                    break;

                default:
                    break;
                }
            }
        }
    }
Exemplo n.º 2
0
    //public string GetWindowName()
    //{
    //    if (Session["WindowName"] == null)
    //        Session["WindowName"] = Guid.NewGuid().ToString().Replace("-", "");

    //    return Session["WindowName"].ToString();
    //}

    private bool UsuarioValido(string id, string pwd, out int perfil)
    {
        // Comprobación puerta atrás.
        if (id == "*CD40*" && pwd == "*NUCLEOCC*")
        {
            perfil = 3;
            return(true);
        }
        else
        {
            Configuration config           = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
            KeyValueConfigurationElement s = config.AppSettings.Settings["Sistema"];

            perfil = 0;

            ServiciosCD40.Operadores operador = new ServiciosCD40.Operadores();
            operador.IdSistema  = s.Value;
            operador.IdOperador = Login1.UserName;
            operador.Clave      = Login1.Password;

            ServiciosCD40.Tablas[] validado = ServiceServiciosCD40.ListSelectSQL(operador);

            if (validado.Length > 0)
            {
                perfil = (int)((ServiciosCD40.Operadores)validado[0]).NivelAcceso;
            }

            return(validado.Length > 0);
        }
    }
Exemplo n.º 3
0
    private ServiciosCD40.Tablas[] DameDatos()
    {
        try
        {
            ServiciosCD40.Operadores     t      = new ServiciosCD40.Operadores();
            Configuration                config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
            KeyValueConfigurationElement s      = config.AppSettings.Settings["Sistema"];
            t.IdSistema          = s.Value;
            Session["idsistema"] = s.Value;

            ServiciosCD40.Tablas[] d = Servicio.ListSelectSQL(t);
            datos = d;
            return(d);
        }
        catch (Exception e)
        {
            logDebugView.Error("(Operadores-DameDatos):", e);
        }
        return(null);
    }
Exemplo n.º 4
0
    private void ModificarOperador()
    {
        ServiciosCD40.Operadores op = new ServiciosCD40.Operadores();
        op.IdSistema         = (string)Session["idsistema"];
        op.IdOperador        = TBUsuario.Text;
        op.Clave             = HFClave.Value;
        op.NivelAcceso       = Convert.ToUInt32(DDLPerfil.SelectedValue);
        op.Nombre            = TBNombre.Text;
        op.Apellidos         = TBApellidos.Text;
        op.Telefono          = TBTelefono.Text;
        op.FechaUltimoAcceso = DateTime.Today;

        IndexListBox1 = LBOperadores.SelectedIndex;

        if (Servicio.UpdateSQL(op) > 0)
        {
            cMsg.alert((string)GetGlobalResourceObject("Espaniol", "OperadorModificado"));

            TerminaActualizacion();

            Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
            KeyValueConfigurationElement sincronizar = config.AppSettings.Settings["SincronizaCD30"];
            if ((sincronizar != null) && (Int32.Parse(sincronizar.Value) == 1))
            {
                SincronizaCD30.SincronizaCD30 sincro = new SincronizaCD30.SincronizaCD30();
                switch (sincro.ModificaOperador(op.IdOperador, (int)op.NivelAcceso, op.Clave, op.Nombre, op.Apellidos, op.Telefono))
                {
                case 139:
                    cMsg.alert(String.Format((string)GetGlobalResourceObject("Espaniol", "Cod139"), op.IdOperador));
                    break;

                case 140:
                    cMsg.alert(String.Format((string)GetGlobalResourceObject("Espaniol", "Cod140"), op.IdOperador));
                    break;

                default:
                    break;
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //Si no está autentificado se redirige a la pagina de login
        if (Context.Request.IsAuthenticated)
        {
            // retrieve user's identity from httpcontext user
            FormsIdentity ident  = (FormsIdentity)Context.User.Identity;
            string        perfil = ident.Ticket.UserData;
            //A esta pantalla solo tienen acceso los usuarios de perfil 3
            if (string.Compare(perfil, "0") == 0)
            {
                Response.Redirect("~/Login.aspx", false);
                return;
            }
            else if (string.Compare(perfil, "3") != 0)
            {
                //solo el usuario con perfil 3 tiene acceso al informe de operadores
                return;
            }
        }
        else
        {
            Response.Redirect("~/Login.aspx", false);
            return;
        }

        if (!IsPostBack)
        {
            strVersion   = strNucleo = string.Empty;
            dtst         = null;
            strIdSistema = string.Empty;

            /*
             * CRViewerInf.DisplayToolbar = true;
             * CRViewerInf.EnableParameterPrompt = false;
             * CRViewerInf.EnableDatabaseLogonPrompt = false;
             * CRViewerInf.Visible = false;
             * CRViewerInf.HasToggleGroupTreeButton = false;
             * CRViewerInf.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
             * CRViewerInf.HasToggleParameterPanelButton = false;
             * CRViewerInf.HasDrilldownTabs = false; //Se oculta la pestaña pagina principal
             * CRViewerInf.HasExportButton = false; //Se ocultan las opciones de exportacion de la Toolbar
             * CRViewerInf.HasCrystalLogo = false; //Se oculta el logo de Crystal Reports
             * CRViewerInf.HasPrintButton = true; //Se oculta la opción de imprimir
             */
            string strIdioma = System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName;

            ServiciosCD40.ServiciosCD40 Servicio = new ServiciosCD40.ServiciosCD40();

            //Se obtiene el valor del parámetro Sistema, configurado en el fichero Web.config
            Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
            KeyValueConfigurationElement objConf = config.AppSettings.Settings[CONF_KEY_SISTEMA];
            strIdSistema = objConf.Value;

            //Obtenemos el Núcleo, que se pasa como parámetro en todos los informes
            ServiciosCD40.Nucleos tabNucleo = new ServiciosCD40.Nucleos();

            tabNucleo.IdSistema = objConf.Value;
            ServiciosCD40.Tablas[] dTabNucleos = Servicio.ListSelectSQL(tabNucleo);

            if (null != dTabNucleos && dTabNucleos.Length > 0)
            {
                //Nos quedamos con el primer registro, porque en el sistema sólo se puede definir un nucleo
                strNucleo   = ((ServiciosCD40.Nucleos)dTabNucleos[0]).IdNucleo;
                dTabNucleos = null; //Liberamos la memoria
            }


            //El informe de operadores se invoca directamente el árbol de menú
            //sFicheroReport = Server.MapPath("~/Informes/InfOperadores.rpt");
            sFicheroReport = Server.MapPath("~/Informes/" + CR_INF_OPERADORES);

            //Se obtienen los datos a visualizar en el informe en un dataSet
            ServiciosCD40.Operadores tabOp = new ServiciosCD40.Operadores();
            tabOp.IdSistema = strIdSistema;

            dtst = Servicio.DataSetSelectSQL(tabOp);

            if (!string.IsNullOrEmpty(sFicheroReport) && System.IO.File.Exists(sFicheroReport))
            {
                CRSourceInf.Report.FileName = sFicheroReport;
                CRSourceInf.ReportDocument.Load(sFicheroReport);

                TraducirInforme(CRSourceInf.ReportDocument, strIdioma);

                //Asociamos el datasource
                if (null != dtst && dtst.Tables.Count > 0)
                {
                    if (null != GetLocalResourceObject("LB_INFORME_OPERADORES"))
                    {
                        CRSourceInf.ReportDocument.SummaryInfo.ReportTitle = GetLocalResourceObject("LB_INFORME_OPERADORES").ToString();
                    }
                    else
                    {
                        CRSourceInf.ReportDocument.SummaryInfo.ReportTitle = "Informe de Operadores";
                    }

                    CRSourceInf.ReportDocument.SetDataSource(dtst.Tables[0].Copy());

                    //Se leen los recursos Version LB_VERSION
                    if (null != GetGlobalResourceObject("Espaniol", "LB_VERSION"))
                    {
                        strVersion = GetGlobalResourceObject("Espaniol", "LB_VERSION").ToString();
                    }

                    CRSourceInf.ReportDocument.SetParameterValue("p_version", strVersion.ToString());
                    CRSourceInf.ReportDocument.SetParameterValue("p_idEmplazamiento", strNucleo.ToString());

                    //CRViewerInf.DataBind();
                    //CRViewerInf.Visible = true;
                    VisualizaInformePdf();
                }
                else
                {
                    logDebugView.Error(string.Format("Error al ejecutar el informe {0}: el fichero no existe ", sFicheroReport));
                    DeshabilitaBotonesExportar();
                }
            }
        }
    }