Esempio n. 1
0
        private void deleteTransientUserReport(UserReport userReport, ReportProjectDBEntities entities)
        {
            // delete the summarize fields
            var sumFields = (from ursf in entities.UserReportSummarizeField
                             where ursf.UserReportID == userReport.UserReportID
                             select ursf).ToList();

            foreach (UserReportSummarizeField sumField in sumFields)
            {
                entities.DeleteObject(sumField);
            }

            // delete the fields
            //TODO: NOt necessary, must be a cascade delete in the database

            // delete the parameters
            var userReportParms = (from urp in entities.UserReportParameter
                                   where urp.UserReportID == userReport.UserReportID
                                   select urp).ToList();

            foreach (UserReportParameter userReportParameter in userReportParms)
            {
                entities.DeleteObject(userReportParameter);
            }

            // delete the user report
            entities.DeleteObject(userReport);

            entities.SaveChanges();
        }
Esempio n. 2
0
        public void SetReportTypeCheckpoints(List <Rpt> reportTypes, string checkpointID)
        {
            ReportProjectDBEntities entities       = new ReportProjectDBEntities();
            var removeReport_ICESecurityCheckpoint = from rptj in entities.Report_ICESecurityCheckpoint
                                                     where rptj.CheckpointID.Trim() == checkpointID.Trim()
                                                     select rptj;

            foreach (Report_ICESecurityCheckpoint Report_ICESecurityCheckpoint in removeReport_ICESecurityCheckpoint)
            {
                entities.DeleteObject(Report_ICESecurityCheckpoint);
            }

            entities.SaveChanges();

            foreach (Rpt rpt in reportTypes)
            {
                entities.AddToReport_ICESecurityCheckpoint(new Report_ICESecurityCheckpoint {
                    CheckpointID = checkpointID, ReportID = rpt.ID
                });
            }

            entities.SaveChanges();
        }