Пример #1
0
 public AccountController(ApplicationUserManager userManager,
                          ISecureDataFormat <AuthenticationTicket> accessTokenFormat)
 {
     UserManager       = userManager;
     AccessTokenFormat = accessTokenFormat;
     helper            = new HelperClasses();
 }
Пример #2
0
        private void FillLessonsList()
        {
            lessons.Clear();
            for (int i = 0; i < 49; ++i)
            {
                lessons.Add(new DisplayCurriculumLesson());
            }

            if (selectedAuditorium == null)
            {
                return;
            }

            using (UniversitySheduleContainer cnt = new UniversitySheduleContainer("name=UniversitySheduleContainer"))
            {
                var les = (from l in cnt.Lessons.Include("RegulatoryAction.AcademicLoad").Include("RegulatoryAction.Curriculum") where l.Period == upweek && l.AuditoriumId == selectedAuditorium.Id select l);
                foreach (var l in les)
                {
                    int i = HelperClasses.numberDayToIndex(l.Day, l.RingId);
                    lessons[i]._Subject = l.RegulatoryAction.Curriculum.First().Subject.Name;
                    lessons[i]._Teacher = l.RegulatoryAction.AcademicLoad.First().Employe.Name;
                    foreach (var c in l.RegulatoryAction.Curriculum)
                    {
                        lessons[i]._Group += c.Group.GroupAbbreviation + " ";
                    }
                }
            }

            Lessons = new ObservableCollection <DisplayCurriculumLesson>(lessons);
        }
        public ActionResult LoadMonthlyTracerBreakdownChart(Search search)
        {
            try
            {
                ViewBag.Header = HelperClasses.GetMonthsList(search.StartDate, search.EndDate);
                var tcService = new MonthlyBreakdownService();
                search = tcService.GetReportValuesForSearch(search);
                return(PartialView("MonthlyTracerBreakdownChart", search));
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "MonthlyTracerBreakdown",
                    MethodName    = "LoadMonthlyTracerBreakdownChart",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
Пример #4
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"));
            }
        }
        public void Json_Object_To_Json_Test()
        {
            var testObject = new
            {
                City    = "London",
                Country = "GB",
                Weather = "Always Changing",
                MaxTemp = 10,
                MinTemp = 6
            };
            var result = HelperClasses.Json(testObject);

            Assert.AreEqual(result, "{\r\n  \"city\": \"London\",\r\n  \"country\": \"GB\",\r\n  \"weather\": \"Always Changing\",\r\n  \"maxTemp\": 10,\r\n  \"minTemp\": 6\r\n}");
        }
        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"));
            }
        }
        // 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"));
            }
        }
Пример #8
0
        static void Main(string[] args)
        {
            HelperClasses helpercls       = new HelperClasses();
            var           jsonhorsePrices = helpercls.ConvertJson();
            var           xmlhorsePrices  = helpercls.ConvertXml();

            foreach (var horse in jsonhorsePrices)
            {
                Console.WriteLine("JsonHorsePrice = {0} JsonHorseName = {1}", horse.HorsePrice, horse.HorseName);
            }
            foreach (var horse in xmlhorsePrices)
            {
                Console.WriteLine("xmlHorsePrice = {0} xmlHorseName = {1}", horse.HorsePrice, horse.HorseName);
            }
            Console.Read();
        }
        public void Json_Dto_To_Json_Test()
        {
            var testDto = new WeatherDataDTO
            {
                CityName     = "Basingstoke",
                ErrorMessage = "",
                ForecastList = new List <ForecastListDTO>()
                {
                    new ForecastListDTO {
                        Day = "Monday", Humidity = 70, MainTemp = 10, WindSpeed = 3.8m, TempMax = 12.4m, TempMin = 6.5m
                    }
                }
            };
            var result = HelperClasses.Json(testDto);

            Assert.AreEqual(result, "{\r\n  \"errorMessage\": \"\",\r\n  \"cityName\": \"Basingstoke\",\r\n  \"forecastList\": [\r\n    {\r\n      \"day\": \"Monday\",\r\n      \"mainTemp\": 10.0,\r\n      \"tempMin\": 6.5,\r\n      \"tempMax\": 12.4,\r\n      \"pressure\": 0.0,\r\n      \"humidity\": 70,\r\n      \"windSpeed\": 3.8\r\n    }\r\n  ]\r\n}");
        }
        // 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"));
            }
        }
