Esempio n. 1
0
        public void insertElement(object element)
        {
            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    FACTURA_DETALLE factura = (FACTURA_DETALLE)element;

                    var validacion = (from cust in entity.FACTURA_DETALLE
                                      where cust.UNID_FACTURA_DETALE == factura.UNID_FACTURA_DETALE
                                      select cust).ToList();

                    if (validacion.Count == 0)
                    {
                        factura.UNID_FACTURA_DETALE = UNID.getNewUNID();
                        //Sync
                        factura.IS_MODIFIED        = true;
                        factura.LAST_MODIFIED_DATE = UNID.getNewUNID();
                        var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
                        modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                        entity.SaveChanges();
                        //
                        entity.FACTURA_DETALLE.AddObject(factura);
                        entity.SaveChanges();
                    }
                }
            }
        }
Esempio n. 2
0
 public void udpateElement(object element)
 {
     if (element != null)
     {
         using (var entity = new TAE2Entities())
         {
             FACTURA_DETALLE factura         = (FACTURA_DETALLE)element;
             var             modifiedFactura = entity.FACTURA_DETALLE.First(p => p.UNID_FACTURA_DETALE == factura.UNID_FACTURA_DETALE);
             modifiedFactura.CANTIDAD          = factura.CANTIDAD;
             modifiedFactura.DESCRIPCION       = factura.DESCRIPCION;
             modifiedFactura.IS_ACTIVE         = factura.IS_ACTIVE;
             modifiedFactura.IMPUESTO_UNITARIO = factura.IMPUESTO_UNITARIO;
             modifiedFactura.NUMERO            = factura.NUMERO;
             modifiedFactura.PRECIO_UNITARIO   = factura.PRECIO_UNITARIO;
             modifiedFactura.UNID_ARTICULO     = factura.UNID_ARTICULO;
             modifiedFactura.UNID_FACTURA      = factura.UNID_FACTURA;
             modifiedFactura.UNID_PEDIMENTO    = factura.UNID_PEDIMENTO;
             modifiedFactura.UNID_UNIDAD       = factura.UNID_UNIDAD;
             //Sync
             modifiedFactura.IS_MODIFIED        = true;
             modifiedFactura.LAST_MODIFIED_DATE = UNID.getNewUNID();
             var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
             modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
             entity.SaveChanges();
             //
             entity.SaveChanges();
         }
     }
 }
Esempio n. 3
0
        public void loadSync(object element)
        {
            if (element != null)
            {
                FACTURA_DETALLE poco = (FACTURA_DETALLE)element;
                using (var entity = new TAE2Entities())
                {
                    var query = (from cust in entity.FACTURA_DETALLE
                                 where poco.UNID_FACTURA_DETALE == cust.UNID_FACTURA_DETALE
                                 select cust).ToList();

                    //Actualización
                    if (query.Count > 0)
                    {
                        var aux = query.First();

                        if (aux.LAST_MODIFIED_DATE < poco.LAST_MODIFIED_DATE)
                        {
                            udpateElement((object)poco);
                        }
                    }
                    //Inserción
                    else
                    {
                        insertElementSync((object)poco);
                    }

                    var modifiedCotizacion = entity.FACTURA_DETALLE.First(p => p.UNID_FACTURA_DETALE == poco.UNID_FACTURA_DETALE);
                    modifiedCotizacion.IS_MODIFIED = false;
                    entity.SaveChanges();
                }
            }
        }
