Exemplo n.º 1
0
        private void btnRegistro_Click(object sender, EventArgs e)
        {
            string msg = string.Empty;

            if (ValidateFields(out msg) == false)
            {
                nameForm = "LoginAnimus";
                msgForm  = msg;
                msgNotification ms = new msgNotification();
                ms.ShowDialog();
                return;
            }
            //si el email ya existe lo tengo que mandar a iniciar session
            Boolean exists = this.ValidateExistsEmail();

            if (exists == true)
            {
                txtCorreo.Text = string.Empty;
                txtNick.Text   = string.Empty;
                nameForm       = "LoginAnimus";
                msgForm        = "La cuenta de correo existe, debe ingresar por la opción ya tengo una cuenta.";
                msgNotification ms = new msgNotification();
                ms.ShowDialog();
                return;
            }

            CoHome home = new CoHome();

            home.nick     = txtNick.Text;
            home.mail     = txtCorreo.Text;
            home.password = txtPassword.Text;

            Boolean  internetStatus = true;
            CoSesion session        = null;

            home = this.brHome.Registry(home, out session, out internetStatus);
            if (!internetStatus)
            {
                this.InternetStatus(internetStatus);
                return;
            }
            else
            {
                this.Hide();
                ControlCenter controlCenter = new ControlCenter(home, session);
                controlCenter.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void btnSaveHome_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text != "")
            {
                this.activeHome.password = txtPassword.Text;
                Boolean internetStatus = true;
                string  sessionToken   = string.Empty;
                this.activeHome = this.brHome.Authenticate(this.activeHome, out sessionToken, out internetStatus);

                if (!internetStatus)
                {
                    MessageBox.Show("No existe conexión a internet, intentelo más tarde");
                    return;
                }

                if (this.activeHome != null && this.activeHome.id != 0)
                {
                    CoSesion session = new CoSesion();
                    session.start = DateTime.Now;
                    session.token = sessionToken;
                    int idSession = new BrSesion().Save(session);
                    if (idSession != 0)
                    {
                        session.id = idSession;
                        this.Hide();
                        ControlCenter c = new ControlCenter(this.activeHome, session);
                        c.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show("Usuario o Password Incorrecto");
                    return;
                }
            }
        }