Пример #11
0
        // GET: Tracer/TracerDepartmentAssignment
        public ActionResult Index(int id, int?actionType)
        {
            try
            {
                HelperClasses.SetReportOrScheduleID(id, (int)ReportsListEnum.TracerDepartmentAssignment);

                // NEVER SET THIS VARIABLE TO FALSE. The value is set based on licensing for selected site and program. - Mark Orlando.
                // AppSession.IsCMSProgram = false;

                ViewBag.ScheduledTracerReport = 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_DepartmentAssignment(AppSession.ReportScheduleID, savedParameters, WebConstants.TRACER_REPORT_TITLE_TRACERDEPARTMENT_ASSIGNMENT_REPORT)));
                }
                else
                {
                    return(View(reportservice.GetSearchLists_DepartmentAssignment(WebConstants.TRACER_REPORT_TITLE_TRACERDEPARTMENT_ASSIGNMENT_REPORT)));
                }
            }
            catch (Exception ex)
            {
                ExceptionLog exceptionLog = new ExceptionLog
                {
                    ExceptionText = "Reports: " + ex.Message,
                    PageName      = "_TracerDepartmentAssignment",
                    MethodName    = "Index",
                    UserID        = Convert.ToInt32(AppSession.UserID),
                    SiteId        = Convert.ToInt32(AppSession.SelectedSiteId),
                    TransSQL      = "",
                    HttpReferrer  = null
                };
                exceptionService.LogException(exceptionLog);

                return(RedirectToAction("Error", "Transfer"));
            }
        }
Пример #12
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"));
            }
        }
Пример #13
0
        public async Task <ActionResult> GetWeatherReport(string cityName)
        {
            WeatherDataModel weatherData   = new WeatherDataModel();
            bool             dataRetrieved = false;

            weatherData.ErrorMessage = "Please specify city name to get the weather forecast.";
            // check if cityName is not empty
            if (!string.IsNullOrWhiteSpace(cityName))
            {
                try
                {
                    string result;
                    // get json string result from the service
                    result = await _weatherService.GetWeatherByCity(cityName);

                    if (!string.IsNullOrWhiteSpace(result))
                    {
                        // map json data to our model class
                        // this will be returned as json object to front end
                        weatherData = JsonConvert.DeserializeObject <WeatherDataModel>(result);
                        weatherData.ErrorMessage = "Please specify a valid city name to get the weather forecast. Or the service is currently unavailable.";
                        // check if the correct city weather is returned
                        if (weatherData.City != null)
                        {
                            if (weatherData.City.Name.Equals(cityName, OrdinalIgnoreCase))
                            {
                                weatherData.ErrorMessage = "";
                                dataRetrieved            = true;
                            }
                        }
                    }
                    if (!dataRetrieved && string.IsNullOrWhiteSpace(weatherData.ErrorMessage))
                    {
                        weatherData.ErrorMessage = "There was some technical problem getting the weather report. Please try again after sometime.";
                    }
                }
                catch (Exception ex)
                {
                    weatherData.ErrorMessage = $"There was some problem getting the weather report: {ex.Message}";
                }
            }

            return(Json(HelperClasses.Json(Mapper.Map <WeatherDataDTO>(weatherData)), JsonRequestBehavior.AllowGet));
        }