Esempio n. 4
0
        public void Delete(int Id)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioFACTURA_DETALLE repositorio      = new RepositorioFACTURA_DETALLE(context);
                    FACTURA_DETALLE            _FACTURA_DETALLE = repositorio.GetById(Id);

                    if (Equals(_FACTURA_DETALLE, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado FACTURA_DETALLE con Id =", Id.ToString()));
                    }

                    _FACTURA_DETALLE.ACTIVO = false;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Esempio n. 5
0
 public DeleteFacturaDetalleModel(FACTURA_DETALLE facturaDetalle)
 {
     this.PRECIO_UNITARIO     = facturaDetalle.PRECIO_UNITARIO;
     this.CANTIDAD            = facturaDetalle.CANTIDAD;
     this.IMPUESTO_UNITARIO   = facturaDetalle.IMPUESTO_UNITARIO;
     this.Articulo            = facturaDetalle.ARTICULO;
     this.UNID_FACTURA_DETALE = facturaDetalle.UNID_FACTURA_DETALE;
 }
        public ActionResult DeleteConfirmed(int id)
        {
            FACTURA_DETALLE fACTURA_DETALLE = db.FACTURA_DETALLE.Find(id);

            db.FACTURA_DETALLE.Remove(fACTURA_DETALLE);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "DETALLE_ID,FACTURA_ID,PRODUCTO_ID,CANTIDAD,PRECIO_FACTURA,ANULADA")] FACTURA_DETALLE fACTURA_DETALLE)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fACTURA_DETALLE).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FACTURA_ID  = new SelectList(db.FACTURA, "FACTURA_ID", "CAUSA_ANULADA", fACTURA_DETALLE.FACTURA_ID);
     ViewBag.PRODUCTO_ID = new SelectList(db.PRODUCTO, "PRODUCTO_ID", "DESCRIPCION", fACTURA_DETALLE.PRODUCTO_ID);
     return(View(fACTURA_DETALLE));
 }
Esempio n. 8
0
        public void udpateElement(object element)
        {
            if (element != null && (element as FACTURA_DETALLE) != null)
            {
                FACTURA_DETALLE fd = element as FACTURA_DETALLE;

                using (var entity = new TAE2Entities())
                {
                    //var resFd=entity.FACTURA_DETALLE.First(o=>o.UNID_FACTURA_DETALE==fd.UNID_FACTURA_DETALE);
                    //resFd.
                }
            }
        }
        // GET: /FACTURA_DETALLE/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FACTURA_DETALLE fACTURA_DETALLE = db.FACTURA_DETALLE.Find(id);

            if (fACTURA_DETALLE == null)
            {
                return(HttpNotFound());
            }
            return(View(fACTURA_DETALLE));
        }
