Exemplo n.º 1
0
        public PublishReportResponse DeleteReport(PublishReportRequest Request)
        {
            try
            {
                PublishReportResponse result = new PublishReportResponse();
                Epi.Web.Interfaces.DataInterfaces.IReportDao IReportDao = new EF.EntityReportDao();



                Epi.Web.BLL.Report Implementation = new Epi.Web.BLL.Report(IReportDao);

                ReportInfoBO ReportInfoBO = Mapper.ToReportInfoBO(Request.ReportInfo);

                Implementation.DeleteReport(ReportInfoBO);

                result.Message = "The report was successfully Deleted";
                return(result);
            }
            catch (Exception ex)
            {
                CustomFaultException customFaultException = new CustomFaultException();
                customFaultException.CustomMessage = ex.Message;
                customFaultException.Source        = ex.Source;
                customFaultException.StackTrace    = ex.StackTrace;
                customFaultException.HelpLink      = ex.HelpLink;
                throw new FaultException <CustomFaultException>(customFaultException);
            }
        }
Exemplo n.º 2
0
        internal static ReportInfoBO ToReportInfoBO(SurveyReportsInfo reportInfo)
        {
            ReportInfoBO ReportInfoBO = new ReportInfoBO();

            ReportInfoBO.CreatedDate = reportInfo.DateCreated;
            ReportInfoBO.EditedDate  = (DateTime)reportInfo.DateEdited;
            if (!string.IsNullOrEmpty(reportInfo.ReportId.ToString()))
            {
                ReportInfoBO.ReportId = reportInfo.ReportId.ToString();
            }
            if (!string.IsNullOrEmpty(reportInfo.SurveyId.ToString()))
            {
                ReportInfoBO.SurveyId = reportInfo.SurveyId.ToString();
            }
            ReportInfoBO.ReportVersion = reportInfo.ReportVersion;


            ReportInfoBO.DataSource = reportInfo.DataSource;
            ReportInfoBO.Gadgets    = new List <GadgetBO>();
            foreach (var item in reportInfo.SurveyReports.OrderBy(x => x.GadgetNumber))
            {
                ReportInfoBO.Gadgets.Add(ToGadgetBO(item));
            }

            ReportInfoBO.RecordCount = reportInfo.RecordCount;
            return(ReportInfoBO);
        }
Exemplo n.º 3
0
        public PublishReportResponse PublishReport(PublishReportRequest Request)
        {
            try
            {
                PublishReportResponse result = new PublishReportResponse();
                Epi.Web.Interfaces.DataInterfaces.IReportDao IReportDao = new EF.EntityReportDao();



                Epi.Web.BLL.Report Implementation = new Epi.Web.BLL.Report(IReportDao);

                ReportInfoBO ReportInfoBO = Mapper.ToReportInfoBO(Request.ReportInfo);

                Implementation.PublishReport(ReportInfoBO);

                result.Message = "The report was successfully published";
                var ReportInfo = new ReportInfoDTO();
                ReportInfo.ReportURL = ConfigurationManager.AppSettings["ReportURL"] + Request.ReportInfo.ReportId;
                result.Reports       = new List <ReportInfoDTO>();
                result.Reports.Add(ReportInfo);
                return(result);
            }
            catch (Exception ex)
            {
                CustomFaultException customFaultException = new CustomFaultException();
                customFaultException.CustomMessage = ex.Message;
                customFaultException.Source        = ex.Source;
                customFaultException.StackTrace    = ex.StackTrace;
                customFaultException.HelpLink      = ex.HelpLink;
                throw new FaultException <CustomFaultException>(customFaultException);
            }
        }
