Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="categoria"></param>
        /// <param name="equipo"></param>
        /// <returns>Regresa un string JSON y si no hay datos </returns>
        public FixupCollection <ARTICULO> getElement(CATEGORIA categoria, EQUIPO equipo)
        {
            FixupCollection <ARTICULO> articulos = new FixupCollection <ARTICULO>();


            if (categoria != null && equipo != null)
            {
                using (var entity = new TAE2Entities())
                {
                    try
                    {
                        (from cust in entity.ARTICULOes
                         where cust.UNID_CATEGORIA == categoria.UNID_CATEGORIA &&
                         cust.UNID_EQUIPO == equipo.UNID_EQUIPO
                         select cust).ToList <ARTICULO>().ForEach(o => articulos.Add(o));
                    }
                    catch (Exception ex)
                    {
                        ;
                    }
                }
            }//endif

            return(articulos);
        }
Ejemplo n.º 2
0
        public ItemModel(ITEM item)
        {
            this._articulo    = item.ARTICULO;
            this._nombre      = item.ARTICULO.ARTICULO1;
            this._unidItem    = item.UNID_ITEM;
            this._sku         = item.SKU;
            this.SKU          = item.SKU;
            this.NUMERO_SERIE = item.NUMERO_SERIE;
            this._numeroSerie = item.NUMERO_SERIE;
            //this._itemStatuss.updateItemStatus = item.UNID_ITEM_STATUS;
            if (item.ITEM_STATUS != null)
            {
                this._itemStatus  = item.ITEM_STATUS;
                this._itemStatuss = new ItemStatusModel(null)
                {
                    ItemStatusName = item.ITEM_STATUS.ITEM_STATUS_NAME, UnidItemStatus = long.Parse(item.UNID_ITEM_STATUS.ToString())
                };
            }
            this.UNID_ITEM_STATUS = item.UNID_ITEM_STATUS;
            this.COSTO_UNITARIO   = item.COSTO_UNITARIO;
            this._pedimentoExpo   = item.PEDIMENTO_EXPO;
            this._pedimentoImpo   = item.PEDIMENTO_IMPO;
            //this._facturaDetalle = item.FACTURA_DETALLE;
            this.IS_ACTIVE  = item.IS_ACTIVE;
            this.IsChecked  = false;
            this._equipo    = item.ARTICULO.EQUIPO;
            this._categoria = item.ARTICULO.CATEGORIA;
            this._marca     = item.ARTICULO.MARCA;
            this._modelo    = item.ARTICULO.MODELO;

            this.Detalles = new ObservableCollection <DeleteFacturaDetalleModel>();

            this._dataMapper = new ItemDataMapper();
        }
        public void insertElement(object element, USUARIO u)
        {
            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    EQUIPO equipo = (EQUIPO)element;

                    var validacion = (from cust in entity.EQUIPOes
                                      where cust.EQUIPO_NAME == equipo.EQUIPO_NAME
                                      select cust).ToList();

                    if (validacion.Count == 0)
                    {
                        equipo.UNID_EQUIPO = UNID.getNewUNID();
                        //Sync
                        equipo.IS_MODIFIED        = true;
                        equipo.LAST_MODIFIED_DATE = UNID.getNewUNID();
                        var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
                        modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                        entity.SaveChanges();
                        //
                        entity.EQUIPOes.AddObject(equipo);
                        entity.SaveChanges();

                        UNID.Master(equipo, u, -1, "Inserción");
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public CatalogEquipoModel(IDataMapper dataMapper)
 {
     this._dataMapper     = new EquipoDataMapper();
     this._equipos        = new FixupCollection <DeleteEquipo>();
     this._selectedEquipo = new EQUIPO();
     this.loadItems();
 }
Ejemplo n.º 5
0
 public DeleteEquipo(EQUIPO equipo)
 {
     this.UNID_EQUIPO = equipo.UNID_EQUIPO;
     this.EQUIPO_NAME = equipo.EQUIPO_NAME;
     this.IS_ACTIVE   = equipo.IS_ACTIVE;
     this.IsChecked   = false;
 }
        public void loadSync(object element)
        {
            if (element != null)
            {
                EQUIPO poco = (EQUIPO)element;
                using (var entity = new TAE2Entities())
                {
                    var query = (from cust in entity.EQUIPOes
                                 where poco.UNID_EQUIPO == cust.UNID_EQUIPO
                                 select cust).ToList();

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

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

                    var modifiedCotizacion = entity.EQUIPOes.First(p => p.UNID_EQUIPO == poco.UNID_EQUIPO);
                    modifiedCotizacion.IS_MODIFIED = false;
                    entity.SaveChanges();
                }
            }
        }
Ejemplo n.º 7
0
        public ActionResult DeleteConfirmed(int id)
        {
            EQUIPO eQUIPO = db.EQUIPO.Find(id);

            db.EQUIPO.Remove(eQUIPO);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 8
0
 public ActionResult Edit([Bind(Include = "IdEquipo,NomEquipo,PaisEquipo")] EQUIPO eQUIPO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eQUIPO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(eQUIPO));
 }
Ejemplo n.º 9
0
 //public DeleteArticulo(object articulo)
 public DeleteArticulo(ARTICULO articulo)
 {
     this.UNID_ARTICULO = articulo.UNID_ARTICULO;
     this.ARTICULO1     = articulo.ARTICULO1;
     this._categoria    = articulo.CATEGORIA;
     this._marca        = articulo.MARCA;
     this._equipo       = articulo.EQUIPO;
     this._modelo       = articulo.MODELO;
     this.IS_ACTIVE     = articulo.IS_ACTIVE;
     this.IsChecked     = false;
 }
Ejemplo n.º 10
0
        public void insertElementTest()
        {
            EquipoDataMapper target  = new EquipoDataMapper(); // TODO: Inicializar en un valor adecuado
            object           element = null;                   // TODO: Inicializar en un valor adecuado
            EQUIPO           equipo  = new EQUIPO();

            equipo.EQUIPO_NAME = "iPhone 4S Blanco";
            target.insertElement(equipo);
            element = target.getElements();
            Assert.Inconclusive("Un método que no devuelve ningún valor no se puede comprobar.");
        }
Ejemplo n.º 11
0
        public ActionResult Create([Bind(Include = "IdEquipo,NomEquipo,PaisEquipo")] EQUIPO eQUIPO)
        {
            if (ModelState.IsValid)
            {
                eQUIPO.IdEquipo = 0;
                db.EQUIPO.Add(eQUIPO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(eQUIPO));
        }
Ejemplo n.º 12
0
 public DeleteProgramado(PROGRAMADO programado)
 {
     this.UNID_PROGRAMADO = programado.UNID_PROGRAMADO;
     this.PROGRAMADO1     = programado.PROGRAMADO1;
     this._almacen        = programado.ALMACEN;
     this._articulo       = programado.ARTICULO;
     this._categoria      = programado.ARTICULO.CATEGORIA;
     this._equipo         = programado.ARTICULO.EQUIPO;
     this._marca          = programado.ARTICULO.MARCA;
     this._modelo         = programado.ARTICULO.MODELO;
     this.IS_ACTIVE       = programado.IS_ACTIVE;
     this.IsChecked       = false;
 }
Ejemplo n.º 13
0
        // GET: EQUIPOes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EQUIPO eQUIPO = db.EQUIPO.Find(id);

            if (eQUIPO == null)
            {
                return(HttpNotFound());
            }
            return(View(eQUIPO));
        }
Ejemplo n.º 14
0
 public DeleteMaxMin(MAX_MIN maxMin)
 {
     this.UNID_MAX_MIN = maxMin.UNID_MAX_MIN;
     this.MAX          = maxMin.MAX;
     this.MIN          = maxMin.MIN;
     this._almacen     = maxMin.ALMACEN;
     this._articulo    = maxMin.ARTICULO;
     this._categoria   = maxMin.ARTICULO.CATEGORIA;
     this._equipo      = maxMin.ARTICULO.EQUIPO;
     this._marca       = maxMin.ARTICULO.MARCA;
     this._modelo      = maxMin.ARTICULO.MODELO;
     this.IS_ACTIVE    = maxMin.IS_ACTIVE;
     this.IsChecked    = false;
 }
        public object getElement(object element)
        {
            object res = null;

            using (var entity = new TAE2Entities())
            {
                EQUIPO Tmp = (EQUIPO)element;

                res = (from tipo in entity.EQUIPOes
                       where tipo.UNID_EQUIPO == Tmp.UNID_EQUIPO
                       select tipo).ToList();

                return(res);
            }
        }
        public void insertElementSync(object element)
        {
            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    EQUIPO equipo = (EQUIPO)element;

                    //Sync

                    var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
                    modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                    entity.SaveChanges();
                    //
                    entity.EQUIPOes.AddObject(equipo);
                    entity.SaveChanges();
                }
            }
        }
 public void udpateElement(object element, USUARIO u)
 {
     if (element != null)
     {
         using (var entity = new TAE2Entities())
         {
             EQUIPO equipo             = (EQUIPO)element;
             var    modifiedItemStatus = entity.EQUIPOes.First(p => p.UNID_EQUIPO == equipo.UNID_EQUIPO);
             modifiedItemStatus.EQUIPO_NAME = equipo.EQUIPO_NAME;
             //Sync
             modifiedItemStatus.IS_MODIFIED        = true;
             modifiedItemStatus.LAST_MODIFIED_DATE = UNID.getNewUNID();
             var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
             modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
             entity.SaveChanges();
             //
             UNID.Master(equipo, u, -1, "Modificación");
         }
     }
 }
 public AgregarItemModel(ITEM item)
 {
     this._articulo      = item.ARTICULO;
     this._nombre        = item.ARTICULO.ARTICULO1;
     this._unidItem      = item.UNID_ITEM;
     this.SKU            = item.SKU;
     this.NUMERO_SERIE   = item.NUMERO_SERIE;
     this._itemStatus    = item.ITEM_STATUS;
     this.COSTO_UNITARIO = item.COSTO_UNITARIO;
     this._pedimentoExpo = item.PEDIMENTO_EXPO;
     this._pedimentoImpo = item.PEDIMENTO_IMPO;
     //this._facturaDetalle = item.FACTURA_DETALLE;
     this.IS_ACTIVE  = item.IS_ACTIVE;
     this.IsChecked  = false;
     this._equipo    = item.ARTICULO.EQUIPO;
     this._categoria = item.ARTICULO.CATEGORIA;
     this._marca     = item.ARTICULO.MARCA;
     this._modelo    = item.ARTICULO.MODELO;
     this.Detalles   = new ObservableCollection <DeleteFacturaDetalleModel>();
 }
 public void deleteElement(object element)
 {
     if (element != null)
     {
         using (var entity = new TAE2Entities())
         {
             EQUIPO equipo       = (EQUIPO)element;
             var    deleteEquipo = entity.EQUIPOes.First(p => p.UNID_EQUIPO == equipo.UNID_EQUIPO);
             deleteEquipo.IS_ACTIVE = false;
             //Sync
             deleteEquipo.IS_MODIFIED        = true;
             deleteEquipo.LAST_MODIFIED_DATE = UNID.getNewUNID();
             var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
             modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
             entity.SaveChanges();
             //
             entity.SaveChanges();
         }
     }
 }
