public int SaveChanges()
        {
            //call our code here
            var hist = new History();
            ChangeTracker.DetectChanges();
            var holder = ChangeTracker.Entries<Hours>();
            foreach (System.Data.Entity.Infrastructure.DbEntityEntry<Hours> entry in holder)
            {
                switch (entry.State)
                {
                    case System.Data.EntityState.Added:
                        hist.type = "added";
                        break;
                    case System.Data.EntityState.Deleted:
                        hist.type = "deleted";
                        break;
                    case System.Data.EntityState.Modified:
                        hist.type = "modified";
                        break;
                }
                hist.dbtable = "Hours";
                hist.change = "workEffortID: " + entry.Property(u => u.workEffortID).CurrentValue +
                              "; timeCode: " + entry.Property(u => u.description).CurrentValue +
                              "; hours: " + entry.Property(u => u.hours).CurrentValue +
                              "; date: " + entry.Property(u => u.timestamp).CurrentValue.ToShortDateString() +
                              "; creator: " + entry.Property(u => u.creator).CurrentValue;
            }

            hist.username = System.Web.HttpContext.Current.User.Identity.Name;
            hist.timestamp = System.DateTime.Now;
            HistDB.HistoryList.Add(hist);
            HistDB.SaveChanges();

            return base.SaveChanges();
        }
Beispiel #2
0
        public int SaveChanges()
        {
            //call our code here
            var hist = new History();
            ChangeTracker.DetectChanges();
            var holder = ChangeTracker.Entries<Divisions>();
            foreach (System.Data.Entity.Infrastructure.DbEntityEntry<Divisions> entry in holder)
            {
                switch (entry.State)
                {
                    case System.Data.EntityState.Added:
                        hist.type = "added";
                        break;
                    case System.Data.EntityState.Deleted:
                        hist.type = "deleted";
                        break;
                    case System.Data.EntityState.Modified:
                        hist.type = "modified";
                        break;
                }
                hist.dbtable = "Divisions";
                hist.change = "Division: " + entry.Property(u => u.divName).CurrentValue;
            }

            hist.username = System.Web.HttpContext.Current.User.Identity.Name;
            hist.timestamp = System.DateTime.Now;
            HistDB.HistoryList.Add(hist);
            HistDB.SaveChanges();

            return base.SaveChanges();
        }
        public int SaveChanges()
        {
            //call our code here
            var hist = new History();
            ChangeTracker.DetectChanges();
            var holder = ChangeTracker.Entries<PCA_WE>();
            foreach (System.Data.Entity.Infrastructure.DbEntityEntry<PCA_WE> entry in holder)
            {
                switch (entry.State)
                {
                    case System.Data.EntityState.Added:
                        hist.type = "added";
                        break;
                    case System.Data.EntityState.Deleted:
                        hist.type = "deleted";
                        break;
                    case System.Data.EntityState.Modified:
                        hist.type = "modified";
                        break;
                }
                hist.dbtable = "PCA_WE";
                hist.change = "pcaID: " + entry.Property(u => u.PCA).CurrentValue +
                              "; workEffortID: " + entry.Property(u => u.WE).CurrentValue +
                              "; associationStart: " + entry.Property(u => u.associationStartDate).CurrentValue +
                              "; associationEnd: " + entry.Property(u => u.associationEndDate).CurrentValue +
                              "; active: " + entry.Property(u => u.active).CurrentValue;
            }

            hist.username = System.Web.HttpContext.Current.User.Identity.Name;
            hist.timestamp = System.DateTime.Now;
            HistDB.HistoryList.Add(hist);
            HistDB.SaveChanges();

            return base.SaveChanges();
        }
        public int SaveChanges()
        {
            //call our code here
            var hist = new History();
            ChangeTracker.DetectChanges();
            var holder = ChangeTracker.Entries<TARSUser>();
            foreach (System.Data.Entity.Infrastructure.DbEntityEntry<TARSUser> entry in holder)
            {
                switch (entry.State)
                {
                    case System.Data.EntityState.Added:
                        hist.type = "added";
                        break;
                    case System.Data.EntityState.Deleted:
                        hist.type = "deleted";
                        break;
                    case System.Data.EntityState.Modified:
                        hist.type = "modified";
                        break;
                }

                if (entry.Property(u => u.startDate).CurrentValue == null)
                {
                    entry.Property(u => u.startDate).CurrentValue = DateTime.MinValue;
                }
                if (entry.Property(u => u.endDate).CurrentValue == null)
                {
                    entry.Property(u => u.endDate).CurrentValue = DateTime.MaxValue;
                }

                hist.dbtable = "TARSUsers";
                hist.change = "userName: "******"; startDate: " + entry.Property(u => u.startDate).CurrentValue.ToShortDateString() +
                                "; endDate: " + entry.Property(u => u.endDate).CurrentValue.ToShortDateString() +
                                "; permission: " + entry.Property(u => u.permission).CurrentValue +
                                "; company: " + entry.Property(u => u.company).CurrentValue +
                                "; department: " + entry.Property(u => u.department).CurrentValue +
                                "; employeeOrContractor: " + entry.Property(u => u.employeeOrContractor).CurrentValue +
                                "; costAllocatedOrNot: " + entry.Property(u => u.costAllocatedOrNot).CurrentValue;
            }

            hist.username = System.Web.HttpContext.Current.User.Identity.Name;
            hist.timestamp = System.DateTime.Now;
            HistDB.HistoryList.Add(hist);
            HistDB.SaveChanges();

            return base.SaveChanges();
        }
