Exemple #1
0
        public SharedReportResponse AddSharedReport(SharedReportDto sharedReportDto)
        {
            var response = new SharedReportResponse();

            try
            {
                var sharedReportRepository = new SharedReportRepository();
                var sharedReport           = new SharedReport()
                {
                    CreatedBy     = sharedReportDto.CreatedBy,
                    Comments      = sharedReportDto.Comments,
                    CreatedDate   = sharedReportDto.CreatedDate,
                    ExpiredDate   = sharedReportDto.ExpiredDate,
                    SharedWith    = sharedReportDto.SharedWith,
                    Token         = sharedReportDto.Token,
                    URL           = sharedReportDto.URL,
                    TinyUrl       = sharedReportDto.TinyUrl,
                    SmartReportId = sharedReportDto.SmartReportId,
                    IsActive      = true
                };
                sharedReportRepository.Add(sharedReport);
                sharedReportRepository.SaveChanges();
                sharedReportDto.IdSharedReports = sharedReport.IdSharedReports;
                response.SharedResponse         = sharedReportDto;
                response.Acknowledgment         = true;
                response.Message = "Success";
                sharedReportRepository.Dispose();
            }
            catch (Exception ex)
            {
                response.Acknowledgment = false;
                response.Message        = "Error creating the shared Report: " + ex.Message;
            }
            return(response);
        }
Exemple #2
0
        public JsonResult GetSharedreport(string comments, int smartReportid, string url)
        {
            var currentUrl      = Request.RawUrl;
            var token           = Guid.NewGuid().ToString();
            var sharedReportDto = new SharedReportDto()
            {
                Comments      = comments,
                CreatedBy     = WebSecurity.CurrentUserId,
                CreatedDate   = DateTime.Now,
                ExpiredDate   = DateTime.Now.AddDays(365.0),
                IsActive      = true,
                Token         = token,
                SmartReportId = smartReportid,
                URL           = url,
                TinyUrl       = TinyURL.GetTinyUrl(Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~") + "Share/Redirect?token=" + token)
            };

            return(Json(_sharedReportService.AddSharedReport(sharedReportDto), JsonRequestBehavior.AllowGet));
        }