Пример #1
0
        public ResultAndError <Recuento> CheckProductoRecuento(string product, ResultAndError <Recuento> recount)
        {
            IEnumerable <HojaRecuento> oHojas = db.HojaRecuentos.Where(o => o.ProductNo == product && o.Date.Value.Month == DateTime.Now.Month);

            if (oHojas.Count() > 0)
            {
                return(recount.AddError("El producto " + product + " ya esta en un recuento" + oHojas.First().Codigo));
            }
            return(recount);
        }
Пример #2
0
        public ResultAndError <bool> Delete(int id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                HojaRecuento oHojaRecuento = Get(id);
                if (oHojaRecuento == null)
                {
                    return(result.AddError("No se encontro la hoja con el id " + id));
                }
                db.HojaRecuentos.Remove(oHojaRecuento);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #3
0
        public ResultAndError <bool> Delete(string id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                DiscountLineInvoice DiscountLineInvoice = Get(id);
                if (DiscountLineInvoice == null)
                {
                    return(result.AddError("No se encontro la tarifa con el id " + id));
                }
                db.DiscountLineInvoices.Remove(DiscountLineInvoice);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #4
0
        public ResultAndError <bool> Delete(string id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                PedVentaCab PedVentaCabs = Get(id);
                if (PedVentaCabs == null)
                {
                    return(result.AddError("No se encontro la tarifa con el id " + id));
                }
                db.PedVentaCabs.Remove(PedVentaCabs);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #5
0
        public ResultAndError <bool> Delete(string id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                Location Warehouse = Get(id);
                if (Warehouse == null)
                {
                    return(result.AddError("No se encontro el almacen con el id " + id));
                }
                db.Locations.Remove(Warehouse);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #6
0
        public ResultAndError <bool> Delete(string documentNo, int lineNo)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                PedVentaLinea PedVentaLineas = Get(documentNo, lineNo);
                if (PedVentaLineas == null)
                {
                    return(result.AddError("No se encontro el pedido venta linea con el documento " + documentNo));
                }
                db.PedVentaLineas.Remove(PedVentaLineas);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #7
0
        public ResultAndError <bool> Delete(string id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                Subcenter Subcenter = Get(id);
                if (Subcenter == null)
                {
                    return(result.AddError("No se encontro el subcentro con el id " + id));
                }
                db.Subcenters.Remove(Subcenter);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #8
0
        public ResultAndError <bool> Delete(string id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                ProductCategory ProductCategory = Get(id);
                if (ProductCategory == null)
                {
                    return(result.AddError("No se encontro la categoria con el id " + id));
                }
                db.ProductCategories.Remove(ProductCategory);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #9
0
        public ResultAndError <bool> Delete(string providerNo)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                Provider oProvider = Get(providerNo);
                if (oProvider == null)
                {
                    return(result.AddError("No se encontro el proveedor con el id " + providerNo));
                }
                db.Providers.Remove(oProvider);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #10
0
        public ResultAndError <bool> Delete(string id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                ZoneProvider ZoneProvider = Get(id);
                if (ZoneProvider == null)
                {
                    return(result.AddError("No se encontro la zona del proveedor con el id " + id));
                }
                db.ZoneProviders.Remove(ZoneProvider);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #11
0
        public ResultAndError <bool> Delete(string productNo, string locationCode)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                AlmacenZP oAlmacenZP = Get(productNo, locationCode);
                if (oAlmacenZP == null)
                {
                    return(result.AddError("No se encontro almacen con el id " + productNo + " " + locationCode));
                }
                db.AlmacenZPs.Remove(oAlmacenZP);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #12
0
        public ResultAndError <bool> Delete(int id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                HistoricoPedido HistoricoPedidos = Get(id);
                if (HistoricoPedidos == null)
                {
                    return(result.AddError("No se encontro la tarifa con el id " + id));
                }
                db.HistoricoPedidos.Remove(HistoricoPedidos);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #13
0
        public ResultAndError <bool> Delete(string productNo, string providerNo)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                ProviderRate oProviderRate = Get(productNo, providerNo);
                if (oProviderRate == null)
                {
                    return(result.AddError("No se encontro la tarifa con el id " + productNo + " " + providerNo));
                }
                db.ProviderRates.Remove(oProviderRate);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #14
0
        public ResultAndError <bool> Delete(string id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                InvoiceProviderDiscount invoiceProviderDiscount = Get(id);
                if (invoiceProviderDiscount == null)
                {
                    return(result.AddError("No se encontro descuento con el id " + id));
                }
                db.InvoiceProviderDiscounts.Remove(invoiceProviderDiscount);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #15
0
        public ResultAndError <bool> Delete(int id, string albaranNo)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                AlbaranLinea AlbaranLinea = Get(id, albaranNo);
                if (AlbaranLinea == null)
                {
                    return(result.AddError("No se encontro la tarifa con el id " + id));
                }
                db.AlbaranLineas.Remove(AlbaranLinea);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #16
0
        public ResultAndError <bool> Delete(int id)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                Document header = Get(id);
                if (header == null)
                {
                    return(result.AddError("No se encontro la cabecera con el id " + id));
                }
                db.HeaderRequests.Remove(header);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #17
0
        public ResultAndError <bool> Delete(string code, string dimensionCode)
        {
            ResultAndError <bool> result = new ResultAndError <bool>();

            try
            {
                Dimension Centro = Get(code, dimensionCode);
                if (Centro == null)
                {
                    return(result.AddError("No se encontro la tarifa con el id " + code));
                }
                db.Dimensions.Remove(Centro);
                db.SaveChanges();
                return(result.AddResult(true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #18
0
 public ResultAndError <Recuento> CheckZonaRecuento(List <string> zonas, ResultAndError <Recuento> recount)
 {
     foreach (string zona in zonas)
     {
         IEnumerable <HojaRecuento> oHojas = db.HojaRecuentos.Where(o => o.Zone == zona && o.Date.Value.Month == DateTime.Now.Month);
         if (oHojas.Count() > 0)
         {
             return(recount.AddError("La zona " + zona + " ya esta en el recuento " + oHojas.First().Codigo));
         }
     }
     return(recount);
 }
Пример #19
0
        public ResultAndError <HistoricoPedido> CloseOrder(Document order)
        {
            ResultAndError <HistoricoPedido> result = new ResultAndError <HistoricoPedido>();

            try
            {
                HistoricoPedido oHistorico = GetHistoricoFromOrder(order);
                return(result = Update(oHistorico, true));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #20
0
        public ResultAndError <UnitMeasureProduct> Add(UnitMeasureProduct c)
        {
            ResultAndError <UnitMeasureProduct> result = new ResultAndError <UnitMeasureProduct>();

            try
            {
                db.UnitMeasureProducts.Add(c);
                db.SaveChanges();
                return(result.AddResult(c));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #21
0
        public ResultAndError <PedVentaCab> Add(PedVentaCab c)
        {
            ResultAndError <PedVentaCab> result = new ResultAndError <PedVentaCab>();

            try
            {
                db.PedVentaCabs.Add(c);
                db.SaveChanges();
                return(result.AddResult(c));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #22
0
        public ResultAndError <CabeceraRecuento> Add(CabeceraRecuento pr)
        {
            ResultAndError <CabeceraRecuento> result = new ResultAndError <CabeceraRecuento>();

            try
            {
                db.CabeceraRecuentos.Add(pr);
                db.SaveChanges();
                return(result.AddResult(pr));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #23
0
        public ResultAndError <AlmacenZP> Add(AlmacenZP pr)
        {
            ResultAndError <AlmacenZP> result = new ResultAndError <AlmacenZP>();

            try
            {
                db.AlmacenZPs.Add(pr);
                db.SaveChanges();
                return(result.AddResult(pr));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #24
0
        public ResultAndError <HistoricoPedido> Add(HistoricoPedido c)
        {
            ResultAndError <HistoricoPedido> result = new ResultAndError <HistoricoPedido>();

            try
            {
                db.HistoricoPedidos.Add(c);
                db.SaveChanges();
                return(result.AddResult(c));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #25
0
        public ResultAndError <Provider> Add(Provider p)
        {
            ResultAndError <Provider> result = new ResultAndError <Provider>();

            try
            {
                db.Providers.Add(p);
                db.SaveChanges();
                return(result.AddResult(p));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #26
0
        public ResultAndError <Subcenter> Add(Subcenter c)
        {
            ResultAndError <Subcenter> result = new ResultAndError <Subcenter>();

            try
            {
                db.Subcenters.Add(c);
                db.SaveChanges();
                return(result.AddResult(c));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #27
0
        public ResultAndError <Line> Add(Line c)
        {
            ResultAndError <Line> result = new ResultAndError <Line>();

            try
            {
                db.LineRequests.Add(c);
                db.SaveChanges();
                return(result.AddResult(c));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #28
0
        public ResultAndError <Document> Add(Document c)
        {
            ResultAndError <Document> result = new ResultAndError <Document>();

            try
            {
                db.HeaderRequests.Add(c);
                db.SaveChanges();
                return(result.AddResult(c));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #29
0
        public ResultAndError <ProductCategory> Add(ProductCategory c)
        {
            ResultAndError <ProductCategory> result = new ResultAndError <ProductCategory>();

            try
            {
                db.ProductCategories.Add(c);
                db.SaveChanges();
                return(result.AddResult(c));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }
Пример #30
0
        public ResultAndError <DiscountLineInvoice> Add(DiscountLineInvoice c)
        {
            ResultAndError <DiscountLineInvoice> result = new ResultAndError <DiscountLineInvoice>();

            try
            {
                db.DiscountLineInvoices.Add(c);
                db.SaveChanges();
                return(result.AddResult(c));
            }
            catch (Exception e)
            {
                return(result.AddError(e, HttpStatusCode.InternalServerError));
            }
        }