public ResultAndError <SalesCountedCenter> Add(SalesCountedCenter c) { ResultAndError <SalesCountedCenter> result = new ResultAndError <SalesCountedCenter>(); try { db.SalesCountedCenters.Add(c); db.SaveChanges(); return(result.AddResult(c)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <PedVentaLinea> Add(PedVentaLinea c) { ResultAndError <PedVentaLinea> result = new ResultAndError <PedVentaLinea>(); try { db.PedVentaLineas.Add(c); db.SaveChanges(); return(result.AddResult(c)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <HojaRecuento> Add(HojaRecuento pr) { ResultAndError <HojaRecuento> result = new ResultAndError <HojaRecuento>(); try { db.HojaRecuentos.Add(pr); db.SaveChanges(); return(result.AddResult(pr)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <CrossReference> Add(CrossReference c) { ResultAndError <CrossReference> result = new ResultAndError <CrossReference>(); try { db.CrossReferences.Add(c); db.SaveChanges(); return(result.AddResult(c)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <Location> Add(Location c) { ResultAndError <Location> result = new ResultAndError <Location>(); try { db.Locations.Add(c); db.SaveChanges(); return(result.AddResult(c)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <AlbaranCompra> Add(AlbaranCompra c) { ResultAndError <AlbaranCompra> result = new ResultAndError <AlbaranCompra>(); try { db.AlbaranCompras.Add(c); db.SaveChanges(); return(result.AddResult(c)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <bool> UpdateReadingDate(IEnumerable <KeyValuePair <string, int> > pedventa, DateTimeOffset readingDate) { ResultAndError <bool> result = new ResultAndError <bool>(); try { foreach (KeyValuePair <string, int> no in pedventa) { PedVentaLinea oPedVentaLineas = Get(no.Key, no.Value); oPedVentaLineas.ReadingDate = readingDate; db.SaveChanges(); } return(result.AddResult(true)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <ProviderRate> Add(ProviderRate pr) { ResultAndError <ProviderRate> result = new ResultAndError <ProviderRate>(); try { if (pr.Id == Guid.Empty) { pr.Id = new Guid(); } db.ProviderRates.Add(pr); db.SaveChanges(); return(result.AddResult(pr)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <bool> UpdateReadingDate(IEnumerable <int> cashId, DateTimeOffset readingDate) { ResultAndError <bool> result = new ResultAndError <bool>(); try { foreach (int no in cashId) { CashMovementCenter oCash = Get(no.ToString()); oCash.ReadingDate = readingDate; db.SaveChanges(); } return(result.AddResult(true)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <bool> UpdateReadingDate(IEnumerable <int> centersNo, DateTimeOffset readingDate) { ResultAndError <bool> result = new ResultAndError <bool>(); try { foreach (int no in centersNo) { Document oSalesCenter = Get(no); oSalesCenter.ReadingDate = readingDate; db.SaveChanges(); } return(result.AddResult(true)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <bool> UpdateReadingDate(IEnumerable <string> centersNo, DateTimeOffset readingDate) { ResultAndError <bool> result = new ResultAndError <bool>(); try { foreach (string no in centersNo) { PedVentaCab oPedVentaCabs = Get(no); oPedVentaCabs.ReadingDate = readingDate; db.SaveChanges(); } return(result.AddResult(true)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <ProviderRate> Update(ProviderRate pr, bool insertIfNoExists = false) { ResultAndError <ProviderRate> result = new ResultAndError <ProviderRate>(); try { ProviderRate old = Get(pr.ProductNo, pr.VendorNo); if (old == null && insertIfNoExists) { return(Add(pr)); } db.Entry(old).CurrentValues.SetValues(pr); db.SaveChanges(); return(result.AddResult(pr)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
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)); } }
public ResultAndError <AlmacenZP> Update(AlmacenZP pr, bool insertIfNoExists = false) { ResultAndError <AlmacenZP> result = new ResultAndError <AlmacenZP>(); try { AlmacenZP old = Get(pr.ProductNo, pr.LocationCode); if (old == null && insertIfNoExists) { return(Add(pr)); } db.Entry(old).CurrentValues.SetValues(pr); db.SaveChanges(); return(result.AddResult(pr)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
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)); } }
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)); } }
public ResultAndError <CustomerCenter> Update(CustomerCenter c, bool insertIfNoExists = false) { ResultAndError <CustomerCenter> result = new ResultAndError <CustomerCenter>(); try { CustomerCenter old = Get(c.CustomerNo); if (old == null && insertIfNoExists) { return(Add(c)); } db.Entry(old).CurrentValues.SetValues(c); db.SaveChanges(); return(result.AddResult(c)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <HistoricoPedido> Update(HistoricoPedido cr, bool insertIfNoExists = false) { ResultAndError <HistoricoPedido> result = new ResultAndError <HistoricoPedido>(); try { HistoricoPedido old = Get(cr.No); if (old == null && insertIfNoExists) { return(Add(cr)); } db.Entry(old).CurrentValues.SetValues(cr); db.SaveChanges(); return(result.AddResult(cr)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
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)); } }
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)); } }
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)); } }
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)); } }
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)); } }
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)); } }
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)); } }
public ResultAndError <CabeceraRecuento> Update(CabeceraRecuento pr, bool insertIfNoExists = false) { ResultAndError <CabeceraRecuento> result = new ResultAndError <CabeceraRecuento>(); try { CabeceraRecuento old = Get(pr.IdRecuento); if (old == null && insertIfNoExists) { return(Add(pr)); } db.Entry(old).CurrentValues.SetValues(pr); db.SaveChanges(); return(result.AddResult(pr)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
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)); } }
public ResultAndError <DiscountLineInvoice> Update(DiscountLineInvoice c, bool insertIfNoExists = false) { ResultAndError <DiscountLineInvoice> result = new ResultAndError <DiscountLineInvoice>(); try { DiscountLineInvoice old = Get(c.ItemNo); if (old == null && insertIfNoExists) { return(Add(c)); } db.Entry(old).CurrentValues.SetValues(c); db.SaveChanges(); return(result.AddResult(c)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <ProductCategory> Update(ProductCategory cr, bool insertIfNoExists = false) { ResultAndError <ProductCategory> result = new ResultAndError <ProductCategory>(); try { ProductCategory old = Get(cr.Code); if (old == null && insertIfNoExists) { return(Add(cr)); } db.Entry(old).CurrentValues.SetValues(cr); db.SaveChanges(); return(result.AddResult(cr)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <UnitMeasureProduct> Update(UnitMeasureProduct u, bool insertIfNoExists = false) { ResultAndError <UnitMeasureProduct> result = new ResultAndError <UnitMeasureProduct>(); try { UnitMeasureProduct old = Get(u.Code); if (old == null && insertIfNoExists) { return(Add(u)); } db.Entry(old).CurrentValues.SetValues(u); db.SaveChanges(); return(result.AddResult(u)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }