コード例 #1
0
ファイル: Autor.xaml.cs プロジェクト: ecastillo550/final
        private void btn_Guardar_Click(object sender, RoutedEventArgs e)
        {
            LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
            if (cmb_libros.SelectedIndex == -1)
            {
                if(txt_nombre.Text != ""){

                
                cliente.NuevoAutor(txt_nombre.Text.ToString(),txt_apaterno.Text.ToString(),txt_nacionalidad.Text.ToString());
                MessageBox.Show( " Guardado ");
                }else{
                MessageBox.Show( " Faltan Datos ");
                }
            }
            else
            {
                 if(txt_nombre.Text != ""){
                    string a =  cmb_libros.SelectedValue.ToString();
                     int id =  Convert.ToInt32(a);
                     cliente.EditaAutor(id, txt_nombre.Text.ToString(), txt_apaterno.Text.ToString(), txt_nacionalidad.Text.ToString());
                MessageBox.Show( " Editado ");
                }else{
                MessageBox.Show( " Faltan Datos ");
                }
               
               
                
            }
            txt_nombre.Text = "";
            txt_nacionalidad.Text = "";
            txt_apaterno.Text = "";
            banderaUpdate = 1;
             llenaCombo();

        }
コード例 #2
0
ファイル: Genero.xaml.cs プロジェクト: ecastillo550/final
        public void llenaCombo()
        {
            
            LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
            ds = cliente.ObtenerListaGeneros();

            //cmb_libros.Items.Clear();

            int cont = ds.Tables[0].Rows.Count;
            int[] idLibro = new int[cont];

            
           
        // cmb_libros.DisplayMember = "Nombre";
         //   cmb_libros.ValueMember = "EditorialID";

            cmb_libros.DataContext = ds.Tables[0];
            cmb_libros.SelectedValuePath = ds.Tables[0].Columns["GeneroID"].ToString();
            cmb_libros.DisplayMemberPath = ds.Tables[0].Columns["Nombre"].ToString();
          
         
           /* for (int i = 0; i < cont; i++)
            {

            cmb_libros.Items.Add(ds.Tables[0].Rows[i][1].ToString());
               
            }*/

         
            
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: ecastillo550/final
 public void llenaGridInicial()
 {
     LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
     DataSet ds = cliente.ObtenerListaLibros();
     
     gridCosas.AutoGenerateColumns = false;
     gridCosas.ItemsSource = ds.Tables[0].DefaultView;
     gridCosas.IsReadOnly = true;
 }
コード例 #4
0
ファイル: Libro.xaml.cs プロジェクト: ecastillo550/final
        public void llenaComboLibro()
        {
            LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
            DataSet dss = cliente.ObtenerListaLibrosNombres();

            cmb_libros.DataContext = dss.Tables[0];
            cmb_libros.SelectedValuePath = dss.Tables[0].Columns["LibroID"].ToString();
            cmb_libros.DisplayMemberPath = dss.Tables[0].Columns["Nombre"].ToString();
             

        }
コード例 #5
0
ファイル: Libro.xaml.cs プロジェクト: ecastillo550/final
        public void llenaComboGenero()
        {

            LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
            DataSet das = cliente.ObtenerListaGeneros();

            cmb_Genero.DataContext = das.Tables[0];
            cmb_Genero.SelectedValuePath = das.Tables[0].Columns["GeneroID"].ToString();
            cmb_Genero.DisplayMemberPath = das.Tables[0].Columns["Nombre"].ToString();
            cmb_Genero.SelectedIndex = 0;
        }
コード例 #6
0
ファイル: Genero.xaml.cs プロジェクト: ecastillo550/final
        private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            if (banderaUpdate == 0)
            {
                LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
                ds = cliente.BuscaGenero(Convert.ToInt32(cmb_libros.SelectedValue.ToString()));

                txt_nombre.Text = ds.Tables[0].Rows[0][0].ToString();
            }
            else { banderaUpdate = 0; }
            
        }
コード例 #7
0
ファイル: Autor.xaml.cs プロジェクト: ecastillo550/final
        public void llenaCombo()
        {
            
            LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
            ds = cliente.ObtenerListaAutor();

            //cmb_libros.Items.Clear();

            cmb_libros.DataContext = ds.Tables[0];
            cmb_libros.SelectedValuePath = ds.Tables[0].Columns["AutorID"].ToString();
            
            cmb_libros.DisplayMemberPath = ds.Tables[0].Columns["Nombre"].ToString();
        }
コード例 #8
0
ファイル: Libro.xaml.cs プロジェクト: ecastillo550/final
        public void llenaComboEditorial()
        {

            LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
            DataSet des = cliente.ObtenerListaEditorial();

            //cmb_libros.Items.Clear();

            cmb_Editorial.DataContext = des.Tables[0];
            cmb_Editorial.SelectedValuePath = des.Tables[0].Columns["EditorialID"].ToString();

            cmb_Editorial.DisplayMemberPath = des.Tables[0].Columns["Nombre"].ToString();

            cmb_Editorial.SelectedIndex = 0;
        }
コード例 #9
0
ファイル: MainWindow.xaml.cs プロジェクト: ecastillo550/final
        public void creaTitulo()
        {
            LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
            DataSet ds = cliente.ObtenerListaLibros();

            if (ds != null) // table is a DataTable
            {
              
                foreach (DataColumn col in ds.Tables[0].Columns)
                { 
                    gridCosas.Columns.Add(
                      new DataGridTextColumn
                      {
                          Header = col.ColumnName,
                          Binding = new Binding(string.Format("[{0}]", col.ColumnName))
                      });
                   
                }

                gridCosas.DataContext = ds;
            }
            gridCosas.Columns[0].Visibility = Visibility.Hidden;
            gridCosas.IsReadOnly = true;
        }
