public static IEnumerable<Equipo> compare(string[] equiposCodes) { PortalDataContext portaldb = new PortalDataContext(ACommerce.BO.Comun.GetConnString()); SecurityDataContext secdb = new SecurityDataContext(ACommerce.BO.Comun.GetConnString()); TiendaDataContext tiendadb = new TiendaDataContext(ACommerce.BO.Comun.GetConnString()); // From i In tiendadb.ProductReviews Where i.IDProduct = _idProduct Select i.Score string parametro = secdb.Parametros.Where(p => p.Codigo.Equals("URL_head")).FirstOrDefault().Valor.ToString(); //ACommerce.BO.usp_GetProductByCategory3Result source = tiendadb.usp_GetProductByCategory3(-1, "", -1, -1, -1); //decimal Precio = Math.Round(source.Productprice1 ?? 0, 0, MidpointRounding.AwayFromZero); //decimal PrecioAnterior = source.Productprice1ant == null ? 0 : Math.Round(source.Productprice1ant ?? 0, 0, MidpointRounding.AwayFromZero); //decimal PrecioPre = Math.Round(source.ProductpricePREP, 0, MidpointRounding.AwayFromZero); //decimal PrecioAnteriorPre = source.ProductpricePREPant == null ? 0: Math.Round(source.ProductpricePREPant, 0, MidpointRounding.AwayFromZero); //Selecciona todos los planes haciendo join con portalbycategory List<Equipo> equiposList = (from p in portaldb.vw_Productos join nv in portaldb.NameValues on p.nvManufacturer equals nv.IDNameValue where equiposCodes.Contains(p.Codigo) && p.nvTipo_Producto == 52 select new Equipo(p.IDProduct, p.Producto, p.Codigo, HtmlRemoval.StripTagsCharArray(p.Descripcion), p.IDPhotoDefault.HasValue ? parametro + "/Lib/Images.aspx?ID=" + p.IDPhotoDefault + "&thum=1" : "", nv.Descripcion, p.ProductPrice1, p.ProductPrice2, p.ProductStock, (from pr in portaldb.ProductReviews where pr.IDProduct == p.IDProduct select pr.Score).FirstOrDefault(), (from ps in portaldb.vw_ProductSpecs where ps.IDProduct == p.IDProduct select new ParCaracteristicas(ps.Especificacion, ps.Value)).ToList() , parametro + "Master/Claro/Secciones/ShowProductMovil.aspx?ID=" + p.IDProduct)) .ToList(); return equiposList; }
public usuarioRepository(TiendaDataContext Context) : base(Context) { }
public perfilRepository(TiendaDataContext Context) : base(Context) { }
public static IEnumerable<Equipo> byPlan(string planCode) { PortalDataContext portaldb = new PortalDataContext(ACommerce.BO.Comun.GetConnString()); SecurityDataContext secdb = new SecurityDataContext(ACommerce.BO.Comun.GetConnString()); TiendaDataContext tiendadb = new TiendaDataContext(ACommerce.BO.Comun.GetConnString()); // From i In tiendadb.ProductReviews Where i.IDProduct = _idProduct Select i.Score string parametro = secdb.Parametros.Where(p => p.Codigo.Equals("URL_head")).FirstOrDefault().Valor.ToString(); //Selecciona todos los planes haciendo join con portalbycategory List<Equipo> equiposList = (from pe in portaldb.vw_Producto_Plans join p in portaldb.Productos on pe.IDProduct equals p.IDProduct where pe.CodigoPlan == planCode && pe.Estatus_Produto == "Activo" && pe.Estatus_Plan == "Activo" && pe.LineType == "S" select new Equipo(p.IDProduct, pe.Nombre_Producto, p.Codigo, HtmlRemoval.StripTagsCharArray(p.ProductDescription), p.IDPhotoDefault.HasValue ? parametro + "/Lib/Images.aspx?ID=" + p.IDPhotoDefault + "&thum=1": "", (from nv in portaldb.NameValues where nv.IDNameValue == p.nvManufacturer select nv.Descripcion).FirstOrDefault().ToString(), p.ProductPrice1, p.ProductPrice2, p.ProductStock, (from pr in portaldb.ProductReviews where pr.IDProduct == p.IDProduct select pr.Score).FirstOrDefault(), (from ps in portaldb.vw_ProductSpecs where ps.IDProduct == p.IDProduct select new ParCaracteristicas(ps.Especificacion, ps.Value)).ToList() , parametro + "Master/Claro/Secciones/ShowProductMovil.aspx?ID=" + p.IDProduct)) .ToList(); return equiposList; }
public BaseRepository(TiendaDataContext repositoryContext) { this.RepositoryContext = repositoryContext; entities = RepositoryContext.Set <T>(); }
public ProductoRepository(TiendaDataContext context) : base(context) { }
static void Main(string[] args) { //Contexto de datos generado de la clase LINQ to SLQ TiendaDataContext db = new TiendaDataContext(); /*Shippers repartidor = new Shippers(); * Shippers repartidor1 = new Shippers(); * Shippers repartidor2 = new Shippers(); * Shippers repartidor3 = new Shippers(); * * //Introducción de un nuevo registro a la tabla shippers en la base de datos * * repartidor.CompanyName = "FEDEX"; * repartidor.ShipperID = 4; * repartidor.Phone="(505) 423 - 423 - 432"; * repartidor1.CompanyName = "FEDEX"; * repartidor1.ShipperID = 1004; * repartidor1.Phone = "(505) 012 - 293 -349"; * repartidor2.CompanyName = "DHL"; * repartidor2.ShipperID = 1005; * repartidor2.Phone = "(402) 403 - 324 - 032"; * repartidor3.CompanyName = "Amazon"; * repartidor3.ShipperID = 1006; * repartidor3.Phone = "(101) 213 - 312- 214"; * * * db.Shippers.InsertOnSubmit(repartidor); * db.Shippers.InsertOnSubmit(repartidor1); * db.Shippers.InsertOnSubmit(repartidor2); * db.Shippers.InsertOnSubmit(repartidor3); * db.SubmitChanges();*/ //Guardamos los cambios dentro de la base de datos //db.SubmitChanges(); //Seleccionamos los numeros telefonicos de los repartidores en nuestra tabla y guardaremos //los registros en la variable numero Console.WriteLine("\n*SELECT*"); var numero = from tel in db.Shippers select tel.Phone; foreach (var num in numero) { Console.WriteLine("Telefono: " + num); } //Ahora vamos a imprimir la compañia del repartidor con el ID número 4. Console.WriteLine("\n*SELECT WHERE*"); var compañia = from rep in db.Shippers where rep.ShipperID == 4 select rep.CompanyName; foreach (var com in compañia) { Console.WriteLine("Compañia: " + com); } //Ordenamos e imprimimos todos los registros pero con el ID de manera descendente. var repartidores = from rep in db.Shippers orderby rep.ShipperID descending select rep; Console.WriteLine("\n*ORDER BY*"); Console.WriteLine(); foreach (var rep in repartidores) { Console.WriteLine("ID:{0} Compañia:{1} Telefono{2}", rep.ShipperID, rep.CompanyName, rep.Phone); } //***UPDATE*** //El objeto repartidor (tabla shipers) recibirá el primer registro que encuentre en la //tabla donde el nombre de la compañia donde trabaja coincida con "FEDEX" Shippers repartidorac = db.Shippers.FirstOrDefault(x => x.CompanyName.Equals("FEDEX")); Console.WriteLine("\nRegistro a actualizar: {0} {1} {2}", repartidorac.ShipperID, repartidorac.CompanyName, repartidorac.Phone); //Actualizamos los datos repartidorac.CompanyName = " Amazon "; repartidorac.ShipperID = 8; repartidorac.Phone = "(509) 345 - 457 - 023"; //***DELETE*** //De la misma manera, recibiremos el primer dato que encuentre con el ID de repartidor #2 //y lo guardaremos en esta variable Shippers repartidorbo = db.Shippers.FirstOrDefault(x => x.ShipperID == 2); Console.WriteLine("\nRegistro a borrar: {0} {1} {2}", repartidorbo.ShipperID, repartidorbo.CompanyName, repartidorbo.Phone); db.Shippers.DeleteOnSubmit(repartidorbo); Console.WriteLine("\n*****VALORES ACTUALIZADOS*****"); var repartidoresfinal = from rep in db.Shippers select rep; foreach (var repf in repartidoresfinal) { Console.WriteLine("ID:{0} Compañia:{1} Telefono{2}", repf.ShipperID, repf.CompanyName, repf.Phone); } Console.ReadKey(); }
public CarritoCompraRepository(TiendaDataContext context) : base(context) { }
public opcionesMenuRepository(TiendaDataContext Context) : base(Context) { }