Пример #14
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"));
            }
        }
        public ActionResult Index(int id, int?actionType)
        {
            HelperClasses.SetReportOrScheduleID(id, (int)ReportsListEnum.OrganizationPriorityFindings);

            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);
            }

            SearchInputService reportservice = new SearchInputService();

            return(View(reportservice.GetOrgFindingsSearchParams(WebConstants.TRACER_REPORT_TITLE_TRACER_PRIORITY_FINDING)));
        }
Пример #16
0
        // GET: Corporate/EPScoring
        public ActionResult Index(int id, int?actionType)
        {
            HelperClasses.SetReportOrScheduleID(id, (int)ReportsListEnum.EPScoringReport);

            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.AMP_EP_SCORING_REPORT)));
            }
            else
            {
                return(View(reportservice.GetCorpSearchLists(WebConstants.AMP_EP_SCORING_REPORT)));
            }
        }
        public void Json_Empty_Object_test()
        {
            var result = HelperClasses.Json(null);

            Assert.AreEqual(result, String.Empty);
        }
Пример #18
0
 /// <summary>
 /// Поиск структуры требуемой задачи в списке структур всех задач,
 /// входящих в выбранный проект
 ///    Входные параметры: 
 ///        String key - ключ задачи Ганта 
 ///    Выходные параметры         Поиск структуры требуемой задачи в списке структур всех задач,
 ///        ref stTask strTask - структура найденной задачи         входящих в выбранный проект
 ///        return bool - true - структура задачи найдена             
 ///        
 /// </summary>
 public bool FindStOnKeyGantt(String keyGantt, ref HelperClasses.clTask strTask, ref int index)
 {
     var st = mainList.FirstOrDefault(o => o.keyGantt == keyGantt);
     if (st != null)
     {
         strTask = st;
         index = mainList.IndexOf(strTask);
         return true;
     }
     return false;
 }
 public PersonController()
 {
     helper = new HelperClasses();
 }
Пример #20
0
        public ActionResult Index(int id, int?actionType)
        {
            try
            {
                if (!AppSession.HasValidSession)
                {
                    SessionExpired();
                }

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

                SearchInputService reportservice  = new SearchInputService();
                SearchList         list           = new SearchList();
                string             savedChapters  = string.Empty;
                string             savedStandards = string.Empty;

                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);

                    //Get the saved Chapters and Standards
                    savedChapters  = savedParameters.ReportParameters.FirstOrDefault(param => param.ReportParameterName == WebConstants.TRACERS_CHAPTER).ParameterValue;
                    savedStandards = savedParameters.ReportParameters.FirstOrDefault(param => param.ReportParameterName == WebConstants.TRACERS_STANDARD).ParameterValue;

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

                list.TracersChapters = reportservice.GetTracersChapters().TracersChapters;

                List <TracersStandards> standardList = new List <TracersStandards>();
                if (!String.IsNullOrWhiteSpace(savedChapters) && savedChapters != "-1") //Load standards only for the selected Chapters
                {
                    standardList = reportservice.GetTracersStandards(savedChapters).TracersStandards.ToList();
                }
                else
                {
                    standardList.Add(new TracersStandards
                    {
                        TracerStandardID = Convert.ToInt32(-1),
                        Code             = "All"
                    });
                }
                list.TracersStandards = standardList;

                List <TracersEP> epList = new List <TracersEP>();
                if (!String.IsNullOrWhiteSpace(savedStandards) && savedStandards != "-1") //Load EPs only for the selected Standards and Chapters
                {
                    epList = reportservice.GetTracersEPs(savedChapters, savedStandards).TracersEPs.ToList();
                }
                else
                {
                    epList.Add(new TracersEP
                    {
                        EPTextID = Convert.ToInt32(-1),
                        StandardLabelAndEPLabel = "All",
                    });
                }

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

                return(RedirectToAction("Error", "Transfer"));
            }
        }
