Exemplo n.º 1
0
 protected void UnloadData(Usuario usuario)
 {
     usuario.Nombre = txtNombre.Text;
     // Grupo de usuario asociado
     usuario.GrupoUsuario = CntLainsaSci.GetGrupoUsuario(int.Parse(rdcGrupo.SelectedValue), ctx);
     usuario.Login        = txtLogin.Text;
     if (rdcInstalacion.SelectedValue != "")
     {
         // La instalación marca la empresa
         instalacion = CntLainsaSci.GetInstalacion(int.Parse(rdcInstalacion.SelectedValue), ctx);
         if (instalacion != null)
         {
             usuario.Instalacion = instalacion;
             usuario.Empresa     = instalacion.Empresa;
         }
     }
     else
     {
         if (rdcEmpresa.SelectedValue != "")
         {
             empresa             = CntLainsaSci.GetEmpresa(int.Parse(rdcEmpresa.SelectedValue), ctx);
             usuario.Empresa     = empresa;
             usuario.Instalacion = null;
         }
     }
     if (txtPassword.Text != "")
     {
         usuario.Password = CntAutenticacion.GetHashCode(txtPassword.Text);
     }
 }
Exemplo n.º 2
0
 protected void UnloadData(UsuarioExtranet usuarioext)
 {
     usuarioext.Nombre = txtNombre.Text;
     // Grupo de usuario asociado
     //usuarioext.Global = chkGlobal.Checked;
     //if (!usuarioext.Global)
     //{
     usuarioext.Empresa = CntLainsaSci.GetEmpresa(int.Parse(rdcEmpresa.SelectedValue), ctx);
     if (rdcInstalacion.SelectedValue != "")
     {
         usuarioext.Instalacion = CntLainsaSci.GetInstalacion(int.Parse(rdcInstalacion.SelectedValue), ctx);
     }
     else
     {
         usuarioext.Instalacion = null;
     }
     //}
     //else
     //{
     //    usuarioext.Empresa = null;
     //    usuarioext.Instalacion = null;
     //}
     usuarioext.Login  = txtLogin.Text;
     usuarioext.Correo = txtEmail.Text;
     if (txtPassword.Text != "")
     {
         usuarioext.Password = CntAutenticacion.GetHashCode(txtPassword.Text);
     }
 }
Exemplo n.º 3
0
 protected void btnAceptar_Click(object sender, EventArgs e)
 {
     // Comprobación del login
     usuario = CntAutenticacion.Login(txtUsuario.Text, txtPassword.Text, ctx);
     if (usuario == null)
     {
         RadNotification1.Text = String.Format("<b>{0}</b><br/>{1}",
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "Warning"),
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "LoginFail"));
         RadNotification1.Show();
         return;
     }
     // Grabamos el usuario en la sessión
     Session["UsuarioId"] = usuario.UsuarioId;
     Response.Redirect("ProgramaList.aspx");
 }
Exemplo n.º 4
0
 protected void btnAceptar_Click(object sender, EventArgs e)
 {
     uex = CntAutenticacion.LoginExtranet(txtLogin.Text, txtPassword.Text, ctx);
     if (uex != null)
     {
         // grabar Id de usario en la sesion
         Session["UsuarioExtranetId"] = uex.UsuarioExtranetId;
         // montamos el directorio personal
         string userDir = MapPath("/") + "Docs\\A" + String.Format("{0:000000}", uex.UsuarioExtranetId);
         CntWinWeb.PrepareUserFolder(userDir);
         Session["UsuarioDir"] = userDir;
         RadAjaxManager1.ResponseScripts.Add("window.open('MainPage.aspx');");
         // Response.Redirect("MainPage.aspx");
     }
     else
     {
         // mostramos error en el login
         string mensaje = (string)GetGlobalResourceObject("LainsaSciExtranet", "FalloLogin");
         RadWindowManager1.RadAlert(mensaje, null, null, "Login EXTRANET", "noHaceNada");
     }
 }
