コード例 #1
0
        private void ReportForm_Load(object sender, EventArgs e)
        {
            SqlConnection con;
            Conexione     repo = new Conexione();

            con = repo.AbrirConexion();
            try
            {
                string            cs                = @"Data Source=(localdb)\Servidor;Initial Catalog=AppGestion;Integrated Security=True";
                string            query             = "select * from Usuario";
                OleDbDataAdapter  adp               = new OleDbDataAdapter(query, cs);
                AppGestionDataSet appGestionDataSet = new AppGestionDataSet();
            }
            catch (InvalidCastException er)
            {
                Console.WriteLine(er.ToString());
            }
            repo.CerrarConexion(con);

            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.Refresh();

            this.reportViewer1.RefreshReport();
            this.reportViewer1.RefreshReport();
        }
コード例 #2
0
        private bool Guardarfacturas()
        {
            Conexione     repo = new Conexione();
            SqlConnection con  = repo.AbrirConexion();
            Usuario       user = repo.LeerUsuario(con);

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                con = repo.AbrirConexion();

                if (dataGridView1.Rows[i].Cells[5].Value != null && dataGridView1.Rows[i].Cells[6].Value == null)
                {
                    Factura fact = new Factura
                                   (
                        txtNumFactura.Text,
                        dataGridView1.Rows[i].Cells[0].Value.ToString(),
                        dataGridView1.Rows[i].Cells[1].Value.ToString(),
                        dataGridView1.Rows[i].Cells[3].Value.ToString(),
                        dataGridView1.Rows[i].Cells[2].Value.ToString(),
                        dataGridView1.Rows[i].Cells[4].Value.ToString(),
                        dataGridView1.Rows[i].Cells[5].Value.ToString(),
                        txtDescuento.Text, txtTotal.Text, txtPorcenIRPF.Text, txtPorcenIVA.Text, txtTotalFactura.Text,
                        comboBox1.SelectedValue.ToString()
                                   );
                    repo.GuardarFactura(con, fact, user.dni);
                }
            }
            return(true);
        }
コード例 #3
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            descuento = 0;
            suma      = 0;
            total     = 0;
            try
            {
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Rows[i].Cells[5].Value != null)
                    {
                        String celImportValue = dataGridView1.Rows[i].Cells[5].Value.ToString();
                        Regex  regex          = new Regex(@"[0-9]*[\.\,]?[.0-9]+");
                        if (ValidacionesUtils.ValidarNumeros(celImportValue))
                        {
                            dataGridView1.Rows[i].Cells[5].Value = "";
                        }
                        if (Decimal.TryParse(celImportValue, out decimal xt))
                        {
                            suma = suma + xt;
                        }
                    }

                    if (dataGridView1.Rows[i].Cells[2].Value != null)
                    {
                        Conexione repo = new Conexione();
                        con = repo.AbrirConexion();
                        try
                        {
                            Factura factura = repo.FacturaDeCliente(con, dataGridView1.Rows[i].Cells[2].Value.ToString());
                            if (dataGridView1.Rows[i].Cells[3].Value == null)
                            {
                                dataGridView1.Rows[i].Cells[3].Value = factura.idLocalidad;
                            }

                            /* if (dataGridView1.Rows[i].Cells[4].Value == null)
                             * {
                             *   dataGridView1.Rows[i].Cells[4].Value = factura.matricula;
                             * }*/
                            if (dataGridView1.Rows[i].Cells[5].Value == null)
                            {
                                dataGridView1.Rows[i].Cells[5].Value = factura.importe;
                            }
                        }
                        catch (InvalidCastException er)
                        {
                            Console.WriteLine(e.ToString());
                        }
                    }
                }
                txtSuma.Text = suma.ToString();
            }
            catch (Exception ex)
            {
            }
            calcularTotal();
        }
コード例 #4
0
 public CrearUsuarioView()
 {
     InitializeComponent();
     this.ActiveControl = lbldni;
     repo          = new Conexione();
     presenter     = new CrearUsuarioPresenter(this, repo);
     usuario       = new Usuario();
     modificarUser = false;
 }
コード例 #5
0
        private void loadImpuestos()
        {
            Conexione     repo = new Conexione();
            SqlConnection con  = repo.AbrirConexion();
            Factura       fact = repo.DatosUltimaFactura(con);

            txtPorcenIRPF.Text = fact.IRPF;
            txtPorcenIVA.Text  = fact.IVA;
            txtNumFactura.Text = fact.numFactura;
        }
コード例 #6
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            progressBar1.Increment(10);

            if (progressBar1.Value == 100)
            {
                timer1.Stop();
                this.Visible = false;
                Conexione    repo         = new Conexione();
                SplashInicia splashInicia = new SplashInicia(repo);
            }
        }
