Beispiel #1
0
        private void btnCloseSession_Click(object sender, EventArgs e)
        {
            if (Alerts.ShowWarning("¿Seguro desea Cerra la Sesión?"))
            {
                Session.closeSesion();

                FormPrincipal formPrincipal = FormPrincipal.formPrincipal;

                formPrincipal.Reset();

                formPrincipal.ActivateButton(formPrincipal.btnInicio, FormPrincipal.RGBColors.color1);
                formPrincipal.OpenChildForm(new FormInicio());

                this.Hide();
            }
        }
 private void btnBeginDA_Click(object sender, EventArgs e)
 {
     formPrincipal.ActivateButton(formPrincipal.btnInicio, FormPrincipal.RGBColors.color1);
     formPrincipal.OpenChildForm(new FormInicio());
 }
        private void btnSesion_Click(object sender, EventArgs e)
        {
            //Console.WriteLine(Properties.Settings.Default.maxWindows);
            //Boolean user = false;

            //string username = Seguridad.Encriptar(txtUser.Text);
            string username = txtUser.Text;
            string password = Seguridad.Encriptar(txtPass.Text);

            /*
             * UsersXml usersXml = new UsersXml();
             *
             * usersXml._CreateXml();
             *
             *
             * XmlNodeList route = usersXml._ReadXml();
             *
             * XmlNode list;
             *
             * if (route.Count < 1)
             * {
             *  user = true;
             * }
             * else
             * {
             *  for (int i = 0; i < route.Count; i++)
             *  {
             *      list = route.Item(i);
             *
             *      string suser = list.SelectSingleNode("UserName").InnerText;
             *      string spass = list.SelectSingleNode("Password").InnerText;
             *
             *      if (username.Equals(suser) && password.Equals(spass))
             *      {
             *          user = true;
             *      }
             *
             *  }
             * }
             */

            UsersModel usersModel = new UsersModel();

            if (usersModel.LogIn(username, password))
            {
                Session.user = txtUser.Text;
                Session.pass = txtPass.Text;
                this.Hide();

                cleanUsertxt();
                cleanPasstxt();

                FormPrincipal formPrincipal = FormPrincipal.formPrincipal;

                formPrincipal.ActivateButton(formPrincipal.btnCerrarSesion, FormPrincipal.RGBColors.color5);
                formPrincipal.OpenChildForm(new FormCuenta());
            }
            else
            {
                Alerts.ShowInformation("El usuario y/o contraseña son incorrectos");
            }
        }