Пример #1
0
 public void LoadImage(ref BitmapImage image,ref Image ImageControl)
 {//Loads images from the path defined by user and displays them using Image Controls
     result = dialog.ShowDialog();
     if (result == true)
     {
         BitmapImage imagetemp = new BitmapImage();
         imagetemp.BeginInit();
         Uri path = new Uri(dialog.FileName);
         imagetemp.UriSource = path;
         imagetemp.EndInit();
         ImageControl.Source = imagetemp;
         image = imagetemp;
         images.Add(imagetemp.ToString());
     }
 }
Пример #2
0
        private async void btnEditar_Click(object sender, RoutedEventArgs e)
        {
            if (dgvConteudo.SelectedIndex != -1)
            {
                try
                {
                    
                    //Padrão do checkPhoto
                    checkFoto = false;

                    //Coletando valores para atualização

                    object itemid = dgvConteudo.SelectedItem;
                    id = (dgvConteudo.SelectedCells[0].Column.GetCellContent(itemid) as TextBlock).Text;
                    id.ToString();

                    object item1 = dgvConteudo.SelectedItem;
                    string value1 = (dgvConteudo.SelectedCells[1].Column.GetCellContent(item1) as TextBlock).Text;
                    value1.ToString();
                    txtNome.Text = value1;

                    object item2 = dgvConteudo.SelectedItem;
                    string value2 = (dgvConteudo.SelectedCells[2].Column.GetCellContent(item2) as TextBlock).Text;
                    value2.ToString();
                    if (value2 == "Masculino")
                    {
                        rdbMasc.IsChecked = true;
                    }
                    else
                    {
                        rdbFem.IsChecked = true;
                    }

                    object item3 = dgvConteudo.SelectedItem;
                    string value3 = (dgvConteudo.SelectedCells[3].Column.GetCellContent(item3) as TextBlock).Text;
                    value3.ToString();
                    txtNascimento.Text = value3;

                    object item4 = dgvConteudo.SelectedItem;
                    string value4 = (dgvConteudo.SelectedCells[4].Column.GetCellContent(item4) as TextBlock).Text;
                    value4.ToString();
                    txtRg.Text = value4;

                    object item5 = dgvConteudo.SelectedItem;
                    string value5 = (dgvConteudo.SelectedCells[5].Column.GetCellContent(item5) as TextBlock).Text;
                    value5.ToString();
                    txtCpf.Text = value5;

                    object item6 = dgvConteudo.SelectedItem;
                    string value6 = (dgvConteudo.SelectedCells[6].Column.GetCellContent(item6) as TextBlock).Text;
                    value6.ToString();
                    cmbTipoSangue.Text = value6;

                    object item7 = dgvConteudo.SelectedItem;
                    string value7 = (dgvConteudo.SelectedCells[7].Column.GetCellContent(item7) as TextBlock).Text;
                    value7.ToString();
                    cmbEtnia.Text = value7;

                    object item8 = dgvConteudo.SelectedItem;
                    string value8 = (dgvConteudo.SelectedCells[8].Column.GetCellContent(item8) as TextBlock).Text;
                    value8.ToString();
                    cmbEstadoCivil.Text = value8;

                    object item9 = dgvConteudo.SelectedItem;
                    string value9 = (dgvConteudo.SelectedCells[9].Column.GetCellContent(item9) as TextBlock).Text;
                    value9.ToString();
                    txtCep.Text = value9;

                    object item10 = dgvConteudo.SelectedItem;
                    string value10 = (dgvConteudo.SelectedCells[10].Column.GetCellContent(item10) as TextBlock).Text;
                    value10.ToString();
                    txtLogradouro.Text = value10;

                    object item11 = dgvConteudo.SelectedItem;
                    string value11 = (dgvConteudo.SelectedCells[11].Column.GetCellContent(item11) as TextBlock).Text;
                    value11.ToString();
                    txtNumero.Text = value11;

                    object item12 = dgvConteudo.SelectedItem;
                    string value12 = (dgvConteudo.SelectedCells[12].Column.GetCellContent(item12) as TextBlock).Text;
                    value12.ToString();
                    txtComplemento.Text = value12;

                    object item13 = dgvConteudo.SelectedItem;
                    string value13 = (dgvConteudo.SelectedCells[13].Column.GetCellContent(item13) as TextBlock).Text;
                    value13.ToString();
                    txtBairro.Text = value13;

                    object item14 = dgvConteudo.SelectedItem;
                    string value14 = (dgvConteudo.SelectedCells[14].Column.GetCellContent(item14) as TextBlock).Text;
                    value14.ToString();
                    txtCidade.Text = value14;

                    object item15 = dgvConteudo.SelectedItem;
                    string value15 = (dgvConteudo.SelectedCells[15].Column.GetCellContent(item15) as TextBlock).Text;
                    value15.ToString();
                    cmbUf.Text = value15;

                    string SQL_SELECT_THIS = "select * from agente where id_Agente='"+id+"'";
                    OracleConnection Oracon = new OracleConnection(oradb);
                    Oracon.Open();
                    OracleCommand selectall = new OracleCommand(SQL_SELECT_THIS, Oracon);
                    OracleDataReader read = selectall.ExecuteReader();
                    read.Read();
                    fotoAgentesource = Convert.ToString(read[16].ToString());
                    digitalsource = Convert.ToString(read[17].ToString());
                    Oracon.Close();

                    ImageSource photoProfile = new BitmapImage(new Uri(fotoAgentesource));
                    imgFoto.Source = photoProfile;
                    destinationPathFoto = photoProfile.ToString();

                    ImageSource fingerPrint = new BitmapImage(new Uri(digitalsource));
                    imgDigital.Source = fingerPrint;
                    destinationPathFinger = fingerPrint.ToString();
                    checkFinger = true;

                    object item18 = dgvConteudo.SelectedItem;
                    string value18 = (dgvConteudo.SelectedCells[18].Column.GetCellContent(item18) as TextBlock).Text;
                    value18.ToString();
                    cmbCargo.Text = value18;

                    gConsultar.IsSelected = false;
                    gCadastrar.IsSelected = true;

                }
                catch (Exception ex)
                {

                    System.Windows.Forms.MessageBox.Show(ex.Message);
                } 
            }
            else
            {
                await this.ShowMessageAsync("Aviso", "Selecione um agente para excluir!");
            }
        }