public static void AddDB(ProductoModel modelo, TipoPrecioToProduct modeloTipoPrecio) { using (efooddatabaseEntities db = new efooddatabaseEntities()) { try { string codigoDeProducto = ConsecutivoModel.GetConsecutivo("Productos"); //Entidades de la base de datos Product product = new Product { ProductCode = codigoDeProducto, ProductDescription = modelo.ProductDescription, FoodOptionCode = modelo.FoodOptionCode, ProductContent = modelo.ProductContent, ProductImage = modelo.ProductImage }; db.Products.Add(product); db.SaveChanges(); PriceTypeToProduct priceToProduct = new PriceTypeToProduct { PriceTypeCode = modeloTipoPrecio.PriceTypeCode, ProductCode = codigoDeProducto, Price = modeloTipoPrecio.Price }; db.PriceTypeToProducts.Add(priceToProduct); db.SaveChanges(); BitacoraModel.AddLogBook("a", "Anadir", Admin.ObtenerIdUsuario()); } catch (Exception e) { ErrorLogModel.AddError(e); } } }
public static void DeletetDB(LineaComidaModel modelo) { try { using (efooddatabaseEntities db = new efooddatabaseEntities()) { var datos = (from valor in db.FoodOptions where valor.FoodOptionCode == modelo.FoodOptionCode select valor).SingleOrDefault(); db.FoodOptions.Remove(datos); db.SaveChanges(); BitacoraModel.AddLogBook("n", "Borrar", Admin.ObtenerIdUsuario()); } } catch (Exception x) { ErrorLogModel.AddError(x); } }
public static void EditDB(TipoPrecioModelo modelo) { try { using (efooddatabaseEntities db = new efooddatabaseEntities()) { var datos = (from valor in db.PriceTypes where valor.PriceTypeCode == modelo.PriceTypeCode select valor).SingleOrDefault(); datos.PriceTypeDescription = modelo.PriceTypeDescription; db.SaveChanges(); BitacoraModel.AddLogBook("e", "Edicion", Admin.ObtenerIdUsuario()); } } catch (Exception x) { ErrorLogModel.AddError(x); } }
public static void AddDB(LineaComidaModel modelo) { using (efooddatabaseEntities db = new efooddatabaseEntities()) { try { //Entidades de la base de datos FoodOption foodOption = new FoodOption { FoodOptionCode = ConsecutivoModel.GetConsecutivo("Líneas de comida"), FoodOptionDescription = modelo.FoodOptionDescription }; db.FoodOptions.Add(foodOption); db.SaveChanges(); BitacoraModel.AddLogBook("a", "Anadir", Admin.ObtenerIdUsuario()); } catch (Exception e) { ErrorLogModel.AddError(e); } } }
public static void AddDB(TipoPrecioModelo modelo) { using (efooddatabaseEntities db = new efooddatabaseEntities()) { try { //Entidades de la base de datos PriceType priceType = new PriceType { PriceTypeCode = ConsecutivoModel.GetConsecutivo("Precios"), PriceTypeDescription = modelo.PriceTypeDescription }; db.PriceTypes.Add(priceType); db.SaveChanges(); BitacoraModel.AddLogBook("a", "Anadir", Admin.ObtenerIdUsuario()); } catch (Exception e) { ErrorLogModel.AddError(e); } } }
public static void AddDB(TarjetaCreditoDebitoModel modelo) { using (efooddatabaseEntities db = new efooddatabaseEntities()) { try { //Entidades de la base de datos Card newCard = new Card { CardCode = ConsecutivoModel.GetConsecutivo("Tarjetas"), CardDescription = modelo.CardDescription }; db.Cards.Add(newCard); db.SaveChanges(); BitacoraModel.AddLogBook("a", "Anadir", Admin.ObtenerIdUsuario()); } catch (Exception e) { ErrorLogModel.AddError(e); } } }
public static void EditDB(TiqueteDescuentoModel modelo) { try { using (efooddatabaseEntities db = new efooddatabaseEntities()) { var datos = (from valor in db.TicketDiscounts where valor.TicketCode == modelo.TicketCode select valor).SingleOrDefault(); datos.TicketDescription = modelo.TicketDescription; datos.TicketDiscountPercentage = modelo.TicketDiscountPercentage; datos.RemainingTickets = modelo.RemainingTickets; db.SaveChanges(); BitacoraModel.AddLogBook("e", "Edicion", Admin.ObtenerIdUsuario()); } } catch (Exception x) { ErrorLogModel.AddError(x); } }
public static void AddDB(TipoPrecioToProduct model) { using (efooddatabaseEntities db = new efooddatabaseEntities()) { try { //Entidades de la base de datos PriceTypeToProduct priceType = new PriceTypeToProduct { PriceTypeCode = model.PriceTypeCode, ProductCode = model.ProductCode, Price = model.Price }; db.PriceTypeToProducts.Add(priceType); db.SaveChanges(); BitacoraModel.AddLogBook("a", "Anadir", Admin.ObtenerIdUsuario()); } catch (Exception e) { ErrorLogModel.AddError(e); } } }
public static void EditDB(ProductoModel modelo) { try { using (efooddatabaseEntities db = new efooddatabaseEntities()) { var datos = (from valor in db.Products where valor.ProductCode == modelo.ProductCode select valor).SingleOrDefault(); datos.ProductDescription = modelo.ProductDescription; datos.FoodOptionCode = modelo.FoodOptionCode; datos.ProductContent = modelo.ProductContent; //datos.ProductImage = null; db.SaveChanges(); BitacoraModel.AddLogBook("e", "Edicion", Admin.ObtenerIdUsuario()); } } catch (Exception x) { ErrorLogModel.AddError(x); } }
public static void AddDB(TiqueteDescuentoModel modelo) { using (efooddatabaseEntities db = new efooddatabaseEntities()) { try { //Entidades de la base de datos TicketDiscount newTicketDiscount = new TicketDiscount { TicketCode = ConsecutivoModel.GetConsecutivo("Tiquetes de descuento"), TicketDescription = modelo.TicketDescription, TicketDiscountPercentage = modelo.TicketDiscountPercentage, RemainingTickets = modelo.RemainingTickets }; db.TicketDiscounts.Add(newTicketDiscount); db.SaveChanges(); BitacoraModel.AddLogBook("a", "Anadir", Admin.ObtenerIdUsuario()); } catch (Exception e) { ErrorLogModel.AddError(e); } } }
public static void EditDB(MediosPagoModel modelo) { try { using (efooddatabaseEntities db = new efooddatabaseEntities()) { var datos = (from valor in db.PaymentProcessors where valor.PaymentProcessorCode == modelo.PaymentProcessorCode select valor).SingleOrDefault(); datos.PaymentProcessorName = modelo.PaymentProcessorName; datos.PaymentProcessorDescription = modelo.PaymentProcessorDescription; datos.PaymentProcessorType = modelo.PaymentProcessorType; datos.PaymentProcessorMethod = modelo.PaymentProcessorMethod; datos.PaymentProcessorStatus = false; datos.PaymentProcessorVerify = false; db.SaveChanges(); BitacoraModel.AddLogBook("e", "Edicion", Admin.ObtenerIdUsuario()); } } catch (Exception x) { ErrorLogModel.AddError(x); } }
public static void AddDB(MediosPagoModel modelo) { using (efooddatabaseEntities db = new efooddatabaseEntities()) { try { //Entidades de la base de datos PaymentProcessor newProcessor = new PaymentProcessor { PaymentProcessorCode = ConsecutivoModel.GetConsecutivo("Medios de pago"), PaymentProcessorName = modelo.PaymentProcessorName, PaymentProcessorDescription = modelo.PaymentProcessorDescription, PaymentProcessorType = modelo.PaymentProcessorType, PaymentProcessorMethod = modelo.PaymentProcessorMethod, PaymentProcessorStatus = false, PaymentProcessorVerify = false }; db.PaymentProcessors.Add(newProcessor); db.SaveChanges(); BitacoraModel.AddLogBook("a", "Anadir", Admin.ObtenerIdUsuario()); } catch (Exception e) { ErrorLogModel.AddError(e); } } }