Exemplo n.º 1
0
        public FileStreamResult CreateMigraDocPdf(int Id)
        {
            try
            {
                var mentor     = _IMentor.GetUserMentorList(Id);
                var user       = _IUser.GetUser(Id);
                var aspiration = _IAspiration.GetUserAspirationList(Id);
                var allocation = _IAllocation.GetUserAllocationList(Id);
                var iinternal  = _IInternal.GetUserInternalList(Id);
                var training   = _ITraining.GetUserTrainingList(Id);

                var data = new PdfData
                {
                    DocumentTitle    = "CDP for " + user.Name,
                    DocumentName     = "CDP - " + Regex.Replace(user.Name, @"\t|\n|\r", ""),
                    CreatedBy        = "system",
                    Description      = "Career Development Plan",
                    DisplayListItems = new List <ItemsToDisplay>
                    {
                        new ItemsToDisplay {
                            Id = "Print Servers", Data1 = "some data", Data2 = "more data to display"
                        },
                        new ItemsToDisplay {
                            Id = "Network Stuff", Data1 = "IP4", Data2 = "any left"
                        },
                        new ItemsToDisplay {
                            Id = "Job details", Data1 = "too many", Data2 = "say no"
                        },
                        new ItemsToDisplay {
                            Id = "Firewall", Data1 = "what", Data2 = "Let's burn it"
                        }
                    },
                    User       = user,
                    Training   = training,
                    Allocation = allocation,
                    Aspiration = aspiration,
                    IInternal  = iinternal,
                    Mentor     = mentor
                };
                var path = _migraDocService.CreateMigraDocPdf(data);

                var stream = new FileStream(path, FileMode.Open);
                return(File(stream, "application/pdf"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public IActionResult LoadUserAspirationData(int Id)
        {
            try
            {
                var UserAspirationList = _IAspiration.GetUserAspirationList(Id).AsEnumerable();

                //total number of rows counts
                var recordsTotal = UserAspirationList.Count();
                //Returning Json Data
                return(Json(new { recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = UserAspirationList }));
            }
            catch (Exception)
            {
                throw;
            }
        }