Esempio n. 10
0
        public void Update(int Id, int FACTURAId, int PRESTACIONId, int MONTO_TOTAL, int MONTO_COBRADO)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioFACTURA_DETALLE repositorio      = new RepositorioFACTURA_DETALLE(context);
                    FACTURA_DETALLE            _FACTURA_DETALLE = repositorio.GetById(Id);
                    if (Equals(_FACTURA_DETALLE, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado FACTURA_DETALLE con Id =", Id.ToString()));
                    }

                    RepositorioFACTURA _repositorioFACTURA = new RepositorioFACTURA(context);
                    FACTURA            _objFACTURA         = _repositorioFACTURA.GetById(FACTURAId);
                    if (Equals(_objFACTURA, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado FACTURA con Id =", FACTURAId.ToString()));
                    }

                    RepositorioPRESTACION _repositorioPRESTACION = new RepositorioPRESTACION(context);
                    PRESTACION            _objPRESTACION         = _repositorioPRESTACION.GetById(PRESTACIONId);
                    if (Equals(_objPRESTACION, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PRESTACION con Id =", PRESTACIONId.ToString()));
                    }

                    //properties

                    _FACTURA_DETALLE.MONTO_TOTAL   = MONTO_TOTAL;
                    _FACTURA_DETALLE.MONTO_COBRADO = MONTO_COBRADO;

                    //parents

                    _FACTURA_DETALLE.FACTURA    = _objFACTURA;
                    _FACTURA_DETALLE.PRESTACION = _objPRESTACION;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
        public FACTURA_DETALLE ConvertToPoco(FacturaCompraDetalleModel fcdm)
        {
            FACTURA_DETALLE poco = new FACTURA_DETALLE()
            {
                UNID_ARTICULO       = fcdm.Articulo.UnidArticulo,
                UNID_FACTURA        = fcdm.Factura.UnidFactura,
                UNID_UNIDAD         = fcdm.Unidad.UnidUnidad,
                UNID_FACTURA_DETALE = fcdm.UnidFacturaCompraDetalle,
                CANTIDAD            = fcdm.Cantidad,
                IS_ACTIVE           = fcdm.IsActive,
                NUMERO          = fcdm.Numero,
                PRECIO_UNITARIO = fcdm.CostoUnitario
            };

            return(poco);
        }
        // GET: /FACTURA_DETALLE/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FACTURA_DETALLE fACTURA_DETALLE = db.FACTURA_DETALLE.Find(id);

            if (fACTURA_DETALLE == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FACTURA_ID  = new SelectList(db.FACTURA, "FACTURA_ID", "CAUSA_ANULADA", fACTURA_DETALLE.FACTURA_ID);
            ViewBag.PRODUCTO_ID = new SelectList(db.PRODUCTO, "PRODUCTO_ID", "DESCRIPCION", fACTURA_DETALLE.PRODUCTO_ID);
            return(View(fACTURA_DETALLE));
        }
Esempio n. 13
0
        private FACTURA GetFacturabyDetalle(FACTURA_DETALLE detalle)
        {
            FACTURA fac = new FACTURA();

            try
            {
                FacturaCompraDataMapper artDataMapper = new FacturaCompraDataMapper();
                fac = artDataMapper.getFacturabyDetalle(detalle);
            }
            catch (Exception)
            {
                ;
            }

            return(fac);
        }
Esempio n. 14
0
        public void Update(int Id, int FACTURA_DETALLEId, int PAGOId, int MONTO)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPAGO_DETALLE repositorio   = new RepositorioPAGO_DETALLE(context);
                    PAGO_DETALLE            _PAGO_DETALLE = repositorio.GetById(Id);
                    if (Equals(_PAGO_DETALLE, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PAGO_DETALLE con Id =", Id.ToString()));
                    }

                    RepositorioFACTURA_DETALLE _repositorioFACTURA_DETALLE = new RepositorioFACTURA_DETALLE(context);
                    FACTURA_DETALLE            _objFACTURA_DETALLE         = _repositorioFACTURA_DETALLE.GetById(FACTURA_DETALLEId);
                    if (Equals(_objFACTURA_DETALLE, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado FACTURA_DETALLE con Id =", FACTURA_DETALLEId.ToString()));
                    }

                    RepositorioPAGO _repositorioPAGO = new RepositorioPAGO(context);
                    PAGO            _objPAGO         = _repositorioPAGO.GetById(PAGOId);
                    if (Equals(_objPAGO, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PAGO con Id =", PAGOId.ToString()));
                    }

                    //properties

                    _PAGO_DETALLE.MONTO = MONTO;

                    //parents

                    _PAGO_DETALLE.FACTURA_DETALLE = _objFACTURA_DETALLE;
                    _PAGO_DETALLE.PAGO            = _objPAGO;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
        public FACTURA getFacturabyDetalle(FACTURA_DETALLE detalle)
        {
            FACTURA respuesta = new FACTURA();

            if (detalle != null)
            {
                using (var entity = new TAE2Entities())
                {
                    var res = (from fact in entity.FACTURAs
                               where fact.UNID_FACTURA == detalle.UNID_FACTURA
                               select fact).First <FACTURA>();

                    res.PROVEEDOR = res.PROVEEDOR;
                    respuesta     = res;
                }
            }

            return(respuesta);
        }
Esempio n. 16
0
 public void insertElement(object element)
 {
     if (element != null)
     {
         using (var entity = new TAE2Entities())
         {
             FACTURA_DETALLE facturaDetalle = (FACTURA_DETALLE)element;
             //Sync
             facturaDetalle.IS_MODIFIED        = true;
             facturaDetalle.IS_ACTIVE          = true;
             facturaDetalle.LAST_MODIFIED_DATE = UNID.getNewUNID();
             var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
             modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
             entity.SaveChanges();
             entity.FACTURA_DETALLE.AddObject(facturaDetalle);
             entity.SaveChanges();
         }
     }
 }
 public static FACTURA_DETALLE CreateFACTURA_DETALLE(int id, int mONTO_TOTAL, int mONTO_COBRADO, bool aCTIVO)
 {
     FACTURA_DETALLE fACTURA_DETALLE = new FACTURA_DETALLE();
     fACTURA_DETALLE.ID = id;
     fACTURA_DETALLE.MONTO_TOTAL = mONTO_TOTAL;
     fACTURA_DETALLE.MONTO_COBRADO = mONTO_COBRADO;
     fACTURA_DETALLE.ACTIVO = aCTIVO;
     return fACTURA_DETALLE;
 }
 public void AddToFACTURA_DETALLE(FACTURA_DETALLE fACTURA_DETALLE)
 {
     base.AddObject("FACTURA_DETALLE", fACTURA_DETALLE);
 }