コード例 #1
0
        public DataSourceResult TracerDashboardHeatMap([DataSourceRequest] DataSourceRequest request, SearchER search)
        {
            List <CompliaceByTracerHeatMap> tracerComplianceHeatMap = new List <CompliaceByTracerHeatMap>();
            DataTable dt = new DataTable();

            DataSourceResult result = new DataSourceResult();

            try
            {
                dt = this.GetComplianceTracerData(search, "heatmap").Tables[0];

                var tracerTransform = dt.ToList <ComplianceByTracerTransform>();
                //convert datatable to list
                tracerComplianceHeatMap = TransformDashboardTracer(tracerTransform, search);
                result = tracerComplianceHeatMap.ToDataSourceResult(request, tc => new CompliaceByTracerHeatMap
                {
                    // TO DO Get Excel View DataSet
                    SiteName = tc.SiteName,
                    HCOID    = tc.HCOID.ToString() == "0" ? "" : tc.HCOID.ToString(),
                    OverallTotalCompletedObservation = tc.OverallTotalCompletedObservation,
                    OverallTracerCompliance          = tc.OverallTracerCompliance,
                    SitewiseTracer = tc.SitewiseTracer
                });
            }
            catch (Exception ex)
            {
                if (ex.Message.ToString() == "No Data")
                {
                    result.Errors = WebConstants.NO_DATA_FOUND_EXCEL_VIEW;
                }
                else if (ex.Message.ToString() == "Limit")
                {
                    result.Errors = "Maximum limit of " + ConfigurationManager.AppSettings["ReportOutputLimit"].ToString() + " records reached. Refine your criteria to narrow the result.";
                }
                if (ex.Message.ToString() != "No Data" && ex.Message.ToString() != "Limit")
                {
                    ExceptionLog exceptionLog = new ExceptionLog
                    {
                        ExceptionText = "Reports: " + ex.Message,
                        PageName      = "ERTracerDashboard",
                        MethodName    = "TracerDashboardHeatMap",
                        UserID        = Convert.ToInt32(AppSession.UserID),
                        SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                        TransSQL      = "",
                        HttpReferrer  = null
                    };
                    _exceptionService.LogException(exceptionLog);
                }
            }
            return(result);
        }
