public void CannotCreateAPresupuestoWithImporteEqualToZero()
 {
     var presupuesto = new Presupuesto(
         GetCliente(),
         GetVehiculo(),
         0);
 }
 public void CannotCreateAPresupuestoWithImporteLessThanZero()
 {
     var presupuesto = new Presupuesto(
         GetCliente(),
         GetVehiculo(),
         -100);
 }
Example #3
0
        public void toStringTest()
        {
            int         Año           = 2020;
            string      Mes           = "Octubre";
            Presupuesto UnPresupuesto = new Presupuesto(Año, Mes, new List <MontoCategoria>());

            Assert.AreEqual("Octubre 2020", UnPresupuesto.ToString());
        }
Example #4
0
        public void ConstructorConParametrosTest()
        {
            int         Año           = 2020;
            string      Mes           = "Octubre";
            Presupuesto UnPresupuesto = new Presupuesto(Año, Mes, new List <MontoCategoria>());

            Assert.IsNotNull(UnPresupuesto);
        }
        public ActionResult DetallePresupuesto(int id)
        {
            int         idEntidad = ((Usuario)Session["usuario"]).idEntidad.Value;
            Presupuesto pres      = PresupuestoDAO.getInstancia().getPresupuesto(id);

            ViewBag.categorias = CategoriaDAO.getInstancia().getCategorias(idEntidad);
            return(View(pres));
        }
        public void EditarTest()
        {
            Presupuesto editado = new Presupuesto(4, 5, "prueba 2");

            editado.AgregarDetalle(3, 5001);

            Assert.IsTrue(editado.Editar());
        }
Example #7
0
 private void LlenaCampo(Presupuesto presupuesto)
 {
     IDnumericUpDown.Value    = presupuesto.Presupuestoid;
     DescripciontextBox.Text  = presupuesto.Descripcion;
     MontonumericUpDown.Value = Convert.ToDecimal(presupuesto.Monto);
     this.Detalle             = presupuesto.cuentas;
     CargarGrid();
 }
Example #8
0
        public void UpdateEstado(PresupuestoSeguimiento seguimiento)
        {
            Presupuesto presupuesto = presupuestoRepository.Get(x => x.Id == seguimiento.PresupuestoId);

            presupuesto.PresupuestoEstadoId = seguimiento.PresupuestoEstadoId;
            presupuestoRepository.Update(presupuesto);
            SavePresupuesto();
        }
        public void AgregarPresupuestoTest()
        {
            Presupuesto Unpresupuesto = new Presupuesto(2018, "Octubre", new List <MontoCategoria>());
            Repositorio Repo          = new Repositorio();

            Repo.AgregarPresupuesto(Unpresupuesto);
            Assert.AreEqual(Unpresupuesto.Id, Repo.GetPresupuestos().GetAll()[0].Id);
        }
