public void textBoxEmail_Validating(object sender, CancelEventArgs e)
        {
            string mySQL = string.Empty;

            mySQL += "SELECT  * FROM [AccountDB].[dbo].[User] WHERE[AccountDB].[dbo].[User].Email = '" + txtEmail.Text.Trim() + "'";
            DataTable userData = Server_connection.executeSQL(mySQL);

            if (userData.Rows.Count > 0)
            {
                e.Cancel = true;
                errorProviderEmail.SetError(txtEmail, "User with this email already exists ");
            }
            Valid_func_delegate delegate_func = Helpers.Valid_email;

            if (validation(delegate_func, model.Email, txtEmail.Text.Trim()))
            {
                e.Cancel = false;
                errorProviderEmail.SetError(txtEmail, "");
            }
            else
            {
                e.Cancel = true;
                errorProviderEmail.SetError(txtEmail, "Email should match to template [email protected] ");
            }
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string mySQL = string.Empty;

            mySQL += "UPDATE[AccountDB].[dbo].[User] SET Firstname = '" + txtFirstname.Text.Trim() + "', Lastname  = '" +
                     txtLastname.Text.Trim() + "' , Email  = '" + txtEmail.Text.Trim() + "', Rol = '" + comboBoxRole.Text + "' WHERE UserID = " + this.user_id;
            DataTable userData = Server_connection.executeSQL(mySQL);

            MessageBox.("Unpdated successfuly");
            FormHome fh = new FormHome();

            fh.ShowDialog();
        }
Esempio n. 3
0
        private void FormAccSettings_Load(object sender, EventArgs e)
        {
            string mySQL = string.Empty;

            mySQL += "SELECT * FROM [AccountDB].[dbo].[User] ";
            mySQL += "WHERE UserID = " + user_id;
            DataTable userData = Server_connection.executeSQL(mySQL);

            txtFirstname.Text = userData.Rows[0][1].ToString();
            txtLastname.Text  = userData.Rows[0][2].ToString();
            txtEmail.Text     = userData.Rows[0][3].ToString();
            comboBoxRole.Text = userData.Rows[0][5].ToString();
        }
        private void FormAccountList_Load(object sender, EventArgs e)
        {
            string mySQL = string.Empty;

            mySQL += "SELECT  [AccountDB].[dbo].[Accounts].AccNumber, [AccountDB].[dbo].[Accounts].Firstname,[AccountDB].[dbo].[Accounts].Lastname, " +
                     " [AccountDB].[dbo].[Accounts].Last_year, FORMAT([AccountDB].[dbo].[Accounts].Summ, 'C', 'de-de') AS \"Sum on account\" FROM[AccountDB].[dbo].[Accounts] INNER JOIN[AccountDB].[dbo].[Usesr_Accounts]" +
                     " ON[AccountDB].[dbo].[Accounts].AccNumber = [AccountDB].[dbo].[Usesr_Accounts].AccNumber WHERE[AccountDB].[dbo].[Usesr_Accounts].UserID = ";
            mySQL += user_id;
            DataTable userData = Server_connection.executeSQL(mySQL);

            if (userData.Rows.Count > 0)
            {
                dataGridViewAccounts.DataSource = userData;
            }
            else
            {
                MessageBox.Show("This user does not have an account");
            }
        }