コード例 #2
0
        // GET: Corporate/EPScoringReportFinalMockSurvey
        public ActionResult Index(int id, int?actionType)
        {
            try
            {
                HelperClasses.SetReportOrScheduleID(id, (int)ReportsListEnum.EPScoringReportFinalMockSurvey);
                string reportTitle = WebConstants.AMP_EP_SCORING_REPORT_FINAL;

                if (AppSession.IsCorporateSite == true)
                {
                    reportTitle = WebConstants.AMP_EP_SCORING_REPORT_FINAL_AND_MOCK_SURVEY;
                }

                SearchInputService reportservice = new SearchInputService();
                if (AppSession.ReportScheduleID > 0)
                {
                    //Load the saved parameters
                    var oSaveAndScheduleService = new SaveAndScheduleService();
                    var savedParameters         = oSaveAndScheduleService.LoadUserSchedule(AppSession.ReportScheduleID);
                    TempData["SavedParameters"] = savedParameters; //This tempdata will be used by the Ajax call to avoid loading the saved parameters again from DB
                    TempData["ActionType"]      = actionType;

                    //Show/Hide Save to my reports button
                    ViewBag.HideSaveReport = HelperClasses.HideSaveToMyReports(AppSession.RoleID, savedParameters.UserID, AppSession.UserID, actionType);

                    return(View(reportservice.GetCorpSearchListsForSavedParameters(AppSession.ReportScheduleID, savedParameters, reportTitle)));
                }
                else
                {
                    return(View(reportservice.GetCorpSearchLists(reportTitle)));
                }
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "EPScoringReportFinalMockSurvey",
                    MethodName    = "Index",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #3
0
        private static bool UpdateAppStyle(AppTheme selectedTheme)
        {
            if (selectedTheme == AppTheme.FollowSystem)
            {
                selectedTheme = (AppTheme)App.Current.RequestedTheme;
            }

            ResourceDictionary theme = selectedTheme switch
            {
                AppTheme.Dark => new DarkTheme(),
                AppTheme.Light => new LightTheme(),
                _ => throw new InvalidOperationException("Unsupported theme"),
            };

            ICollection <ResourceDictionary> resources = Application.Current.Resources.MergedDictionaries;

            if (resources.FirstOrDefault()?.GetType() == theme.GetType())
            {
                return(false);
            }

            try
            {
                resources.Clear();
                resources.Add(theme);
            }
            catch (Exception ex)
            {
                ExceptionService.LogException(ex);
            }

            return(true);
        }
コード例 #4
0
        public async static Task <List <Program> > SelectTracerProgramsBySiteAndUser(int userID, int siteID, int cycleID)
        {
            try
            {
                List <Program> rtn = await EprodWebApi.SelectTracerProgramsBySiteAndUser(userID, siteID, cycleID);


                Program = rtn;

                return(rtn);
            }
            catch (Exception ex)
            {
                if (ex.Message.ToString() != "No Data" && ex.Message.ToString() != "Limit")
                {
                    ExceptionLog exceptionLog = new ExceptionLog
                    {
                        ExceptionText = "Reports: " + ex.Message,
                        PageName      = "WebApiMethods.cs",
                        MethodName    = "GetTracersCategories",
                        UserID        = Convert.ToInt32(AppSession.UserID),
                        SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                        TransSQL      = "",
                        HttpReferrer  = null
                    };
                    ExceptionService _exceptionService = new ExceptionService();
                    _exceptionService.LogException(exceptionLog);
                }
            }
            return(null);
        }
コード例 #5
0
        private static List <FullCourse> Find(this IEnumerable <FullCourse> courses, Lesson lesson)
        {
            string            simplifiedFullName = lesson.FullName.Simplify();
            List <FullCourse> matchedCourses     = courses
                                                   .Where(c => c.ShortName.Contains($":{lesson.ShortName}:") || simplifiedFullName.StartsWith(c.FullName.Simplify()))
                                                   .ToList();

            if (matchedCourses.Count > 1)
            {
                List <FullCourse> ongoingCourses = matchedCourses.Where(c => c.StartDateUtc <= DateTime.UtcNow && c.EndDateUtc > DateTime.UtcNow).ToList();
                if (ongoingCourses.Any())
                {
                    matchedCourses = ongoingCourses;

                    if (matchedCourses.Count > 1)
                    {
                        InvalidOperationException ex = new("Found multiple moodle courses")
                        {
                            Data = { { "Lesson", $"{lesson.FullName} ({lesson.ShortName})" } }
                        };
                        for (int i = 0; i < matchedCourses.Count; i++)
                        {
                            ex.Data.Add($"Course {i}", $"{matchedCourses[i].FullName} ({matchedCourses[i].ShortName})");
                        }
                        ExceptionService.LogException(ex);
                    }
                }
            }

            return(matchedCourses);
        }
コード例 #6
0
        // GET: TracerER/ERTracerDashboard
        public ActionResult Index(int id, int?actionType)
        {
            try
            {
                if (!AppSession.HasValidSession)
                {
                    return(RedirectToAction("IndexER", "Transfer", new { area = "" }));
                }

                HelperClasses.SetReportOrScheduleID(id, (int)ReportsListEnum.ERTracerDashboard);

                SearchInputService reportservice = new SearchInputService();
                if (AppSession.ReportScheduleID > 0)
                {
                    //Load the saved parameters
                    var oSaveAndScheduleService = new SaveAndScheduleService();
                    var savedParameters         = oSaveAndScheduleService.LoadUserSchedule(AppSession.ReportScheduleID);
                    TempData["SavedParameters"] = savedParameters; //This tempdata will be used by the Ajax call to avoid loading the saved parameters again from DB
                    TempData["ActionType"]      = actionType;

                    //Show/Hide Save to my reports button
                    ViewBag.HideSaveReport = HelperClasses.HideSaveToMyReports(AppSession.RoleID, savedParameters.UserID, AppSession.UserID, actionType);
                }

                ERSearchList list = new ERSearchList();
                list = reportservice.GetERComplianceByTracer(WebConstants.ERTRACER_REPORT_TITLE_Tracer_Dashboard_Report);

                return(View(list));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "ER Reports: " + ex.Message,
                    PageName      = "ERTracerDashboard",
                    MethodName    = "Index",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #7
0
        public ActionResult Index(int id, int?actionType)
        {
            try
            {
                if (!AppSession.HasValidSession)
                {
                    SessionExpired();
                }

                HelperClasses.SetReportOrScheduleID(id, (int)ReportsListEnum.TracerByCMS);

                SearchInputService reportservice = new SearchInputService();
                var list = reportservice.GetSearchLists(WebConstants.TRACER_REPORT_TITLE_TRACE_BY_CMS_REPORT);
                list.TracersChapters = reportservice.GetTracersChapters().TracersChapters;
                ViewBag.allSites     = false;
                if (AppSession.ReportScheduleID > 0)
                {
                    //Load the saved parameters
                    var oSaveAndScheduleService = new SaveAndScheduleService();
                    var savedParameters         = oSaveAndScheduleService.LoadUserSchedule(AppSession.ReportScheduleID);
                    TempData["SavedParameters"] = savedParameters; //This tempdata will be used by the Ajax call to avoid loading the saved parameters again from DB
                    TempData["ActionType"]      = actionType;

                    //Show/Hide Save to my reports button
                    ViewBag.HideSaveReport = HelperClasses.HideSaveToMyReports(AppSession.RoleID, savedParameters.UserID, AppSession.UserID, actionType);

                    int?chapterID = null;
                    if (savedParameters.ReportParameters.Find(param => param.ReportParameterName == WebConstants.TRACERS_CHAPTER) != null)
                    {
                        chapterID = Convert.ToInt32(savedParameters.ReportParameters.Find(param => param.ReportParameterName == WebConstants.TRACERS_CHAPTER).ParameterValue);
                    }

                    list.CMSTags = reportservice.GetTracersCMS(chapterID == -1 ? null : chapterID).CMSTags;
                }
                else
                {
                    list.CMSTags = reportservice.GetTracersCMS(null).CMSTags;
                }

                return(View(list));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "TracerByCMS",
                    MethodName    = "Index",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #8
0
        public ActionResult GetScoredByForEPs(int?siteID, int?selectedProgramID, string selectedChapterIDs, string selectedStandardIDs, string selectedScoreType)
        {
            try
            {
                CorporateSearchInputService reportservice = new CorporateSearchInputService();
                var epsScoredBy = new List <ScoredByUser>();

                if (!siteID.HasValue)
                {
                    return(new EmptyResult());
                }

                if (selectedProgramID.HasValue)
                {
                    epsScoredBy = reportservice.GetScoredByForEPs((int)siteID, (int)selectedProgramID, selectedChapterIDs, selectedStandardIDs, selectedScoreType);
                }
                else
                {
                    epsScoredBy.Insert(0, new ScoredByUser
                    {
                        UserID   = Convert.ToInt32(-1),
                        UserName = "******",
                    });
                }

                return(PartialView("Search/_EpScoredBy", epsScoredBy));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "EP Scoring Report",
                    MethodName    = "GetScoredByForEPs",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #9
0
        //
        // GET: Tracer/ComplianceDepartment
        public ActionResult Index(int id, int?actionType)
        {
            try
            {
                HelperClasses.SetReportOrScheduleID(id, (int)ReportsListEnum.ComplianceByDepartment);
                ViewBag.ShowCMSRadio = true;

                SearchInputService reportservice = new SearchInputService();
                if (AppSession.ReportScheduleID > 0)
                {
                    //Load the saved parameters
                    var oSaveAndScheduleService = new SaveAndScheduleService();
                    var savedParameters         = oSaveAndScheduleService.LoadUserSchedule(AppSession.ReportScheduleID);
                    TempData["SavedParameters"] = savedParameters; //This tempdata will be used by the Ajax call to avoid loading the saved parameters again from DB
                    TempData["ActionType"]      = actionType;

                    //Show/Hide Save to my reports button
                    ViewBag.HideSaveReport = HelperClasses.HideSaveToMyReports(AppSession.RoleID, savedParameters.UserID, AppSession.UserID, actionType);

                    return(View(reportservice.GetSavedParameters_ComplianceDepartment(AppSession.ReportScheduleID, savedParameters, WebConstants.TRACER_REPORT_TITLE_COMPLIANCE_BY_DEPARTMENT)));
                }
                else
                {
                    return(View(reportservice.GetSearchLists_ComplianceDepartment(WebConstants.TRACER_REPORT_TITLE_COMPLIANCE_BY_DEPARTMENT)));
                }
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "ComplianceDepartment",
                    MethodName    = "Index",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #10
0
ファイル: HomeController.cs プロジェクト: SubhoM/ReportApp
        public ActionResult Index(int pageId = 0)
        {
            try
            {
                if (!AppSession.HasValidSession)
                {
                    return(RedirectToAction("Index", "Transfer", new { area = "" }));
                }
                else
                {
                    // Mark Orlando 12/5/2017. Needed to support TEN. While user is in reports, as they click on different pages,
                    // the client passes pageId to controller. Controller must store pageId in AppSession. This is required
                    // because AppSession.LinkType is now read-only and derived from pageId.
                    if (pageId > 0)
                    {
                        AppSession.PageID = pageId;
                    }
                }
                AppSession.ReportType = "ERTracersReport";
                ViewBag.Message       = "Tracer Enterprise Reporting";

                //Change it to a View model
                ViewBag.ShowHeader = true;

                ViewBag.IsCMSProgram = AppSession.IsCMSProgram;

                ClearReportParameters();

                CommonService cs   = new CommonService();
                var           list = cs.SelectReporListByProductID((int)WebConstants.ProductID.TracerER);

                var rtn = new ReportList {
                    List = list
                };
                //  var attributes = cs.SelectReporAttributesByProductIDReportID((int) WebConstants.ProductID.Tracer,null);
                // rtn.ListAttributes=attributes;
                return(View(rtn));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = " Tracer ER Reports: " + ex.Message,
                    PageName      = "Home",
                    MethodName    = "Index",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #11
0
        public DataSourceResult NewEPExcel([DataSourceRequest] DataSourceRequest request, Search search)
        {
            DataSourceResult result = new DataSourceResult();

            try
            {
                SearchFormat sf = new SearchFormat();
                sf.CheckInputs(search);

                List <NewEp> newEPExcel = new List <NewEp>();
                DataTable    dt         = new DataTable();

                dt = newEPData(search).Tables[0];

                //convert datatable to list
                newEPExcel = dt.ToList <NewEp>();


                result = newEPExcel.ToDataSourceResult(request, tc => new NewEp
                {
                    StdEffectiveBeginDate = tc.StdEffectiveBeginDate,
                    StdEP  = tc.StdEP,
                    EPText = tc.EPText
                });
            }
            catch (Exception ex)
            {
                if (ex.Message.ToString() == "No Data")
                {
                    result.Errors = "No Data found matching your criteria.";
                }
                else if (ex.Message.ToString() == "Limit")
                {
                    result.Errors = "Maximum limit of " + ConfigurationManager.AppSettings["ReportOutputLimit"].ToString() + " records reached. Refine your criteria to narrow the result.";
                }


                if (ex.Message.ToString() != "No Data" && ex.Message.ToString() != "Limit")
                {
                    ExceptionLog exceptionLog = new ExceptionLog
                    {
                        ExceptionText = "Reports: " + ex.Message,
                        PageName      = "NewEP",
                        MethodName    = "NewEPExcel",
                        UserID        = Convert.ToInt32(AppSession.UserID),
                        SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                        TransSQL      = "",
                        HttpReferrer  = null
                    };
                    _exceptionService.LogException(exceptionLog);
                }
            }

            return(result);
        }
コード例 #12
0
 protected static async Task <bool> HandleException(Func <Task <bool> > func)
 {
     try
     {
         return(await func());
     }
     catch (Exception ex)
     {
         ExceptionService.LogException(ex);
     }
     return(false);
 }
コード例 #13
0
        public static async Task <InAppBillingPurchase?> Buy(string productId, bool consume)
        {
            IInAppBilling billing = CrossInAppBilling.Current;

            try
            {
                if (!CrossInAppBilling.IsSupported || !await billing.ConnectAsync())
                {
                    return(null);
                }

                List <InAppBillingPurchase> existingPurchases = (await billing.GetPurchasesAsync(ItemType.InAppPurchase))
                                                                .Where(p => p.ProductId == productId)
                                                                .ToList();
                foreach (var existingPurchase in existingPurchases)
                {
                    await ProcessPurchase(billing, existingPurchase, consume);
                }

                InAppBillingPurchase purchase = await billing.PurchaseAsync(productId, ItemType.InAppPurchase);

                if (purchase != null && purchase.State == PurchaseState.Purchased)
                {
                    await ProcessPurchase(billing, purchase, consume);

                    return(purchase);
                }
            }
            catch (InAppBillingPurchaseException billingEx)
            {
                if (billingEx.PurchaseError != PurchaseError.UserCancelled &&
                    billingEx.PurchaseError != PurchaseError.ServiceUnavailable)
                {
                    billingEx.Data.Add(nameof(billingEx.PurchaseError), billingEx.PurchaseError);
                    billingEx.Data.Add("Product Id", productId);
                    ExceptionService.LogException(billingEx);
                }
            }
            catch (TaskCanceledException) { }
            catch (Exception ex)
            {
                ExceptionService.LogException(ex);
            }
            finally
            {
                // Disconnect, it is okay if we never connected, this will never throw an exception
                await billing.DisconnectAsync();
            }
            return(null);
        }
コード例 #14
0
 // Allocate the async/await state machine only when needed for performance reason.
 // More info about the state machine: https://blogs.msdn.microsoft.com/seteplia/2017/11/30/dissecting-the-async-methods-in-c/?WT.mc_id=DT-MVP-5003978
 async static Task ForgetAwaited(Task task, bool logExceptions)
 {
     try
     {
         // No need to resume on the original SynchronizationContext, so use ConfigureAwait(false)
         await task.ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         if (logExceptions)
         {
             ExceptionService.LogException(ex);
         }
     }
 }
コード例 #15
0
        public ActionResult LoadDepartmentAssigmentTab(Search search)
        {
            TracerDepartmentAssignmentInput model = new TracerDepartmentAssignmentInput();

            try
            {
                var tcService = new DepartmentAssignmentService();
                List <TracerFrequency> result = tcService.GetValidFrequencyForDepartmentAssignmentData(search);

                if (result.Count > 0)
                {
                    model.DefaultFrequencyNames = result.Select(x => x.TracerObsFrequencyTypeName).ToList();

                    model.ActiveFrequencyName = model.DefaultFrequencyNames.First();
                    model.FrequencyName       = string.Join(",", model.DefaultFrequencyNames);
                }

                return(PartialView("_TracerDepartmentAssignment", model));
            }

            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "_TracerDepartmentAssignment",
                    MethodName    = "LoadDepartmentAssigmentTab",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);
                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #16
0
        public ActionResult Index(int id, int?actionType)
        {
            try
            {
                HelperClasses.SetReportOrScheduleID(id, (int)ReportsListEnum.TracerComplianceSummary);

                SearchInputService reportservice = new SearchInputService();
                SearchList         oSearchList   = new SearchList();
                if (AppSession.ReportScheduleID > 0)
                {
                    //Load the saved parameters
                    var oSaveAndScheduleService = new SaveAndScheduleService();
                    var savedParameters         = oSaveAndScheduleService.LoadUserSchedule(AppSession.ReportScheduleID);
                    TempData["SavedParameters"] = savedParameters; //This tempdata will be used by the Ajax call to avoid loading the saved parameters again from DB
                    TempData["ActionType"]      = actionType;

                    //Show/Hide Save to my reports button
                    ViewBag.HideSaveReport = HelperClasses.HideSaveToMyReports(AppSession.RoleID, savedParameters.UserID, AppSession.UserID, actionType);

                    oSearchList = reportservice.GetSearchListsForSavedParameters(AppSession.ReportScheduleID, savedParameters, WebConstants.TRACER_REPORT_TITLE_TRACER_COMPLIANCE_SUMMARY_REPORT);
                }
                else
                {
                    oSearchList = reportservice.GetSearchLists(WebConstants.TRACER_REPORT_TITLE_TRACER_COMPLIANCE_SUMMARY_REPORT);
                }

                var qryTracers = oSearchList.TracersLists.Where(item => item.TracerCustomID != -1);
                oSearchList.TracersLists = qryTracers;

                return(View(oSearchList));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "TracerCompliance",
                    MethodName    = "Index",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #17
0
        // GET: Corporate/PriorityTjcRFI
        public ActionResult Index(int id, int?actionType)
        {
            try
            {
                HelperClasses.SetReportOrScheduleID(id, (int)ReportsListEnum.RFIFindingReport);


                SearchInputService reportservice = new SearchInputService();


                if (AppSession.ReportScheduleID > 0)
                {
                    //Load the saved parameters
                    var oSaveAndScheduleService = new SaveAndScheduleService();
                    var savedParameters         = oSaveAndScheduleService.LoadUserSchedule(AppSession.ReportScheduleID);
                    TempData["SavedParameters"] = savedParameters; //This tempdata will be used by the Ajax call to avoid loading the saved parameters again from DB
                    TempData["ActionType"]      = actionType;

                    //Show/Hide Save to my reports button
                    ViewBag.HideSaveReport = HelperClasses.HideSaveToMyReports(AppSession.RoleID, savedParameters.UserID, AppSession.UserID, actionType);

                    return(View(reportservice.GetCorpSearchListsForSavedParameters(AppSession.ReportScheduleID, savedParameters, WebConstants.RFI_REPORT_TITLE_FINDING_REPORT)));
                }
                else
                {
                    return(View(reportservice.GetCorpSearchLists(WebConstants.RFI_REPORT_TITLE_FINDING_REPORT)));
                }
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "PriorityFindingRFI",
                    MethodName    = "RFIFindingSummaryIndex",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #18
0
        /// <param name="timetable">Used to save results</param>
        public static async ValueTask <(Url?attendanceUrl, string?errorMessage)> GetAttendanceUrlAsync(Lesson lesson, TimetableInfo?timetable = null)
        {
            try
            {
                var lessonInfo = timetable?.GetAndAddLessonsInfo(lesson);
                if (lessonInfo?.DlNureInfo.AttendanceUrl != null)
                {
                    return(lessonInfo.DlNureInfo.AttendanceUrl, null);
                }

                int?lessonId = await GetLessonIdAsync(lesson, timetable);

                if (lessonId == null)
                {
                    return(null, LN.LessonNotFound);
                }

                CourseModule?attendance = (await new MoodleRepository()
                                           .GetCourseContentsAsync(lessonId.Value, new() { { GetCourseContentsOption.ModName, "attendance" } }))
                                          .FirstOrDefault()?
                                          .Modules
                                          .FirstOrDefault();
                if (attendance == null)
                {
                    return(null, LN.NoAttendanceModule);
                }

                Uri attendanceUrl = new(attendance.Url);
                if (timetable != null)
                {
                    lessonInfo !.DlNureInfo.AttendanceUrl = attendanceUrl;
                    await EventsRepository.UpdateLessonsInfo(timetable);
                }

                return(attendanceUrl, null);
            }
            catch (Exception ex)
            {
                EnrichException(ex, timetable?.Entity, lesson);
                ExceptionService.LogException(ex);
                return(null, ex.Message);
            }
        }
コード例 #19
0
ファイル: WebApiMethods.cs プロジェクト: SubhoM/ReportApp
        public static bool AddApplicationEvent(int selectedSiteID, ActionTaken actionTaken)
        {
            try
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                var apiUrl = ConfigurationManager.AppSettings.Get("WebAPI");
                if (null == AppSession.AccessToken || string.IsNullOrEmpty(AppSession.AccessToken.Token))
                {
                    AppSession.AccessToken = EprodWebApi.GetAuthenticationToken(apiUrl,
                                                                                ConfigurationManager.AppSettings.Get("AppID"),
                                                                                ConfigurationManager.AppSettings.Get("AppPassword"));
                }
                ApplicationEvent appEvent = new ApplicationEvent()
                {
                    UserId       = (int)AppSession.UserID,
                    SiteId       = selectedSiteID,
                    ProgramId    = AppSession.SelectedProgramId,
                    EproductId   = (int)EProductType.Reports,
                    ActionTypeId = (int)actionTaken
                };

                return(EprodWebApi.ApplicationEvent(appEvent, apiUrl, AppSession.AccessToken.Token));
            }
            catch (Exception ex)
            {
                if (ex.Message.ToString() != "No Data" && ex.Message.ToString() != "Limit")
                {
                    ExceptionLog exceptionLog = new ExceptionLog
                    {
                        ExceptionText = "Reports: " + ex.Message,
                        PageName      = "WebApiMethods.cs",
                        MethodName    = "AddApplicationEvent",
                        UserID        = Convert.ToInt32(AppSession.UserID),
                        SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                        TransSQL      = "",
                        HttpReferrer  = null
                    };
                    ExceptionService _exceptionService = new ExceptionService();
                    _exceptionService.LogException(exceptionLog);
                }
            }
            return(false);
        }
コード例 #20
0
        /// <summary>
        /// Index: Entry point - Confirm access, Setup session and variables, etc.
        /// </summary>
        /// <returns>Redirect</returns>
        public ActionResult Index()
        {
            try
            {
                Security.SetUpSession();

                if (AppSession.HasValidSession)
                {
                    if (AppSession.DirectView != null)
                    {
                        return(RedirectToAction(AppSession.DirectView, "Home", new { area = FindArea() }));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Home", new { area = FindArea() }));
                    }
                }

                // return to portal
                return(Redirect(ConfigurationManager.AppSettings["JcrPortalUrl"].ToString()));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "TransferController",
                    MethodName    = "Index",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };


                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #21
0
        public static async Task <List <LessonInfo> > UpdateLessonIdsAsync(TimetableInfo timetable)
        {
            try
            {
                List <Lesson> lessons          = timetable.Lessons().ToList();
                bool          areAllIdsPresent = lessons
                                                 .Select(l => timetable.GetAndAddLessonsInfo(l))
                                                 .All(li => li.DlNureInfo.LessonId != null);
                if (areAllIdsPresent)
                {
                    return(timetable.LessonsInfo);
                }

                List <FullCourse> courses = await new MoodleRepository().GetEnrolledCoursesAsync();
                foreach (var lesson in lessons)
                {
                    var lessonInfo = timetable.GetAndAddLessonsInfo(lesson);
                    if (lessonInfo.DlNureInfo.LessonId != null)
                    {
                        continue;
                    }

                    lessonInfo.DlNureInfo.LessonId = courses.Find(lesson).FirstOrDefault()?.Id;
                }

                await EventsRepository.UpdateLessonsInfo(timetable);

                return(timetable.LessonsInfo);
            }
            catch (Exception ex)
            {
                EnrichException(ex, timetable.Entity);
                ExceptionService.LogException(ex);
                return(timetable.LessonsInfo);
            }
        }
コード例 #22
0
        /// <param name="timetable">Used to save results</param>
        public static async ValueTask <int?> GetLessonIdAsync(Lesson lesson, TimetableInfo?timetable = null)
        {
            try
            {
                if (timetable == null)
                {
                    List <FullCourse> courses = await new MoodleRepository().GetEnrolledCoursesAsync();
                    FullCourse?       course  = courses.Find(lesson).FirstOrDefault();
                    return(course?.Id);
                }
                else
                {
                    var lessonInfos = await UpdateLessonIdsAsync(timetable);

                    return(lessonInfos.FirstOrDefault(li => li.Lesson == lesson)?.DlNureInfo.LessonId);
                }
            }
            catch (Exception ex)
            {
                EnrichException(ex, timetable?.Entity, lesson);
                ExceptionService.LogException(ex);
                return(null);
            }
        }
コード例 #23
0
        public static async Task <IList <Calendar> > GetAllCalendarsAsync()
        {
            if (!await RequestPermissionsAsync())
            {
                return(new List <Calendar>());
            }

            // Getting Calendar list
            IList <Calendar> calendars = await CrossCalendars.Current.GetCalendarsAsync();

            calendars = calendars
                        .Where(c => string.Equals(c.Name, c.AccountName, StringComparison.OrdinalIgnoreCase) ||
                               string.Equals(c.AccountName, CustomCalendarName, StringComparison.OrdinalIgnoreCase))
                        .ToList();

            // Getting our custom calendar
            Calendar?customCalendar = calendars.FirstOrDefault(c => string.Equals(c.AccountName, CustomCalendarName, StringComparison.OrdinalIgnoreCase));

            if (customCalendar == null)
            {
                customCalendar = new Calendar
                {
                    Name  = CustomCalendarName,
                    Color = "#56a5de"
                };
                await CrossCalendars.Current.AddOrUpdateCalendarAsync(customCalendar);

                calendars.Add(customCalendar);
            }
            else if (calendars.Count(c => c.AccountName == customCalendar.AccountName) > 1)
            {
                ExceptionService.LogException(new IndexOutOfRangeException($"There are {calendars.Count(c => c.AccountName == customCalendar.AccountName)} calendars with AccountName {customCalendar.AccountName}"));
            }

            return(calendars);
        }
コード例 #24
0
        public ActionResult GetProgramsList(string selectedSiteIDs, string selectedProgramIDs = "")
        {
            try
            {
                var programlist = StandardData.GetProgramSites(selectedSiteIDs).OrderBy(item => item.SortOrder);

                var programs = selectedProgramIDs.Trim().TrimEnd(',').Split(',');

                if (selectedProgramIDs.Length > 0 && selectedProgramIDs != "-1")
                {
                    programlist = programlist.Where(item => programs.Contains(item.BaseProgramID.ToString().Trim())).OrderBy(item => item.SortOrder);
                }

                return(PartialView("Search/_ReportsProgramSelect", programlist));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "CorporatePriorityFinding",
                    MethodName    = "GetMultiSitePrograms",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #25
0
        public ReportViewer CMSComplianceRDLC(SearchCMSCompliance searchParams, Email emailInput, string reportType = "Summary")
        {
            DateTime?startDate  = null;
            DateTime?endDate    = null;
            string   reportDate = "All Dates";

            SearchFormat searchoutput = new SearchFormat();

            if (searchParams.StartDate != null)
            {
                startDate = searchParams.StartDate;
                if (searchParams.EndDate != null)
                {
                    reportDate = searchParams.StartDate.Value.ToShortDateString() + " - " + searchParams.EndDate.Value.ToShortDateString();
                }
                else
                {
                    reportDate = "since " + searchParams.StartDate.Value.ToShortDateString();
                }
            }

            if (searchParams.EndDate != null)
            {
                endDate = searchParams.EndDate.Value.Date.AddHours(23).AddMinutes(59).AddSeconds(59);
                if (searchParams.StartDate == null)
                {
                    reportDate = "through " + searchParams.EndDate.Value.ToShortDateString();
                }
            }

            ReportViewer reportViewer = new ReportViewer();

            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;
            try
            {
                if (AppSession.ReportScheduleID > 0 && searchParams.ReportTitle != null)
                {
                    searchParams.ReportTitle = String.Concat(searchParams.ReportTitle, " - Report ID: ", AppSession.ReportScheduleID);
                }
                else
                {
                    if (reportType == "Summary")
                    {
                        searchParams.ReportTitle = "CMS Compliance Report - Summary";
                    }
                    else
                    {
                        searchParams.ReportTitle = "CMS Compliance Report - Detail";
                    }
                }

                string rdlcfilename = string.Empty;
                string dsName       = string.Empty;

                if (reportType == "Summary")
                {
                    rdlcfilename = "rptCMSCompliance_Summary.rdlc";
                    dsName       = "dstCMSComplianceSummary";
                }
                else
                {
                    rdlcfilename = "rptCMSCompliance_Detail.rdlc";
                    dsName       = "dstCMSComplianceDetail";
                }

                ReportParameterCollection reportParameterCollection = new ReportParameterCollection();

                DataTable dtblReportForCMSCompliance = GetReportDataView(searchParams, reportType).Tables[0];

                DataView dvReportResultForCMSCompliance = new DataView(dtblReportForCMSCompliance);
                reportViewer.LocalReport.DisplayName = searchParams.ReportTitle;
                reportViewer.LocalReport.ReportPath  = HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath) + @"Areas\Corporate\Reports\" + rdlcfilename;
                reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dsName, dvReportResultForCMSCompliance));

                reportParameterCollection.Add(new ReportParameter("ReportTitle", searchParams.ReportTitle));
                reportParameterCollection.Add(new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Copyright.ToString()));
                reportParameterCollection.Add(new ReportParameter("ProgramName", searchParams.ProgramNames));
                reportParameterCollection.Add(new ReportParameter("SiteName", searchParams.SelectedSiteNames));
                reportParameterCollection.Add(new ReportParameter("ReportDateTitle", DateTime.Now.ToString()));
                reportParameterCollection.Add(new ReportParameter("CoPNameList", searchParams.SelectedCoPNames));
                reportParameterCollection.Add(new ReportParameter("TagNameList", searchParams.SelectedTagNames));
                reportParameterCollection.Add(new ReportParameter("IdentifiedByNameList", searchParams.SelectedIdentifiedByNames));
                reportParameterCollection.Add(new ReportParameter("CompliancePeriod", reportDate));
                reportParameterCollection.Add(new ReportParameter("ComplianceValueNameList", searchParams.ComplianceValueNameList));
                reportParameterCollection.Add(new ReportParameter("DocumentationNameList", searchParams.DocumentationNameList));

                switch (reportType)
                {
                case "Summary":

                    var autoCitationArray = dtblReportForCMSCompliance.AsEnumerable()
                                            .Where(a => string.IsNullOrEmpty(a.Field <string>("AutoCitationText")) == false)
                                            .GroupBy(a => new { AutoCitationText = a.Field <string>("AutoCitationText"), AutoCitationSortOrder = a.Field <int>("AutoCitationSortOrder") })
                                            .Select(g => g.First())
                                            .OrderBy(a => a.Field <int>("AutoCitationSortOrder"))
                                            .Select(a => a.Field <string>("AutoCitationText")).ToArray();
                    var autoCitationText = string.Join("<br />", autoCitationArray);

                    reportParameterCollection.Add(new ReportParameter("CitedLegends", autoCitationText));
                    break;

                case "Detail":
                    reportParameterCollection.Add(new ReportParameter("IncludeTJC", searchParams.chkIncludeTJC.ToString()));
                    break;
                }

                reportViewer.LocalReport.SetParameters(reportParameterCollection);


                if (emailInput.To != null)
                {
                    CommonService emailService = new CommonService();
                    int           actionTypeId = (int)ActionTypeEnum.CMSComplianceReport;
                    if (emailService.SendReportEmail(emailInput, actionTypeId, emailService.SetRdlcEmail(reportViewer)))
                    {
                        HttpContext.Current.Session["EmailSuccess"] = "true";
                    }
                    else
                    {
                        HttpContext.Current.Session["EmailSuccess"] = "false";
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.ToString() != "No Data")
                {
                    ExceptionLog exceptionLog = new ExceptionLog
                    {
                        ExceptionText = "Reports: " + ex.Message,
                        PageName      = "CMSComplianceSummary",
                        MethodName    = "CMSComplianceSummaryRDLC",
                        UserID        = Convert.ToInt32(AppSession.UserID),
                        SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                        TransSQL      = "",
                        HttpReferrer  = null
                    };
                    _exceptionService.LogException(exceptionLog);
                }
                throw ex;
            }

            return(reportViewer);
        }
コード例 #26
0
ファイル: HomeController.cs プロジェクト: SubhoM/ReportApp
        public ActionResult Index(int pageId = 0)
        {
            try
            {
                if (!AppSession.HasValidSession)
                {
                    return(RedirectToAction("Index", "Transfer", new { area = "" }));
                }
                else
                {
                    // Mark Orlando 12/5/2017. Needed to support TEN. While user is in reports, as they click on different pages,
                    // the client passes pageId to controller. Controller must store pageId in AppSession. This is required
                    // because AppSession.LinkType is now read-only and derived from pageId.
                    if (pageId > 0)
                    {
                        AppSession.PageID = pageId;
                    }
                }

                AppSession.ReportType = "AMPReports";
                ViewBag.Message       = "Reports";

                //Change it to a View model
                ViewBag.ShowHeader = true;

                ClearReportParameters();

                CommonService cs   = new CommonService();
                var           list = cs.SelectReporListByProductID((int)WebConstants.ProductID.AMP);

                if (AppSession.IsCMSProgram == false)
                {
                    list = list.Where(a => a.ERReportDisplayGroupID != (int)WebConstants.ERReportDisplayGroup.CMS_Report).ToList();
                }

                //Update report name
                if (AppSession.IsCorporateSite == false)
                {
                    string reportTitle = WebConstants.AMP_EP_SCORING_REPORT_FINAL;
                    list.First(a => a.ERReportID == (int)ReportsListEnum.EPScoringReportFinalMockSurvey).ERReportName = reportTitle;
                }


                var reportsList = list.GroupBy(lst => new { lst.ERReportDisplayGroupName, lst.ERReportDisplayGroupID })
                                  .Select(grp => new ReportGroup()
                {
                    GroupName = grp.Key.ERReportDisplayGroupName,
                    GroupID   = grp.Key.ERReportDisplayGroupID,
                    rptList   = grp.ToList()
                }).ToList();

                return(View(reportsList));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "CorporatePriorityFinding",
                    MethodName    = "Index",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
コード例 #27
0
        public byte[] TracersComplianceSummaryRDLC(SearchER search, int reportType, string SortBy = "", string SortOrder = "")
        {
            byte[] fileContents    = null;
            string reportDateTitle = "";

            string   rdlcName = String.Empty;
            string   dsName   = String.Empty;
            DataView dv       = null;

            ReportParameterCollection reportParameterCollection = null;


            try
            {
                if (AppSession.ReportScheduleID > 0)
                {
                    search.ReportTitle = String.Concat(search.ReportTitle, " - Report ID: ", AppSession.ReportScheduleID);
                }

                reportDateTitle = CommonService.InitializeReportDateTitle("Observation", search.StartDate, search.EndDate);
                search.EndDate  = (search.EndDate != null && search.EndDate.ToString() != "") ? search.EndDate.Value.Date.AddHours(23).AddMinutes(29).AddSeconds(59) : search.EndDate;


                // Setup ReportViewer
                ReportViewer reportViewer = new ReportViewer();
                reportViewer.ProcessingMode          = ProcessingMode.Local;
                reportViewer.SizeToReportContent     = true;
                reportViewer.LocalReport.DisplayName = search.ReportTitle;

                // Add Initial Common Report Parameter
                // Set Parameters



                switch (search.LevelIdentifier)
                {
                case (int)WebConstants.TracerComplianceSummaryLevels.Level1_Program:
                default:
                {
                    rdlcName = "rptReportTracerComplianceSummary_ByProgram.rdlc";
                    dsName   = "dsReport_TracerComplianceSummaryByProgram";
                    dv       = new DataView(GetLevel1DataSet(search).Tables[0]);
                    ReportParameter p1  = new ReportParameter("ReportTitle", search.ReportTitle.ToString());
                    ReportParameter p2  = new ReportParameter("Programs", search.ProgramNames.ToString());
                    ReportParameter p3  = new ReportParameter("Tracers", search.TracerListNames.ToString());
                    ReportParameter p4  = new ReportParameter("HCOID", search.SelectedSiteHCOIDs.ToString());
                    ReportParameter p5  = new ReportParameter("ReportDateTitle", reportDateTitle.ToString());
                    ReportParameter p6  = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Tracer_Copyright.ToString());
                    ReportParameter p7  = new ReportParameter("ReportSubTitle", "Overall Compliance by Program");
                    ReportParameter p8  = new ReportParameter("ReportType", search.ReportType.ToString());
                    ReportParameter p9  = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0");
                    ReportParameter p10 = new ReportParameter("IsCMSProgram", AppSession.IsCMSProgram ? "1" : "0");
                    reportParameterCollection = new ReportParameterCollection {
                        p1, p2, p3, p4, p5, p6, p7, p8, p9, p10
                    };
                    break;
                }

                case (int)WebConstants.TracerComplianceSummaryLevels.Level2_Site:
                {
                    rdlcName = "rptReportTracerComplianceSummary_BySite.rdlc";
                    dsName   = "dsReport_TracerComplianceSummaryBySite";
                    dv       = new DataView(GetLevel2DataSet(search).Tables[0]);
                    ReportParameter p1  = new ReportParameter("ReportTitle", search.ReportTitle.ToString());
                    ReportParameter p2  = new ReportParameter("Programs", search.ProgramNames.ToString());
                    ReportParameter p3  = new ReportParameter("Tracers", search.TracerListNames.ToString());
                    ReportParameter p4  = new ReportParameter("HCOID", search.SelectedSiteHCOIDs.ToString());
                    ReportParameter p5  = new ReportParameter("ReportDateTitle", reportDateTitle.ToString());
                    ReportParameter p6  = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Tracer_Copyright.ToString());
                    ReportParameter p7  = new ReportParameter("ReportSubTitle", "Compliance by Site");
                    ReportParameter p8  = new ReportParameter("ReportType", search.ReportType.ToString());
                    ReportParameter p9  = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0");
                    ReportParameter p10 = new ReportParameter("IsCMSProgram", AppSession.IsCMSProgram ? "1" : "0");
                    reportParameterCollection = new ReportParameterCollection {
                        p1, p2, p3, p4, p5, p6, p7, p8, p9, p10
                    };
                    break;
                }

                case (int)WebConstants.TracerComplianceSummaryLevels.Level3_Tracer:
                {
                    rdlcName = "rptReportTracerComplianceSummary_ByTracer.rdlc";
                    dsName   = "dsReport_TracerComplianceSummaryByTracer";
                    dv       = new DataView(GetLevel3DataSet(search).Tables[0]);
                    ReportParameter p1  = new ReportParameter("ReportTitle", search.ReportTitle.ToString());
                    ReportParameter p2  = new ReportParameter("Programs", search.ProgramNames.ToString());
                    ReportParameter p3  = new ReportParameter("ReportDateTitle", reportDateTitle.ToString());
                    ReportParameter p4  = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Tracer_Copyright.ToString());
                    ReportParameter p5  = new ReportParameter("ReportSubTitle", "Compliance by Tracer");
                    ReportParameter p6  = new ReportParameter("SiteName", search.SelectedSiteHCOIDs.ToString());
                    ReportParameter p7  = new ReportParameter("Tracers", search.TracerListNames.ToString());
                    ReportParameter p8  = new ReportParameter("ReportType", search.ReportType.ToString());
                    ReportParameter p9  = new ReportParameter("HCOID", search.SelectedSiteHCOIDs.ToString());
                    ReportParameter p10 = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0");
                    ReportParameter p11 = new ReportParameter("IsCMSProgram", AppSession.IsCMSProgram ? "1" : "0");
                    reportParameterCollection = new ReportParameterCollection {
                        p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11
                    };
                    break;
                }

                case (int)WebConstants.TracerComplianceSummaryLevels.Level4_Question:
                {
                    rdlcName = "rptReportTracerComplianceSummary_ByQuestion.rdlc";
                    dsName   = "dsReport_TracerComplianceSummaryByQuestion";
                    dv       = new DataView(GetLevel4DataSet(search).Tables[0]);
                    ReportParameter p1  = new ReportParameter("ReportTitle", search.ReportTitle.ToString());
                    ReportParameter p2  = new ReportParameter("Programs", search.ProgramNames.ToString());
                    ReportParameter p3  = new ReportParameter("Tracers", search.TracerListNames.ToString());
                    ReportParameter p4  = new ReportParameter("ReportDateTitle", reportDateTitle.ToString());
                    ReportParameter p5  = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Tracer_Copyright.ToString());
                    ReportParameter p6  = new ReportParameter("ReportSubTitle", "Compliance by Question");
                    ReportParameter p7  = new ReportParameter("SiteName", search.SelectedSiteHCOIDs.ToString());
                    ReportParameter p8  = new ReportParameter("ReportType", search.ReportType.ToString());
                    ReportParameter p9  = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0");
                    ReportParameter p10 = new ReportParameter("IsCMSProgram", AppSession.IsCMSProgram ? "1" : "0");
                    reportParameterCollection = new ReportParameterCollection {
                        p1, p2, p3, p4, p5, p6, p7, p8, p9, p10
                    };
                    break;
                }
                }
                if (SortBy != "")
                {
                    dv.Sort = SortBy + " " + SortOrder;
                }
                // Setup Data sources for report
                reportViewer.LocalReport.DataSources.Clear();
                reportViewer.LocalReport.ReportPath = HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath) + @"Areas\TracerER\Reports\" + rdlcName.ToString();
                reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dsName, dv));

                reportViewer.LocalReport.SetParameters(reportParameterCollection);
                Warning[] warnings;
                string[]  streamIds;
                string    mimeType  = string.Empty;
                string    encoding  = string.Empty;
                string    extension = string.Empty;

                string format = WebConstants.REPORT_FORMAT_PDF;      // PDF is default
                if (reportType == (int)WebConstants.ReportFormat.EXCEL)
                {
                    format = WebConstants.REPORT_FORMAT_EXCEL;        // If Excel option chosen
                }
                fileContents = reportViewer.LocalReport.Render(format, null, out mimeType, out encoding, out extension, out streamIds, out warnings);
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "TracerComplianceSummaryRDLC",
                    MethodName    = "TracerComplianceSummaryRDLC",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                _exceptionService.LogException(exceptionLog);
            }

            return(fileContents);
        }
コード例 #28
0
        public DataSourceResult TracerComprehensiveExcel([DataSourceRequest] DataSourceRequest request, Search search)
        {
            DataSourceResult result = new DataSourceResult();

            try
            {
                SearchFormat sf = new SearchFormat();
                sf.CheckInputs(search);

                List <TracerComprehensiveExcel> tracerComprehensiveExcel = new List <TracerComprehensiveExcel>();
                DataTable dt        = new DataTable();
                var       tcService = new TracerComprehensive();
                dt = tcService.TracerComprehensiveData(search).Tables[0];
                //int rowsCount = dt.Rows.Count;
                //if (rowsCount > 65000)
                //{
                //    result.Errors = WebConstants.DATA_LIMIT_EXCEL_VIEW + rowsCount.ToString();
                //}
                //else
                //{
                //convert datatable to list
                tracerComprehensiveExcel = dt.ToList <TracerComprehensiveExcel>();


                result = tracerComprehensiveExcel.ToDataSourceResult(request, tc => new TracerComprehensiveExcel
                {
                    // Get Excel View DataSet
                    //SiteID = tc.SiteID,
                    TracerCustomName = tc.TracerCustomName,
                    //TracerCustomID = tc.TracerCustomID,
                    TracerResponseTitle = tc.TracerResponseTitle,
                    //TracerResponseID = tc.TracerResponseID,
                    OrgName_Rank3      = tc.OrgName_Rank3,
                    OrgName_Rank2      = tc.OrgName_Rank2,
                    OrgName_Rank1_Dept = tc.OrgName_Rank1_Dept,
                    //OrgID_Rank1_Dept = tc.OrgID_Rank1_Dept,
                    //OrgID_Rank2 = tc.OrgID_Rank2,
                    //OrgID_Rank3 = tc.OrgID_Rank3,
                    SurveyTeam           = tc.SurveyTeam.ReplaceNewline(),
                    MedicalStaffInvolved = tc.MedicalStaffInvolved.ReplaceNewline(),
                    Location             = tc.Location.ReplaceNewline(),
                    MedicalRecordNumber  = tc.MedicalRecordNumber.ReplaceNewline(),
                    EquipmentObserved    = tc.EquipmentObserved.ReplaceNewline(),
                    ContractedService    = tc.ContractedService.ReplaceNewline(),
                    StaffInterviewed     = tc.StaffInterviewed.ReplaceNewline(),
                    TracerNote           = tc.TracerNote.ReplaceNewline(),
                    UpdatedById          = tc.UpdatedById,
                    UpdatedByUserName    = tc.UpdatedByUserName,
                    QuestionAnswer       = tc.QuestionAnswer,
                    ObservationDate      = tc.ObservationDate,
                    UpdatedDate          = tc.UpdatedDate,
                    Numerator            = tc.Numerator,
                    Denominator          = tc.Denominator,
                    CompliancePercent    = tc.CompliancePercent,
                    TracerQuestionNumber = tc.TracerQuestionNumber,
                    TracerQuestionID     = tc.TracerQuestionID,
                    QuestionText         = tc.QuestionText.ReplaceSpecialCharacters(),
                    //TotalNumerator = tc.TotalNumerator,
                    //TotalDenominator = tc.TotalDenominator,
                    //TotalCompliancePercent = tc.TotalCompliancePercent,
                    FollowUpRequired       = tc.FollowUpRequired,
                    TracerQuestionNote     = tc.TracerQuestionNote.ReplaceNewline(),
                    StandardEP             = tc.StandardEP.ReplaceNewline(),
                    TotalObservationsCount = tc.TotalObservationsCount
                });
                // }
            }
            catch (Exception ex)
            {
                if (ex.Message.ToString() == "No Data")
                {
                    result.Errors = WebConstants.NO_DATA_FOUND_EXCEL_VIEW;
                }
                else if (ex.Message.ToString() == "Limit")
                {
                    if (search.ReportTypeSumDet == "ExcelView")
                    {
                        result.Errors = "Maximum limit of " + ConfigurationManager.AppSettings["ReportOutputLimitExcelView"].ToString() + " records reached. Refine your criteria to narrow the result.";
                    }
                    else
                    {
                        result.Errors = "Maximum limit of " + ConfigurationManager.AppSettings["ReportOutputLimit"].ToString() + " records reached. Refine your criteria to narrow the result.";
                    }
                }


                if (ex.Message.ToString() != "No Data" && ex.Message.ToString() != "Limit")
                {
                    ExceptionLog exceptionLog = new ExceptionLog
                    {
                        ExceptionText = "Reports: " + ex.Message,
                        PageName      = "TracerComprehensive",
                        MethodName    = "_TracerComprehensiveDataExcel",
                        UserID        = Convert.ToInt32(AppSession.UserID),
                        SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                        TransSQL      = "",
                        HttpReferrer  = null
                    };
                    _exceptionService.LogException(exceptionLog);
                }
            }

            return(result);
        }
コード例 #29
0
        public ReportViewer EPAssignmentScoringRDLC(SearchEPAssignmentScoringParams searchParams, Email emailInput, string reportType = "Summary")
        {
            DateTime?startDate  = null;
            DateTime?endDate    = null;
            string   reportDate = "All Dates";

            SearchFormat searchoutput = new SearchFormat();

            if (searchParams.DateStart != null)
            {
                startDate = searchParams.DateStart;
                if (searchParams.DateEnd != null)
                {
                    reportDate = searchParams.DateStart.Value.ToShortDateString() + " - " + searchParams.DateEnd.Value.ToShortDateString();
                }
                else
                {
                    reportDate = "since " + searchParams.DateStart.Value.ToShortDateString();
                }
            }

            if (searchParams.DateEnd != null)
            {
                endDate = searchParams.DateEnd.Value.Date.AddHours(23).AddMinutes(59).AddSeconds(59);
                if (searchParams.DateStart == null)
                {
                    reportDate = "through " + searchParams.DateEnd.Value.ToShortDateString();
                }
            }

            ReportViewer reportViewer = new ReportViewer();

            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;
            try
            {
                if (AppSession.ReportScheduleID > 0 && searchParams.ReportTitle != null)
                {
                    searchParams.ReportTitle = String.Concat(searchParams.ReportTitle, " - Report ID: ", AppSession.ReportScheduleID);
                }
                else
                {
                    if (reportType == "Summary")
                    {
                        searchParams.ReportTitle = "Individual and Preliminary Scoring - Summary";
                    }
                    else
                    {
                        searchParams.ReportTitle = "Individual and Preliminary Scoring - Detail";
                    }
                }

                string rdlcfilename = string.Empty;
                string dsName       = string.Empty;

                if (reportType == "Summary")
                {
                    rdlcfilename = "rptEP_Assignment_Scoring_Summary.rdlc";
                    dsName       = "dsEPAssignmentScoringSummary";
                }

                else
                {
                    rdlcfilename = "rptEP_Assignment_Scoring_Detail.rdlc";
                    dsName       = "dsEPAssignmentScoringDetail";
                }

                DataView dvReportResultForEPScoring = new DataView(GetReportDataView(searchParams, reportType).Tables[0]);
                reportViewer.LocalReport.DisplayName = searchParams.ReportTitle;
                reportViewer.LocalReport.ReportPath  = HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath) + @"Areas\Corporate\Reports\" + rdlcfilename;
                reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dsName, dvReportResultForEPScoring));

                string filterBy = string.Empty;
                if (searchParams.FSA == 1)
                {
                    filterBy = "\nInclude FSA Eps";
                }
                if (searchParams.DocRequiredValue == 1)
                {
                    filterBy += "\nDocumentation Required";
                }
                if (searchParams.NewChangedEPs == 1)
                {
                    filterBy += "\nNew Eps";
                }

                searchParams.ScoreTypeNameList = string.Empty;
                if (searchParams.ScoreTypeList.Contains("1"))
                {
                    searchParams.ScoreTypeNameList = "Individual, ";
                }
                if (searchParams.ScoreTypeList.Contains("2"))
                {
                    searchParams.ScoreTypeNameList += "Preliminary";
                }


                searchParams.ScoreValueNameList = string.Empty;
                if (searchParams.ScoreValueList.Contains("2"))
                {
                    searchParams.ScoreValueNameList = "Satisfactory, ";
                }
                if (searchParams.ScoreValueList.Contains("0"))
                {
                    searchParams.ScoreValueNameList += "Insufficient, ";
                }
                if (searchParams.ScoreValueList.Contains("6"))
                {
                    searchParams.ScoreValueNameList += "Not Applicable, ";
                }
                if (searchParams.ScoreValueList.Contains("99"))
                {
                    searchParams.ScoreValueNameList += "Not Scored";
                }

                string assignmentStatus = string.Empty;
                if (searchParams.EPAssigned == 1)
                {
                    assignmentStatus = "Assigned, ";
                }
                if (searchParams.EPNotAssigned == 1)
                {
                    assignmentStatus += "Not Assigned";
                }

                ReportParameter p1  = new ReportParameter("ReportTitle", searchParams.ReportTitle);
                ReportParameter p2  = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Copyright.ToString());
                ReportParameter p3  = new ReportParameter("ProgramName", searchParams.ProgramName);
                ReportParameter p4  = new ReportParameter("SiteName", searchParams.SiteName);
                ReportParameter p5  = new ReportParameter("ReportDateTitle", DateTime.Now.ToString());
                ReportParameter p6  = new ReportParameter("ChapterNameList", searchParams.ChapterNameList);
                ReportParameter p7  = new ReportParameter("StandardNameList", searchParams.StandardNameList);
                ReportParameter p8  = new ReportParameter("AssignedToNameList", searchParams.AssignedToNameList);
                ReportParameter p9  = new ReportParameter("AssignmentPeriod", reportDate);
                ReportParameter p10 = new ReportParameter("ScoreValueNameList", Regex.Replace(searchParams.ScoreValueNameList, ", $", ""));
                ReportParameter p11 = new ReportParameter("ScoreTypeNameList", Regex.Replace(searchParams.ScoreTypeNameList, ", $", ""));
                ReportParameter p12 = new ReportParameter("FilterByList", filterBy == "" ? "None" : filterBy);

                string DocumentationList = string.Empty;
                if (searchParams.OrgFindings == 1)
                {
                    DocumentationList = "All Organizational Findings\n";
                }
                else if (searchParams.OrgFindings == 2)
                {
                    DocumentationList = "Presence of Organizational Findings\n";
                }
                else if (searchParams.OrgFindings == 3)
                {
                    DocumentationList = "Absence of Organizational Findings\n";
                }
                if (searchParams.PlanOfAction == 1)
                {
                    DocumentationList = DocumentationList + "All Plan of Action\n";
                }
                else if (searchParams.PlanOfAction == 2)
                {
                    DocumentationList = DocumentationList + "Presence of Plan of Action\n";
                }
                else if (searchParams.PlanOfAction == 3)
                {
                    DocumentationList = DocumentationList + "Absence of Plan of Action\n";
                }
                if (searchParams.OrgNotes == 1)
                {
                    DocumentationList = DocumentationList + "All Internal Notes\n";
                }
                else if (searchParams.OrgNotes == 2)
                {
                    DocumentationList = DocumentationList + "Presence of Internal Notes\n";
                }
                else if (searchParams.OrgNotes == 3)
                {
                    DocumentationList = DocumentationList + "Absence of Internal Notes\n";
                }
                if (searchParams.LinkedDocs == 1)
                {
                    DocumentationList = DocumentationList + "All Linked Documents\n";
                }
                else if (searchParams.LinkedDocs == 2)
                {
                    DocumentationList = DocumentationList + "Presence of Linked Documents\n";
                }
                else if (searchParams.LinkedDocs == 3)
                {
                    DocumentationList = DocumentationList + "Absence of Linked Documents";
                }

                ReportParameter p13 = new ReportParameter("DocumentationList", DocumentationList);
                ReportParameter p14 = new ReportParameter("AssignmentStatus", Regex.Replace(assignmentStatus, ", $", ""));
                ReportParameter p15 = new ReportParameter("ProgramID", searchParams.ProgramID.ToString());
                ReportParameter p16 = new ReportParameter("IncludeCMS", searchParams.chkIncludeCMS.ToString());

                ReportParameterCollection reportParameterCollection = new ReportParameterCollection {
                    p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16
                };

                reportParameterCollection.Add(new ReportParameter("EPAssigned", searchParams.EPAssigned.ToString()));
                reportViewer.LocalReport.SetParameters(reportParameterCollection);

                if (emailInput.To != null)
                {
                    CommonService emailService = new CommonService();
                    int           actionTypeId = (int)ActionTypeEnum.EPAssignmentReport;
                    if (emailService.SendReportEmail(emailInput, actionTypeId, emailService.SetRdlcEmail(reportViewer)))
                    {
                        HttpContext.Current.Session["EmailSuccess"] = "true";
                    }
                    else
                    {
                        HttpContext.Current.Session["EmailSuccess"] = "false";
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.ToString() != "No Data")
                {
                    ExceptionLog exceptionLog = new ExceptionLog
                    {
                        ExceptionText = "Reports: " + ex.Message,
                        PageName      = "EPAssignmentScoringSummary",
                        MethodName    = "EPAssignmentScoringSummaryRDLC",
                        UserID        = Convert.ToInt32(AppSession.UserID),
                        SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                        TransSQL      = "",
                        HttpReferrer  = null
                    };
                    _exceptionService.LogException(exceptionLog);
                }
                throw ex;
            }

            return(reportViewer);
        }
コード例 #30
0
        public static async Task <(Local::TimetableInfo?timetable, Exception?exception)> GetTimetableFromCistAsync(Local::Entity entity, DateTime dateStart, DateTime dateEnd)
        {
            if ((await SettingsRepository.CheckCistTimetableUpdateRightsAsync(entity)).Count == 0)
            {
                return(null, null);
            }

            try
            {
                MessagingCenter.Send(Application.Current, MessageTypes.TimetableUpdating, entity);
                Analytics.TrackEvent("Cist request", new Dictionary <string, string>
                {
                    { "Type", "GetTimetable" },
                    { "Subtype", entity.Type.ToString() },
                    { "Hour of the day", DateTime.Now.Hour.ToString() }
                });

                // Getting events
                Local::TimetableInfo timetable = await GetTimetableLocalAsync(entity) ?? new(entity);

                Uri    uri         = Urls.CistApiEntityTimetable(entity.Type, entity.ID, dateStart, dateEnd);
                string responseStr = await uri.GetStringOrWebExceptionAsync();

                responseStr = responseStr.Replace("&amp;", "&");
                responseStr = responseStr.Replace("\"events\":[\n]}]", "\"events\": []");
                Cist::Timetable cistTimetable = CistHelper.FromJson <Cist::Timetable>(responseStr);

                // Check for valid results
                if (timetable.Events.Count != 0 && cistTimetable.Events.Count == 0)
                {
                    Analytics.TrackEvent("Received timetable is empty", new Dictionary <string, string>
                    {
                        { "Entity", $"{entity.Type} {entity.Name} ({entity.ID})" },
                        { "From", dateStart.ToString("dd.MM.yyyy") },
                        { "To", dateEnd.ToString("dd.MM.yyyy") }
                    });

                    return(null, null);
                }

                // Updating timetable information
                timetable.Events = cistTimetable.Events
                                   .Select(ev =>
                {
                    Local::Event localEvent = MapConfig.Map <Cist::Event, Local::Event>(ev);
                    localEvent.Lesson       = MapConfig.Map <Cist::Lesson, Local::Lesson>(cistTimetable.Lessons.First(l => l.Id == ev.LessonId));
                    var cistType            = cistTimetable.EventTypes.FirstOrDefault(et => et.Id == ev.TypeId);
                    if (cistType != null)
                    {
                        localEvent.Type = MapConfig.Map <Cist::EventType, Local::EventType>(cistType);
                    }
                    localEvent.Teachers = cistTimetable.Teachers
                                          .Where(t => ev.TeacherIds.Contains(t.Id))
                                          .DistinctBy(t => t.ShortName.Replace('ї', 'i'))
                                          .Select(t => MapConfig.Map <Cist::Teacher, Local::Teacher>(t))
                                          .ToList();
                    localEvent.Groups = cistTimetable.Groups
                                        .Where(g => ev.GroupIds.Contains(g.Id))
                                        .Select(g => MapConfig.Map <Cist::Group, Local::Group>(g))
                                        .ToList();
                    return(localEvent);
                })
                                   .Distinct()
                                   .ToList();

                // Saving timetables
                await UpdateTimetableLocalAsync(timetable);

                // Updating LastUpdated for saved entity
                await UniversityEntitiesRepository.ModifySavedAsync(savedEntities =>
                {
                    var savedEntity = savedEntities.SingleOrDefault(e => e == entity);
                    if (savedEntity == null)
                    {
                        // Saved entity may be deleted while timetable is updating
                        return(true);
                    }

                    savedEntity.LastUpdated = DateTime.Now;
                    return(false);
                });

                return(timetable, null);
            }
            catch (Exception ex)
            {
                ex.Data.Add("Entity", $"{entity.Type} {entity.Name} ({entity.ID})");
                ex.Data.Add("From", dateStart.ToString("dd.MM.yyyy"));
                ex.Data.Add("To", dateEnd.ToString("dd.MM.yyyy"));
                ExceptionService.LogException(ex);

                return(null, ex);
            }
            finally
            {
                MessagingCenter.Send(Application.Current, MessageTypes.TimetableUpdated, entity);
            }
        }