コード例 #7
0
        private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            var dataGrid = sender as DataGridView;

            if (dataGrid == null)
            {
                return;
            }
            List <Factura> facturas = null;
            TextBox        auto     = e.Control as TextBox;

            if (auto != null)
            {
                AutoCompleteStringCollection autotxt = new AutoCompleteStringCollection();
                auto.AutoCompleteMode   = AutoCompleteMode.Suggest;
                auto.AutoCompleteSource = AutoCompleteSource.CustomSource;

                Conexione repo = new Conexione();
                con = repo.AbrirConexion();
                try
                {
                    facturas = repo.FacturasByCliente(con);
                }
                catch (InvalidCastException er)
                {
                    Console.WriteLine(e.ToString());
                }
                foreach (Factura fact in facturas)
                {
                    switch (columnna)
                    {
                    case "Localidad":
                        autotxt.Add(fact.idLocalidad);
                        break;

                    case "Cliente":
                        autotxt.Add(fact.idCliente);
                        break;

                        /*   case "Matricula":
                         *     autotxt.Add(fact.matricula);
                         *     break;*/
                    }
                }
                auto.AutoCompleteCustomSource = autotxt;
            }
        }
コード例 #8
0
        private void CrearUsuarioView_Load(object sender, EventArgs e)
        {
            Conexione     repo = new Conexione();
            SqlConnection con  = repo.AbrirConexion();
            Usuario       user = repo.LeerUsuario(con);

            if (user.dni != null)
            {
                modificarUser      = true;
                editDNI.Text       = user.dni;
                editNombre.Text    = user.nombre;
                editApellido1.Text = user.apellido;
                editDireccion.Text = user.direccion;
                editCP.Text        = user.cp;
                editCiudad.Text    = user.ciudad;
                editProvincia.Text = user.provincia;
            }
        }
コード例 #9
0
        private void loadFacturasMes(string facturaABuscar)
        {
            Conexione     repo = new Conexione();
            SqlConnection con  = repo.AbrirConexion();

            factGuardadas = repo.LoadFacturasMes(con, facturaABuscar);
            bool registrado;

            for (int i = 0; i < factGuardadas.Count; i++)
            {
                if (String.IsNullOrEmpty(factGuardadas[i].PkId))
                {
                    registrado = false;
                }
                else
                {
                    registrado = true;
                }
                this.dataGridView1.Rows.Add(factGuardadas[i].fecha, factGuardadas[i].numAlbaran, factGuardadas[i].idCliente, factGuardadas[i].idLocalidad, factGuardadas[i].matricula, factGuardadas[i].importe, registrado);
            }
        }
コード例 #10
0
        private void loadClientes()
        {
            Conexione      repo     = new Conexione();
            SqlConnection  con      = repo.AbrirConexion();
            List <Cliente> clientes = repo.LoadClientes(con);

            bool registrado;

            for (int i = 0; i < clientes.Count; i++)
            {
                if (String.IsNullOrEmpty(clientes[i].cif))
                {
                    registrado = false;
                }
                else
                {
                    registrado = true;
                }
                this.dataGridView1.Rows.Add(clientes[i].nombre, clientes[i].cif, clientes[i].direccion, clientes[i].codigoPostal, clientes[i].provincia);
            }
        }
コード例 #11
0
        public void avisoGuardar()
        {
            DialogResult result = MessageBox.Show("¿Has guardado las facturas?", "Imprimir", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                Conexione repo = new Conexione();
                con = repo.AbrirConexion();
                try
                {
                    List <Factura> user = repo.MostrarFacturas(con);
                }
                catch (InvalidCastException e)
                {
                    Console.WriteLine(e.ToString());
                }
                repo.CerrarConexion(con);
            }
            else if (result == DialogResult.No)
            {
            }
        }
コード例 #12
0
        private void loadImpuestos(string facturaABuscar)
        {
            Conexione     repo  = new Conexione();
            SqlConnection con   = repo.AbrirConexion();
            long          value = 0;

            fact = repo.DatosUltimaFactura(con);
            txtPorcenIRPF.Text = fact.IRPF;
            txtPorcenIVA.Text  = fact.IVA;
            if (String.IsNullOrEmpty(facturaABuscar))
            {
                if (long.TryParse(fact.numFactura, out value))
                {
                    value = value + 1;
                    txtNumFactura.Text = value.ToString();
                }
            }
            else
            {
                txtNumFactura.Text = fact.numFactura;
            }
        }
コード例 #13
0
        private bool GuardarClientes()
        {
            Conexione     repo = new Conexione();
            SqlConnection con  = repo.AbrirConexion();
            Usuario       user = repo.LeerUsuario(con);

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                con = repo.AbrirConexion();
                if (dataGridView1.Rows[i].Cells[0].Value != null)
                {
                    Cliente cli = new Cliente
                                  (
                        dataGridView1.Rows[i].Cells[0].Value.ToString(),
                        dataGridView1.Rows[i].Cells[1].Value.ToString(),
                        dataGridView1.Rows[i].Cells[3].Value.ToString(),
                        dataGridView1.Rows[i].Cells[2].Value.ToString(),
                        dataGridView1.Rows[i].Cells[4].Value.ToString()
                                  );
                    repo.GuardarCliente(con, cli, user.dni);
                }
            }
            return(true);
        }
コード例 #14
0
 public SplashInicia(Conexione conexion)
 {
     this.repo = conexion;
     this.setUp();
 }
コード例 #15
0
 public CrearUsuarioPresenter(CrearUsuarioView crearUsuarioView, Conexione repo)
 {
     this.crearUsuarioView = crearUsuarioView;
     this.repo             = repo;
 }
コード例 #16
0
 public CrearUsuarioPresenter(Usuario usuario, SqlConnection con, bool modificarUsuario)
 {
     this.view = view;
     this.repo = repo;
 }