public FileResult Process(PatientPortal.Models.PatientModel p) { var fs = new FileStream(Server.MapPath("../..") + "\\Content\\template.pptx", System.IO.FileMode.Open, System.IO.FileAccess.Read); var ppt = new Aspose.Slides.Pptx.PresentationEx(fs); fs.Close(); (ppt.Slides[0].Shapes[0] as Aspose.Slides.Pptx.AutoShapeEx).TextFrame.Text = p.ID; int x = 1; int fields_in_slide = 0; var unwritten_text = ""; foreach (PropertyInfo prop in typeof(PatientModel).GetProperties()) { if (prop.GetValue(p) != null) { if (fields_in_slide == 5) { ppt.Slides.AddClone(ppt.Slides[1]); fields_in_slide = 0; x++; } string title; DisplayAttribute[] attributes = (DisplayAttribute[])prop.GetCustomAttributes(typeof(DisplayAttribute), false); if ((attributes != null) && (attributes.Length > 0)) { title = attributes[0].Name; } else { title = prop.Name; } var value = prop.GetValue(p); unwritten_text = title + ":" + prop.GetValue(p).ToString() + "\n"; (ppt.Slides[x].Shapes[1] as Aspose.Slides.Pptx.AutoShapeEx).TextFrame.Text += fields_in_slide++; } } //var img = ppt.Images.AddImage(System.Drawing.Image.FromFile(Server.MapPath("../..") + "\\target\\Picture1.png")); //ppt.Slides[2].Shapes.AddPictureFrame(ShapeTypeEx.Rectangle, 100, 100, img.Width, img.Height, img); ppt.Save(Server.MapPath("../..") + "/target/casepresentation.pptx", Aspose.Slides.Export.SaveFormat.Pptx); return(new FileStreamResult(new FileStream(Server.MapPath("../..") + "/target/casepresentation.pptx", System.IO.FileMode.Open, System.IO.FileAccess.Read), "application/vnd.openxmlformats-officedocument.presentationml.presentation")); }
public void AddPatient(PatientModel patient) { var result =_patients.Insert<PatientModel>(patient); if (result.ErrorMessage != null) throw new Exception("Problem inserting document"); }
public IEnumerable<FileModel> GetFilesForPatient(PatientModel patient) { var cursor = _gridFS.Find(Query.EQ("metadata.PatientID", patient.ID)); foreach (var result in cursor) { yield return FileModelFromGridFSMetadata(result); } }
public PatientViewModel(PatientModel model, IList<FileModel> files) { Patient = model; Files = files; }
public PatientViewModel() { Patient = new PatientModel(); Files = new List<FileModel>(); }
public PatientViewModel(PatientModel model, IList <FileModel> files) { Patient = model; Files = files; }
public PatientViewModel() { Patient = new PatientModel(); Files = new List <FileModel>(); }