Beispiel #5
0
        public int SaveChanges()
        {
            //call our code here
            var hist = new History();
            ChangeTracker.DetectChanges();
            var holder = ChangeTracker.Entries<Timesheet>();
            foreach (System.Data.Entity.Infrastructure.DbEntityEntry<Timesheet> entry in holder)
            {
                switch (entry.State)
                {
                    case System.Data.EntityState.Added:
                        hist.type = "added";
                        break;
                    case System.Data.EntityState.Deleted:
                        hist.type = "deleted";
                        break;
                    case System.Data.EntityState.Modified:
                        hist.type = "modified";
                        break;
                }
                hist.dbtable = "Timesheets";
                hist.change = "worker: " + entry.Property(u => u.worker).CurrentValue +
                              "; periodStart: " + entry.Property(u => u.periodStart).CurrentValue.ToShortDateString() +
                              "; periodEnd: " + entry.Property(u => u.periodEnd).CurrentValue.ToShortDateString() +
                              "; submitted: " + entry.Property(u => u.submitted).CurrentValue +
                              "; approved: " + entry.Property(u => u.approved).CurrentValue +
                              "; locked: " + entry.Property(u => u.locked).CurrentValue;
            }

            if (System.Web.HttpContext.Current != null)
            {
                hist.username = System.Web.HttpContext.Current.User.Identity.Name;
            }
            else
            {
                hist.username = "******";
            }
            hist.timestamp = System.DateTime.Now;
            HistDB.HistoryList.Add(hist);
            HistDB.SaveChanges();

            return base.SaveChanges();
        }
        public int SaveChanges()
        {
            //call our code here
            var hist = new History();
            ChangeTracker.DetectChanges();
            var holder = ChangeTracker.Entries<PcaCode>();
            foreach (System.Data.Entity.Infrastructure.DbEntityEntry<PcaCode> entry in holder)
            {
                switch (entry.State)
                {
                    case System.Data.EntityState.Added:
                        hist.type = "added";
                        break;
                    case System.Data.EntityState.Deleted:
                        hist.type = "deleted";
                        break;
                    case System.Data.EntityState.Modified:
                        hist.type = "modified";
                        break;
                }

                //If user didn't enter anything for the endDate
                if (entry.Property(u => u.endDate).CurrentValue == null)
                {
                    entry.Property(u => u.endDate).CurrentValue = DateTime.MaxValue.Date;
                }

                hist.dbtable = "PcaCodes";
                hist.change = "pcaCode: " + entry.Property(u => u.code).CurrentValue +
                              "; description: " + entry.Property(u => u.description).CurrentValue +
                              "; division: " + entry.Property(u => u.division).CurrentValue +
                              "; startDate: " + entry.Property(u => u.startDate).CurrentValue +
                              "; endDate: " + entry.Property(u => u.endDate).CurrentValue;
            }

            hist.username = System.Web.HttpContext.Current.User.Identity.Name;
            hist.timestamp = System.DateTime.Now;
            HistDB.HistoryList.Add(hist);
            HistDB.SaveChanges();

            return base.SaveChanges();
        }
        public int SaveChanges()
        {
            //call our code here
            var hist = new History();
            ChangeTracker.DetectChanges();
            var holder = ChangeTracker.Entries<WorkEffort>();
            foreach (System.Data.Entity.Infrastructure.DbEntityEntry<WorkEffort> entry in holder)
            {
                switch (entry.State)
                {
                    case System.Data.EntityState.Added:
                        hist.type = "added";
                        break;
                    case System.Data.EntityState.Deleted:
                        hist.type = "deleted";
                        break;
                    case System.Data.EntityState.Modified:
                        hist.type = "modified";
                        break;
                }

                hist.dbtable = "WorkEfforts";
                hist.change = "description: " + entry.Property(u => u.description).CurrentValue +
                              "; comments: " + entry.Property(u => u.comments).CurrentValue +
                              "; pcaCode: " + entry.Property(u => u.pcaCode).CurrentValue +
                              "; startDate: " + entry.Property(u => u.startDate).CurrentValue +
                              "; endDate: " + entry.Property(u => u.endDate).CurrentValue +
                              "; hidden: " + entry.Property(u => u.hidden).CurrentValue;
            }

            hist.username = System.Web.HttpContext.Current.User.Identity.Name;
            hist.timestamp = System.DateTime.Now;
            HistDB.HistoryList.Add(hist);
            HistDB.SaveChanges();

            return base.SaveChanges();
        }