/// <summary> /// Display the pay rent form or the purchase property form /// </summary> /// <param name="player">Current player</param> /// <param name="property">Property tile that the current player landed on</param> private void DisplayPayRentOrPurchasePropertyForm(Player player, Property property) { Player propertyOwner = property.Owner; // if a property and is not owned, call the purchase property form if (propertyOwner == null) { // Figured out how to center windows with respect to their predecessors: // https://stackoverflow.com/questions/4306593/wpf-how-to-set-a-dialog-position-to-show-at-the-center-of-the-application PurchaseProperty purchaseProperty = new PurchaseProperty(); purchaseProperty.Owner = this; // Output information to the purchase property form purchaseProperty.tbOutputName.Text = player.Name; purchaseProperty.tbOutputMoney.Text = string.Format("{0:$#,##0}", player.Money); foreach (Property proprty in player.PropertiesOwned) { purchaseProperty.lbOutputPropertiesOwned.Items.Add(proprty.Name); } purchaseProperty.tbOutputCostOfProperty.Text = property.Cost.ToString("c0"); if (player.Money >= property.Cost) { purchaseProperty.tbUserInformation.Text = "Would you like to buy " + property.Name + "?"; } else { purchaseProperty.tbUserInformation.Text = "Sorry, you do not have enough money to purchase " + property.Name + "."; purchaseProperty.btnYesBuy.IsEnabled = false; } purchaseProperty.ShowDialog(); } // if the current player owns the property, do nothing else if (propertyOwner.Name == player.Name) { } // if another player owns the property, call the PayRent form else { PayRent payRent = new PayRent(); payRent.Owner = this; // Output information to pay rent form payRent.tbOutputName.Text = player.Name; payRent.tbOutputMoney.Text = string.Format("{0:$#,##0}", player.Money); payRent.tbOutputPayRentTo.Text = propertyOwner.Name; // Calculates the rent for utility or railroad property before output to the pay rent form if (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Utility)) { Utility utilityProperty = (Utility)property; utilityProperty.CalculateRent((Utility)GameLoop.getInstance().Gameboard.TileOrder[12], (Utility)GameLoop.getInstance().Gameboard.TileOrder[28], utilityProperty.NearstUtility); } else if (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Railroad)) { Railroad railroadProperty = (Railroad)property; railroadProperty.CalculateRent((Railroad)GameLoop.getInstance().Gameboard.TileOrder[5], (Railroad)GameLoop.getInstance().Gameboard.TileOrder[15], (Railroad)GameLoop.getInstance().Gameboard.TileOrder[25], (Railroad)GameLoop.getInstance().Gameboard.TileOrder[35], railroadProperty.NearestRailroad); } payRent.tbOutputRentIsHowMuch.Text = property.Rent.ToString("c0"); payRent.ShowDialog(); } }
public CarExtraArr GetCarExtraRent(PayRent payRent) { OrderRent order = payRent.Order; OrderDetailsRentArr orderDetailsRentArr = new OrderDetailsRentArr(); orderDetailsRentArr.Fill(); orderDetailsRentArr = orderDetailsRentArr.Filter(order); return(orderDetailsRentArr.GetCarExtraArr()); }
private PayRent FormToPayRent(OrderRent orderRent) { PayRent pay = new PayRent(); pay.Id = int.Parse(lbl_Idtxt.Text); pay.FullName = txt_FullName.Text; pay.CardNumber = txt_Card.Text; pay.Date = GetDate(); pay.CVC = txt_CVC.Text; pay.Order = orderRent; return(pay); }
private void btn_Save_Click(object sender, EventArgs e) { // שומר את המידע שקיבלנו לטבלה if (CheckForm()) { if (DoesBuy) { PayBuy payBuy = FormToPayBuy(neworderBuy); if (payBuy.Id == 0) { if (payBuy.Insert()) { ClearForm(); Form_Invoice newform = new Form_Invoice(payBuy); Hide(); newform.ShowDialog(); Close(); } } } else { PayRent payRent = FormToPayRent(neworderRent); if (payRent.Id == 0) { if (payRent.Insert()) { ClearForm(); Form_Invoice newform = new Form_Invoice(payRent); Hide(); newform.ShowDialog(); Close(); } } } } }
public Form_Invoice(PayRent payRent) { double days; InitializeComponent(); newpayRent = payRent; DoesBuy = false; days = (payRent.Order.DateTo - payRent.Order.DateFrom).TotalDays; AddItemToList(newpayRent.Order.Product, Convert.ToInt32(days)); AddItemsToList(GetCarExtraRent(newpayRent)); client = newpayRent.Order.Client; digits = newpayRent.CardNumber.Substring(newpayRent.CardNumber.Length - 4); Id = newpayRent.Order.Id; status = "Rent"; }
public override void CreateBoard() { ITile tile = new ActionTile("GO Collect £200", this); IGameAction action = new ReceiveMoneyAction("Collect £200", 200, GetGame()); tile.AddAction(action); base.GetTiles().Add(tile); ProperityDeed deed = new ProperityDeed(2, 10, 30, 90, 160, 250, 30, 30, 50); Properity properity = new Properity(200, deed, ColorSets.brown); tile = new ProperityTile("Old Kent", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); deed = new ProperityDeed(4, 20, 60, 180, 360, 450, 30, 30, 50); properity = new Properity(200, deed, ColorSets.brown); tile = new ProperityTile("Whitechapel Road", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); tile = new SimpleTile("Community Chest", this); action = new CommunityChestPickCard("Pick Community Chest Card", GetGame()); tile.AddAction(action); base.GetTiles().Add(tile); tile = new ActionTile("Income Tax (Pay 10% or $200)", this); action = new ReceiveMoneyAction("Income Tax (Pay 10% or $200)", -200, GetGame()); tile.AddAction(action); base.GetTiles().Add(tile); //TODO: change tile to utility tile = new SimpleTile("King's Cross Station", this); base.GetTiles().Add(tile); deed = new ProperityDeed(6, 30, 90, 270, 400, 550, 50, 50, 50); properity = new Properity(100, deed, ColorSets.lightblue); tile = new ProperityTile("The Angel Islington", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); tile = new SimpleTile("Chance", this); action = new ChancePickACard("Pick Chance Card", GetGame()); tile.AddAction(action); base.GetTiles().Add(tile); deed = new ProperityDeed(6, 30, 90, 270, 400, 550, 50, 50, 50); properity = new Properity(100, deed, ColorSets.lightblue); tile = new ProperityTile("Euston Road", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); deed = new ProperityDeed(8, 40, 100, 300, 450, 600, 50, 50, 60); properity = new Properity(120, deed, ColorSets.lightblue); tile = new ProperityTile("Pentonville Road", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); //TODO: change tile to utility tile = new SimpleTile("Jail/Just Visiting", this); base.GetTiles().Add(tile); deed = new ProperityDeed(10, 50, 150, 450, 625, 750, 100, 100, 70); properity = new Properity(140, deed, ColorSets.pink); tile = new ProperityTile("Pall Mall", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); //TODO: change tile to utility tile = new SimpleTile("Electric Company", this); base.GetTiles().Add(tile); deed = new ProperityDeed(10, 50, 150, 450, 625, 750, 100, 100, 70); properity = new Properity(140, deed, ColorSets.pink); tile = new ProperityTile("Whitehall", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); deed = new ProperityDeed(12, 60, 180, 500, 700, 900, 100, 100, 80); properity = new Properity(160, deed, ColorSets.pink); tile = new ProperityTile("Northumberland Avenue", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); //TODO: change tile to utility tile = new SimpleTile("Marylebone Station", this); base.GetTiles().Add(tile); deed = new ProperityDeed(14, 70, 200, 550, 750, 950, 100, 100, 90); properity = new Properity(180, deed, ColorSets.orange); tile = new ProperityTile("Bow Street", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); tile = new SimpleTile("Community Chest", this); action = new CommunityChestPickCard("Pick Community Chest Card", GetGame()); tile.AddAction(action); base.GetTiles().Add(tile); deed = new ProperityDeed(14, 70, 200, 550, 750, 950, 100, 100, 90); properity = new Properity(180, deed, ColorSets.orange); tile = new ProperityTile("Marlborough Street", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); deed = new ProperityDeed(16, 80, 220, 600, 800, 1000, 100, 100, 100); properity = new Properity(200, deed, ColorSets.orange); tile = new ProperityTile("Vine Street", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); tile = new SimpleTile("Free Parking", this); base.GetTiles().Add(tile); deed = new ProperityDeed(18, 90, 250, 700, 875, 1050, 150, 150, 110); properity = new Properity(220, deed, ColorSets.red); tile = new ProperityTile("Strand", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); tile = new SimpleTile("Chance", this); action = new ChancePickACard("Pick Chance Card", GetGame()); tile.AddAction(action); base.GetTiles().Add(tile); deed = new ProperityDeed(18, 90, 250, 700, 875, 1050, 150, 150, 110); properity = new Properity(220, deed, ColorSets.red); tile = new ProperityTile("Fleet Street", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); deed = new ProperityDeed(20, 100, 300, 750, 925, 1100, 150, 150, 120); properity = new Properity(240, deed, ColorSets.red); tile = new ProperityTile("Trafalgar Square", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); //TODO: change tile to utility tile = new SimpleTile("Fenchurch St. Station", this); base.GetTiles().Add(tile); deed = new ProperityDeed(22, 110, 330, 800, 975, 1150, 150, 150, 150); properity = new Properity(260, deed, ColorSets.yellow); tile = new ProperityTile("Leicester Square", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); deed = new ProperityDeed(22, 110, 330, 800, 975, 1150, 150, 150, 150); properity = new Properity(260, deed, ColorSets.yellow); tile = new ProperityTile("Coventry Street", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); //TODO: change tile to utility tile = new SimpleTile("Water Works", this); base.GetTiles().Add(tile); deed = new ProperityDeed(22, 120, 360, 850, 1025, 1200, 140, 140, 150); properity = new Properity(280, deed, ColorSets.yellow); tile = new ProperityTile("Piccadilly", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); //TODO: change tile to utility tile = new SimpleTile("Go to Jail", this); GetTiles().Add(tile); deed = new ProperityDeed(26, 130, 390, 900, 1100, 1275, 150, 150, 200); properity = new Properity(300, deed, ColorSets.green); tile = new ProperityTile("Regent Street", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); deed = new ProperityDeed(26, 130, 390, 900, 1100, 1275, 150, 150, 200); properity = new Properity(300, deed, ColorSets.green); tile = new ProperityTile("Oxford Street", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); tile = new SimpleTile("Community Chest", this); action = new CommunityChestPickCard("Pick Community Chest Card", GetGame()); tile.AddAction(action); base.GetTiles().Add(tile); deed = new ProperityDeed(28, 150, 450, 1000, 1200, 1400, 160, 160, 200); properity = new Properity(320, deed, ColorSets.green); tile = new ProperityTile("Bond Street", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); //TODO: change tile to utility tile = new SimpleTile("Liverpool Street Station", this); base.GetTiles().Add(tile); tile = new SimpleTile("Chance", this); action = new ChancePickACard("Pick Chance Card", GetGame()); tile.AddAction(action); base.GetTiles().Add(tile); deed = new ProperityDeed(35, 175, 500, 1100, 1300, 1500, 200, 200, 175); properity = new Properity(350, deed, ColorSets.blue); tile = new ProperityTile("Park Lane", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); tile = new ActionTile("Super Tax (Pay £100)", this); action = new ReceiveMoneyAction("Super Tax(Pay £100)", -100, GetGame()); tile.AddAction(action); base.GetTiles().Add(tile); deed = new ProperityDeed(50, 200, 600, 1400, 1700, 2000, 200, 200, 200); properity = new Properity(400, deed, ColorSets.blue); tile = new ProperityTile("Mayfair", this, properity); action = new PayRent("Pay Rent", tile, GetGame()); tile.AddAction(action); GetTiles().Add(tile); }
public void MonthlyPayment() { PayRent?.Invoke(this, new RentEventArgs(MonthlyRent)); Account -= MonthlyRent; }
internal void RaisePayRent(HouseField pStreetField) { PayRent?.Invoke(pStreetField, pStreetField.PayRent(this), pStreetField.Rent); }