Exemplo n.º 1
0
 public CatalogTipoPedimentoModel(IDataMapper dataMapper)
 {
     this._dataMapper            = new TipoPedimentoDataMapper();
     this._tipoPedimento         = new FixupCollection <DeleteTipoPedimento>();
     this._selectedTipoPedimento = new TIPO_PEDIMENTO();
     this.loadItems();
 }
Exemplo n.º 2
0
        public void loadSync(object element)
        {
            if (element != null)
            {
                TIPO_PEDIMENTO poco = (TIPO_PEDIMENTO)element;
                using (var entity = new TAE2Entities())
                {
                    var query = (from cust in entity.TIPO_PEDIMENTO
                                 where poco.UNID_TIPO_PEDIMENTO == cust.UNID_TIPO_PEDIMENTO
                                 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 modifiedMenu = entity.TIPO_PEDIMENTO.First(p => p.UNID_TIPO_PEDIMENTO == poco.UNID_TIPO_PEDIMENTO);
                    modifiedMenu.IS_MODIFIED = false;
                    entity.SaveChanges();
                }
            }
        }
Exemplo n.º 3
0
        public void insertElement(object element, USUARIO u)
        {
            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    TIPO_PEDIMENTO tipoPedimento = (TIPO_PEDIMENTO)element;

                    var validacion = (from cust in entity.TIPO_PEDIMENTO
                                      where cust.TIPO_PEDIMENTO_NAME == tipoPedimento.TIPO_PEDIMENTO_NAME
                                      select cust).ToList();

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

                        UNID.Master(tipoPedimento, u, -1, "Inserción");
                    }
                }
            }
        }
Exemplo n.º 4
0
 public DeleteTipoPedimento(TIPO_PEDIMENTO tipoPedimento)
 {
     this.UNID_TIPO_PEDIMENTO = tipoPedimento.UNID_TIPO_PEDIMENTO;
     this.CLAVE               = tipoPedimento.CLAVE;
     this.NOTA                = tipoPedimento.NOTA;
     this.REGIMEN             = tipoPedimento.REGIMEN;
     this.TIPO_PEDIMENTO_NAME = tipoPedimento.TIPO_PEDIMENTO_NAME;
     this.IS_ACTIVE           = tipoPedimento.IS_ACTIVE;
     this._isChecked          = false;
 }
Exemplo n.º 5
0
        public void insertElementSync(object element)
        {
            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    TIPO_PEDIMENTO tipoPedimento = (TIPO_PEDIMENTO)element;

                    //Sync

                    var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
                    modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                    entity.SaveChanges();
                    //
                    entity.TIPO_PEDIMENTO.AddObject(tipoPedimento);
                    entity.SaveChanges();
                }
            }
        }
Exemplo n.º 6
0
 public MovimientoSalidasModel(IDataMapper dataMapper, USUARIO u)
 {
     this._unidMovimiento  = UNID.getNewUNID();
     this._fechaMovimiento = DateTime.Now;
     this._isActive        = true;
     if ((dataMapper as MovimientoDataMapper) != null)
     {
         this._dataMapper = new MovimientoDataMapper();
     }
     this._almacenDestino     = new ALMACEN();
     this._proveedorDestino   = new PROVEEDOR();
     this._clienteDestino     = null;
     this._almacenProcedencia = new ALMACEN();
     this._servicio           = new SERVICIO();
     this._transporte         = new TRANSPORTE();
     this._cliente            = new CLIENTE();
     this._proveedor          = new PROVEEDOR();
     this._facturaVenta       = new FACTURA_VENTA();
     this._solicitante        = null;
     this._tipoPedimento      = new TIPO_PEDIMENTO();
     this.ActualUser          = u;
 }
Exemplo n.º 7
0
        public void deleteElement(object element)
        {
            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    TIPO_PEDIMENTO tipoPedimento = (TIPO_PEDIMENTO)element;

                    var deleteTipoPedimento = entity.TIPO_PEDIMENTO.First(p => p.UNID_TIPO_PEDIMENTO == tipoPedimento.UNID_TIPO_PEDIMENTO);

                    deleteTipoPedimento.IS_ACTIVE = false;
                    //Sync
                    deleteTipoPedimento.IS_MODIFIED        = true;
                    deleteTipoPedimento.LAST_MODIFIED_DATE = UNID.getNewUNID();
                    var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
                    modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                    entity.SaveChanges();
                    //
                    entity.SaveChanges();
                }
            }
        }
Exemplo n.º 8
0
 public void udpateElement(object element, USUARIO u)
 {
     if (element != null)
     {
         using (var entity = new TAE2Entities())
         {
             TIPO_PEDIMENTO tipoPedimento         = (TIPO_PEDIMENTO)element;
             var            modifiedTipoPedimento = entity.TIPO_PEDIMENTO.First(p => p.UNID_TIPO_PEDIMENTO == tipoPedimento.UNID_TIPO_PEDIMENTO);
             modifiedTipoPedimento.TIPO_PEDIMENTO_NAME = tipoPedimento.TIPO_PEDIMENTO_NAME;
             modifiedTipoPedimento.REGIMEN             = tipoPedimento.REGIMEN;
             modifiedTipoPedimento.NOTA  = tipoPedimento.NOTA;
             modifiedTipoPedimento.CLAVE = tipoPedimento.CLAVE;
             //Sync
             modifiedTipoPedimento.IS_MODIFIED        = true;
             modifiedTipoPedimento.LAST_MODIFIED_DATE = UNID.getNewUNID();
             var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
             modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
             entity.SaveChanges();
             //
             UNID.Master(tipoPedimento, u, -1, "Modificación");
         }
     }
 }
Exemplo n.º 9
0
        public object getElement(object element)
        {
            object o = null;

            if (element != null)
            {
                TIPO_PEDIMENTO Eprov = (TIPO_PEDIMENTO)element;
                FixupCollection <TIPO_PEDIMENTO> tp = new FixupCollection <TIPO_PEDIMENTO>();

                using (var Entity = new TAE2Entities())
                {
                    var query = (from p in Entity.TIPO_PEDIMENTO
                                 where p.UNID_TIPO_PEDIMENTO == Eprov.UNID_TIPO_PEDIMENTO
                                 select p).ToList();

                    if (query.Count > 0)
                    {
                        o = query;
                    }
                }
            }
            return(o);
        }