Exemple #1
0
        public TS_03SetUpBrigades[] GetTSSetUpBrigades(string turnId)
        {
            using (var dataContext = new AusterlitzDbContext())
            {
                var listRepository = new GenericRepository <TS_03SetUpBrigades>(dataContext);
                var tsItems        = listRepository.GetItems(x => x.TurnId == turnId).OrderBy(y => y.OrderNo);

                if (tsItems.Count() == 0)
                {
                    var newItems = new TS_03SetUpBrigades[8];

                    for (var itemCount = 1; itemCount <= newItems.Count(); itemCount++)
                    {
                        TS_03SetUpBrigades item = new TS_03SetUpBrigades()
                        {
                            TurnId = turnId, OrderNo = itemCount
                        };
                        newItems[itemCount - 1] = item;
                    }

                    listRepository.InsertRange(newItems);
                    dataContext.SaveChanges();
                    tsItems = listRepository.GetItems(x => x.TurnId == turnId).OrderBy(y => y.OrderNo);
                }
                return(tsItems.ToArray());
            }
        }
Exemple #2
0
        public TS_03SetUpBrigades[] GetBlankTurnSheetSetUpBrigades(string turnId)
        {
            var TSItems = new TS_03SetUpBrigades[8];

            for (var itemCount = 1; itemCount <= TSItems.Count(); itemCount++)
            {
                TS_03SetUpBrigades item = new TS_03SetUpBrigades()
                {
                    TurnId = turnId, OrderNo = itemCount
                };
            }
            return(TSItems);
        }