コード例 #1
0
        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"));
        }
コード例 #2
0
        public IHttpActionResult NotifyRatersByRater(string rater, string selectedSurveyFor)
        {
            var selectedSurveyForList = selectedSurveyFor.Split(',');

            var user = Generic.GetCurrentLogonUserName();

            foreach (var empObject in selectedSurveyForList)
            {
                try
                {
                    StringBuilder emailBody = new StringBuilder();

                    var redirectlink = ConfigurationManager.AppSettings["CompleteSurveyLink"];

                    var adminFullName = ConfigurationManager.AppSettings["adminFullName"];

                    SurveyEmployee employee = new SurveyEmployee();

                    employee.Employee = rater.ToLower();

                    var email = new Surveys().getSurveyManager(employee);

                    var emailAddress = !string.IsNullOrWhiteSpace(employee.Employee) ? email.First().EmpEmail : "";

                    //var emailAddress = GetEmailAddress(rater);

                    emailBody.Append("Dear " + rater);

                    emailBody.Append("\n\n");

                    emailBody.Append("You have been asked to complete a 360 degree performance survey for " + empObject + "\n\n");

                    emailBody.Append("Follow the link below to complete the questionnaire.\n\n");

                    emailBody.Append("Link to questionnaire\t " + redirectlink + "\n\n");

                    emailBody.Append("If you have any questions please come and chat to me. \n\n");

                    emailBody.Append("The deadline for completion of the 360-degree review process is Monday 16 January 2017. [Please note: The system will be closed after this date in order to run the reports.] \n\n");

                    emailBody.Append("Regards,\n");

                    //var employeeFulleName = new Surveys().getSurveyTeamEmployeeList().Where(c => c.AD_User_Name.ToLower() == user.ToLower()).First().Employee;

                    emailBody.Append(adminFullName + "\n\n");
                    try
                    {
                        EmailSurveyEmail(emailBody.ToString(), emailAddress);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }

            return(Ok());
        }
コード例 #3
0
        //[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"));
        }