Example #1
0
        // Database methods
        // Get all Collective agreements from database
        private List <CollectiveAgreement> GetCollectiveAgreementsAsync()
        {
            using (var ctx = new SW3Projekt.DatabaseDir.Database())
            {
                List <CollectiveAgreement> colAgreeList = new List <CollectiveAgreement>();

                colAgreeList = ctx.CollectiveAgreements.Include(x => x.Rates).ToList();
                colAgreeList = SortAgreements(colAgreeList);
                return(colAgreeList);
            }
        }
Example #2
0
        public void SetCollectiveAgreementArchived(CollectiveAgreement colAgr)
        {
            using (var ctx = new SW3Projekt.DatabaseDir.Database())
            {
                CollectiveAgreement col = ctx.CollectiveAgreements.FirstOrDefault(x => x.Id == colAgr.Id);
                col.IsArchived = true;

                ctx.CollectiveAgreements.Attach(col);
                ctx.Entry(col).State = EntityState.Modified;
                ctx.SaveChanges();
            }
        }
Example #3
0
        public void SetCollectiveAgreementActive(CollectiveAgreement colAgr)
        {
            using (var ctx = new SW3Projekt.DatabaseDir.Database())
            {
                foreach (CollectiveAgreement item in ctx.CollectiveAgreements.ToList())
                {
                    item.IsActive = false;
                }

                CollectiveAgreement col = ctx.CollectiveAgreements.FirstOrDefault(x => x.Id == colAgr.Id);
                col.IsActive = true;

                ctx.CollectiveAgreements.Attach(col);
                ctx.Entry(col).State = EntityState.Modified;
                ctx.SaveChanges();
            }
        }