private void btnSaloonSave_Click(object sender, EventArgs e) { try { if (tbxSaloonName.Text == "") { MessageBox.Show("Please do not leave blank !"); } else { Saloon saloon = new Saloon() { Saloons = tbxSaloonName.Text, Capacity = Convert.ToInt32(nudSaloonCapacity.Value) }; saloons.Add(saloon); MessageBox.Show("Saloon successfully added :)"); } } catch (Exception x) { MessageBox.Show(x.ToString()); } }
public string update(Saloon saloon) { try { var updatesaloon = db.Saloon.Where(k => k.ID == saloon.ID).FirstOrDefault(); if (updatesaloon != null) { if (!string.IsNullOrWhiteSpace(saloon.Name) && !string.IsNullOrWhiteSpace(saloon.Capacity.ToString())) { updatesaloon.Name = saloon.Name; updatesaloon.Capacity = saloon.Capacity; if (db.SaveChanges() > 0) { return(saloon.Name + " Update successful"); } return(saloon.Name + " Update failed"); } return("Validation error"); } return(" Update failed"); } catch (Exception msg) { return(msg.Message); } }
static void Main(string[] args) { // Create a blue saloon car IVehicle myCar = new Saloon(new StandardEngine(1300)); myCar.Paint(VehicleColour.Blue); Console.WriteLine(myCar); // Add air-conditioning to the car... myCar = new AirConditionedVehicle(myCar); Console.WriteLine(myCar); // Now add alloy wheels... myCar = new AlloyWheeledVehicle(myCar); Console.WriteLine(myCar); // Now add leather seats... myCar = new LeatherSeatedVehicle(myCar); Console.WriteLine(myCar); // Now add metallic paint... myCar = new MetallicPaintedVehicle(myCar); Console.WriteLine(myCar); // Now add satellite navigation myCar = new SatNavVehicle(myCar); Console.WriteLine(myCar); Console.Read(); }
public async Task <IActionResult> Edit(int id, [Bind("SaloonID,SaloonName,SaloonAddress,Contact_Number")] Saloon saloon) { if (id != saloon.SaloonID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(saloon); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SaloonExists(saloon.SaloonID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(saloon)); }
// le bot souhaite joeur un Saloon void PlaySaloonBot(List <int> botHand, List <int> playedThisTurn, int i) { Saloon s = new Saloon(); s.PlayBot(botHand[i]); playedThisTurn.Add(i); Debug.Log("Joue Saloon"); }
public ActionResult DeleteConfirmed(Guid id) { Saloon saloon = db.Saloons.Find(id); db.Saloons.Remove(saloon); db.SaveChanges(); return(RedirectToAction("Index")); }
public void CarBuilderPatternTest() { AbstractCar car = new Saloon(new StandardEngine(1300)); VehicleBuilder builder = new CarBuilder(car); VehicleDirector vehicleDirector = new CarDirector(); IVehicle veh = vehicleDirector.Build(builder); Console.WriteLine(veh); }
public ActionResult Edit([Bind(Include = "Id,ManagerId,Name,Comments,Code")] Saloon saloon) { if (ModelState.IsValid) { db.Entry(saloon).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(saloon)); }
public void Main() { AbstractCar car = new Saloon(new StandardEngine(1300)); VehicleBuilder builder = new CarBuilder(car); VehicleDirector director = new CarDirector(); IVehicle v = director.Build(builder); Console.WriteLine(v); Console.Read(); }
/// <summary> /// /// </summary> /// <param name="args"></param> static void Main(string[] args) { AbstractCar _car = new Saloon(new StandardEngine(1300)); VehicleBuilder _builder = new CarBuilder(_car); VehicleDirector _director = new CarDirector(); IVehicle _vehicle = _director.Build(_builder); Console.WriteLine(_vehicle); Console.Read(); }
public Sample() { //Sample for Saloon AbstractCar car = new Saloon(new StandardEngine(1300)); VehicleBuilder builder = new CarBuilder(car); VehicleDirector director = new CarDirector(); IVehicle v = director.Build(builder); Console.WriteLine(v); }
public async Task <IActionResult> Create([Bind("SaloonID,SaloonName,SaloonAddress,Contact_Number")] Saloon saloon) { if (ModelState.IsValid) { _context.Add(saloon); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(saloon)); }
public ActionResult Create([Bind(Include = "Id,ManagerId,Name,Comments,Code")] Saloon saloon) { if (ModelState.IsValid) { saloon.Id = Guid.NewGuid(); db.Saloons.Add(saloon); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(saloon)); }
// GET: Production/Saloons/Delete/5 public ActionResult Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Saloon saloon = db.Saloons.Find(id); if (saloon == null) { return(HttpNotFound()); } return(View(saloon)); }
static void Main() { /* * - Builder class contains all possible build methods for all possible * vehicle types. */ AbstractCar vCar = new Saloon(new StandardEngine(1300)); VehicleBuilder vBuilder = new CarBuilder(vCar); VehicleDirector vDirector = new CarDirector(); Common.IVehicle vVehicle = vDirector.Build(vBuilder); WriteLine(vVehicle); ReadKey(); }
public void CarDecoratorTest() { //given IVehicle car = new Saloon(new StandardEngine(1300)); car.Paint(VehicleColour.Blue); //when car = new AlloyWheeledVehicle(car); //AlloyWheeled car = new LeatherSeatedVehicle(car); //LeatherSeated car = new MetalicPaintedVehicle(car); //MetalicPaintedVehicle car = new SatNavVehicle(car); //SateliteNavigation System.Console.WriteLine(car); }
private void AddSaloon_Click(object sender, EventArgs e) { Saloon saloon = new Saloon(); saloon.Name = txtSaloonName.Text; saloon.Capacity = Convert.ToInt32(txtSaloonCap.Text); saloonService.Add(saloon); txtSaloonCap.Text = ""; txtSaloonName.Text = ""; dgSaloon.DataSource = saloonService.SelectAll(); MessageBox.Show(saloon.Name + " Saloon is added with " + saloon.Capacity + " capacity."); }
public string delete(Saloon saloon) { try { db.Saloon.Remove(saloon); if (db.SaveChanges() > 0) { saloon.ID = 0; return(saloon.Name + " Delete successful"); } return(saloon.Name + " Delete failed"); } catch (Exception msg) { return(msg.Message); } }
protected internal override IVehicle SelectVehicle (DrivingStyle style) { IVehicle selectedVehicle; if (style == DrivingStyle.Economical) { selectedVehicle = new Saloon(new StandardEngine(1300)); } else if (style == DrivingStyle.Midrange) { selectedVehicle = new Coupe(new StandardEngine(1600)); } else { selectedVehicle = new Sport(new TurboEngine(2000)); } return(selectedVehicle); }
public string insert(Saloon salon) { try { if (!string.IsNullOrWhiteSpace(salon.Name) && !string.IsNullOrWhiteSpace(salon.Capacity.ToString())) { db.Saloon.Add(salon); if (db.SaveChanges() > 0) { return(salon.Name + " Insert successful"); } return(salon.Name + " Insert failed"); } return("Validation error"); } catch (Exception msg) { return(msg.Message); } }
static void Main(string[] args) { List <Auto> autos1 = new List <Auto>() { new Audi("red", AutoType.travel, "Germany", Gas.diesel, 3, 8.5, 25000), new Audi("silver", AutoType.travel, "Germany", Gas.petrol, 5, 5.5, 18000), new Audi("black", AutoType.cargo, "Germany", Gas.petrol, 5, 7.5, 35000) }; Saloon saloonAudi = new Saloon("Boul Jane Sandaski BB", autos1); saloonAudi.Buy(19000, 36000); List <Auto> autos2 = new List <Auto>() { new BMW(AutoType.travel, "Germany", Gas.diesel, 3, 5.2, 17000, true), new BMW(AutoType.cargo, "Germany", Gas.petrol, 5, 5.2, 25000, true), new BMW(AutoType.travel, "Germany", Gas.diesel, 5, 5.2, 22000, false), }; Saloon saloonBMW = new Saloon("Krste misirkov", autos2); saloonBMW.Buy(18000, 22000); }
public ActionResult UpdateSaloon([Bind(Prefix = "Saloon")] Saloon item) { _salRep.Update(item); return(RedirectToAction("SaloonList")); }
/// <summary> /// Moves this Cowboy from its current Tile to an adjacent Tile. /// </summary> /// <param name="tile">The Tile you want to move this Cowboy to.</param> /// <returns>True if the move worked, false otherwise.</returns> public bool Move(Saloon.Tile tile) { return this.RunOnServer<bool>("move", new Dictionary<string, object> { {"tile", tile} }); }
/// <summary> /// Sits down and plays a piano. /// </summary> /// <param name="piano">The Furnishing that is a piano you want to play.</param> /// <returns>True if the play worked, false otherwise.</returns> public bool Play(Saloon.Furnishing piano) { return this.RunOnServer<bool>("play", new Dictionary<string, object> { {"piano", piano} }); }
/// <summary> /// Does their job's action on a Tile. /// </summary> /// <param name="tile">The Tile you want this Cowboy to act on.</param> /// <param name="drunkDirection">The direction the bottle will cause drunk cowboys to be in, can be 'North', 'East', 'South', or 'West'.</param> /// <returns>True if the act worked, false otherwise.</returns> public bool Act(Saloon.Tile tile, string drunkDirection="") { return this.RunOnServer<bool>("act", new Dictionary<string, object> { {"tile", tile}, {"drunkDirection", drunkDirection} }); }
public void Add(Saloon entity) { entity.Name = entity.Name.Trim().ToLower(); _saloonDal.Add(entity); }
public void Delete(Saloon saloon) { context.Saloons.Remove(saloon); context.SaveChanges(); }
static void Main(string[] args) { List <Auto> autos1 = new List <Auto>() { new Audi("A3", "Red", AutoType.travel, Gas.diesel, 3, 5.5, 18000), new Audi("Q5", "Silver", AutoType.travel, Gas.petrol, 5, 7.5, 25000), new Audi("Q7", "Black", AutoType.cargo, Gas.diesel, 2, 7.5, 35000) }; Saloon saloon_Audi = new Saloon("Boul Jane Sandaski BB", autos1); //saloon_Audi.Buy(19000, 36000); List <Auto> autos2 = new List <Auto>() { new BMW("M5", true, AutoType.travel, Gas.petrol, 5, 8, 27000), new BMW("M3", false, AutoType.travel, Gas.diesel, 5, 6.5, 22000), new BMW("X6", true, AutoType.cargo, Gas.petrol, 5, 8.2, 35000), }; Saloon saloon_BMW = new Saloon("Krste misirkov", autos2); //saloon_BMW.Buy(18000, 22000); List <Auto> autos3 = new List <Auto>() { new Opel("Zafira", "Germany", AutoType.travel, Gas.diesel, 5, 5.7, 19000), new Opel("Insignia", "USA", AutoType.cargo, Gas.petrol, 3, 7.5, 21500) }; Saloon saloon_Opel = new Saloon("Skopje", autos3); List <Saloon> saloons = new List <Saloon> { saloon_Audi, saloon_BMW, saloon_Opel }; while (true) { Console.WriteLine("Welcome to autoApp Macedonia"); int min; while (true) { Console.WriteLine("Please enter the minimum willing to spend on new auto"); bool minParse = int.TryParse(Console.ReadLine(), out min); if (minParse) { break; } } int max; while (true) { Console.WriteLine("Now enter the maximum willing to spend on new auto"); bool maxParse = int.TryParse(Console.ReadLine(), out max); if (maxParse && max > min) { break; } } while (true) { Console.WriteLine("Please choose a saloon to see it`s cars in the desired range"); Console.WriteLine("1. Saloon Audi"); Console.WriteLine("2. Saloon BMW"); Console.WriteLine("3. Saloon Opel"); string userChoice = Console.ReadLine(); if (userChoice == "1") { saloon_Audi.Buy(min, max); break; } else if (userChoice == "2") { saloon_BMW.Buy(min, max); break; } else if (userChoice == "3") { saloon_Opel.Buy(min, max); break; } else { continue; } //switch (userChoice) //{ // case "1": // saloon_Audi.Buy(min, max); // break; // case "2": // saloon_BMW.Buy(min, max); // break; // case "3": // saloon_Opel.Buy(min, max); // break; // default: // Console.WriteLine("No such saloon please try again"); // break; //} } Console.WriteLine($"-----------------------"); Console.WriteLine($"Do you want exit Y/N"); string studentlogout = Console.ReadLine().ToLower(); if (studentlogout == "y") { Console.WriteLine("Thank you for using autoApp Macedonia"); break; } else { continue; } } }
public static void Main() { // Create a blue saloon car... IVehicle myCar = new Saloon(new StandardEngine(1300)); myCar.Paint(VehicleColour.Blue); Console.WriteLine(myCar); // Add air-conditioning to the car... myCar = new AirConditionedVehicle(myCar); Console.WriteLine(myCar); // Now add alloy wheels... myCar = new AlloyWheeledVehicle(myCar); Console.WriteLine(myCar); // Now add leather seats... myCar = new LeatherSeatedVehicle(myCar); Console.WriteLine(myCar); // Now add metallic paint... myCar = new MetallicPaintedVehicle(myCar); Console.WriteLine(myCar); // Now add satellite-navigation... myCar = new SatNavVehicle(myCar); Console.WriteLine(myCar); }
public void Update(Saloon entity) { throw new NotImplementedException(); }
public Saloon Update(Saloon saloon) { return(_saloonDal.Update(saloon)); }
static void Main() { // Create a blue saloon car... IVehicle myCar = new Saloon(new StandardEngine(1300)); myCar.Paint(VehicleColour.Blue); Console.WriteLine(myCar); // prepare the car for sale VehicleFacade fac = new VehicleFacade(); fac.PrepareForSale(myCar); }
public void Create(Saloon saloon) { context.Saloons.Add(saloon); context.SaveChanges(); }
static void Main() { AbstractCar car = new Saloon(new StandardEngine(1300)); VehicleBuilder builder = new CarBuilder(car); VehicleDirector director = new CarDirector(); IVehicle v = director.Build(builder); Console.WriteLine(v); Console.Read(); // You can see the required Builder object is constructed // and passed to the required Director object, after which // we invoke the method to build the product and then retrieve // the finished article. // The output should show: // Building car chassis // Building car body // Building car passenger area // Building car boot // Building car windows // Saloon (StandardEngine (1300), Unpainted) }
public void Update(Saloon saloon) { context.Saloons.Update(saloon); context.SaveChanges(); }
protected override void Seed(MyContext context) { Employee au = new Employee();//Boss Tanımlama au.Email = "*****@*****.**"; au.Password = DantexCrypt.Crypt("123"); au.ConfirmPassword = DantexCrypt.Crypt("123"); au.EmployeeType = ENTITIES.Enums.EmployeeType.Boss; au.FirstName = "Serkan"; au.LastName = "Akçay"; au.TCNO = "21111111111"; au.Sallary = 5300; au.MobilePhone = "5316622582"; context.Employees.Add(au); context.SaveChanges(); AppUser vau = new AppUser();//VIP Tanımlama vau.Role = ENTITIES.Enums.UserRole.Vip; vau.Active = true; vau.Email = "*****@*****.**"; vau.Password = DantexCrypt.Crypt("123456"); vau.ConfirmPassword = DantexCrypt.Crypt("123456"); context.AppUsers.Add(vau); UserProfile vup = new UserProfile();//VIP Profil Tanımlama vup.ID = vau.ID; vup.FirstName = "Emre"; vup.LastName = "Özdemir"; vup.MobilePhone = "5345997081"; vup.Gender = ENTITIES.Enums.Gender.Erkek; context.UserProfiles.Add(vup); context.SaveChanges(); Employee emp = new Employee();//BookingClerk emp.Email = "*****@*****.**"; emp.Password = DantexCrypt.Crypt("123"); emp.ConfirmPassword = DantexCrypt.Crypt("123"); emp.EmployeeType = ENTITIES.Enums.EmployeeType.BookingClerk; emp.FirstName = "Ercan"; emp.LastName = "Karahan"; emp.TCNO = "21111111111"; emp.Sallary = 1300; emp.MobilePhone = "5316622582"; context.Employees.Add(emp); context.SaveChanges(); Employee emp2 = new Employee(); //BoxOfficeSuperVisor emp2.EmployeeType = ENTITIES.Enums.EmployeeType.BoxOfficeSupervisor; emp2.Email = "*****@*****.**"; emp2.Password = DantexCrypt.Crypt("1234"); emp2.ConfirmPassword = DantexCrypt.Crypt("1234"); emp2.FirstName = "Yusuf Emre"; emp2.LastName = "Ozdemir"; emp2.TCNO = "11111111111"; emp2.Sallary = 1301; emp2.MobilePhone = "5312622582"; context.Employees.Add(emp2); context.SaveChanges(); Employee emp3 = new Employee(); //Management emp3.EmployeeType = ENTITIES.Enums.EmployeeType.Management; emp3.Email = "*****@*****.**"; emp3.Password = DantexCrypt.Crypt("serkan1903"); emp3.ConfirmPassword = DantexCrypt.Crypt("serkan1903"); emp3.FirstName = "Serkan"; emp3.LastName = "Akçay"; emp3.TCNO = "11111111113"; emp3.Sallary = 4500; emp3.MobilePhone = "5312625582"; context.Employees.Add(emp3); context.SaveChanges(); string[] genres = new string[] { "Korku", "Bilim Kurgu", "Aksiyon", "Belgesel", "Macera" }; for (int i = 1; i <= 5; i++) { Genre genre = new Genre(); genre.ID = i; genre.GenreName = genres[i - 1]; genre.Description = new Lorem("tr").Sentence(10); context.Genres.Add(genre); } context.SaveChanges(); for (int i = 1; i <= 10; i++) { Actor actor = new Actor(); actor.FirstName = new Name("en").FirstName(); actor.LastName = new Name("en").LastName(); actor.Age = new Random().Next(30, 50).ToString(); actor.Country = new Address("en").Country(); context.Actors.Add(actor); } context.SaveChanges(); for (int i = 1; i <= 5; i++) { Director director = new Director(); director.FirstName = new Name("en").FirstName(); director.LastName = new Name("en").LastName(); director.Age = new Random().Next(30, 50).ToString(); director.Country = new Address("en").Country(); context.Directors.Add(director); } context.SaveChanges(); for (int i = 1; i <= 20; i++) { Movie movie = new Movie(); movie.MovieName = new Lorem("en").Word(); movie.Description = new Lorem("en").Sentences(10); movie.DirectorID = new Random().Next(1, 6); movie.MovieYear = new Random().Next(2005, 2020).ToString(); movie.GenreID = new Random().Next(1, 6); movie.MovieImagePath = "/Pictures/starWars.jpg"; context.Movies.Add(movie); } context.SaveChanges(); context.SaveChanges(); DateTime[] sessions = new DateTime[] { Convert.ToDateTime("2021-04-17 11:00:00.000"), Convert.ToDateTime("2021-04-22 13:00:00.000"), Convert.ToDateTime("2021-05-27 14:00:00.000"), Convert.ToDateTime("2021-05-29 15:00:00.000"), Convert.ToDateTime("2021-06-12 15:00:00.000") }; for (int i = 0; i < 5; i++) { Session session = new Session(); session.ID = i + 1; session.Time = sessions[i]; session.SessionActive = true; session.IsSpecial = false; session.Price = Convert.ToDecimal(new Commerce("tr").Price()); context.Sessions.Add(session); } context.SaveChanges(); for (int i = 1; i <= 5; i++) { Saloon saloon = new Saloon(); saloon.SaloonNo = i; context.Saloons.Add(saloon); } context.SaveChanges(); for (int i = 1; i <= 5; i++) { for (char j = 'A'; j < 'I'; j++) { for (int k = 1; k <= 14; k++) { Seat seat = new Seat(); seat.SeatActive = false; seat.SaloonID = i; seat.SessionID = i; seat.Character = Convert.ToString(j); seat.Number = k; context.Seats.Add(seat); } } } context.SaveChanges(); for (int l = 1; l <= 5; l++) { MovieSessionSaloon mss = new MovieSessionSaloon(); mss.MovieID = l; mss.SessionID = l; mss.SaloonID = l; context.MovieSessionSaloons.Add(mss); } context.SaveChanges(); }