Exemplo n.º 1
0
        private void GetDetails()
        {
            try
            {
                Class.forName("com.mysql.jdbc.Driver");
                Connection c = (Connection)DriverManager.getConnection(Resource.DATABASE_URL, Resource.USERNAME, Resource.PASSWORD);

                PreparedStatement ps = c.prepareStatement("select * from info where account_number = ?");
                ps.setString(1, Accc);
                ResultSet            rs  = ps.executeQuery();
                ImageSourceConverter img = new ImageSourceConverter();

                while (rs.next())
                {
                    TextBoxName.Text         = rs.getString("Name");
                    textBox_address.Text     = rs.getString("Address");
                    textBox_email.Text       = rs.getString("Email");
                    textBox_phonenumber.Text = rs.getString("phone_number");
                    myDatePicker.Text        = rs.getString("BirthDate");
                    AccountHolderImage.SetValue(Image.SourceProperty, img.ConvertFromString(rs.getString("ImagePath")));
                }
            }
            catch (SQLException exception)
            {
                //MaterialDesignDialogBox.Show("Error", "Something went wrong." + exception.Message, "OK");
            }
        }
Exemplo n.º 2
0
        private void SaveDataToDatabase()
        {
            string fullName = TextBoxName.Text;

            try
            {
                Class.forName("com.mysql.jdbc.Driver");
                Connection c = (Connection)DriverManager.getConnection(Resource.DATABASE_URL, Resource.USERNAME, Resource.PASSWORD);

                PreparedStatement ps = c.prepareStatement("update info set Name = ? ,  Address = ? , phone_number = ? , Email = ? , ImagePath = ? , BirthDate = ? where account_number = ? ");
                ps.setString(1, fullName);
                ps.setString(2, textBox_address.Text);
                ps.setString(3, textBox_phonenumber.Text);
                ps.setString(4, textBox_email.Text);
                ps.setString(5, _imageFilePath);
                ps.setString(6, myDatePicker.Text);
                ps.setString(7, Accc);
                ps.executeUpdate();
                c.close();
                //MaterialDesignDialogBox.Show("Sucess", "Changes done sucessfully", "OK");
            }
            catch (SQLException exception)
            {
                //MaterialDesignDialogBox.Show("Error", "Something went wrong." + exception.Message, "OK");
            }
        }
Exemplo n.º 3
0
        public static string GetAccountHolderMobileNumber(string accountNumber)
        {
            var phoneNum = string.Empty;

            try
            {
                Class.forName("com.mysql.jdbc.Driver");
                _connection = (Connection)DriverManager.getConnection(
                    Resource.DATABASE_URL,
                    Resource.USERNAME,
                    Resource.PASSWORD);

                var ps = _connection.prepareStatement("select phone_number from info where account_number = ?");
                ps.setString(1, accountNumber);
                var rs = ps.executeQuery();
                while (rs.next())
                {
                    phoneNum = rs.getString("phone_number");
                }

                return(phoneNum);
            }
            catch (SQLException exception)
            {
                DialogBox.Show("Error", "Something went wrong " + exception.Message, "OK");
                return(null);
            }
        }
Exemplo n.º 4
0
        // please check method name of each. Method name is itself explanetory about what it does.
        // It's JAVA code
        // all method are static so you dont need to create an object of this class to call them just Operations.<method_name> to call it.
        public static bool DoesSendMobileNotifications(string accountNumber)
        {
            var status = string.Empty;

            try
            {
                Class.forName("com.mysql.jdbc.Driver");

                _connection = (Connection)DriverManager.getConnection(
                    Resource.DATABASE_URL,
                    Resource.USERNAME,
                    Resource.PASSWORD);

                var ps = _connection.prepareStatement("select MobileVerification from info where account_number = ?");
                ps.setString(1, accountNumber);
                var rs = ps.executeQuery();
                while (rs.next())
                {
                    status = rs.getString("MobileVerification");
                }

                return(status == "Yes");
            }
            catch (SQLException exception)
            {
                DialogBox.Show("Error", "Something went wrong " + exception.Message, "OK");
                return(false);
            }
        }
Exemplo n.º 5
0
        public static string GetAccountHolderName(string accountNumber)
        {
            var name = string.Empty;

            try
            {
                Class.forName("com.mysql.jdbc.Driver");
                _connection = (Connection)DriverManager.getConnection(
                    Resource.DATABASE_URL,
                    Resource.USERNAME,
                    Resource.PASSWORD);

                var ps = _connection.prepareStatement("select Name from info where account_number = ?");
                ps.setString(1, accountNumber);
                var result = ps.executeQuery();

                while (result.next())
                {
                    name = result.getString("Name");
                }

                return(name);
            }
            catch (SQLException exception)
            {
                MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Stop);
                return(null);
            }
        }
Exemplo n.º 6
0
        private void SaveNewName(string name)
        {
            try
            {
                Class.forName("com.mysql.jdbc.Driver");
                Connection c = (Connection)DriverManager.getConnection(Resource.DATABASE_URL, Resource.USERNAME, Resource.PASSWORD);

                java.sql.PreparedStatement ps = c.prepareStatement("update info set Name = ? where account_number = ?");
                ps.setString(1, name);
                ps.setString(2, accNum);
                ps.executeUpdate();
                c.close();
                MessageBox.Show("Changes saved sucessfully");
                new LoggedIn().Show();
            }
            catch (SQLException exception)
            {
                MessageBox.Show(exception.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Stop);
            }
        }