コード例 #10
0
ファイル: MainWindow.xaml.cs プロジェクト: ecastillo550/final
        private void cmbCat_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();

            int index = cmbCat.SelectedIndex;
            DataSet ds = cliente.ObtenerListaLibros();
            switch (index)
            {
                case 0:
                    ds = cliente.ObtenerListaLibrosOrdenada(0,0);
                    break;
                case 1:
                    ds = cliente.ObtenerListaLibrosOrdenada(0,1);
                    break;
                case 2:
                    ds = cliente.ObtenerListaLibrosOrdenada(1,0);
                    break;
                case 3:
                    ds = cliente.ObtenerListaLibrosOrdenada(1,1);
                    break;
                case 4:
                    ds = cliente.ObtenerListaLibrosOrdenada(2,0);
                    break;
                case 5:
                    ds = cliente.ObtenerListaLibrosOrdenada(2,1);
                    break;
            }


            gridCosas.AutoGenerateColumns = false;
            gridCosas.ItemsSource = ds.Tables[0].DefaultView;
            gridCosas.IsReadOnly = true;
        }
コード例 #11
0
ファイル: Libro.xaml.cs プロジェクト: ecastillo550/final
 public void buscaLibroDatos()
 {
     LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
     DataSet libros = cliente.BuscaLibro(MainWindow.idLibro);
     cmb_libros.SelectedValue = libros.Tables[0].Rows[0][7].ToString();
     //Nombre,AutorID,EditorialID,GeneroID,Idioma,Pais,NoPaginas
     txt_nombre.Text = libros.Tables[0].Rows[0][0].ToString();
     txt_idioma.Text = libros.Tables[0].Rows[0][4].ToString();
     txt_pais.Text = libros.Tables[0].Rows[0][5].ToString();
     txt_paginas.Text = libros.Tables[0].Rows[0][6].ToString();
     cmb_Autor.SelectedValue = libros.Tables[0].Rows[0][1].ToString();
     cmb_Editorial.SelectedValue = libros.Tables[0].Rows[0][2].ToString();
     cmb_Genero.SelectedValue = libros.Tables[0].Rows[0][3].ToString();
 }
コード例 #12
0
ファイル: Libro.xaml.cs プロジェクト: ecastillo550/final
        private void btn_Guardar_Click(object sender, RoutedEventArgs e)
        {
            LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
            if (cmb_libros.SelectedIndex == -1)
            {
               

                if (txt_nombre.Text != "")
                {

                    string a = cmb_Autor.SelectedValue.ToString();
                    int idA = Convert.ToInt32(a);
                    a = cmb_Editorial.SelectedValue.ToString();
                    int idE = Convert.ToInt32(a);
                    a = cmb_Genero.SelectedValue.ToString();
                    int idG = Convert.ToInt32(a);

                    cliente.NuevoLibro(txt_nombre.Text.ToString(), idA, idE, idG, txt_idioma.Text.ToString(), txt_pais.Text.ToString(), Convert.ToInt32(txt_paginas.Text.ToString()));
                    MessageBox.Show(" Guardado ");
                }
                else
                {
                    MessageBox.Show(" Faltan Datos ");
                }
            }
            else
            {
                if (txt_nombre.Text != "")
                {
                    string a = cmb_Autor.SelectedValue.ToString();
                    int idA = Convert.ToInt32(a);
                    a = cmb_Editorial.SelectedValue.ToString();
                    int idE = Convert.ToInt32(a);
                    a = cmb_Genero.SelectedValue.ToString();
                    int idG = Convert.ToInt32(a);
                     a = cmb_libros.SelectedValue.ToString();
                    int id = Convert.ToInt32(a);
                    cliente.EditaLibro(id, txt_nombre.Text.ToString(), idA, idE, idG, txt_idioma.Text.ToString(), txt_pais.Text.ToString(), Convert.ToInt32(txt_paginas.Text.ToString()));
                    MessageBox.Show(" Editado ");
                }
                else
                {
                    MessageBox.Show(" Faltan Datos ");
                }



            }
            txt_nombre.Text = "";
            txt_idioma.Text = "";
            txt_paginas.Text = "";
            txt_pais.Text = "";
            banderaUpdate = 1;
            llenaComboLibro();
            cmb_Genero.SelectedIndex = 0;
            cmb_Autor.SelectedIndex = 0;
            cmb_Editorial.SelectedIndex = 0;

        }
コード例 #13
0
ファイル: Libro.xaml.cs プロジェクト: ecastillo550/final
 private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
 {
     if (banderaUpdate == 0)
     {
         LibrosRef.Service1Client cliente = new LibrosRef.Service1Client();
         DataSet libros = cliente.BuscaLibro(Convert.ToInt32(cmb_libros.SelectedValue.ToString()));
         //Nombre,AutorID,EditorialID,GeneroID,Idioma,Pais,NoPaginas
         txt_nombre.Text = libros.Tables[0].Rows[0][0].ToString();
         txt_idioma.Text = libros.Tables[0].Rows[0][4].ToString();
         txt_pais.Text = libros.Tables[0].Rows[0][5].ToString();
         txt_paginas.Text = libros.Tables[0].Rows[0][6].ToString();
         cmb_Autor.SelectedValue = libros.Tables[0].Rows[0][1].ToString();
         cmb_Editorial.SelectedValue = libros.Tables[0].Rows[0][2].ToString();
         cmb_Genero.SelectedValue = libros.Tables[0].Rows[0][3].ToString();
             
     }
     else { banderaUpdate = 0; }
     
 }