コード例 #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");
            }
        }
コード例 #2
0
        /// <summary>
        ///     Following code will execute when upload image button gets clicked
        /// </summary>
        private void ButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                _fileDialog = new OpenFileDialog {
                    Filter = "Image files | *.jpg"
                };

                _fileDialog.ShowDialog();
                _imageFilePath = _fileDialog.FileName;
                var img = new ImageSourceConverter();
                AccountHolderImage.SetValue(Image.SourceProperty, img.ConvertFromString(_fileDialog.FileName));
            }
            catch (Exception exception)
            {
                DialogBox.Show("Error", "Something went wrong. " + exception.Message);
            }
        }