public Lot Clone() { Wood wood = this.Wood; LotSize size = this.Size; int pieces = this.pieces; decimal price = this.Price; if (wood == Wood.Buk) { return(new BukLot(size, pieces, price)); } else if (wood == Wood.Dub) { return(new DubLot(size, pieces, price)); } else if (wood == Wood.Yavor) { return(new YavorLot(size, pieces, price)); } else if (wood == Wood.Yasen) { return(new YasenLot(size, pieces, price)); } else { throw new ArgumentException("Lot cloning error: Invalid wood type!"); } }
//constructor public Lot(Wood wood, LotSize size, int pieces, decimal price) { this.Id = IdGenerator.GetId(); this.Wood = wood; this.Size = size; this.Pieces = pieces; this.Price = price; }
//int newSizeW = 0; //int newSizeH = 0; //int newSizeL = 0; //int newPeaces = 0; //decimal newPrice = 0m; public Window1() { InitializeComponent(); // ================================= Fields ======= string[] materialType = { "Buk", "Dub", "Yavor", "Yasen" }; this.MaterialType.SelectedValue = materialType[0]; LotSize newSise = new LotSize(0,0,0); // ================================= this.NewID.Text = IdGenerator.GetId().ToString(); this.MaterialType.ItemsSource = materialType; }
private Lot LotParser() { Wood wood = (Wood)WoodComboBox.SelectedItem; int tempW = int.Parse(NewWidthTextBox.Text); int tempH = int.Parse(NewHeightTextBox.Text); int tempL = int.Parse(NewLengthTextBox.Text); int tempPieces = int.Parse(NewPiecesTextBox.Text); decimal tempPrice = decimal.Parse(NewPriceTextBox.Text); LotSize tempSize = new LotSize(tempW, tempH, tempL); switch (wood) { case Wood.Buk: return new BukLot(tempSize, tempPieces, tempPrice); case Wood.Dub: return new DubLot(tempSize, tempPieces, tempPrice); case Wood.Yavor: return new YavorLot(tempSize, tempPieces, tempPrice); case Wood.Yasen: return new YasenLot(tempSize, tempPieces, tempPrice); default: throw new ArgumentException("Invalid wood type"); } }
public DubLot(LotSize size, int Pieces, decimal price) : base(Wood.Dub, size, Pieces, price) { }
public YavorLot(LotSize size, int Pieces, decimal price) : base(Wood.Yavor, size, Pieces, price) { }
public BukLot(LotSize size, int Pieces, decimal price) : base(Wood.Buk, size, Pieces, price) { }