Esempio n. 5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string mySQL = string.Empty;

            mySQL += "SELECT * FROM [AccountDB].[dbo].[User] ";
            mySQL += "WHERE Email = '" + txtEmail.Text.Trim() + "'";
            DataTable userData = Server_connection.executeSQL(mySQL);

            if (userData.Rows.Count == 1)
            {
                string hashed_pass = userData.Rows[0][4].ToString();
                if (Helpers.Verify(txtPassword.Text.Trim(), hashed_pass))
                {
                    txtEmail.Clear();
                    txtPassword.Clear();
                    PasswordCheckBox.Checked = false;
                    if (userData.Rows[0][0].ToString() == "Client")
                    {
                        this.Hide();
                        FormAccountList fal = new FormAccountList(userData.Rows[0][0].ToString());
                        fal.ShowDialog();
                    }
                    else
                    {
                        this.Hide();
                        FormBankAccounts fba = new FormBankAccounts(userData.Rows[0][0].ToString());
                        fba.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show("Wrong password");
                }
            }
            else
            {
                MessageBox.Show("User with this email and password is not registreted");
            }
        }
        private void btnSort_Click(object sender, EventArgs e)
        {
            string mySQL = string.Empty;

            mySQL += "SELECT  [AccountDB].[dbo].[Accounts].AccNumber, [AccountDB].[dbo].[Accounts].Firstname,[AccountDB].[dbo].[Accounts].Lastname, " +
                     " [AccountDB].[dbo].[Accounts].Last_year, FORMAT([AccountDB].[dbo].[Accounts].Summ, 'C', 'de-de') AS \"Sum on account\" FROM[AccountDB].[dbo].[Accounts] INNER JOIN[AccountDB].[dbo].[Usesr_Accounts]" +
                     " ON[AccountDB].[dbo].[Accounts].AccNumber = [AccountDB].[dbo].[Usesr_Accounts].AccNumber WHERE[AccountDB].[dbo].[Usesr_Accounts].UserID = ";
            mySQL += user_id + " ORDER BY ";
            if (comboBoxSort.Text.Trim() == "Account Number")
            {
                mySQL += "[AccountDB].[dbo].[Accounts].AccNumber";
            }
            if (comboBoxSort.Text.Trim() == "Owner name")
            {
                mySQL += "[AccountDB].[dbo].[Accounts].Firstname";
            }
            if (comboBoxSort.Text.Trim() == "Owner surname")
            {
                mySQL += "[AccountDB].[dbo].[Accounts].Lastname";
            }
            if (comboBoxSort.Text.Trim() == "Last year")
            {
                mySQL += "[AccountDB].[dbo].[Accounts].Last_year";
            }
            if (comboBoxSort.Text.Trim() == "Sum on account")
            {
                mySQL += "\"Sum on account\"";
            }
            DataTable userData = Server_connection.executeSQL(mySQL);

            if (userData.Rows.Count > 0)
            {
                dataGridViewAccounts.DataSource = userData;
            }
            else
            {
                MessageBox.Show("You should chooce by what value to sort");
            }
        }
        private void btnSearch_Click_1(object sender, EventArgs e)
        {
            string mySQL = string.Empty;

            mySQL += "SELECT  [AccountDB].[dbo].[Accounts].AccNumber, [AccountDB].[dbo].[Accounts].Firstname,[AccountDB].[dbo].[Accounts].Lastname, " +
                     " [AccountDB].[dbo].[Accounts].Last_year, FORMAT([AccountDB].[dbo].[Accounts].Summ, 'C', 'de-de') AS \"Sum on account\" FROM[AccountDB].[dbo].[Accounts] INNER JOIN[AccountDB].[dbo].[Usesr_Accounts]" +
                     " ON[AccountDB].[dbo].[Accounts].AccNumber = [AccountDB].[dbo].[Usesr_Accounts].AccNumber WHERE [AccountDB].[dbo].[Usesr_Accounts].UserID = ";
            mySQL += user_id + " AND [AccountDB].[dbo].[Usesr_Accounts].";
            if (comboBoxSearch.Text.Trim() == "Account Number")
            {
                mySQL += "AccNumber = " + txtSearch.Text.Trim();
            }
            if (comboBoxSearch.Text.Trim() == "Owner name")
            {
                mySQL += "Firstname = '" + txtSearch.Text.Trim() + "'";
            }
            if (comboBoxSearch.Text.Trim() == "Owner surname")
            {
                mySQL += "Lastname = '" + txtSearch.Text.Trim() + "'";
            }
            if (comboBoxSearch.Text.Trim() == "Last year")
            {
                mySQL += "Last_year = " + txtSearch.Text.Trim();
            }
            if (comboBoxSearch.Text.Trim() == "Sum on account")
            {
                mySQL += "Summ = " + txtSearch.Text.Trim();
            }
            DataTable userData = Server_connection.executeSQL(mySQL);

            if (userData.Rows.Count > 0)
            {
                dataGridViewAccounts.DataSource = userData;
            }
            else
            {
                MessageBox.Show("No matches finded");
            }
        }