Ejemplo 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;
            }
        }
Ejemplo n.º 2
0
        public IActionResult LoadUserTrainingReport(int Id)
        {
            try
            {
                List <UserTrainingCalendar> userTrainingCalendarList = new List <UserTrainingCalendar>();
                var UserTrainingList = _ITraining.GetUserTrainingList(Id);
                var UserCalendarList = _ICalendar.GetUserCalendarList(Id);
                foreach (var v in UserTrainingList)
                {
                    UserTrainingCalendar entry = new UserTrainingCalendar();
                    entry.Training         = v.TrainingCode + " - " + v.Training;
                    entry.TrainingCategory = v.TrainingCategory;
                    entry.Priority         = v.Priority;
                    if (v.IsPrimary)
                    {
                        entry.IsPrimary = "Primary Skills";
                    }
                    else
                    {
                        entry.IsPrimary = "Secondary Skills";
                    }
                    var data = UserCalendarList.Where(a => a.TrainingId == v.TrainingId).FirstOrDefault();
                    if (data != null)
                    {
                        if (data.Attended)
                        {
                            entry.Status = "Attended on " + data.StartDate.ToString("dd-MM-yyyy");
                            entry.Color  = "#5cb85c";
                        }
                        else
                        {
                            entry.Status = "Not Attended " + data.StartDate.ToString("dd-MM-yyyy");
                            entry.Color  = "#D9534F";
                        }
                    }
                    else
                    {
                        entry.Status = "Not yet scheduled";
                        entry.Color  = "#aaa";
                    }
                    userTrainingCalendarList.Add(entry);
                }

                //total number of rows counts
                var recordsTotal = userTrainingCalendarList.Count;
                //Returning Json Data
                return(Json(new { recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = userTrainingCalendarList }));
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        public IActionResult LoadUserTrainingData(int Id)
        {
            try
            {
                var UserTrainingList = _ITraining.GetUserTrainingList(Id).AsEnumerable();

                var usertrainingData = UserTrainingList;

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