Exemplo n.º 5
0
 protected bool DatosOk()
 {
     if (txtLogin.Text == "" || txtPassword.Text == "")
     {
         RadNotification1.Text = String.Format("<b>{0}</b><br/>{1}",
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "Warning"),
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "LoginAndPasswordNeeded"));
         RadNotification1.Show();
         return(false);
     }
     // Comprobación del login
     usuario = CntAutenticacion.Login(txtLogin.Text, txtPassword.Text, ctx);
     if (usuario == null)
     {
         RadNotification1.Text = String.Format("<b>{0}</b><br/>{1}",
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "Warning"),
                                               (string)GetGlobalResourceObject("ResourceLainsaSci", "LoginFail"));
         RadNotification1.Show();
         return(false);
     }
     // Grabamos el usuario en la sessión
     Session["UsuarioId"] = usuario.UsuarioId;
     return(true);
 }
        protected void btnGenerar_Click(object sender, ImageClickEventArgs e)
        {
            string jCommand = "";

            if (!DataOk())
            {
                return;
            }
            if (newRecord)
            {
                usuarioextranet = new UsuarioExtranet();
            }
            UnloadData(usuarioextranet);

            //string pass = CntLainsaSci.CreateRandomPassword(10);
            string pass = "******";

            usuarioextranet.Password      = CntAutenticacion.GetHashCode(pass);
            usuarioextranet.PlainPassword = pass;
            if (newRecord)
            {
                ctx.Add(usuarioextranet);
            }
            ctx.SaveChanges();
            string nomempresa = "";
            string calle      = "";
            string cPostal    = "";
            string poblacion  = "";
            string provincia  = "";
            string pais       = "";

            if (usuarioextranet.Empresa != null)
            {
                nomempresa = usuarioextranet.Empresa.Nombre;
                Direccion dir = usuarioextranet.Empresa.Direcciones[0];
                calle     = dir.DirPostal;
                poblacion = dir.Poblacion;
                cPostal   = dir.CodPostal;
                provincia = dir.Provincia;
                pais      = dir.Pais;
            }
            if (usuarioextranet.Instalacion != null)
            {
                Direccion dir = usuarioextranet.Instalacion.Direcciones[0];
                calle     = dir.DirPostal;
                poblacion = dir.Poblacion;
                cPostal   = dir.CodPostal;
                provincia = dir.Provincia;
                pais      = dir.Pais;
            }
            //-- Ahora llamar a la plantilla de carta.
            //Plantilla pl = CntLainsaSci.GetPlantilla(1, ctx);

            //string contenido = String.Format(pl.Contenido,
            //                                 usuarioextranet.Nombre,
            //                                 calle,
            //                                 cPostal,
            //                                 poblacion,
            //                                 String.Format("{0:dd/MM/yyyy}", DateTime.Now),
            //                                 usuarioextranet.Login,
            //                                 usuarioextranet.PlainPassword,
            //                                 nomempresa,
            //                                 provincia,
            //                                 pais);
            //Session["Plantilla"] = contenido;
            //jCommand = "abrirPlantilla();";
            //RadAjaxManager1.ResponseScripts.Add(jCommand);
            //RadAjaxManager1.ResponseScripts.Add("var w1 = window.open('VisorInformeForm.aspx?PlantillaId=1', 'PLANTILLA', 'width=800, height=600,resizable=1'); w1.focus();");
            //-- Y seguir como si fuera aceptar.
            if (newRecord)
            {
                jCommand = String.Format("closeWindowRefreshGrid('{0}', 'new');", caller);
                RadAjaxManager1.ResponseScripts.Add(jCommand);
            }
            else
            {
                jCommand = String.Format("closeWindowRefreshGrid('{0}', 'edit');", caller);
                RadAjaxManager1.ResponseScripts.Add(jCommand);
            }
        }