Beispiel #1
0
        public void OrderVaraFromStorage(int ID, int ArticlesOrderedTotal)
        {
            LagerServiceDatabaseEntityDataModel db = new LagerServiceDatabaseEntityDataModel();
            int articleAmount; // Variable used for LagerAntal

            Vara VaraData = db.Vara.Find(ID);

            try
            {
                articleAmount = Convert.ToInt32(VaraData.LagerAntal);
            }
            catch
            {
                articleAmount = 0;
            }

            // If storage lacks the required items
            if (ArticlesOrderedTotal > articleAmount)
            {
                GrossistServiceReference.Service1Client grossistConnection = new GrossistServiceReference.Service1Client();
                VaraData.LagerAntal += grossistConnection.AddArticle();
                VaraData.LagerAntal -= ArticlesOrderedTotal;
                VaraData.ButikAntal += ArticlesOrderedTotal;
            }
            else
            {
                VaraData.LagerAntal -= ArticlesOrderedTotal;
                VaraData.ButikAntal += ArticlesOrderedTotal;
            }

            db.SaveChanges();
        }
Beispiel #2
0
        public List <Vara> GetListVara()
        {
            // Creates a list of table "Vara" and returns it as ToList()
            List <Vara> VaraList = new List <Vara>();
            LagerServiceDatabaseEntityDataModel db = new LagerServiceDatabaseEntityDataModel();

            VaraList = db.Vara.ToList();
            return(VaraList);
        }