예제 #1
0
        public static void IsPosibleDelete(long oid, ETipoAcreedor providerType)
        {
            QueryConditions conditions = new QueryConditions
            {
                TipoAcreedor = new ETipoAcreedor[1] {
                    providerType
                },
                Acreedor = ProviderBaseInfo.New(oid, providerType),
                Estado   = EEstado.NoAnulado
            };

            InputDeliveryList albaranes = InputDeliveryList.GetList(conditions, false);

            if (albaranes.Count > 0)
            {
                throw new iQException(Resources.Messages.ALBARANES_ASOCIADOS);
            }

            InputInvoiceList facturas = InputInvoiceList.GetList(conditions, false);

            if (facturas.Count > 0)
            {
                throw new iQException(Resources.Messages.FACTURAS_ASOCIADAS);
            }

            conditions.PaymentType = ETipoPago.Factura;

            PaymentList pagos = PaymentList.GetList(conditions, false);

            if (pagos.Count > 0)
            {
                throw new iQException(Resources.Messages.PAGOS_ASOCIADOS);
            }
        }
예제 #2
0
        public new static IAgenteHipatiaList GetAgentes(EntidadInfo entidad)
        {
            IAgenteHipatiaList lista = new IAgenteHipatiaList(new List <IAgenteHipatia>());

            if (entidad.Tipo == typeof(Almacen).Name)
            {
                StoreList list = StoreList.GetList(false);

                foreach (StoreInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(Despachante).Name)
            {
                DespachanteList list = DespachanteList.GetList(false);

                foreach (DespachanteInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(Employee).Name)
            {
                EmployeeList list = EmployeeList.GetList(false);

                foreach (EmployeeInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(Expedient).Name)
            {
                ExpedienteList list = ExpedienteList.GetList(false);

                foreach (ExpedientInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(InputInvoice).Name)
            {
                InputInvoiceList list = InputInvoiceList.GetList(false);

                foreach (InputInvoiceInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(LineaFomento).Name)
            {
                LineaFomentoList list = LineaFomentoList.GetList(false);

                foreach (LineaFomentoInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(Naviera).Name)
            {
                NavieraList list = NavieraList.GetList(false);

                foreach (NavieraInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(Payment).Name)
            {
                PaymentList list = PaymentList.GetList(false);

                foreach (PaymentInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(Product).Name)
            {
                ProductList list = ProductList.GetList(false);

                foreach (ProductInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(Proveedor).Name)
            {
                ProveedorList list = ProveedorList.GetList(false);

                foreach (ProveedorInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else if (entidad.Tipo == typeof(Transporter).Name)
            {
                TransporterList list = TransporterList.GetList(false);

                foreach (TransporterInfo obj in list)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
            }
            else
            {
                throw new iQException("No se ha encontrado el tipo de entidad " + entidad.Tipo);
            }

            return(lista);
        }