Exemplo n.º 4
0
        public List <ReportInfoBO> GetReport(string ReportID)
        {
            List <ReportInfoBO> ReportInfoBOList = new List <ReportInfoBO>();

            try
            {
                ReportInfoBO ReportInfoBO = new ReportInfoBO();

                var reportid = Guid.Parse(ReportID);

                using (var Context = DataObjectFactory.CreateContext())
                {
                    var Query = Context.SurveyReportsInfoes.Where(x => x.ReportId == reportid);//.OrderBy(x=>x.GadgetNumber);

                    foreach (var item in Query)
                    {
                        ReportInfoBO = Mapper.ToReportInfoBO(item);
                        ReportInfoBOList.Add(ReportInfoBO);
                    }
                }


                return(ReportInfoBOList);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 5
0
        internal static SurveyReportsInfo ToReportInfoEF(ReportInfoBO reportInfo)
        {
            SurveyReportsInfo SurveyReport = new SurveyReportsInfo();

            SurveyReport.DateCreated = reportInfo.CreatedDate;
            SurveyReport.DateEdited  = reportInfo.EditedDate;
            if (!string.IsNullOrEmpty(reportInfo.ReportId.ToString()))
            {
                SurveyReport.ReportId = Guid.Parse(reportInfo.ReportId);
            }
            if (!string.IsNullOrEmpty(reportInfo.SurveyId.ToString()))
            {
                SurveyReport.SurveyId = Guid.Parse(reportInfo.SurveyId);
            }
            SurveyReport.ReportVersion = reportInfo.ReportVersion;


            SurveyReport.DataSource  = reportInfo.DataSource;
            SurveyReport.RecordCount = reportInfo.RecordCount;

            SurveyReport.SurveyReports = ToGadgetsEF(reportInfo.Gadgets);


            return(SurveyReport);
        }
Exemplo n.º 6
0
        public static ReportInfoBO ToReportInfoBO(ReportInfoDTO reportInfo)
        {
            ReportInfoBO ReportInfoBO = new ReportInfoBO();

            ReportInfoBO.CreatedDate   = reportInfo.CreatedDate;
            ReportInfoBO.EditedDate    = reportInfo.EditedDate;
            ReportInfoBO.ReportId      = reportInfo.ReportId;
            ReportInfoBO.ReportVersion = reportInfo.ReportVersion;
            ReportInfoBO.SurveyId      = reportInfo.SurveyId;
            ReportInfoBO.ReportURL     = reportInfo.ReportURL;
            ReportInfoBO.Gadgets       = ToReportInfoBOList(reportInfo.Gadgets);
            ReportInfoBO.RecordCount   = reportInfo.RecordCount;
            ReportInfoBO.DataSource    = reportInfo.DataSource;
            return(ReportInfoBO);
        }
Exemplo n.º 7
0
        public List <ReportInfoBO> GetSurveyReports(string SurveyID, bool IncludHTML)
        {
            try
            {
                var surveyid             = Guid.Parse(SurveyID);
                List <ReportInfoBO> List = new List <ReportInfoBO>();
                using (var Context = DataObjectFactory.CreateContext())
                {
                    if (IncludHTML)
                    {
                        var Query = Context.SurveyReportsInfoes.Where(x => x.SurveyId == surveyid);

                        foreach (var item in Query)
                        {
                            List.Add(Mapper.ToReportInfoBO(item));
                        }
                    }
                    else
                    {
                        var NoHtmlQuery = (from response in Context.SurveyReportsInfoes
                                           where response.SurveyId == surveyid
                                           select new { response.ReportId, response.ReportVersion, response.DateCreated, response.DateEdited, response.DataSource, response.RecordCount });
                        foreach (var reportInfo in NoHtmlQuery)
                        {
                            ReportInfoBO ReportInfoBO = new ReportInfoBO();
                            ReportInfoBO.CreatedDate = reportInfo.DateCreated;
                            ReportInfoBO.EditedDate  = (DateTime)reportInfo.DateEdited;
                            if (!string.IsNullOrEmpty(reportInfo.ReportId.ToString()))
                            {
                                ReportInfoBO.ReportId = reportInfo.ReportId.ToString();
                            }
                            ReportInfoBO.DataSource    = reportInfo.DataSource;
                            ReportInfoBO.RecordCount   = reportInfo.RecordCount;
                            ReportInfoBO.ReportVersion = reportInfo.ReportVersion;

                            List.Add(ReportInfoBO);
                        }
                    }
                }
                return(List);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemplo n.º 8
0
        public static ReportInfoDTO ToReportInfoDTO(ReportInfoBO reportInfo)
        {
            ReportInfoDTO ReportDTO = new ReportInfoDTO();

            ReportDTO.CreatedDate   = reportInfo.CreatedDate;
            ReportDTO.EditedDate    = reportInfo.EditedDate;
            ReportDTO.ReportId      = reportInfo.ReportId;
            ReportDTO.ReportVersion = reportInfo.ReportVersion;
            ReportDTO.SurveyId      = reportInfo.SurveyId;
            ReportDTO.DataSource    = reportInfo.DataSource;
            ReportDTO.RecordCount   = reportInfo.RecordCount;
            if (reportInfo.Gadgets != null)
            {
                ReportDTO.Gadgets = ToGadgetsListDTO(reportInfo.Gadgets);
            }
            return(ReportDTO);
        }
Exemplo n.º 9
0
 public void DeleteReport(ReportInfoBO Report)
 {
     if (ReportExist2(Guid.Parse(Report.ReportId)))
     {
         Guid ReportId = Guid.Parse(Report.ReportId);
         using (var Context = DataObjectFactory.CreateContext())
         {
             var Query = from SurveyReport in Context.SurveyReports
                         where SurveyReport.ReportId == ReportId && SurveyReport.GadgetVersion == Report.ReportVersion
                         select SurveyReport;
             foreach (var item in Query)
             {
                 Context.SurveyReports.Remove(item);
             }
             Context.SaveChanges();
         }
     }
 }
Exemplo n.º 10
0
 public void PublishReport(ReportInfoBO reportBO)
 {
     this.ReportDao.PublishReport(reportBO);
 }
Exemplo n.º 11
0
 public void DeleteReport(ReportInfoBO reportBO)
 {
     this.ReportDao.DeleteReport(reportBO);
 }
Exemplo n.º 12
0
        public void PublishReport(ReportInfoBO ReportInfo)
        {
            try
            {
                var SurveyId = Guid.Parse(ReportInfo.SurveyId);
                //var GadgetId = Guid.Parse(ReportInfo.GadgetId);
                var ReportId = Guid.Parse(ReportInfo.ReportId);
                using (var Context = DataObjectFactory.CreateContext())
                {
                    if (!ReportExist(SurveyId, ReportId))
                    {
                        SurveyReportsInfo ReportEntity = Mapper.ToReportInfoEF(ReportInfo);

                        Context.SurveyReportsInfoes.Add(ReportEntity);

                        Context.SaveChanges();
                    }
                    else
                    {
                        var Query = from SurveyReportInfo in Context.SurveyReportsInfoes
                                    where SurveyReportInfo.ReportId == ReportId
                                    select SurveyReportInfo;

                        var DataRow = Query.Single();
                        DataRow.DateEdited    = DateTime.Now;
                        DataRow.RecordCount   = ReportInfo.RecordCount;
                        DataRow.ReportVersion = ReportInfo.ReportVersion + 1;
                        DataRow.DataSource    = ReportInfo.DataSource;
                        Context.SaveChanges();

                        // update Gadget
                        foreach (var gadget in ReportInfo.Gadgets)
                        {
                            var GadgetId    = Guid.Parse(gadget.GadgetId);
                            var GadgetQuery = from SurveyReport in Context.SurveyReports
                                              where SurveyReport.ReportId == ReportId && SurveyReport.GadgetId == GadgetId
                                              select SurveyReport;
                            if (GadgetQuery != null && GadgetQuery.Count() > 0)
                            {
                                var GadgetDataRow = GadgetQuery.Single();
                                GadgetDataRow.DateEdited = DateTime.Now;

                                GadgetDataRow.GadgetVersion = gadget.GadgetVersion + 1;
                                GadgetDataRow.ReportHtml    = gadget.ReportHtml;
                                Context.SaveChanges();
                            }
                            else
                            {
                                List <SurveyReport> ReportEntity = Mapper.ToGadgetsEF(ReportInfo.Gadgets);
                                foreach (var item in ReportEntity)
                                {
                                    Context.SurveyReports.Add(item);
                                }
                                Context.SaveChanges();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }