public void DownloadAttachment(Attachment attachment, string localPath)
        {
            Procedure procedure = (from p in appManager.ApplicationDb.Procedures
                                   from a in p.Attachments
                                   where a.Id == attachment.Id
                                   select p).FirstOrDefault();
            MedicalRecord medicalRecord = (from m in appManager.ApplicationDb.MedicalRecords
                                           from p in m.Procedures
                                           where p.Id == procedure.Id
                                           select m).FirstOrDefault();
            Patient patient = (from p in appManager.ApplicationDb.Patients
                               from m in p.MedicalHistory
                               where m.Id == medicalRecord.Id
                               select p).FirstOrDefault();

            string medicalRecordPath = String.Format("{0}/{1}", patient.Ssn, medicalRecord.Id);
            string ftpFileName = String.Format("{0}/{1}_{2}_{3}", medicalRecordPath, procedure.Id, attachment.Id, attachment.File);

            FTPConnection ftp = new FTPConnection("193.224.69.39", "balu", "szoftech", "hubasky/attachments");
            ftp.DownloadFile(ftpFileName, localPath);
        }
        private void Btn_NewAttachmentMod_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openDialog = new OpenFileDialog();
            openDialog.Filter = "Képek|*.jpg;*.png;*.bmp|Dokumentumok|*.docx;*.doc;*.pdf|Minden fájl|*.*";
            openDialog.Multiselect = true;
            if (openDialog.ShowDialog() == true)
            {
                FilesToSave = new List<Attachment>();
                LocalPathToSave = new List<string>();
                foreach (string file in openDialog.SafeFileNames)
                {
                    Attachment att = new Attachment(file);
                    Procedure.AddAttachment(att);
                    FilesToSave.Add(att);
                }
                foreach (string file in openDialog.FileNames)
                {
                    LocalPathToSave.Add(file);
                }

                ListBox_Attachments.Items.Refresh();
            }
        }