/// <summary> /// Verifica se os campos do PetShop não são nulos /// </summary> public void PetShoptIsNotNull(PetShop petShop, string method) { if (method == "UPDATE") { if (petShop.PetShopId.Equals(0)) { throw new ModelFieldIsNullException("O ID do PetShop não pode ser 0"); } } else { if (string.IsNullOrEmpty(petShop.Name)) { throw new ModelFieldIsNullException("O nome do PetShop está vazio"); } else if (string.IsNullOrEmpty(petShop.Company.CompanyCane)) { throw new ModelFieldIsNullException("O nome da Compania está vazio"); } else if (string.IsNullOrEmpty(petShop.Company.CNPJ)) { throw new ModelFieldIsNullException("O CNPJ da Compania está vazio"); } else if (!petShop.Pets.Any()) { throw new ModelFieldIsNullException("Deve ser informado ao menos um Pet"); } } }
static void Main(string[] args) { //Initialize data PetShop myShop = new PetShop("Mark's Elite Pups and Paws"); Dog bingo = new Dog("bingo", 4, "male"); Dog lucky = new Dog("lucky", 3, "female"); Cat mrSnibbley = new Cat("Mr. Snibbley", 4, "male"); Snake hiss = new Snake("Sir Hiss", 0, "male"); Snake ka = new Snake("Ka", 0, "female"); //Add pets to shop myShop.AddPet("dog", bingo); myShop.AddPet("dog", lucky); myShop.AddPet("cat", mrSnibbley); myShop.AddPet("snake", hiss); myShop.AddPet("snake", ka); Console.Clear(); Console.WriteLine("Welcome to my PetShop"); //Itterate over key value pairs (pair) in the Pets dictionary (myShop.pets) foreach (var pair in myShop.Pets) { //Print the name of the pet type (pair.Key) System.Console.WriteLine(pair.Key + "s"); //for each value (pair.Value) itterate over the list of pets pair.Value.ForEach(pet => { System.Console.WriteLine(pet.Name); }); } myShop.PrintType("dog"); }
public FormularioVenta(PetShop petShop, Producto productoSeleccionado, ManejadorDeMensajes manejadorDeMensajes) { InitializeComponent(); this.petShop = petShop; this.productoSeleccionado = productoSeleccionado; this.manejadorDeMensajes = manejadorDeMensajes; }
public PetShop CalcularTotal(PetShop PetShop, int qtdCaesPequenos, int qtdCaesGrandes) { PetShop.TotalCaoGrande = PetShop.ValorCaoGrande * qtdCaesGrandes; PetShop.TotalCaoPequeno = PetShop.ValorCaoPequeno * qtdCaesPequenos; return(PetShop); }
public FormPetShop() { InitializeComponent(); this.petShop = PetShop.GetInstance(); this.petShop.ListaDeProductosModificada += ActualizacionLista; this.manejadorDeMensajes = new ManejadorDeMensajes(); }
public void TestConverter() { Registry registry = new Registry(); Strategy interceptor = new RegistryStrategy(registry); Persister persister = new Persister(interceptor); StringWriter writer = new StringWriter(); PetShop shop = new PetShop(); registry.bind(Dog.class, DogConverter.class)
public PetShopsModel(PetShop ps, double distanceFromUser) : base() { this.Zip = ps.Zip; this.Name = ps.Name; this.Address = ps.Address; this.Phone = ps.Phone; this.City = ps.City; this.Latitude = ps.Latitude; this.Longitude = ps.Longitude; this.MonStart = ps.MonStart; this.MonEnd = ps.MonEnd; this.TueStart = ps.TueStart; this.TueEnd = ps.TueEnd; this.WedStart = ps.WedStart; this.WedEnd = ps.WedEnd; this.ThuStart = ps.ThuStart; this.ThuEnd = ps.ThuEnd; this.FriStart = ps.FriStart; this.FriEnd = ps.FriEnd; this.SatStart = ps.SatStart; this.SatEnd = ps.SatEnd; this.SunStart = ps.SunStart; this.SunEnd = ps.SunEnd; this.DistanceFromUser = distanceFromUser; }
public PetShop GetPetShop(DateTime data, int quantidadeCaesPequenos, int quantidadeCaesGrandes) { PetShop petShop = new PetShop(/*data, quantidadeCaesPequenos, quantidadeCaesGrandes*/); var meuCaninoFeliz = petShop.MeuCaninoFeliz(petShop); var vaiRex = petShop.VaiRex(petShop); var chowChawgas = petShop.ChowChawgas(petShop); var totalCaninoFeliz = meuCaninoFeliz.ValorCaoGrande + meuCaninoFeliz.ValorCaoPequeno; var totalVaiRex = vaiRex.ValorCaoGrande + vaiRex.ValorCaoPequeno; var totalchowChawgas = chowChawgas.ValorCaoPequeno + chowChawgas.ValorCaoPequeno; if(totalCaninoFeliz < totalVaiRex && totalCaninoFeliz < totalchowChawgas) { _resultado = meuCaninoFeliz; } if (totalVaiRex < totalCaninoFeliz && totalVaiRex < totalchowChawgas) { _resultado = vaiRex; } if (totalchowChawgas < totalCaninoFeliz && totalchowChawgas < totalVaiRex) { _resultado = chowChawgas; } return _resultado; }
public void Setup() { shop = new PetShop(); shop.AddPet(new Dog("Rover")); shop.AddPet(new Cat("MEOWingtons")); shop.AddPet(new Fish("FINlay")); }
public Task <IActionResult> Put([FromBody] PetShop model, int id) => VerifyResultAsync(async() => { var petShop = await _petShop.UpdatePetShop(model, id); return(new ObjectResult(petShop) { StatusCode = StatusCodes.Status200OK }); });
public Task <IActionResult> Post([FromBody] PetShop model) => VerifyResultAsync(async() => { await _petShop.CreatePetShop(model); return(new ObjectResult("PetShop criado com sucesso!") { StatusCode = StatusCodes.Status201Created }); });
public static void WriteLog(PetShop petShop, Dog dog1, Dog dog2) { Console.WriteLine(petShop.Name); Console.WriteLine($"Should let in {dog1.Name}?"); Console.WriteLine(petShop.ShouldLetPetIn(dog1)); Console.WriteLine($"Should let in {dog2.Name}?"); Console.WriteLine(petShop.ShouldLetPetIn(dog2)); }
public static void TestShop() { PetShop<Cat> shop = new PetShop<Cat>(); shop.Add(new Cat("Cirmos")); shop.Add(new Cat("Filemon")); shop.Buy("Filemon", "Gyongyver"); Console.WriteLine(shop.Find("Filemon")); }
public void TestDePruebaDeSingleton() { //arrange PetShop petShop; petShop = PetShop.GetInstance(); //assert Assert.IsTrue(petShop == PetShop.GetInstance()); }
public void TestPruebaCompraProducto() { //arrange Producto producto = new Producto(); PetShop petShop = PetShop.GetInstance(); //act Compra compra = petShop.Comprar(producto, 20); //assert Assert.IsTrue(petShop.Compras.Contains(compra)); }
public void TestPruebaVentaProducto() { //arrange Producto producto = new Producto(); PetShop petShop = PetShop.GetInstance(); //act Venta venta = petShop.Vender(producto, 20); //assert Assert.IsTrue(petShop.Ventas.Contains(venta)); }
public async Task <PetShop> CreatePetShop(PetShop model) { PetShoptIsNotNull(model, "CREATE"); _repo.Add(model); if (await _repo.SaveChangeAsync()) { return(model); } else { throw new InvalidOperationException(); } }
/// <summary> /// Inserts the order and updates the inventory stock within a transaction. /// </summary> /// <param name="order">All information about the order</param> public void Insert(PetShop.Model.OrderInfo order) { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { dal.Insert(order); // Update the inventory to reflect the current inventory after the order submission Inventory inventory = new Inventory(); inventory.TakeStock(order.LineItems); // Calling Complete commits the transaction. // Excluding this call by the end of TransactionScope's scope will rollback the transaction ts.Complete(); } }
public ActionResult Create(PetViewModel collection) { try { var model = new PetShop(); model.Name = collection.Name; model.Age = collection.Age; model.Active = collection.Active; _servicespet.save(model); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
static void Main(string[] args) { try { ///Se Agregan dos productos, se compran y se realiza una venta, se utiliza los dos metodos de mostrar compra y venta ///para mostrarlos en la consola, sino lanza excepcion Producto productoUno = new Producto(20, "Rascador para gatos", 20, 200); Producto productoDos = new Producto(25, "Palito golosina", 5, 20); PetShop.GetInstance().Comprar(productoUno, 3); PetShop.GetInstance().Comprar(productoDos, 2); PetShop.GetInstance().Vender(productoDos, 2); Console.WriteLine("Compras: {0}\n", PetShop.GetInstance().MostrarCompras()); Console.WriteLine("Ventas: {0}\n", PetShop.GetInstance().MostrarVentas()); Console.ReadKey(); }catch (Exception ex) { throw new PetShopException("No se pudo completar el proceso", ex); } }
private void btnAgregar_Click_1(object sender, EventArgs e) { try { string nuevaDescripcion = this.txtDescripcion.Text; double nuevoPrecio = Convert.ToDouble(this.txtPrecio.Text); int nuevoStock = (int)this.NUDStock.Value; this.manejadorDeMensajes.ManejarMensaje("Compra realizada exitosamente!", Entidades.TipoMensajeCronometrado.SUCCESS, 4000); ; Producto productoExistente = null; foreach (Producto producto in PetShop.GetInstance().Productos) { if (producto.Descripcion.Equals(nuevaDescripcion)) { productoExistente = producto; break; } } Boolean productoYaExiste = productoExistente != null; if (productoYaExiste) { ProductosDAO.Update(productoExistente.Codigo, productoExistente.Precio, productoExistente.Stock + nuevoStock); productoExistente.Stock += nuevoStock; } else { productoExistente = new Producto(0, nuevaDescripcion, nuevoStock, nuevoPrecio); ProductosDAO.Insert(nuevaDescripcion, nuevoPrecio, nuevoStock); } PetShop.GetInstance().Comprar(productoExistente, nuevoStock); this.Close(); }catch (Exception ex) { manejadorDeMensajes.ManejarMensaje(ex, 5000); } }
public PetShop PreencherValores(PetShop PetShop, DateTime data, int qtdCaesPequenos, int qtdCaesGrandes) { if (PetShop.TipoPetShop == TipoPetShop.MeuCaninoFeliz) { if (data.FimDeSemana()) { PetShop.ValorCaoGrande = Convert.ToDecimal(40 + (40 * 0.2)); PetShop.ValorCaoPequeno = Convert.ToDecimal(20 + (20 * 0.2)); } else { PetShop.ValorCaoGrande = 40; PetShop.ValorCaoPequeno = 20; } } else if (PetShop.TipoPetShop == TipoPetShop.VaiRex) { if (data.FimDeSemana()) { PetShop.ValorCaoGrande = 55; PetShop.ValorCaoPequeno = 20; } else { PetShop.ValorCaoGrande = 50; PetShop.ValorCaoPequeno = 15; } } else if (PetShop.TipoPetShop == TipoPetShop.ChowChawgas) { PetShop.ValorCaoGrande = 45; PetShop.ValorCaoPequeno = 30; } else { throw new RegraDeNegocioException("Não foi possivel encontra o Canil informado."); } return(CalcularTotal(PetShop, qtdCaesPequenos, qtdCaesGrandes)); }
public async Task <PetShop> UpdatePetShop(PetShop model, int id) { PetShoptIsNotNull(model, "UPDATE"); var petShop = await _petShop.GetPetShopById(id); if (petShop == null) { throw new DataNotFoundException($"Não foi encontrado um PetShop com o ID: {id}."); } else { _repo.Update(model); if (await _repo.SaveChangeAsync()) { return(model); } else { throw new InvalidOperationException(); } } }
public static void Main(string[] args) { //petshop1 only wants dogs with 4 legs var petShop1 = new PetShop { Name = "4-legged dogland", ShouldLetPetIn = dog => dog.NumberOfPaws == 4 }; //petshop2 only wants dogs that are shibas var petShop2 = new PetShop { Name = "Vincenzo's Shibaland", ShouldLetPetIn = dog => dog.IsShiba }; var petShop3 = new PetShop { Name = "Kristen's 1-legged Shibaland", ShouldLetPetIn = dog => dog.IsShiba && dog.NumberOfPaws == 1 }; var pupper = new Dog { Name = "pupper", IsShiba = false, NumberOfPaws = 4 }; var doge = new Dog { Name = "Doge", IsShiba = true, NumberOfPaws = 3 }; WriteLog(petShop1, pupper, doge); WriteLog(petShop2, pupper, doge); WriteLog(petShop3, pupper, doge); Console.ReadKey(); }
partial void DeleteOrderStatus(PetShop.Core.Data.OrderStatus instance);
partial void InsertProduct(PetShop.Core.Data.Product instance);
partial void UpdateProduct(PetShop.Core.Data.Product instance);
partial void DeleteProduct(PetShop.Core.Data.Product instance);
partial void DeleteSupplier(PetShop.Core.Data.Supplier instance);
/// <summary> /// Inserts a PetShop.Business.Product object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Product object to insert.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.Product object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, PetShop.Business.Product entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Product_Insert", _useStoredProcedure); database.AddInParameter(commandWrapper, "@ProductId", DbType.AnsiString, entity.ProductId ); database.AddInParameter(commandWrapper, "@CategoryId", DbType.AnsiString, entity.CategoryId ); database.AddInParameter(commandWrapper, "@Name", DbType.AnsiString, entity.Name ); database.AddInParameter(commandWrapper, "@Descn", DbType.AnsiString, entity.Descn ); database.AddInParameter(commandWrapper, "@Image", DbType.AnsiString, entity.Image ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } entity.OriginalProductId = entity.ProductId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Inserts a PetShop.Business.Order object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Order object to insert.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.Order object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, PetShop.Business.Order entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Orders_Insert", _useStoredProcedure); database.AddOutParameter(commandWrapper, "@OrderId", DbType.Int32, 4); database.AddInParameter(commandWrapper, "@UserId", DbType.AnsiString, entity.UserId ); database.AddInParameter(commandWrapper, "@OrderDate", DbType.DateTime, entity.OrderDate ); database.AddInParameter(commandWrapper, "@ShipAddr1", DbType.AnsiString, entity.ShipAddr1 ); database.AddInParameter(commandWrapper, "@ShipAddr2", DbType.AnsiString, entity.ShipAddr2 ); database.AddInParameter(commandWrapper, "@ShipCity", DbType.AnsiString, entity.ShipCity ); database.AddInParameter(commandWrapper, "@ShipState", DbType.AnsiString, entity.ShipState ); database.AddInParameter(commandWrapper, "@ShipZip", DbType.AnsiString, entity.ShipZip ); database.AddInParameter(commandWrapper, "@ShipCountry", DbType.AnsiString, entity.ShipCountry ); database.AddInParameter(commandWrapper, "@BillAddr1", DbType.AnsiString, entity.BillAddr1 ); database.AddInParameter(commandWrapper, "@BillAddr2", DbType.AnsiString, entity.BillAddr2 ); database.AddInParameter(commandWrapper, "@BillCity", DbType.AnsiString, entity.BillCity ); database.AddInParameter(commandWrapper, "@BillState", DbType.AnsiString, entity.BillState ); database.AddInParameter(commandWrapper, "@BillZip", DbType.AnsiString, entity.BillZip ); database.AddInParameter(commandWrapper, "@BillCountry", DbType.AnsiString, entity.BillCountry ); database.AddInParameter(commandWrapper, "@Courier", DbType.AnsiString, entity.Courier ); database.AddInParameter(commandWrapper, "@TotalPrice", DbType.Decimal, entity.TotalPrice ); database.AddInParameter(commandWrapper, "@BillToFirstName", DbType.AnsiString, entity.BillToFirstName ); database.AddInParameter(commandWrapper, "@BillToLastName", DbType.AnsiString, entity.BillToLastName ); database.AddInParameter(commandWrapper, "@ShipToFirstName", DbType.AnsiString, entity.ShipToFirstName ); database.AddInParameter(commandWrapper, "@ShipToLastName", DbType.AnsiString, entity.ShipToLastName ); database.AddInParameter(commandWrapper, "@AuthorizationNumber", DbType.Int32, entity.AuthorizationNumber ); database.AddInParameter(commandWrapper, "@Locale", DbType.AnsiString, entity.Locale ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } object _orderId = database.GetParameterValue(commandWrapper, "@OrderId"); entity.OrderId = (int)_orderId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
public bool update(PetShop pet) { throw new NotImplementedException(); }
/// <summary> /// Inserts a PetShop.Business.Supplier object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Supplier object to insert.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.Supplier object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, PetShop.Business.Supplier entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Supplier_Insert", _useStoredProcedure); database.AddInParameter(commandWrapper, "@SuppId", DbType.Int32, entity.SuppId ); database.AddInParameter(commandWrapper, "@Name", DbType.AnsiString, entity.Name ); database.AddInParameter(commandWrapper, "@Status", DbType.AnsiString, entity.Status ); database.AddInParameter(commandWrapper, "@Addr1", DbType.AnsiString, entity.Addr1 ); database.AddInParameter(commandWrapper, "@Addr2", DbType.AnsiString, entity.Addr2 ); database.AddInParameter(commandWrapper, "@City", DbType.AnsiString, entity.City ); database.AddInParameter(commandWrapper, "@State", DbType.AnsiString, entity.State ); database.AddInParameter(commandWrapper, "@Zip", DbType.AnsiString, entity.Zip ); database.AddInParameter(commandWrapper, "@Phone", DbType.AnsiString, entity.Phone ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } entity.OriginalSuppId = entity.SuppId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
partial void DeleteProfile(PetShop.Core.Data.Profile instance);
partial void InsertSupplier(PetShop.Core.Data.Supplier instance);
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Profiles object to update.</param> /// <remarks> /// After updating the datasource, the PetShop.Business.Profiles object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Update(TransactionManager transactionManager, PetShop.Business.Profiles entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Profiles_Update", _useStoredProcedure); database.AddInParameter(commandWrapper, "@UniqueId", DbType.Int32, entity.UniqueId ); database.AddInParameter(commandWrapper, "@Username", DbType.AnsiString, entity.Username ); database.AddInParameter(commandWrapper, "@ApplicationName", DbType.AnsiString, entity.ApplicationName ); database.AddInParameter(commandWrapper, "@IsAnonymous", DbType.Boolean, (entity.IsAnonymous.HasValue ? (object) entity.IsAnonymous : System.DBNull.Value) ); database.AddInParameter(commandWrapper, "@LastActivityDate", DbType.DateTime, (entity.LastActivityDate.HasValue ? (object) entity.LastActivityDate : System.DBNull.Value) ); database.AddInParameter(commandWrapper, "@LastUpdatedDate", DbType.DateTime, (entity.LastUpdatedDate.HasValue ? (object) entity.LastUpdatedDate : System.DBNull.Value) ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } //Stop Tracking Now that it has been updated and persisted. if (DataRepository.Provider.EnableEntityTracking) EntityManager.StopTracking(entity.EntityTrackingKey); entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity)); return Convert.ToBoolean(results); }
partial void InsertOrderStatus(PetShop.Core.Data.OrderStatus instance);
partial void DeleteOrder(PetShop.Core.Data.Order instance);
public bool save(PetShop pet) { return(_repository.save(pet)); }
partial void UpdateOrder(PetShop.Core.Data.Order instance);
/// <summary> /// Inserts a PetShop.Business.Cart object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Cart object to insert.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.Cart object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, PetShop.Business.Cart entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Cart_Insert", _useStoredProcedure); database.AddOutParameter(commandWrapper, "@CartId", DbType.Int32, 4); database.AddInParameter(commandWrapper, "@UniqueId", DbType.Int32, entity.UniqueId ); database.AddInParameter(commandWrapper, "@ItemId", DbType.AnsiString, entity.ItemId ); database.AddInParameter(commandWrapper, "@Name", DbType.AnsiString, entity.Name ); database.AddInParameter(commandWrapper, "@Type", DbType.AnsiString, entity.Type ); database.AddInParameter(commandWrapper, "@Price", DbType.Decimal, entity.Price ); database.AddInParameter(commandWrapper, "@CategoryId", DbType.AnsiString, entity.CategoryId ); database.AddInParameter(commandWrapper, "@ProductId", DbType.AnsiString, entity.ProductId ); database.AddInParameter(commandWrapper, "@IsShoppingCart", DbType.Boolean, entity.IsShoppingCart ); database.AddInParameter(commandWrapper, "@Quantity", DbType.Int32, entity.Quantity ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } object _cartId = database.GetParameterValue(commandWrapper, "@CartId"); entity.CartId = (int)_cartId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Category object to update.</param> /// <remarks> /// After updating the datasource, the PetShop.Business.Category object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Update(TransactionManager transactionManager, PetShop.Business.Category entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Category_Update", _useStoredProcedure); database.AddInParameter(commandWrapper, "@CategoryId", DbType.AnsiString, entity.CategoryId ); database.AddInParameter(commandWrapper, "@OriginalCategoryId", DbType.AnsiString, entity.OriginalCategoryId); database.AddInParameter(commandWrapper, "@Name", DbType.AnsiString, entity.Name ); database.AddInParameter(commandWrapper, "@Descn", DbType.AnsiString, entity.Descn ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } //Stop Tracking Now that it has been updated and persisted. if (DataRepository.Provider.EnableEntityTracking) EntityManager.StopTracking(entity.EntityTrackingKey); entity.OriginalCategoryId = entity.CategoryId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity)); return Convert.ToBoolean(results); }
partial void UpdateProfile(PetShop.Core.Data.Profile instance);
partial void InsertOrder(PetShop.Core.Data.Order instance);
partial void InsertProfile(PetShop.Core.Data.Profile instance);
/// <summary> /// This method serializes the order object and send it to the queue for asynchronous processing /// </summary> /// <param name="order">All information about the order</param> public void Insert(PetShop.Model.OrderInfo order) { asynchOrder.Send(order); }
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Item object to update.</param> /// <remarks> /// After updating the datasource, the PetShop.Business.Item object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Update(TransactionManager transactionManager, PetShop.Business.Item entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Item_Update", _useStoredProcedure); database.AddInParameter(commandWrapper, "@ItemId", DbType.AnsiString, entity.ItemId ); database.AddInParameter(commandWrapper, "@OriginalItemId", DbType.AnsiString, entity.OriginalItemId); database.AddInParameter(commandWrapper, "@ProductId", DbType.AnsiString, entity.ProductId ); database.AddInParameter(commandWrapper, "@ListPrice", DbType.Decimal, (entity.ListPrice.HasValue ? (object) entity.ListPrice : System.DBNull.Value) ); database.AddInParameter(commandWrapper, "@UnitCost", DbType.Decimal, (entity.UnitCost.HasValue ? (object) entity.UnitCost : System.DBNull.Value) ); database.AddInParameter(commandWrapper, "@Supplier", DbType.Int32, (entity.Supplier.HasValue ? (object) entity.Supplier : System.DBNull.Value) ); database.AddInParameter(commandWrapper, "@Status", DbType.AnsiString, entity.Status ); database.AddInParameter(commandWrapper, "@Name", DbType.AnsiString, entity.Name ); database.AddInParameter(commandWrapper, "@Image", DbType.AnsiString, entity.Image ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } //Stop Tracking Now that it has been updated and persisted. if (DataRepository.Provider.EnableEntityTracking) EntityManager.StopTracking(entity.EntityTrackingKey); entity.OriginalItemId = entity.ItemId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Inserts a PetShop.Business.Profiles object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Profiles object to insert.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.Profiles object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, PetShop.Business.Profiles entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Profiles_Insert", _useStoredProcedure); database.AddOutParameter(commandWrapper, "@UniqueId", DbType.Int32, 4); database.AddInParameter(commandWrapper, "@Username", DbType.AnsiString, entity.Username ); database.AddInParameter(commandWrapper, "@ApplicationName", DbType.AnsiString, entity.ApplicationName ); database.AddInParameter(commandWrapper, "@IsAnonymous", DbType.Boolean, (entity.IsAnonymous.HasValue ? (object) entity.IsAnonymous : System.DBNull.Value)); database.AddInParameter(commandWrapper, "@LastActivityDate", DbType.DateTime, (entity.LastActivityDate.HasValue ? (object) entity.LastActivityDate : System.DBNull.Value)); database.AddInParameter(commandWrapper, "@LastUpdatedDate", DbType.DateTime, (entity.LastUpdatedDate.HasValue ? (object) entity.LastUpdatedDate : System.DBNull.Value)); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } object _uniqueId = database.GetParameterValue(commandWrapper, "@UniqueId"); entity.UniqueId = (System.Int32)_uniqueId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Inserts a PetShop.Business.Account object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Account object to insert.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.Account object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, PetShop.Business.Account entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Account_Insert", _useStoredProcedure); database.AddOutParameter(commandWrapper, "@AccountId", DbType.Int32, 4); database.AddInParameter(commandWrapper, "@UniqueId", DbType.Int32, entity.UniqueId ); database.AddInParameter(commandWrapper, "@Email", DbType.AnsiString, entity.Email ); database.AddInParameter(commandWrapper, "@FirstName", DbType.AnsiString, entity.FirstName ); database.AddInParameter(commandWrapper, "@LastName", DbType.AnsiString, entity.LastName ); database.AddInParameter(commandWrapper, "@Address1", DbType.AnsiString, entity.Address1 ); database.AddInParameter(commandWrapper, "@Address2", DbType.AnsiString, entity.Address2 ); database.AddInParameter(commandWrapper, "@City", DbType.AnsiString, entity.City ); database.AddInParameter(commandWrapper, "@State", DbType.AnsiString, entity.State ); database.AddInParameter(commandWrapper, "@Zip", DbType.AnsiString, entity.Zip ); database.AddInParameter(commandWrapper, "@Country", DbType.AnsiString, entity.Country ); database.AddInParameter(commandWrapper, "@Phone", DbType.AnsiString, entity.Phone ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } object _accountId = database.GetParameterValue(commandWrapper, "@AccountId"); entity.AccountId = (int)_accountId; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
public void SetUp() { shop = new PetShop(); }
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Account object to update.</param> /// <remarks> /// After updating the datasource, the PetShop.Business.Account object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Update(TransactionManager transactionManager, PetShop.Business.Account entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Account_Update", _useStoredProcedure); database.AddInParameter(commandWrapper, "@AccountId", DbType.Int32, entity.AccountId ); database.AddInParameter(commandWrapper, "@UniqueId", DbType.Int32, entity.UniqueId ); database.AddInParameter(commandWrapper, "@Email", DbType.AnsiString, entity.Email ); database.AddInParameter(commandWrapper, "@FirstName", DbType.AnsiString, entity.FirstName ); database.AddInParameter(commandWrapper, "@LastName", DbType.AnsiString, entity.LastName ); database.AddInParameter(commandWrapper, "@Address1", DbType.AnsiString, entity.Address1 ); database.AddInParameter(commandWrapper, "@Address2", DbType.AnsiString, entity.Address2 ); database.AddInParameter(commandWrapper, "@City", DbType.AnsiString, entity.City ); database.AddInParameter(commandWrapper, "@State", DbType.AnsiString, entity.State ); database.AddInParameter(commandWrapper, "@Zip", DbType.AnsiString, entity.Zip ); database.AddInParameter(commandWrapper, "@Country", DbType.AnsiString, entity.Country ); database.AddInParameter(commandWrapper, "@Phone", DbType.AnsiString, entity.Phone ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } //Stop Tracking Now that it has been updated and persisted. if (DataRepository.Provider.EnableEntityTracking) EntityManager.StopTracking(entity.EntityTrackingKey); entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity)); return Convert.ToBoolean(results); }
/// <summary> /// Update an existing row in the datasource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.Orders object to update.</param> /// <remarks> /// After updating the datasource, the PetShop.Business.Orders object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Update(TransactionManager transactionManager, PetShop.Business.Orders entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Orders_Update", _useStoredProcedure); database.AddInParameter(commandWrapper, "@OrderId", DbType.Int32, entity.OrderId ); database.AddInParameter(commandWrapper, "@UserId", DbType.AnsiString, entity.UserId ); database.AddInParameter(commandWrapper, "@OrderDate", DbType.DateTime, entity.OrderDate ); database.AddInParameter(commandWrapper, "@ShipAddr1", DbType.AnsiString, entity.ShipAddr1 ); database.AddInParameter(commandWrapper, "@ShipAddr2", DbType.AnsiString, entity.ShipAddr2 ); database.AddInParameter(commandWrapper, "@ShipCity", DbType.AnsiString, entity.ShipCity ); database.AddInParameter(commandWrapper, "@ShipState", DbType.AnsiString, entity.ShipState ); database.AddInParameter(commandWrapper, "@ShipZip", DbType.AnsiString, entity.ShipZip ); database.AddInParameter(commandWrapper, "@ShipCountry", DbType.AnsiString, entity.ShipCountry ); database.AddInParameter(commandWrapper, "@BillAddr1", DbType.AnsiString, entity.BillAddr1 ); database.AddInParameter(commandWrapper, "@BillAddr2", DbType.AnsiString, entity.BillAddr2 ); database.AddInParameter(commandWrapper, "@BillCity", DbType.AnsiString, entity.BillCity ); database.AddInParameter(commandWrapper, "@BillState", DbType.AnsiString, entity.BillState ); database.AddInParameter(commandWrapper, "@BillZip", DbType.AnsiString, entity.BillZip ); database.AddInParameter(commandWrapper, "@BillCountry", DbType.AnsiString, entity.BillCountry ); database.AddInParameter(commandWrapper, "@Courier", DbType.AnsiString, entity.Courier ); database.AddInParameter(commandWrapper, "@TotalPrice", DbType.Decimal, entity.TotalPrice ); database.AddInParameter(commandWrapper, "@BillToFirstName", DbType.AnsiString, entity.BillToFirstName ); database.AddInParameter(commandWrapper, "@BillToLastName", DbType.AnsiString, entity.BillToLastName ); database.AddInParameter(commandWrapper, "@ShipToFirstName", DbType.AnsiString, entity.ShipToFirstName ); database.AddInParameter(commandWrapper, "@ShipToLastName", DbType.AnsiString, entity.ShipToLastName ); database.AddInParameter(commandWrapper, "@AuthorizationNumber", DbType.Int32, entity.AuthorizationNumber ); database.AddInParameter(commandWrapper, "@Locale", DbType.AnsiString, entity.Locale ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Update", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } //Stop Tracking Now that it has been updated and persisted. if (DataRepository.Provider.EnableEntityTracking) EntityManager.StopTracking(entity.EntityTrackingKey); entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Update", entity)); return Convert.ToBoolean(results); }
public PetShop Get() { DateTime data = new DateTime(2018, 08, 03); MeuCaninoFeliz meuCaninoFeliz = new MeuCaninoFeliz(data, 3, 5); VaiRex vaiRex = new VaiRex(data, 3, 5); ChowChawgas chowChawgas = new ChowChawgas(data, 3, 5); meuCaninoFeliz.GetMeuCaninoFeliz(meuCaninoFeliz); vaiRex.GetVaiRex(vaiRex); chowChawgas.GetChowChawgas(chowChawgas); var totalMeCaninoFeliz = meuCaninoFeliz.ValorCaoGrande + meuCaninoFeliz.ValorCaoPequeno; var totalVaiRex = vaiRex.ValorCaoGrande + vaiRex.ValorCaoPequeno; var totalChowChawgas = chowChawgas.ValorCaoGrande + chowChawgas.ValorCaoPequeno; if (totalMeCaninoFeliz < totalVaiRex && totalMeCaninoFeliz < totalChowChawgas) { PetShop petShop = new PetShop(); petShop.Nome = meuCaninoFeliz.Nome; petShop.ValorTotalBanhos = meuCaninoFeliz.ValorTotalBanhos; _petShop = petShop; } if (totalVaiRex < totalMeCaninoFeliz && totalVaiRex < totalChowChawgas) { PetShop petShop = new PetShop(); petShop.Nome = vaiRex.Nome; petShop.ValorTotalBanhos = vaiRex.ValorTotalBanhos; _petShop = petShop; } if (totalChowChawgas < totalVaiRex && totalChowChawgas < totalVaiRex) { PetShop petShop = new PetShop(); petShop.Nome = chowChawgas.Nome; petShop.ValorTotalBanhos = chowChawgas.ValorTotalBanhos; _petShop = petShop; } if (totalMeCaninoFeliz == totalVaiRex && totalMeCaninoFeliz == totalChowChawgas) { if (meuCaninoFeliz.Distancia < vaiRex.Distancia && meuCaninoFeliz.Distancia < chowChawgas.Distancia) { PetShop petShop = new PetShop(); petShop.Nome = meuCaninoFeliz.Nome; petShop.ValorTotalBanhos = meuCaninoFeliz.ValorTotalBanhos; _petShop = petShop; } if (chowChawgas.Distancia < vaiRex.Distancia && chowChawgas.Distancia < meuCaninoFeliz.Distancia) { PetShop petShop = new PetShop(); petShop.Nome = chowChawgas.Nome; petShop.ValorTotalBanhos = chowChawgas.ValorTotalBanhos; _petShop = petShop; } if (vaiRex.Distancia < meuCaninoFeliz.Distancia && vaiRex.Distancia < chowChawgas.Distancia) { PetShop petShop = new PetShop(); petShop.Nome = vaiRex.Nome; petShop.ValorTotalBanhos = vaiRex.ValorTotalBanhos; _petShop = petShop; } } return(_petShop); }
/// <summary> /// Inserts a PetShop.Business.OrderStatus object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">PetShop.Business.OrderStatus object to insert.</param> /// <remarks> /// After inserting into the datasource, the PetShop.Business.OrderStatus object will be updated /// to refelect any changes made by the datasource. (ie: identity or computed columns) /// </remarks> /// <returns>Returns true if operation is successful.</returns> /// <exception cref="System.Exception">The command could not be executed.</exception> /// <exception cref="System.Data.DataException">The <paramref name="transactionManager"/> is not open.</exception> /// <exception cref="System.Data.Common.DbException">The command could not be executed.</exception> public override bool Insert(TransactionManager transactionManager, PetShop.Business.OrderStatus entity) { SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand commandWrapper = StoredProcedureProvider.GetCommandWrapper(database, "dbo.OrderStatus_Insert", _useStoredProcedure); database.AddInParameter(commandWrapper, "@OrderId", DbType.Int32, entity.OrderId ); database.AddInParameter(commandWrapper, "@LineNum", DbType.Int32, entity.LineNum ); database.AddInParameter(commandWrapper, "@Timestamp", DbType.DateTime, entity.Timestamp ); database.AddInParameter(commandWrapper, "@Status", DbType.AnsiString, entity.Status ); int results = 0; //Provider Data Requesting Command Event OnDataRequesting(new CommandEventArgs(commandWrapper, "Insert", entity)); if (transactionManager != null) { results = Utility.ExecuteNonQuery(transactionManager, commandWrapper); } else { results = Utility.ExecuteNonQuery(database,commandWrapper); } entity.OriginalOrderId = entity.OrderId; entity.OriginalLineNum = entity.LineNum; entity.AcceptChanges(); //Provider Data Requested Command Event OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity)); return Convert.ToBoolean(results); }
static void Main(string[] args) { System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("pt-BR"); int smallCount; int bigCount; Console.WriteLine("Insira a quantidade de cachorros de pequeno porte."); smallCount = int.Parse(Console.ReadLine()); Console.WriteLine("Insira a quantidade de cachorros de grande porte"); bigCount = int.Parse(Console.ReadLine()); Console.WriteLine("Insira uma data de agendamento."); DateTime scheduled = DateTime.Parse(Console.ReadLine()); //****************************************** LIST ********************************************************* PetShop VaiRex = new PetShop() { petShopName = "Vai Rex", priceSmall = 15.00, priceBig = 50.00, distance = 1700, priceSmallWeekend = 20.00, priceBigWeekend = 55.00, smallCounter = smallCount, bigCounter = bigCount, }; PetShop MeuCanino = new PetShop() { petShopName = "Meu Canino", priceSmall = 20.00, priceBig = 40.00, distance = 2000, priceSmallWeekend = 20.00 * (1.2), priceBigWeekend = 40.00 * (1.2), smallCounter = smallCount, bigCounter = bigCount, }; PetShop ChowChawgs = new PetShop() { petShopName = "ChowChawgs", priceSmall = 30.00, priceBig = 45.00, distance = 800, priceSmallWeekend = 30.00, priceBigWeekend = 45.00, smallCounter = smallCount, bigCounter = bigCount, }; //********************************************************************************************************* List <PetShop> PetShops = new List <PetShop>(); PetShops.Add(VaiRex); PetShops.Add(MeuCanino); PetShops.Add(ChowChawgs); //********************************************************************************************************* CalculatePrice(PetShops, scheduled); IEnumerable <PetShop> query = from elements in PetShops orderby elements.finalPrice, elements.distance select elements; Console.WriteLine(query.First().petShopName); }