예제 #1
0
 private void BotonAceptar_Click(object sender, RoutedEventArgs e)
 {
     if (msgText.Text == "Ingresado correctamente")
     {
         Pantalla_inicio PantallaInicio_Form = new Pantalla_inicio();
         PantallaInicio_Form.Show();
         this.Close();
     }
 }
예제 #2
0
        void Basededatos()
        {
            string        pss      = txt_Contraseña.Password;
            ASCIIEncoding encoding = new ASCIIEncoding();
            string        postdata = "NU=" + txt_NombreUsuario.Text + "&pss=" + pss;

            byte[]     data    = encoding.GetBytes(postdata);
            WebRequest request = WebRequest.Create("http://sicconviene.com/ABRIR_CONEX.php");

            request.Method        = "POST";
            request.ContentType   = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;
            Stream stream = request.GetRequestStream();

            stream.Write(data, 0, data.Length);
            stream.Close();
            WebResponse response = request.GetResponse();

            stream = response.GetResponseStream();
            StreamReader leer        = new StreamReader(stream);
            string       lectura_php = leer.ReadToEnd();

            leer.Close();
            stream.Close();
            if (lectura_php.Contains("registros_generados"))
            {
                int inicio, fin;
                inicio = lectura_php.IndexOf("o");
                fin    = lectura_php.IndexOf("Q") - 6;
                Clase_php.No_Control_Usuario = lectura_php.Substring(inicio + 1, fin - 1);
                msgText.Text = "Ingresado correctamente";
                if (RecordarContra.IsChecked == true)
                {
                    Properties.Settings.Default.usuario = txt_NombreUsuario.Text;
                    Properties.Settings.Default.Save();
                    Properties.Settings.Default.contraseña = txt_Contrasena.Text;
                    Properties.Settings.Default.Save();
                    Properties.Settings.Default.recordar = true;
                    Properties.Settings.Default.Save();
                }
                else
                {
                    Properties.Settings.Default.usuario = "";
                    Properties.Settings.Default.Save();
                    Properties.Settings.Default.contraseña = "";
                    Properties.Settings.Default.Save();
                    Properties.Settings.Default.recordar = false;
                    Properties.Settings.Default.Save();
                }
            }
            if (Properties.Settings.Default.recordar == true)
            {
                Hecho.IsOpen = true;
            }
            else
            {
                Pantalla_inicio PantallaInicio_Form = new Pantalla_inicio();
                PantallaInicio_Form.Show();
                this.Close();
            }
        }