Пример #21
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     HelperClasses.MainProgram();
 }
        public JsonResult SaveReport(List <Dictionary <string, string> > objDictionary)
        {
            string message = string.Empty;

            try
            {
                int             reportID   = AppSession.ReportID;
                SaveAndSchedule oSaveModel = new SaveAndSchedule();

                //Set the schedule information
                if (AppSession.ReportScheduleID > 0 && Convert.ToInt16(objDictionary.Find(p => p.ContainsKey("ReportDelete"))["ReportDelete"]) != 1)
                {
                    oSaveModel.ReportUserScheduleID = AppSession.ReportScheduleID;

                    SaveAndScheduleService oScheduleService = new SaveAndScheduleService();
                    oSaveModel = oScheduleService.LoadUserSchedule(AppSession.ReportScheduleID);
                }
                else
                {
                    oSaveModel.LastRunStatus = (int)LastRunStatus.NotRun;
                    oSaveModel.UserID        = AppSession.UserID;
                }
                oSaveModel.ReportParameters.Clear();

                oSaveModel.ReportID = AppSession.ReportID;

                //Get all the selected sites
                var selectedSites = objDictionary.Find(d => d.ContainsKey("SelectedSites")) != null?
                                    objDictionary.Find(d => d.ContainsKey("SelectedSites"))["SelectedSites"].ToString() : string.Empty;

                oSaveModel.ReportSiteMaps.Clear();
                if (!String.IsNullOrWhiteSpace(selectedSites))
                {
                    foreach (var site in selectedSites.Trim(',').Split(','))
                    {
                        oSaveModel.ReportSiteMaps.Add(new ReportUserScheduleSiteMap {
                            SiteID = Convert.ToInt32(site)
                        });
                    }
                }
                else
                {
                    oSaveModel.ReportSiteMaps.Add(new ReportUserScheduleSiteMap {
                        SiteID = AppSession.SelectedSiteId
                    });
                }

                var scheduledReportName = objDictionary.Find(d => d.ContainsKey("ScheduledReportName"));
                if (scheduledReportName != null && scheduledReportName.Count > 0)
                {
                    oSaveModel.ReportNameOverride = scheduledReportName["ScheduledReportName"];
                    AppSession.ReportScheduleName = scheduledReportName["ScheduledReportName"];
                }

                var scheduledReportDesc = objDictionary.Find(d => d.ContainsKey("ScheduledReportDesc"));
                if (scheduledReportDesc != null && scheduledReportDesc.Count > 0)
                {
                    oSaveModel.ReportDescription  = scheduledReportDesc["ScheduledReportDesc"];
                    AppSession.ReportScheduleDesc = scheduledReportDesc["ScheduledReportDesc"];
                }

                var reportType = objDictionary.Find(d => d.ContainsKey("ReportType"));
                if (reportType != null && reportType.Count > 0)
                {
                    if (string.Equals(reportType["ReportType"], "ExcelView"))
                    {
                        oSaveModel.RenderFormatTypeID = (int)RenderFormatType.Excel;
                    }
                    else
                    if (reportID == (int)ReportsListEnum.ComplianceByDepartment || reportID == (int)ReportsListEnum.TracerComplianceDepartment)
                    {
                        oSaveModel.RenderFormatTypeID = (int)RenderFormatType.Excel;
                    }
                    else
                    {
                        oSaveModel.RenderFormatTypeID = (int)RenderFormatType.PDF;
                    }
                }
                else
                {
                    //Only excel format for Monthly breakdowns reports
                    if (reportID == (int)ReportsListEnum.MonthlyQuestionBreakdown || reportID == (int)ReportsListEnum.MonthlyTracerBreakdown || reportID == (int)ReportsListEnum.ComplianceByDepartment)
                    {
                        oSaveModel.RenderFormatTypeID = (int)RenderFormatType.Excel;
                    }
                    else
                    {
                        oSaveModel.RenderFormatTypeID = (int)RenderFormatType.PDF;
                    }
                }
                oSaveModel.Priority = 1;

                //Recurrence information
                oSaveModel.EmailTo = objDictionary.Find(d => d.ContainsKey("EmailTo")) != null?objDictionary.Find(d => d.ContainsKey("EmailTo"))["EmailTo"].ToString() : String.Concat(AppSession.EmailAddress, "; ");

                //Check for Email place holder texts
                oSaveModel.EmailCC = objDictionary.Find(d => d.ContainsKey("EmailCC")) != null?objDictionary.Find(d => d.ContainsKey("EmailCC"))["EmailCC"].ToString() : String.Empty;

                if (!String.IsNullOrWhiteSpace(oSaveModel.EmailCC) && oSaveModel.EmailCC == EMAILPLACEHOLDER)
                {
                    oSaveModel.EmailCC = string.Empty;
                }

                oSaveModel.EmailBCC = objDictionary.Find(d => d.ContainsKey("EmailBCC")) != null?objDictionary.Find(d => d.ContainsKey("EmailBCC"))["EmailBCC"].ToString() : String.Empty;

                if (!String.IsNullOrWhiteSpace(oSaveModel.EmailBCC) && oSaveModel.EmailBCC == EMAILPLACEHOLDER)
                {
                    oSaveModel.EmailBCC = string.Empty;
                }

                oSaveModel.ReplyTo = string.Empty;
                oSaveModel.Subject = objDictionary.Find(d => d.ContainsKey("Subject")) != null?objDictionary.Find(d => d.ContainsKey("Subject"))["Subject"].ToString() : String.Empty;

                oSaveModel.Comment = objDictionary.Find(d => d.ContainsKey("Comment")) != null?objDictionary.Find(d => d.ContainsKey("Comment"))["Comment"].ToString() : String.Empty;

                var scheduleTypeID = objDictionary.Find(p => p.ContainsKey("ScheduleTypeID")) == null ? 0 : Convert.ToInt16(objDictionary.Find(p => p.ContainsKey("ScheduleTypeID"))["ScheduleTypeID"]);

                oSaveModel.DaysOfWeek  = null;
                oSaveModel.DaysOfMonth = null;

                if (scheduleTypeID == (int)ScheduleType.Weekly)
                {
                    oSaveModel.ScheduleTypeID         = (int)ScheduleType.Weekly;
                    oSaveModel.DaysOfWeek             = objDictionary.Find(p => p.ContainsKey("DaysOfWeek"))["DaysOfWeek"].ToString().TrimEnd(',');
                    oSaveModel.ReportScheduleStatusID = (int)ScheduleStatus.Scheduled;
                }
                else if (scheduleTypeID == (int)ScheduleType.Monthly)
                {
                    oSaveModel.ScheduleTypeID         = (int)ScheduleType.Monthly;
                    oSaveModel.DaysOfMonth            = Convert.ToInt16(objDictionary.Find(p => p.ContainsKey("DaysOfMonth"))["DaysOfMonth"]);
                    oSaveModel.ReportScheduleStatusID = (int)ScheduleStatus.Scheduled;
                }
                else if (scheduleTypeID == (int)ScheduleType.Quarterly)
                {
                    oSaveModel.ScheduleTypeID         = (int)ScheduleType.Quarterly;
                    oSaveModel.DaysOfQuarter          = Convert.ToInt16(objDictionary.Find(p => p.ContainsKey("PeriodOfQuarter"))["PeriodOfQuarter"]);
                    oSaveModel.ReportScheduleStatusID = (int)ScheduleStatus.Scheduled;
                }
                else if (scheduleTypeID == (int)ScheduleType.Daily)
                {
                    oSaveModel.ScheduleTypeID         = (int)ScheduleType.Daily;
                    oSaveModel.ReportScheduleStatusID = (int)ScheduleStatus.Scheduled;
                }
                else
                {
                    oSaveModel.ScheduleTypeID         = (int)ScheduleType.None;
                    oSaveModel.ReportScheduleStatusID = (int)ScheduleStatus.Complete;
                }
                if (Convert.ToInt16(objDictionary.Find(p => p.ContainsKey("ReportDelete"))["ReportDelete"]) == 1)
                {
                    // We hit report limit issue and want ReportLauncher to generate report for us
                    oSaveModel.ReportDelete   = 1;
                    oSaveModel.DaysOfWeek     = null;
                    oSaveModel.DaysOfMonth    = null;
                    oSaveModel.ScheduleTypeID = (int)ScheduleType.None;         // Should not be rescheduled

                    // Launch report immediately
                    oSaveModel.ReportScheduleStatusID = (int)ScheduleStatus.Pending;
                }
                else
                {
                    oSaveModel.ReportDelete = 0;
                }


                oSaveModel.NextRunScheduled = HelperClasses.CalculateNextRunDate(oSaveModel.ScheduleTypeID, oSaveModel.DaysOfWeek, oSaveModel.DaysOfMonth, oSaveModel.DaysOfQuarter);

                oSaveModel.UpdateByUserId   = AppSession.UserID;
                oSaveModel.ReportLauncherID = 1;

                //Set the parameters
                SaveAndScheduleService objSaveService = new SaveAndScheduleService();
                var lstReportParameters = objSaveService.GetReportParameters(reportID);

                foreach (var parameter in lstReportParameters)
                {
                    var param = objDictionary.Find(d => d.ContainsKey(parameter.ParameterName));
                    if (param != null && param.Count > 0)
                    {
                        oSaveModel.ReportParameters.Add(new ReportUserScheduleParameter
                        {
                            ReportParameterID   = parameter.ReportParameterID,
                            ParameterValue      = param[parameter.ParameterName],
                            DisplayTextOverride = parameter.DisplayText
                        });
                    }
                }

                SaveAndScheduleService oService = new SaveAndScheduleService();
                //  AppSession.ReportScheduleID = oService.SaveUserSchedule(oSaveModel);
                int ReportScheduleID = oService.SaveUserSchedule(oSaveModel);
                if (ReportScheduleID > 0)
                {
                    if (oSaveModel.ReportDelete == 0)
                    {
                        AppSession.ReportScheduleID = ReportScheduleID;
                        message = string.Format("{0} has been saved successfully!!", AppSession.ReportScheduleName);
                    }
                    else
                    {
                        message = "The report will be delivered to the recipient email addresses. It may take a few minutes for the report to show up in your email inbox.";
                    }
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", "Error saving the report");
                message = "Error saving the report";
            }

            return(Json(message));
        }
Пример #23
0
 public AccountController()
 {
     helper = new HelperClasses();
 }
        public ActionResult LoadMonthlyTracerBreakdown(DateTime?StartDate, DateTime?EndDate)
        {
            ViewBag.Header = HelperClasses.GetMonthsList(StartDate, EndDate);

            return(PartialView("MonthlyTracerBreakdown"));
        }
Пример #25
0
        //
        // GET: /TracersByTJCStandard/
        public ActionResult Index(int id, int?actionType)
        {
            try
            {
                if (!AppSession.HasValidSession)
                {
                    return(RedirectToAction("IndexER", "Transfer", new { area = "" }));
                }

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

                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_ByTJCStandard(AppSession.ReportScheduleID, savedParameters, WebConstants.ERTRACER_REPORT_TITLE_Tracer_By_TJC_Standard)));
                }
                else
                {
                    ERSearchList list = new ERSearchList();
                    list = reportservice.GetSearchLists_ByTJCStandard(WebConstants.ERTRACER_REPORT_TITLE_Tracer_By_TJC_Standard);
                    List <TracersStandards> standardList = new List <TracersStandards>();
                    standardList.Add(new TracersStandards
                    {
                        TracerStandardID = Convert.ToInt32(-1),
                        Code             = "All"
                    });
                    list.TracersStandards = standardList;
                    List <TracersEP> epList = new List <TracersEP>();

                    epList.Add(new TracersEP
                    {
                        EPTextID = Convert.ToInt32(-1),
                        StandardLabelAndEPLabel = "All",
                    });


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

                return(RedirectToAction("Error", "Transfer"));
            }
        }