Beispiel #1
0
        public void DeleteArticle(RequestItem obj)
        {
            int pos = 0;

            for (int i = 0; i < _requestItems.Length; i++)
            {
                if (_requestItems[i].Article.Name == obj.Article.Name)
                {
                    pos = i;
                }
            }
            Array.Clear(_requestItems, pos, 1);
        }
Beispiel #2
0
        public void AddArticle(RequestItem obj)
        {
            if (_requestItems == null)
            {
                _requestItems = new RequestItem[1];
            }
            else
            {
                Array.Resize(ref _requestItems, _requestItems.Length + 1);
            }

            _requestItems[_requestItems.Length - 1] = obj;
        }
        public static void Main(string[] args)
        {
            /*Article article = new Article() {Name = "Article", Code = "1234", Price = 25};
             * Client client = new Client() {Name = "Alex", Surname = "Tkachenko", Address = "Address", Number = "Number"};
             * RequestItem requestItem = new RequestItem() {Article = article, Quantity = 4};
             * Request request = new Request() {Client = client, Date = "12 November", OrderCode = "1234"};
             * request.AddArticle(requestItem);
             * Console.WriteLine(request.Sum);
             * Article article1 = new Article() {Name = "Coca-Cola", Code = "1234", Price = 30};
             * request.AddArticle(new RequestItem(article1, 12));
             * request.DeleteArticle(requestItem);
             * Console.WriteLine(request.Sum);*/

            Shop    shop    = new Shop();
            Article article = new Article()
            {
                Name = "Coca-Cola", Code = "1234", Price = 30, ArticleType = (ArticleType)0
            };
            RequestItem requestItem = new RequestItem()
            {
                Article = article, Quantity = 4
            };
            Client client = new Client()
            {
                Name = "Alex", Surname = "Tkachenko", Address = "Address", Number = "Number"
            };
            Request request = new Request()
            {
                Client = client, Date = "12 November", OrderCode = "1234"
            };

            client.AddArticle(request);
            request.AddArticle(requestItem);
            shop.AddArticle(article);
            shop.AddClient(client);
            Console.WriteLine(request.Sum);
        }