Exemplo n.º 1
0
        public void saveArticulo()
        {
            CategoriaDataMapper catDM = new CategoriaDataMapper();
            MarcaDataMapper     marDM = new MarcaDataMapper();
            ModeloDataMapper    modDM = new ModeloDataMapper();
            EquipoDataMapper    equDM = new EquipoDataMapper();

            catDM.insertElement(new CATEGORIA()
            {
                UNID_CATEGORIA = this._categoria.UNID_CATEGORIA, IS_MODIFIED = true, IS_ACTIVE = true, CATEGORIA_NAME = this._categoria.CATEGORIA_NAME
            }, this.ActualUser);
            marDM.insertElement(new MARCA()
            {
                UNID_MARCA = this._marca.UNID_MARCA, IS_ACTIVE = true, IS_MODIFIED = true, MARCA_NAME = this._marca.MARCA_NAME
            }, this.ActualUser);
            modDM.insertElement(new MODELO()
            {
                UNID_MODELO = this._modelo.UNID_MODELO, IS_ACTIVE = true, IS_MODIFIED = true, MODELO_NAME = this._modelo.MODELO_NAME
            }, this.ActualUser);
            equDM.insertElement(new EQUIPO()
            {
                UNID_EQUIPO = this._equipo.UNID_EQUIPO, IS_ACTIVE = true, IS_MODIFIED = true, EQUIPO_NAME = this._equipo.EQUIPO_NAME
            }, this.ActualUser);

            if (_dataMapper != null)
            {
                _dataMapper.insertElement(new ARTICULO()
                {
                    IS_ACTIVE = true, ARTICULO1 = this._articuloName, UNID_CATEGORIA = this._categoria.UNID_CATEGORIA, UNID_EQUIPO = this._equipo.UNID_EQUIPO, UNID_MODELO = this._modelo.UNID_MODELO, UNID_MARCA = this._marca.UNID_MARCA
                }, this.ActualUser);
            }
        }
 public CategoriaModel(IDataMapper dataMapper)
 {
     if ((dataMapper as CategoriaDataMapper) != null)
     {
         this._dataMapper = dataMapper as CategoriaDataMapper;
     }
 }
Exemplo n.º 3
0
        private ObservableCollection <CATEGORIA> GetCategoriasByProveedor()
        {
            ban = true;
            ObservableCollection <CATEGORIA> categorias = new ObservableCollection <CATEGORIA>();

            try
            {
                CategoriaDataMapper catDataMapper   = new CategoriaDataMapper();
                List <CATEGORIA>    categoriaResult = catDataMapper.getElementsByProveedor(new PROVEEDOR()
                {
                    UNID_PROVEEDOR = this._proveedor.UNID_PROVEEDOR
                });
                categoriaResult.ForEach(o => categorias.Add(new CATEGORIA()
                {
                    UNID_CATEGORIA = o.UNID_CATEGORIA,
                    CATEGORIA_NAME = o.CATEGORIA_NAME
                }));
            }
            catch (Exception)
            {
                //Validar excepción
            }

            return(categorias);
        }
 public CategoriaModel(IDataMapper dataMapper, USUARIO u)
 {
     if ((dataMapper as CategoriaDataMapper) != null)
     {
         this._dataMapper = dataMapper as CategoriaDataMapper;
     }
     this.ActualUser = u;
 }
Exemplo n.º 5
0
        public void LastModifiedDateTest()
        {
            CategoriaDataMapper target   = new CategoriaDataMapper(); // TODO: Inicializar en un valor adecuado
            Nullable <long>     expected = new Nullable <long>();     // TODO: Inicializar en un valor adecuado
            Nullable <long>     actual;

            actual = target.LastModifiedDate();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Compruebe la exactitud de este método de prueba.");
        }
Exemplo n.º 6
0
        public void GetJsonCategoriaTest()
        {
            CategoriaDataMapper target = new CategoriaDataMapper(); // TODO: Inicializar en un valor adecuado
            string expected            = string.Empty;              // TODO: Inicializar en un valor adecuado
            string actual;

            actual = target.GetJsonCategoria();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Compruebe la exactitud de este método de prueba.");
        }
Exemplo n.º 7
0
        public void getElementsByProveedorTest()
        {
            CategoriaDataMapper target    = new CategoriaDataMapper(); // TODO: Inicializar en un valor adecuado
            PROVEEDOR           proveedor = new PROVEEDOR()
            {
                UNID_PROVEEDOR = 20121113012552944
            };                                // TODO: Inicializar en un valor adecuado
            List <CATEGORIA> expected = null; // TODO: Inicializar en un valor adecuado
            List <CATEGORIA> actual;

            actual = target.getElementsByProveedor(proveedor);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Compruebe la exactitud de este método de prueba.");
        }
