示例#1
0
文件: Form1.cs 项目: santii810/Dam209
        private void button1_Click(object sender, EventArgs e)
        {
            ruta = Application.StartupPath + "\\data\\Clientes.xml";

            FicheroXml fich = new FicheroXml(ruta);

            cliente = fich.BuscarCliente(this.txbCodigo.Text.Trim().ToLower());
            cargaclientes();
        }
示例#2
0
 private void VentanaProductos_Load(object sender, EventArgs e)
 {
     try
     {
         doc  = new FicheroXml(Application.StartupPath + "\\data\\productos.xml");
         list = doc.leerProductos();
         foreach (Producto p in list)
         {
             lbProduct.Items.Add(p.Codigo + " - " + p.Descripcion);
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show("Carga de  Productos erronea");
     }
 }
示例#3
0
 private void VentanaProductos_Load(object sender, EventArgs e)
 {
     try
     {
         doc = new FicheroXml(Application.StartupPath + "\\data\\productos.xml");
         list = doc.leerProductos();
         foreach (Producto p in list)
         {
             lbProduct.Items.Add(p.Codigo + " - " + p.Descripcion);
         }
        
     }
     catch (Exception exc)
     {
         MessageBox.Show("Carga de  Productos erronea");
     }            
 }
示例#4
0
        private void VentanaClientes_Load(object sender, EventArgs e)
        {
            try

            { 
                doc = new FicheroXml(Application.StartupPath + "\\data\\clientes.xml");
                list = doc.LeerClientes();
                foreach (Cliente p in list)
                {
                    lbClientes.Items.Add(p.Codigo + " - " + p.Nombre);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Ha habido un problema cargando el fichero de Productos");
            }
        }
示例#5
0
        private void VentanaClientes_Load(object sender, EventArgs e)
        {
            try

            {
                doc  = new FicheroXml(Application.StartupPath + "\\data\\clientes.xml");
                list = doc.LeerClientes();
                foreach (Cliente p in list)
                {
                    lbClientes.Items.Add(p.Codigo + " - " + p.Nombre);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Ha habido un problema cargando el fichero de Productos");
            }
        }
示例#6
0
文件: Form1.cs 项目: santii810/Dam209
        private void abrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = Application.StartupPath + "\\data\\";
            openFileDialog.Filter = "xml files (*.xml)|*.xml";
            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (File.Exists(openFileDialog.FileName))
                {
                    try
                    {
                        ruta = openFileDialog.FileName;
                        FicheroXml doc = new FicheroXml(ruta);
                        Factura fac = doc.leerFactura();
                        txbCodigo.Text = fac.CodClient;
                        txbDireccion.Text = fac.DirClient;
                        txbNombre.Text = fac.NameClient;
                        txbTelefono.Text = fac.TlfClient.ToString();
                        txbNumero.Text = fac.Numero.ToString();
                        dtp.Value = fac.Fecha;
                        BindingLista = new BindingList<Producto>(fac.Products);


                        decimal total = 0;

                        foreach (Producto p in BindingLista)
                        {
                            total += p.Total;
                        }
                        txbTotal.Text = total.ToString();
                        dgv.DataSource = BindingLista;
                        calculatotal();
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show("El fichero seleccionado no tiene el formato correcto");
                    }
                }
            }
        }
示例#7
0
文件: Form1.cs 项目: santii810/Dam209
        private void abrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = Application.StartupPath + "\\data\\";
            openFileDialog.Filter           = "xml files (*.xml)|*.xml";
            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (File.Exists(openFileDialog.FileName))
                {
                    try
                    {
                        ruta = openFileDialog.FileName;
                        FicheroXml doc = new FicheroXml(ruta);
                        Factura    fac = doc.leerFactura();
                        txbCodigo.Text    = fac.CodClient;
                        txbDireccion.Text = fac.DirClient;
                        txbNombre.Text    = fac.NameClient;
                        txbTelefono.Text  = fac.TlfClient.ToString();
                        txbNumero.Text    = fac.Numero.ToString();
                        dtp.Value         = fac.Fecha;
                        BindingLista      = new BindingList <Producto>(fac.Products);


                        decimal total = 0;

                        foreach (Producto p in BindingLista)
                        {
                            total += p.Total;
                        }
                        txbTotal.Text  = total.ToString();
                        dgv.DataSource = BindingLista;
                        calculatotal();
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show("El fichero seleccionado no tiene el formato correcto");
                    }
                }
            }
        }
示例#8
0
文件: Form1.cs 项目: santii810/Dam209
 private void guardarToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (txbTelefono.Text != "" && txbTelefono.Text != "" && txbCodigo.Text != "" && txbNombre.Text != "" && txbDireccion.Text != "" && txbNumero.Text != "" && txbTelefono.Text != "")
     {
         if (Int32.Parse(txbTelefono.Text) > 0 && Int32.Parse(txbNumero.Text) > 0)
         {
             ruta = Application.StartupPath + "\\data\\factura_" + txbNumero.Text + ".xml";
             Factura    fact = new Factura(Convert.ToInt32(txbNumero.Text), txbCodigo.Text, txbNombre.Text, txbDireccion.Text, Convert.ToInt32(txbTelefono.Text), BindingLista.ToList(), dtp.Value);
             FicheroXml fich = new FicheroXml(ruta);
             fich.saveFacturaXML(fact);
         }
         else
         {
             MessageBox.Show("Por favor introduce valores númericos en Nº de factura y en el teléfono");
         }
     }
     else
     {
         MessageBox.Show("Algunos elementos del formulario están en blanco. por favor complétalos");
     }
 }
示例#9
0
文件: Form1.cs 项目: santii810/Dam209
        private void guardarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (txbTelefono.Text != "" && txbTelefono.Text != "" && txbCodigo.Text != "" && txbNombre.Text != "" && txbDireccion.Text != "" && txbNumero.Text != "" && txbTelefono.Text != "")
            {
                if (Int32.Parse(txbTelefono.Text)>0 && Int32.Parse(txbNumero.Text)>0)
                {
                    ruta = Application.StartupPath + "\\data\\factura_" + txbNumero.Text + ".xml";
                    Factura fact = new Factura(Convert.ToInt32(txbNumero.Text), txbCodigo.Text, txbNombre.Text, txbDireccion.Text, Convert.ToInt32(txbTelefono.Text), BindingLista.ToList(), dtp.Value);
                    FicheroXml fich = new FicheroXml(ruta);
                    fich.saveFacturaXML(fact);
                }
                else
                {
                    MessageBox.Show("Por favor introduce valores númericos en Nº de factura y en el teléfono");
                }
            }
            else
            {
                MessageBox.Show("Algunos elementos del formulario están en blanco. por favor complétalos");
            }

        }
示例#10
0
文件: Form1.cs 项目: santii810/Dam209
 private void button1_Click(object sender, EventArgs e)
 {
     ruta = Application.StartupPath + "\\data\\Clientes.xml";
    
     FicheroXml fich = new FicheroXml(ruta);
     cliente=fich.BuscarCliente(this.txbCodigo.Text.Trim().ToLower());
     cargaclientes();
 }