예제 #1
0
        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!");
            }
        }
예제 #2
0
 //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;
 }
예제 #3
0
 //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;
 }
예제 #4
0
 //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;
     
 }
예제 #5
0
        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");
            }
        }
예제 #6
0
 public DubLot(LotSize size, int Pieces, decimal price)
     : base(Wood.Dub, size, Pieces, price)
 {
 }
예제 #7
0
 public YavorLot(LotSize size, int Pieces, decimal price)
     : base(Wood.Yavor, size, Pieces, price)
 {
 }
예제 #8
0
 public BukLot(LotSize size, int Pieces, decimal price)
     : base(Wood.Buk, size, Pieces, price)
 {
 }
예제 #9
0
 public DubLot(LotSize size, int Pieces, decimal price)
     : base(Wood.Dub, size, Pieces, price)
 {
 }
예제 #10
0
 public BukLot(LotSize size, int Pieces, decimal price)
     : base(Wood.Buk, size, Pieces, price)
 {
 }