Ejemplo n.º 20
0
        public ItemModel(ITEM item, int lectura, ITEM_STATUS status)
        {
            this._dataMapper2        = new ItemStatusDataMapper();
            this._articulo           = item.ARTICULO;
            this._nombre             = item.ARTICULO.ARTICULO1;
            this._unidItem           = item.UNID_ITEM;
            this._sku                = item.SKU;
            this.SKU                 = item.SKU;
            this.NUMERO_SERIE        = item.NUMERO_SERIE;
            this._numeroSerie        = item.NUMERO_SERIE;
            this._cantidadMovimiento = lectura;

            object itemStatusLectura = this._dataMapper2.getElement(status);

            if (itemStatusLectura != null)
            {
                this._itemStatus  = itemStatusLectura as ITEM_STATUS;
                this._itemStatuss = new ItemStatusModel(null)
                {
                    ItemStatusName = this._itemStatus.ITEM_STATUS_NAME, UnidItemStatus = this._itemStatus.UNID_ITEM_STATUS
                };
            }
            this.UNID_ITEM_STATUS = item.UNID_ITEM_STATUS;
            this.COSTO_UNITARIO   = item.COSTO_UNITARIO;
            this._pedimentoExpo   = item.PEDIMENTO_EXPO;
            this._pedimentoImpo   = item.PEDIMENTO_IMPO;
            this.IS_ACTIVE        = item.IS_ACTIVE;
            this.IsChecked        = false;
            this._equipo          = item.ARTICULO.EQUIPO;
            this._categoria       = item.ARTICULO.CATEGORIA;
            this._marca           = item.ARTICULO.MARCA;
            this._modelo          = item.ARTICULO.MODELO;

            this.Detalles = new ObservableCollection <DeleteFacturaDetalleModel>();

            this._dataMapper = new ItemDataMapper();
        }