Example #10
0
        public ActionResult DeleteConfirmed(int id)
        {
            Presupuesto presupuesto = db.Presupuesto.Find(id);

            db.Presupuesto.Remove(presupuesto);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #11
0
 public PresupuestoViewModel(Presupuesto presupuesto, List <PresupuestoDetalle> presupuestoDetalles, List <Categoria> categorias, List <Categoria> subCategorias)
 {
     Presupuesto         = presupuesto;
     PresupuestoDetalles = presupuestoDetalles;
     Categorias          = categorias;
     SubCategorias       = subCategorias;
     States = new StatesDictionary();
 }
Example #12
0
        static void Main(string[] args)
        {
            Presupuesto           p = new Presupuesto();
            ConciliacionBanacaria c = new ConciliacionBanacaria();

            double venta    = 15000;
            double comision = (venta < 1500) ? (venta * 0.10) : (venta * 0.15);

            Console.WriteLine("La comiscion por la venta es {0} es de {1}.", venta, comision);
            Console.ReadLine();

            Tiempo t = new Tiempo();

            t.setHora(20);
            t.setMinuto(30);
            t.setSegundo(20);
            Fecha f = new Fecha();

            Console.WriteLine("Hora: " + t.getHora() + " \nMinuto: " + t.getMinuto() + " \nSegundo: " + t.getSegundo() + "\n");
            Console.WriteLine(f.getFecha());

            Console.WriteLine("#\t\tBisiesto");
            for (int i = 1996; i <= DateTime.Now.Year; i++)
            {
                if (Fecha.EsBiciesto(i))
                {
                    Console.WriteLine(String.Format("{0}\t\t{1}", i, Fecha.EsBiciesto(i) ? "Si" : "No"));
                }
            }
            Console.WriteLine(f[1]);
            Console.WriteLine(f[2]);
            Console.WriteLine(f[3]);

            f[1] = 50;
            f[2] = 40;
            f[3] = 60;
            Console.WriteLine(f[1]);
            Console.WriteLine(f[2]);
            Console.WriteLine(f[3]);
            Console.ReadKey();



            string[] nom = { "Walder", "Reyes", "De", "Jesus" };
            Array.Sort(nom);
            foreach (string nom in noms)
            {
                Console.WriteLine(nom);
            }
            Console.ReadKey();

            ArrayList arr = new ArrayList();

            arr.Add(23);
            arr.Add(40);

            List <Persona>
        }
Example #13
0
 public void IngresarDatos(string[,] m)
 {
     try
     {
         PrincipalPermission MyPermission = new PrincipalPermission(NombreUsuario, "P4");
         MyPermission.Demand();
         if (m != null)
         {
             Presupuesto_Contenido   sa = new Presupuesto_Contenido();
             Presupuesto_Contenido[] l  = sa.TableToArray(sa.SelXNumPresupuesto(idpresupuesto));
             bool esta = false;
             for (int x = 0; x < l.Length; x++)
             {
                 for (int y = 0; y < m.Length / 7; y++)
                 {
                     if (Convert.ToInt32(m[y, 0]) == l[x].Numero_Concepto && l[x].Eliminado == false)
                     {
                         esta = true;
                     }
                 }
                 if (esta == false)
                 {
                     sa.Eliminar(idpresupuesto, l[x].Numero_Concepto);
                     esta = false;
                 }
                 esta = false;
             }
             for (int x = 0; x < m.Length / 7; x++)
             {
                 Presupuesto_Contenido agregar = new Presupuesto_Contenido(idpresupuesto, Convert.ToInt32(m[x, 0]));
                 if (agregar.Numero_Concepto != 0)
                 {
                     if (agregar.Eliminado == false)
                     {
                         agregar.Actualizar(idpresupuesto, Convert.ToInt32(m[x, 0]), Convert.ToDecimal(m[x, 3]), Convert.ToInt32(m[x, 4]), Convert.ToDecimal(m[x, 5]));
                     }
                     else
                     {
                         agregar.Activar(idpresupuesto, agregar.Numero_Concepto);
                         agregar.Actualizar(idpresupuesto, Convert.ToInt32(m[x, 0]), Convert.ToDecimal(m[x, 3]), Convert.ToInt32(m[x, 4]), Convert.ToDecimal(m[x, 5]));;
                     }
                 }
                 else if (agregar.Numero_Concepto == 0)
                 {
                     agregar.Insertar(idpresupuesto, Convert.ToInt32(m[x, 0]), Convert.ToDecimal(m[x, 3]), Convert.ToInt32(m[x, 4]), Convert.ToDecimal(m[x, 5]));
                 }
             }
             Presupuesto presupuesto = new Presupuesto(idpresupuesto);
             if (presupuesto.Existe)
             {
                 presupuesto.Actualizar(idpresupuesto, presupuesto.Etiqueta, presupuesto.Nombre_Solicitante, presupuesto.Nombre_Propietario, TXT_Genero.Text, presupuesto.Mts, Convert.ToDecimal(Total.Text.Trim()), EstadoPresupuesto.SelectedIndex, IdTipodeproyecto);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Example #14
0
        public void RegistroDePresupuestoValidoTest()
        {
            int    Año = 2021;
            string Mes = "Mayo";
            List <MontoCategoria> ListaCategoriasMonto = new List <MontoCategoria>();
            Presupuesto           UnPresupuesto        = new Presupuesto(Año, Mes, ListaCategoriasMonto);

            Assert.IsNotNull(UnPresupuesto);
        }
Example #15
0
        private int _GuardarPresupuesto()
        {
            if (_FaltaCampoRequerido())
            {
                return(0);
            }

            var presupuesto = new Presupuesto();

            presupuesto.idCliente        = _idCliente;
            presupuesto.FechaEmision     = dtpFechaEmision.Value;
            presupuesto.Numero           = txtNumPresupuesto.Text;
            presupuesto.FechaVto         = dtpVencimiento.Value;
            presupuesto.Condiciones      = txtCondiciones.Text;
            presupuesto.Total            = Convert.ToDecimal(lblTotal.Text);
            presupuesto.DomicilioEntrega = txtDomicilioEntrega.Text;
            presupuesto.LocalidadEntrega = txtLocalidad.Text;
            presupuesto.ProvinciaEntrega = comboProvincia.Text;
            presupuesto.CodPostalEntrega = txtCodPostal.Text;
            presupuesto.Disponibilidad   = txtDisponibilidad.Text;

            try
            {
                presupuesto.idEstado = PresupuestoController.ListarDocumentosEstado().First().idEstado;
            }
            catch (Exception)
            {
                presupuesto.idEstado = 1;
            }

            //Carga de lineas
            foreach (DataGridViewRow row in grdDetallePresupuesto.Rows)
            {
                if (!row.IsNewRow)
                {
                    var linea    = new Presupuestos_Linea();
                    var articulo = ArticulosController.DatosArticuloPorCodigoYColor(row.Cells["Codigo"].Value.ToString());
                    linea.idArticulo = articulo.idArticulo;
                    linea.Cantidad   = Convert.ToInt32(row.Cells["Cantidad"].Value);
                    linea.Precio     = articulo.Precio;

                    presupuesto.Presupuestos_Lineas.Add(linea);
                }
            }

            if (PresupuestoController.AgregarPresupuesto(presupuesto))
            {
                MessageBox.Show("Presupuesto guardado correctamente");
                _idPresupuestoGuardado = presupuesto.idPresupuesto;
                btnGuardar.Enabled     = false;
            }
            else
            {
                MessageBox.Show("Ocurrio un problema al guardar el Presupuesto, inténtelo nuevamente");
            }
            return(presupuesto.idPresupuesto);
        }
Example #16
0
 //------------------------------------------------------------------------------
 //Gestion de Presupuestos
 ///<summary>
 ///Inserta un presupuesto en la base de datos , y lo asocia a sus tablas correspondientes
 ///</summary>
 public void crearPresupuesto(Presupuesto p, List <Vehiculo> vehiculos)
 {
     foreach (Vehiculo v in vehiculos)
     {
         p.CocheList.Add(v);
         PersistenciaPresupuestoVehiculo.Añadir(new PresupuestoVehiculoDato(new Clave(p.Id_presupuesto, v.NumBastidor)));
     }
     PersistenciaPresupuesto.Añadir(p);
 }
Example #17
0
        void Partidas_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
        {
            if (View != null && View.ObjectSpace != null && !View.ObjectSpace.IsCommitting)
            {
                Presupuesto obj = View.CurrentObject as Presupuesto;

                obj.Total = obj.Partidas.Count;
            }
        }
Example #18
0
        public void PresupuestoRepetidoTest()
        {
            Repositorio        Repositorio   = new Repositorio();
            ManagerPresupuesto Manager       = new ManagerPresupuesto(Repositorio);
            Presupuesto        UnPresupuesto = new Presupuesto(2020, "Octubre", new List <MontoCategoria>());

            Repositorio.AgregarPresupuesto(UnPresupuesto);
            Manager.ValidacionAgregarPresupuesto(UnPresupuesto);
        }
Example #19
0
        private void LlenaCampos(Presupuesto presupuesto)
        {
            IdNumericUpDown.Value     = presupuesto.PresupuestoId;
            DescripcionTextBox.Text   = presupuesto.Descripcion;
            FechaDateTimePicker.Value = presupuesto.Fecha;

            this.Detalle = presupuesto.Monto;
            CargarGrid();
        }
 public void LlenarDatos(Presupuesto presupuesto)
 {
     presupuesto.UsuarioId   = Convert.ToInt32(UsuarioDropDownList.SelectedValue);
     presupuesto.Descripcion = DescripcionTextBox.Text;
     foreach (GridViewRow dr in DetalleGridView.Rows)
     {
         presupuesto.AgregarDetalle(Convert.ToInt32(dr.Cells[0].Text), Convert.ToSingle(dr.Cells[1].Text));
     }
 }
Example #21
0
 public PresupuestoDAO CalcularTotal(Presupuesto p)
 {
     using (var context = new MySql())
     {
         p.calcular_total();
         context.SaveChanges();
     }
     return(this);
 }
Example #22
0
        public IEnumerable <ValidationResult> CanAddNewRevisionPresupuesto(Presupuesto nuevoPresupuesto)
        {
            Presupuesto presupuestoPadre = null;

            if (nuevoPresupuesto.Id != Guid.Empty)
            {
                presupuestoPadre = this.presupuestoRepository.Get(x => x.Id == nuevoPresupuesto.Id && x.Codigo == nuevoPresupuesto.Codigo);
            }
            if (presupuestoPadre == null)
            {
                yield return(new ValidationResult("Codigo", Resources.PresupuestoNoExiste));
            }
            if (presupuestoPadre.PresupuestoNuevo != null)
            {
                yield return(new ValidationResult("Codigo", Resources.PresupuestoRevisionNoActualizable));
            }

            if (nuevoPresupuesto.ClienteId == Guid.Empty || nuevoPresupuesto.ClienteId == null)
            {
                yield return(new ValidationResult("ClienteId", Resources.ClienteRequired));
            }
            if (nuevoPresupuesto.ObraId == Guid.Empty || nuevoPresupuesto.ObraId == null)
            {
                yield return(new ValidationResult("ObraId", Resources.ObraRequired));
            }
            var itemPadres = presupuestoPadre.PresupuestoItem.ToList();

            foreach (var item in nuevoPresupuesto.PresupuestoItem)
            {
                if (item.Estado != "GUARDADO")
                {
                    var itemPadre = itemPadres.Where(x => x.Id == item.Id).SingleOrDefault();
                    if (itemPadre == null)
                    {
                        yield return(new ValidationResult("Items", Resources.ItemNotExists));
                    }
                }
                else if (item.Estado != "MODIFICADO")
                {
                    var itemPadre = itemPadres.Where(x => x.Id == item.Id).SingleOrDefault();
                    if (itemPadre == null)
                    {
                        yield return(new ValidationResult("Items", Resources.ItemNotExists));
                    }
                }
                else if (item.Estado == "NUEVO" || item.Estado == String.Empty || item.Estado == null)
                {
                    ;
                }

                if (item.ArchivoTipologiaId != Guid.Empty && item.ArchivoTipologiaId != null && nuevoPresupuesto.ArchivoTransaccionId == Guid.Empty)
                {
                    yield return(new ValidationResult("ArchivoTransaccionId", Resources.InvalidEmptyTransaccion));
                }
            }
        }
Example #23
0
        /// <summary>
        /// PRE:la clase que se pasa como parametro debe de estar incializada
        /// POST: Dado un Presupuesto (Del que solo se utilizara la clave), obtendremos un Presupuesto con todos sus campos,
        /// no se contempla el caso en el que el Presupuesto no esta en la BD
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public static Presupuesto Buscar(Presupuesto p)
        {
            PresupuestosDato presupuesto = new PresupuestosDato(p.Id, null, p.FechaRealizacion, p.Estado, ""); //Solo nos interesa la clave
            PresupuestosDato dev         = BD.SelectPresupuesto(presupuesto);

            //Cliente asociado:
            Cliente c = Persistencia.Buscar(new Cliente(dev.Cliente));

            //Vehiculo comprado:
            Vehiculo vehiculoComprado;

            if (dev.VehiculoComprado == "")
            {
                vehiculoComprado = null;
            }
            else
            {
                if (Persistencia.Existe(new VehiculoNuevo(dev.VehiculoComprado)))
                {
                    //Se trata de un vehiculo nuevo:
                    vehiculoComprado = Persistencia.Buscar(new VehiculoNuevo(dev.VehiculoComprado));
                }
                else
                {
                    //Se trata de un vehiculo de segunda mano:
                    vehiculoComprado = Persistencia.Buscar(new VehiculoSegundaMano(dev.VehiculoComprado));
                }
            }

            //Lista de vehiculos:
            List <Vehiculo>            l = new List <Vehiculo>();
            Presupuesto_VehiculosTabla t = BD.Presupuesto_vehiculos;
            int tam = t.Count();

            for (int i = 0; i < tam; i++)
            {
                Presupuesto_VehiculosDato pv = t[i]; //vamos cogiendo elemento a elemento y miramos si coincide el id para si eso agregarlo a la lista
                if (pv.Clave.Id.Equals(p.Id))
                {
                    Vehiculo vehiculoActual;
                    if (Persistencia.Existe(new VehiculoNuevo(pv.Clave.Vehiculo)))
                    {
                        //Se trata de un vehiculo nuevo:
                        vehiculoActual = Persistencia.Buscar(new VehiculoNuevo(pv.Clave.Vehiculo));
                    }
                    else
                    {
                        //Se trata de un vehiculo de segunda mano:
                        vehiculoActual = Persistencia.Buscar(new VehiculoSegundaMano(pv.Clave.Vehiculo));
                    }
                    l.Add(vehiculoActual);
                }
            }

            return(new Presupuesto(dev.Id, c, dev.FechaRealizacion, dev.Estado, l, vehiculoComprado));
        }
Example #24
0
 public ActionResult Edit([Bind(Include = "CustomerId,Cliente,Factura,OrderDate")] Presupuesto presupuesto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(presupuesto).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(presupuesto));
 }
        public void TestAgregarPresupuesto()
        {
            DAOPresupuestoFactura servidorSQL = new DAOPresupuestoFactura();
            Presupuesto           presupuesto = new Presupuesto(11, 2550.0, new DateTime(2012, 10, 27));

            presupuesto.Observaciones       = "observacion 1";
            presupuesto.Listado_presupuesto = new List <Detalle_Presupuesto_Factura>();

            Assert.IsTrue(servidorSQL.AgregarPresupuesto(presupuesto, 1));
        }
        private void LlenarCamposInstancia()
        {
            int id = 0;

            if (PresupuestoIdTextBox.Text != "")
            {
                id = Utilidad.ToInt(PresupuestoIdTextBox.Text);
            }
            presupuesto = new Presupuesto(id, DateTime.Parse(FechaTextBox.Text), DescripcionTextBox.Text, Utilidad.ToDouble(MontoTextBox.Text));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Presupuesto presupuesto = new Presupuesto();

            ListadoPresupuestoViewer.ProcessingMode         = ProcessingMode.Local;
            ListadoPresupuestoViewer.LocalReport.ReportPath = Server.MapPath("~/Rpts/ListadoPresupuesto.rdlc");
            ListadoPresupuestoViewer.LocalReport.DataSources.Clear();
            ListadoPresupuestoViewer.LocalReport.DataSources.Add(new ReportDataSource("Presupuestos", presupuesto.Listado("*", "1=1", "")));
            ListadoPresupuestoViewer.LocalReport.Refresh();
        }
 protected void EliminarButton_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(PresupuestoIdTextBox.Text))
     {
         int id = Utilidad.ToInt(PresupuestoIdTextBox.Text);
         presupuesto = PresupuestoBLL.Buscar(P => P.PresupuestoId == id);
         PresupuestoBLL.Eliminar(presupuesto);
         Limpiar();
     }
 }
        public static bool Eliminar(Presupuesto id)
        {
            bool retorno = false;

            using (var conn = new Repositorio <Presupuesto>())
            {
                retorno = conn.Eliminar(id);
            }
            return(retorno);
        }
        public static bool Modificar(Presupuesto criterio)
        {
            bool result = false;

            using (var conn = new Repositorio <Presupuesto>())
            {
                result = conn.Modificar(criterio);
            }
            return(result);
        }
        public static Presupuesto Buscar(Expression <Func <Presupuesto, bool> > id)
        {
            Presupuesto result = null;

            using (var conn = new Repositorio <Presupuesto>())
            {
                result = conn.Buscar(id);
            }
            return(result);
        }
        public static Presupuesto Guardar(Presupuesto nuevo)
        {
            Presupuesto result = null;

            using (var conn = new Repositorio <Presupuesto>())
            {
                result = conn.Guardar(nuevo);
            }
            return(result);
        }
Example #33
0
 public static string GetLockKeyCodigo(this PresupuestoItem request, Presupuesto presupuesto)
 {
     return string.Format("urn:lock:PresupuestoItem:IdPresupuesto:{0}:Codigo:{1}",
                          presupuesto.Id, request.Codigo);
 }
 public void CannotCreateAPresupuestoWithTransientCliente()
 {
     var presupuesto = new Presupuesto(
         new Cliente("carlos", "tirado", "", true),
         GetVehiculo(),
         100);
 }
 public void CannotCreateAPresupuestoWithNullVehiculo()
 {
     var presupuesto = new Presupuesto(
         GetCliente(),
         null,
         100);
 }
 public void CannotCreateAPresupuestoWithTransientVehiculo()
 {
     var presupuesto = new Presupuesto(
         GetCliente(),
         new Vehiculo("Opel", "Astra", 200),
         100);
 }
 private Presupuesto GetPresupuesto()
 {
     var presupuesto = new Presupuesto(GetCliente(), GetVehiculo(), 100);
     presupuesto.ChangeCurrentIdentity(1);
     return presupuesto;
 }