public void RatingFullWithProductByPrice() { var props = TestHelper.LoadProperties(ReportsTypes.RatingFullWithProductByPrice); var report = new RatingReport(Conn, props); TestHelper.ProcessReport(report, ReportsTypes.RatingFullWithProductByPrice); }
public void RatingNewWithPayerList() { var props = TestHelper.LoadProperties(ReportsTypes.RatingWithPayersList); var report = new RatingReport(Conn, props); TestHelper.ProcessReport(report, ReportsTypes.RatingWithPayersList); }
public void RatingJunkOnly() { var props = TestHelper.LoadProperties(ReportsTypes.RatingJunkOnly); var report = new RatingReport(Conn, props); TestHelper.ProcessReport(report, ReportsTypes.RatingJunkOnly); }
public void RatingWithLocalPrice() { ulong price = 216; var fileName = "RatingWithLocalPrice.xls"; Property("JunkState", 0); Property("ReportInterval", 10); Property("ByPreviousMonth", false); Property("PriceCodeEqual", new List <ulong> { price }); // Устанавливаем единственный прайс, по которому делаем отчет в служебный MySqlCommand cmd = new MySqlCommand( String.Format("update usersettings.pricesdata set IsLocal=1 where pricecode={0}", price), Conn); cmd.ExecuteNonQuery(); report = new RatingReport(Conn, properties); BuildReport(fileName); // возвращаем настроки прайса как было cmd = new MySqlCommand( String.Format("update usersettings.pricesdata set IsLocal=0 where pricecode={0}", price), Conn); cmd.ExecuteNonQuery(); Assert.That(((RatingReport)report).ResultTable.Select("F1 is not null").Length, Is.EqualTo(0)); }
public async Task <ActionResult <RatingReportDto> > PostRatingReportAsync(RatingReportDto ratingReportDto) { // getting the authorized students id var identity = (ClaimsIdentity)User.Identity; var studentId = identity.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value; if (studentId == null || m_context.Students.Find(studentId) == null) { return(NotFound("Student not found")); } var report = new RatingReport { Id = Guid.NewGuid(), DateCreated = DateTime.Now, StudentId = studentId, RatingId = ratingReportDto.RatingId, Reason = ratingReportDto.Reason }; m_context.RatingReports.Add(report); await m_context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetRatingReport), new { id = report.Id })); }
public static RatingReportDto SelectRatingReportDto(this RatingReport rr) { return(new RatingReportDto { Id = rr.Id, StudentId = rr.StudentId, DateCreated = rr.DateCreated, Reason = rr.Reason, RatingId = rr.Rating.Id, Rating = rr.Rating.SelectRatingDto() }); }
public void Build_chart() { Property("ByPreviousMonth", false); Property("ClientCodeEqual", new List <ulong> { 3110, 465, 11279 }); Property("ProductNamePosition", 0); Property("BuildChart", true); var file = "Build_chart.xls"; report = new RatingReport(Conn, properties); BuildOrderReport(file); }
public void Show_only_relative_values() { Property("ByPreviousMonth", false); Property("ClientCodeEqual", new List <ulong> { 3110, 465, 11279 }); Property("ProductNamePosition", 0); Property("BuildChart", true); Property("DoNotShowAbsoluteValues", true); var file = "Show_only_relative_values.xls"; report = new RatingReport(Conn, properties); BuildOrderReport(file); }
public void RatingWithoutGroup() { var fileName = "RatingWithoutGroup.xls"; Property("JunkState", 0); Property("ReportInterval", 10); Property("ByPreviousMonth", false); Property("PayerEqual", new List <ulong> { 3450, 3733, 3677 }); report = new RatingReport(Conn, properties); BuildReport(fileName); }
public ActionResult PrintRatingReportPerBusinessUnit(List <SurveyStatus> Survey_ForList, bool includeRaters, string businessUnit) { if (Survey_ForList.Count() == 0) { return(Redirect("PrintRatingReport")); } List <string> itemRow = new List <string>(); RatingReport reportObject = new RatingReport(); DataTable dt = new DataTable(); SurveyForList surveyReportPParameterObject = new SurveyForList(); surveyReportPParameterObject.Type = "Annually"; surveyReportPParameterObject.Period = "2016"; //var tempDirectoryPath = ConfigurationManager.AppSettings["BusinessUnitReportLocation"] + @"" + businessUnit; //var files = Directory.GetFiles(tempDirectoryPath, "*.xlsx"); //if (Directory.Exists(tempDirectoryPath)) //{ // foreach (var item in files) // { // System.IO.File.Delete(item); // } // Directory.Delete(tempDirectoryPath); //} foreach (var ratee in Survey_ForList) { surveyReportPParameterObject.Survey_For = ratee.Survey_For; List <SurveyStatus> list = new List <SurveyStatus>(); list.Add(new SurveyStatus() { Survey_For = ratee.Survey_For }); var raterList = new List <string>(); if (!string.IsNullOrWhiteSpace(ratee.Survey_For)) { dt = new DataTable(); var report = new Surveys().getSurveyForReport(surveyReportPParameterObject); if (report.Count() > 0) { ViewBag.ReportList = report; dt = reportObject.GetColumns(dt, report); reportObject.AddHeadings(dt, ratee.Survey_For, report.First().Period); reportObject.AddQuestionHeadings(dt, report); reportObject.AddQuestionAverallMinRating(dt, report); reportObject.AddQuestionAverallMaxRating(dt, report); reportObject.AddQuestionAverageRating(dt, report); dt.Rows.Add(new List <string>().ToArray()); //if (includeRaters) //{ itemRow.Add("INDIVIDUAL RATER SCORES AND COMMENTS"); dt.Rows.Add(itemRow.ToArray()); var raters = report.Select(c => c.Rater).AsQueryable().Distinct().ToList(); var questionsPerRater = report.Select(c => c.Rater_Comment).AsQueryable().Distinct().ToList(); //for (int i = 0; i < report.Select(c => c.Question_ID).AsQueryable().Distinct().ToList().Count; i++) // { foreach (var item in raters) { var record = report.Where(c => c.Rater == item).ToList(); reportObject.AddIndividualRaterComment(dt, record, includeRaters, item, report); reportObject.AddIndividualRating(dt, record, includeRaters, item, report); } // } //} } } if (!string.IsNullOrWhiteSpace(ratee.Survey_For) && dt.Rows.Count > 0) { GenerateRatingReportExcelFilePerBusinessUnit(dt, list, includeRaters, businessUnit); } } return(Redirect("PrintRatingReport")); }
//[AccessDeniedAuthorize(Roles = @"FUTUREGROWTH\FG-APP-PAS-ADMIN")] public ActionResult PrintRatingReport(string Survey_For) { var generateBulkReport = false; List <SurveyStatus> employeePerBusinessUnit = new List <SurveyStatus>(); var surveyFor = Request.Form["Survey_For"]; var includeRaters = Convert.ToBoolean(Request.Form["IncludeRaters"]); //Generate report per business unit var employeeForList = GetEmployeeList(); var teamList = new Surveys().getSurveyTeams(); if (surveyFor == "Performance and Attribution") { surveyFor = surveyFor.Replace("and", "&"); } var employeeSurveyListPerTeam = teamList.Where(c => c.Team == surveyFor); //if this is true then, generate bulk report if (employeeSurveyListPerTeam.Count() > 0) { generateBulkReport = true; if (generateBulkReport) { employeePerBusinessUnit = employeeForList.Where(c => c.Team_Desc == surveyFor).ToList(); } PrintRatingReportPerBusinessUnit(employeePerBusinessUnit, includeRaters, surveyFor); } else { if (string.IsNullOrWhiteSpace(surveyFor)) { return(View()); } List <string> itemRow = new List <string>(); RatingReport reportObject = new RatingReport(); DataTable dt = new DataTable(); SurveyForList surveyReportPParameterObject = new SurveyForList(); surveyReportPParameterObject.Type = "Annually"; surveyReportPParameterObject.Period = "2016"; surveyReportPParameterObject.Survey_For = surveyFor; var raterList = new List <string>(); if (!string.IsNullOrWhiteSpace(surveyFor)) { var report = new Surveys().getSurveyForReport(surveyReportPParameterObject); if (report.Count > 0) { ViewBag.ReportList = report; dt = reportObject.GetColumns(dt, report); reportObject.AddHeadings(dt, surveyFor, report.First().Period); reportObject.AddQuestionHeadings(dt, report); reportObject.AddQuestionAverallMinRating(dt, report); reportObject.AddQuestionAverallMaxRating(dt, report); reportObject.AddQuestionAverageRating(dt, report); dt.Rows.Add(new List <string>().ToArray()); //if (includeRaters) //{ itemRow.Add("INDIVIDUAL RATER SCORES AND COMMENTS"); dt.Rows.Add(itemRow.ToArray()); var raters = report.Select(c => c.Rater).AsQueryable().Distinct().ToList(); var questionsPerRater = report.Select(c => c.Rater_Comment).AsQueryable().Distinct().ToList(); // for (int i = 0; i < report.Select(c => c.Question_ID).AsQueryable().Distinct().ToList().Count; i++) // { foreach (var item in raters) { var record = report.Where(c => c.Rater == item).ToList(); reportObject.AddIndividualRaterComment(dt, record, includeRaters, item, report); reportObject.AddIndividualRating(dt, record, includeRaters, item, report); } // } //} } } if (!string.IsNullOrWhiteSpace(surveyFor) && dt.Rows.Count > 0) { GenerateRatingReportExcelFile(dt, surveyFor, includeRaters); } } return(RedirectToAction("PrintRatingReport")); }
public IHttpActionResult PrintRatingReport(string Survey_For) { //surveyFor = "Andile Madiba"; if (string.IsNullOrWhiteSpace(Survey_For)) { return(Ok()); } List <string> itemRow = new List <string>(); RatingReport reportObject = new RatingReport(); DataTable dt = new DataTable(); SurveyForList surveyReportPParameterObject = new SurveyForList(); surveyReportPParameterObject.Type = "Annually"; surveyReportPParameterObject.Period = "2016"; surveyReportPParameterObject.Survey_For = Survey_For; var raterList = new List <string>(); if (!string.IsNullOrWhiteSpace(Survey_For)) { var report = new Surveys().getSurveyForReport(surveyReportPParameterObject).GroupBy(c => c.Question_ID).Select(y => y.FirstOrDefault()).ToList(); //dt = reportObject.GetColumns(dt, report); //reportObject.AddHeadings(dt, Survey_For, report.First().Period); //reportObject.AddQuestionHeadings(dt, report); //reportObject.AddQuestionAverallMinRating(dt, report); //reportObject.AddQuestionAverallMaxRating(dt, report); //reportObject.AddQuestionAverageRating(dt, report); //dt.Rows.Add(new List<string>().ToArray()); //itemRow.Add("INDIVIDUAL RATER SCORES AND COMMENTS"); //dt.Rows.Add(itemRow.ToArray()); //foreach (var rater in report) //{ // if (!(raterList.Contains(rater.Rater))) // { // reportObject.AddIndividualRaterComment(dt, report); // reportObject.AddIndividualRating(dt, report); // raterList.Add(rater.Rater); // } //} return(Ok(report)); } //if (!string.IsNullOrWhiteSpace(Survey_For)) //{ // GenerateRatingReportExcelFile(dt, Survey_For); //} return(Ok()); }