private void btnSave_Click(object sender, EventArgs e)
        {
            if (_id != 0)
            {
                Update();
            }
            else
            {
                if (!_service.Get(lblSurveyId.Text, lblQuantity.Text))
                {
                    Add();
                }
                else
                {
                    var limite = MessageBox.Show("Ha llegado al limite de preguntas en esta encuesta,¿Desea Volver al Menu Principal?", "Limite Preguntas", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (limite == DialogResult.Yes)
                    {
                        frmSurvey survey = new frmSurvey();
                        survey.username = userName;
                        this.Hide();
                        survey.Show();
                    }
                }
                LoadData();
            }
        }
        void valid()
        {
            var exist     = _service.Get(null, txtUserName.Text);
            var existPass = _service.validPassWord(txtUserName.Text, txtPassword.Text);

            if (exist)
            {
                if (existPass)
                {
                    frmSurvey survey = new frmSurvey();
                    survey.username = txtUserName.Text;
                    this.Hide();
                    survey.Show();
                }
                else
                {
                    MessageBox.Show("Contraseña Incorrecta");
                }
            }
            else
            {
                var result = MessageBox.Show("Este usuario no se encuentra en el sistema, ¿Desea Registrarse?", "Registrar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    frmRegister registration = new frmRegister();
                    this.Hide();
                    registration.Show();
                }
            }
        }
        private void volverAlMenuPrincipalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSurvey survey = new frmSurvey();

            survey.username = userName;
            this.Hide();
            survey.Show();
        }
        private void btnFinish_Click(object sender, EventArgs e)
        {
            frmSurvey survey = new frmSurvey();

            survey.username = username;
            this.Hide();
            survey.Show();
        }
Esempio n. 5
0
        public void Update()
        {
            Survey survey = new Survey(txtName.Text, Convert.ToInt32(txtQuantity.Text), username);

            survey.Id = _id;
            _service.Update(survey);
            _id = 0;
            frmSurvey frmSurvey = new frmSurvey();

            frmSurvey.username = username;
            this.Hide();
            frmSurvey.Show();
        }