示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name             = textBox1.Text;
            string password         = textBox2.Text;
            string confirmPassword  = textBox3.Text;
            bool   passwordIdentity = FormValidation.StringsMatches(password, confirmPassword);

            if (!passwordIdentity)
            {
                MessageBox.Show("Parolele introduse nu se potrivesc!");
                return;
            }
            bool validName     = FormValidation.CheckProfileString(name);
            bool validPassword = FormValidation.CheckProfileString(password);

            if (!validName || !validPassword)
            {
                MessageBox.Show("Datele introduse nu sunt corecte!");
                return;
            }
            bool res = Core.CurrentProfile.Add(name, password);

            if (res)
            {
                MessageBox.Show("V-aţi înregistrat cu succes!");
                this.Close();
            }
            else
            {
                MessageBox.Show("Datele introduse nu sunt corect4e!");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string name          = textBox1.Text;
            string password      = textBox2.Text;
            bool   nameCheck     = FormValidation.CheckProfileString(name);
            bool   passwordCheck = FormValidation.CheckProfileString(password);

            if (!nameCheck || !passwordCheck)
            {
                MessageBox.Show("Datele introduse nu sunt corecte!");
                return;
            }
            bool res = Core.CurrentProfile.Load(name, password);

            if (!res)
            {
                MessageBox.Show("Datele introduse nu corespund nici unui cont!");
                return;
            }
            else
            {
                MessageBox.Show("Autentificare cu succes");
                this.Close();
            }
        }
        private string CheckName()
        {
            string name = textBox1.Text;

            if (!FormValidation.CheckProfileString(name))
            {
                ValidationMessage += "Numele introdus nu este valid! ";
            }
            return(name);
        }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name  = textBox1.Text;
            bool   valid = FormValidation.CheckProfileString(name);

            if (!valid)
            {
                MessageBox.Show("Datele introduse nu sunt valide!");
                return;
            }
            new Target().Add(name, Core.CurrentProfile.Id);
            MessageBox.Show("Datale au fost introduse cu succes!");
            this.Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string name        = textBox1.Text;
            bool   validString = FormValidation.CheckProfileString(name);

            if (!validString)
            {
                MessageBox.Show("Numele introdus nu este valid!");
                return;
            }
            new Category().Add(name, Core.CurrentProfile.Id);
            Core.CurrentProfile.RefreshCategories();
            MessageBox.Show("Categoria a fost adăugată cu succes!");
            this.Close();
        }
        private int CheckNewTarget()
        {
            int    result    = 0;
            string newTarget = textBox4.Text;
            bool   valid     = FormValidation.CheckProfileString(newTarget);

            if (!valid)
            {
                ValidationMessage += "Numele către/dinspre nu este valid! ";
            }
            else
            {
                Target addedTarget = new Target();
                if (addedTarget.Add(newTarget, Core.CurrentProfile.Id))
                {
                    result = addedTarget.Id;
                }
            }
            return(result);
        }
        private int CheckNewCategory()
        {
            int    result      = 0;
            string newCategory = textBox3.Text;
            bool   valid       = FormValidation.CheckProfileString(newCategory);

            if (!valid)
            {
                ValidationMessage += "Numele categoriei nu este valid! ";
            }
            else
            {
                Category addedCategory = new Category();
                if (addedCategory.Add(newCategory, Core.CurrentProfile.Id))
                {
                    result = addedCategory.Id;
                }
            }
            return(result);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string pass1      = textBox1.Text;
            string pass2      = textBox2.Text;
            string pass3      = textBox3.Text;
            bool   validPass1 = FormValidation.CheckProfileString(pass1);
            bool   validPass2 = FormValidation.CheckProfileString(pass2);
            bool   validPass3 = FormValidation.CheckProfileString(pass3);

            if (!validPass1 || !validPass2 || !validPass3)
            {
                MessageBox.Show("Datele introduse nu sunt corecte!");
                return;
            }
            if (!FormValidation.StringsMatches(pass2, pass3))
            {
                MessageBox.Show("Parolele nu coincid");
                return;
            }
            if (!FormValidation.StringsMatches(pass1, Core.CurrentProfile.Password))
            {
                MessageBox.Show("Parola veche este greşită!");
                return;
            }
            bool changed = Core.CurrentProfile.ChangePassword(pass2);

            if (changed)
            {
                MessageBox.Show("Parola a fost schimbată cu succes!");
                this.Close();
            }
            else
            {
                MessageBox.Show("Eroare la modificarea parolei!");
            }
        }