Esempio n. 1
0
        // GET: /ResponsibleRegistration/Report
        //public FileStreamResult Report()
        //{
        //    if (Request.IsAuthenticated)
        //    {
        //        List<Recommend> lst = new List<Recommend>();
        //        foreach (var item in myData)
        //        {
        //            Recommend rec = new Recommend();
        //            rec.ActionNeeded = item.ActionNeeded.ToString();
        //            if (rec.Eveidences != null)
        //                rec.Eveidences = item.Eveidences.ToString();
        //            rec.ID = item.ID.ToString();
        //            rec.IDDivisionProgram = item.IDDivisionProgram.ToString();
        //            rec.Overseeing = item.Overseeing.ToString();
        //            rec.OverseeingPerson = item.OverseeingPerson.ToString();
        //            rec.Recommendations = item.Recommendations.ToString();
        //            rec.Resource = item.Resource.ToString();
        //            rec.Resources = item.Resources.ToString();
        //            rec.ResponsibleEmail = item.ResponsibleEmail.ToString();
        //            rec.ResponsibleOffice = item.ResponsibleOffice.Name.ToString();
        //            rec.ResponsibleOfficePerson = item.ResponsibleOfficePerson.ToString();
        //            DateTime dt;
        //            DateTime.TryParse(item.TimeFrame.ToString(), out dt);
        //            rec.TimeFrame = dt.ToString("dd/MM/yyyy");
        //            lst.Add(rec);
        //        }
        //        var rpt = new PdfController().CreateRecommendationReport(lst);
        //        MemoryStream workStream = new MemoryStream();
        //        using (FileStream file = new FileStream(AppPath.ApplicationPath + @"\Reports\Recommendation.pdf", FileMode.Open, FileAccess.Read))
        //        {
        //            byte[] bytes = new byte[file.Length];
        //            file.Read(bytes, 0, (int)file.Length);
        //            workStream.Write(bytes, 0, (int)file.Length);
        //            workStream.Position = 0;
        //        }
        //        return new FileStreamResult(workStream, "application/pdf");
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}
        public FileStreamResult Report(int? id)
        {
            if (Request.IsAuthenticated)
            {
                var division = db.DivisionPrograms.FirstOrDefault(o => o.ID == id);

                List<Recommend> lst = new List<Recommend>();
                foreach (var item in myData)
                {
                    Recommend rec = new Recommend();
                    rec.ActionNeeded = item.ActionNeeded.ToString();
                    if (rec.Eveidences != null)
                        rec.Eveidences = item.Eveidences.ToString();
                    rec.ID = item.ID.ToString();
                    rec.IDDivisionProgram = item.IDDivisionProgram.ToString();
                    rec.Overseeing = item.Overseeing.ToString();
                    rec.OverseeingPerson = item.OverseeingPerson.ToString();
                    rec.Recommendations = item.Recommendations.ToString();
                    rec.Resource = item.Resource.ToString();
                    rec.Resources = item.Resources.ToString();
                    rec.ResponsibleEmail = item.ResponsibleEmail.ToString();
                    rec.ResponsibleOffice = item.ResponsibleOffice.Name.ToString();
                    rec.ResponsibleOfficePerson = item.ResponsibleOfficePerson.ToString();
                    DateTime dt;
                    DateTime.TryParse(item.TimeFrame.ToString(), out dt);
                    rec.TimeFrame = dt.ToString("dd/MM/yyyy");
                    lst.Add(rec);
                }

                var rpt = new PdfController().CreateRecommendationReport(lst, division);

                MemoryStream workStream = new MemoryStream();
                using (FileStream file = new FileStream(AppPath.ApplicationPath + @"\Reports\Recommendation.pdf", FileMode.Open, FileAccess.Read))
                {
                    byte[] bytes = new byte[file.Length];
                    file.Read(bytes, 0, (int)file.Length);
                    workStream.Write(bytes, 0, (int)file.Length);
                    workStream.Position = 0;
                }

                return new FileStreamResult(workStream, "application/pdf");
            }
            else
            {
                return null;
            }
        }
        // GET: /ResponsibleRegistration/Report
        public FileStreamResult Report()
        {
            if (Request.IsAuthenticated)
            {
                List<NQFRegistration> lst = new List<NQFRegistration>();
                foreach (var item in myData)
                {
                    NQFRegistration nqf = new NQFRegistration();
                    nqf.ID = item.ID.ToString();
                    nqf.MemberID = item.MemberID.ToString();
                    nqf.NQFIDNumber = item.NQFIDNumber.ToString();
                    nqf.NQFLevel = item.NQFLevel.ToString();
                    nqf.NQFRegistrationStatus = item.NQFRegistrationStatus.ToString();
                    nqf.QualificationName = item.QualificationName.ToString();
                    nqf.ReviewDate = item.ReviewDate.ToString();
                    lst.Add(nqf);
                }

                var rpt = new PdfController().CreateResponsibleRegistrationReport(lst);

                MemoryStream workStream = new MemoryStream();
                using (FileStream file = new FileStream(AppPath.ApplicationPath + @"\Reports\ResponsibleRegistration.pdf", FileMode.Open, FileAccess.Read))
                {
                    byte[] bytes = new byte[file.Length];
                    file.Read(bytes, 0, (int)file.Length);
                    workStream.Write(bytes, 0, (int)file.Length);
                    workStream.Position = 0;
                }

                return new FileStreamResult(workStream, "application/pdf");
            }
            else
            {
                return null;
            }
        }
        // GET: /ResponsibleAccreditation/Report
        public FileStreamResult Report()
        {
            if (Request.IsAuthenticated)
            {
                List<Accreditation> lst = new List<Accreditation>();
                foreach (var item in myData)
                {
                    Accreditation accre = new Accreditation();
                    accre.Accreditations = item.Accreditation.ToString();
                    accre.AccreditationDate = item.AccreditationDate.ToString();
                    accre.Emails = item.Emails.ToString();
                    accre.ID = item.ID.ToString();
                    accre.MemberID = item.MemberID.ToString();
                    accre.NQFLevel = item.NQFLevel.ToString();
                    accre.QualificationName = item.QualificationName.ToString();
                    DateTime rvDate = item.ReviewDate.Value;
                    accre.ReviewDate = rvDate.ToString("dd/MM/yyyy");
                    lst.Add(accre);
                }

                var rpt = new PdfController().CreateRoleAccreditationReport(lst);

                MemoryStream workStream = new MemoryStream();
                using (FileStream file = new FileStream(AppPath.ApplicationPath + @"\Reports\ResponsibleAccreditation.pdf", FileMode.Open, FileAccess.Read))
                {
                    byte[] bytes = new byte[file.Length];
                    file.Read(bytes, 0, (int)file.Length);
                    workStream.Write(bytes, 0, (int)file.Length);
                    workStream.Position = 0;
                }

                return new FileStreamResult(workStream, "application/pdf");
            }
            else
            {
                return null;
            }
        }