Exemplo n.º 8
0
 public CatalogCategoriaViewModel()
 {
     try
     {
         IDataMapper dataMapper = new CategoriaDataMapper();
         this._catalogCategoriaModel = new CatalogCategoriaModel(dataMapper);
     }
     catch (ArgumentException a)
     {
         ;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 9
0
        public string downloadCategoria(long?lastModifiedDate)
        {
            string respuesta = null;

            if (lastModifiedDate != null)
            {
                CategoriaDataMapper dataMapper = new CategoriaDataMapper();

                respuesta = dataMapper.GetJsonCategoria(lastModifiedDate);

                if (String.IsNullOrEmpty(respuesta))
                {
                    respuesta = null;
                }
            }
            return(respuesta);
        }
Exemplo n.º 10
0
        private ObservableCollection <CategoriaModel> GetCategorias()
        {
            ObservableCollection <CategoriaModel> categorias = new ObservableCollection <CategoriaModel>();

            try
            {
                CategoriaDataMapper catDataMapper   = new CategoriaDataMapper();
                List <CATEGORIA>    categoriaResult = (List <CATEGORIA>)catDataMapper.getElements();
                categoriaResult.ForEach(o => categorias.Add(new CategoriaModel(catDataMapper)
                {
                    UnidCategoria = o.UNID_CATEGORIA,
                    CategoriaName = o.CATEGORIA_NAME
                }));
            }
            catch (Exception)
            {
                //Validar excepción
            }

            return(categorias);
        }
        public void loadItems(long unidProv)
        {
            CategoriaDataMapper cat = new CategoriaDataMapper();
            object element          = cat.getElementsByProveedor(new PROVEEDOR()
            {
                UNID_PROVEEDOR = unidProv
            });

            FixupCollection <DeleteCategoria> ic = new FixupCollection <DeleteCategoria>();

            if (element != null)
            {
                if (((List <CATEGORIA>)element).Count > 0)
                {
                    foreach (CATEGORIA item in (List <CATEGORIA>)element)
                    {
                        DeleteCategoria aux = new DeleteCategoria(item);
                        ic.Add(aux);
                    }
                }
            }
            this.Categoria = ic;
        }
Exemplo n.º 12
0
        private ObservableCollection <CategoriaModel> GetCategoriasByProveedor2()
        {
            ObservableCollection <CategoriaModel> categorias = new ObservableCollection <CategoriaModel>();

            try
            {
                CategoriaDataMapper catDataMapper   = new CategoriaDataMapper();
                List <CATEGORIA>    categoriaResult = catDataMapper.getElementsByProveedor(new PROVEEDOR()
                {
                    UNID_PROVEEDOR = VM.ItemModel.Proveedor.UNID_PROVEEDOR
                });
                categoriaResult.ForEach(o => categorias.Add(new CategoriaModel(catDataMapper)
                {
                    UnidCategoria = o.UNID_CATEGORIA,
                    CategoriaName = o.CATEGORIA_NAME
                }));
            }
            catch (Exception)
            {
                //Validar excepción
            }

            return(categorias);
        }
Exemplo n.º 13
0
        public void getElement()
        {
            ITEM aux = new ITEM();

            aux.SKU          = this.Sku;
            aux.NUMERO_SERIE = this.NumeroSerie;
            this.Error       = "";

            ITEM res = (this._dataMapper.getElement(aux)) as ITEM;

            this.init();
            if (res != null)
            {
                this._unidItem   = res.UNID_ITEM;
                this.NumeroSerie = res.NUMERO_SERIE;
                this.Sku         = res.SKU;
                this.ItemStatus  = res.ITEM_STATUS;
                //this.ItemStatus.UNID_ITEM_STATUS = res.UNID_ITEM_STATUS;
                this.FacturaDetalle = res.FACTURA_DETALLE;
                this.CostoUnitario  = res.COSTO_UNITARIO;
                this.PedimentoExpo  = res.PEDIMENTO_EXPO;
                this.PedimentoImpo  = res.PEDIMENTO_IMPO;
                this.CantidadItem   = res.CANTIDAD;

                CategoriaDataMapper datacat = new CategoriaDataMapper();
                this.Categoria = datacat.getElementByArticulo(res.ARTICULO);

                foreach (ARTICULO i in this.Articulos)
                {
                    if (i.UNID_ARTICULO == res.ARTICULO.UNID_ARTICULO)
                    {
                        this.Articulo = i;
                    }
                }

                this.FacturaDetalle = res.FACTURA_DETALLE;
                FACTURA temp = new FACTURA();
                temp = GetFacturabyDetalle(this.FacturaDetalle);

                foreach (FACTURA f in this.Facturas)
                {
                    if (temp.UNID_FACTURA == f.UNID_FACTURA)
                    {
                        this.Factura = f;
                    }
                }

                foreach (DeleteFacturaDetalleModel d in this.Detalles)
                {
                    if (this.FacturaDetalle != null)
                    {
                        if (d.UNID_FACTURA_DETALE == this.FacturaDetalle.UNID_FACTURA_DETALE)
                        {
                            this.FacturaDetalle = d;
                        }
                    }
                    else
                    {
                        this.FacturaDetalle = new FACTURA_DETALLE();
                    }
                }
            }
            else
            {
                this.Error = "El número de serie o SKU no existe";
            }
        }
        public void getElement2()
        {
            ITEM aux = new ITEM();

            aux.SKU          = this.Sku;
            aux.NUMERO_SERIE = this.NumeroSerie;
            this.Error       = "";

            ITEM res = (this._dataMapper.getElement(aux)) as ITEM;

            this.init();
            if (res != null)
            {
                this._unidItem                = res.UNID_ITEM;
                this.NumeroSerie              = res.NUMERO_SERIE;
                this.Sku                      = res.SKU;
                this.ItemStatus               = res.ITEM_STATUS;
                this.FacturaDetalle           = res.FACTURA_DETALLE;
                this.CostoUnitario            = res.COSTO_UNITARIO;
                this.PedimentoExpo            = res.PEDIMENTO_EXPO;
                this.PedimentoImpo            = res.PEDIMENTO_IMPO;
                this.CantidadItem             = res.CANTIDAD;
                this.Propiedad                = res.PROPIEDAD;
                this.Proveedor.UNID_PROVEEDOR = res.FACTURA_DETALLE.FACTURA.PROVEEDOR.UNID_PROVEEDOR;
                this.Proveedor.PROVEEDOR_NAME = res.FACTURA_DETALLE.FACTURA.PROVEEDOR.PROVEEDOR_NAME;

                this.FacturaDetalle = res.FACTURA_DETALLE;

                foreach (DeleteFacturaDetalleModel d in this.Detalles)
                {
                    if (this.FacturaDetalle != null)
                    {
                        if (d.UNID_FACTURA_DETALE == this.FacturaDetalle.UNID_FACTURA_DETALE)
                        {
                            this.FacturaDetalle = d;
                        }
                    }
                    else
                    {
                        this.FacturaDetalle = new FACTURA_DETALLE();
                    }
                }

                CategoriaDataMapper datacat = new CategoriaDataMapper();
                CATEGORIA           auxcat  = datacat.getElementByArticulo(res.ARTICULO);

                this.Categoria = auxcat;
                this.Articulo  = res.ARTICULO;

                List <EQUIPO> auxEquipo = new List <EQUIPO>();
                auxEquipo.Add(new EQUIPO());
                auxEquipo[0].UNID_EQUIPO = this.Articulo.UNID_EQUIPO;
                EquipoDataMapper eq = new EquipoDataMapper();
                auxEquipo   = (List <EQUIPO>)eq.getElement(auxEquipo[0]);
                this.Equipo = auxEquipo[0];
            }
            else
            {
                this.Error = "El número de serie o SKU no existe";
            }
        }
        public void AttempModifyItem()
        {
            BorrarBool                  = true;
            this._itemModel.Sku         = this.Sku;
            this._itemModel.NumeroSerie = this.NumeroSerie;
            this._itemModel.getElement2();

            if (this._itemModel.Error.Equals(""))
            {
                this.CatalogPropiedad.SelectedPropiedad = this.ItemModel.Propiedad;
                if (this.CatalogPropiedad.SelectedPropiedad != null)
                {
                    PropiedadBool = true;
                }

                CategoriaDataMapper ccc = new CategoriaDataMapper();
                ProveedorModel = this._itemModel.FacturaDetalle.FACTURA.PROVEEDOR.PROVEEDOR_NAME;



                List <CATEGORIA> auxxx = ccc.getElementsByProveedor(this._itemModel.FacturaDetalle.FACTURA.PROVEEDOR);
                ObservableCollection <CATEGORIA> fin = new ObservableCollection <CATEGORIA> ();

                foreach (CATEGORIA AA in auxxx)
                {
                    fin.Add(AA);
                }
                this._itemModel._categorias = fin;


                FacturaCompraModel fAux = new FacturaCompraModel();
                fAux.FechaFactura    = (DateTime)this._itemModel.FacturaDetalle.FACTURA.FECHA_FACTURA;
                fAux.NumeroFactura   = this._itemModel.FacturaDetalle.FACTURA.FACTURA_NUMERO;
                fAux.NumeroPedimento = this._itemModel.FacturaDetalle.FACTURA.NUMERO_PEDIMENTO;
                fAux.PorIva          = (double)this._itemModel.FacturaDetalle.FACTURA.IVA_POR;
                fAux.UnidFactura     = this._itemModel.FacturaDetalle.UNID_FACTURA;

                foreach (DAL.POCOS.FACTURA_DETALLE ffdd in this._itemModel.FacturaDetalle.FACTURA.FACTURA_DETALLE)
                {
                    FacturaCompraDetalleModel auxx = new FacturaCompraDetalleModel();
                    auxx.CostoUnitario = ffdd.PRECIO_UNITARIO;
                    auxx.Cantidad      = ffdd.CANTIDAD;
                    fAux.FacturaDetalle.Add(auxx);
                }

                this.Factura = fAux;
                this.FacturaCollection.Add(fAux);

                UltimoMovimientoModel aux = new UltimoMovimientoModel();
                ObservableCollection <UltimoMovimientoModel> temp = aux.RegresaListaLugares(this._itemModel.UnidItem);

                this.UltimoMovimiento.Clear();
                this.ItemModelCollection.Clear();

                this.ItemModelCollection.Add(this._itemModel);

                foreach (UltimoMovimientoModel um in temp)
                {
                    this.UltimoMovimiento.Add(um);
                }
            }
        }