Example #1
0
        public string GetPdf(int patientId, int noteId)
        {
            string converted = string.Empty;

            tblDocMaster patientNotes = _unitOfWork.DocMasterRepo.Get(o => o.PTrowid == patientId && o.Docrowid == noteId).FirstOrDefault();

            if (!string.IsNullOrEmpty(patientNotes.PDFName))
            {
                byte[] pdfBytes = CloudeStoreg.ByteFromFile(patientNotes.PDFName);
                //byte[] pdfBytes;
                //string pdfName = Path.GetFileName(filePath);

                //string networkPath = filePath.Replace("\\" + pdfName, "");
                //string username = Convert.ToString(ConfigurationManager.AppSettings["NetworkUserName"]);
                //string password = Convert.ToString(ConfigurationManager.AppSettings["NetworkPassword"]);
                //var credentials = new NetworkCredential(username, password);
                //using (new NetworkConnection(networkPath, credentials))
                //{
                //    pdfBytes = System.IO.File.ReadAllBytes(filePath);
                //}


                //   filePath = @"C:\Users\Shukraj Khadse\Downloads\Driving Licence.pdf";

                //  byte[] pdfBytes = System.IO.File.ReadAllBytes(filePath);
                converted = Encoding.UTF8.GetString(pdfBytes, 0, pdfBytes.Length);
            }
            else
            {
                converted = "Note has not been signed, Please sign the note first";
            }

            return(converted);
        }
Example #2
0
        public bool SendRefEMail(string recipient, int npinum, int patientId, int noteId)
        {
            bool isMessageSent = true;
            //Intialise Parameters
            //   string aa = "appdatafiles\\EasyDoc\\D1\\121-108590_ALINA_YELIZAROV_PPOC_1_11-21-2017_5-19-2019-6-41-26-PM_RefSigned.pdf";
            tblPatients     patientNotes  = _unitOfWork.PatientEntityRepo.Get(o => o.Prowid == patientId).FirstOrDefault();
            tblReferrerSign _ReferralSign = _unitOfWork.ReferrerSignRepo.Get(o => o.NPINumber == npinum &&
                                                                             o.PTrowid == patientId && o.Docrowid == noteId
                                                                             ).FirstOrDefault();
            var smtpEmail    = Convert.ToString(ConfigurationManager.AppSettings["SMTPEmail"]);
            var smtpPassword = Convert.ToString(ConfigurationManager.AppSettings["SMTPPassword"]);

            try
            {
                byte[]      pdfBytes   = CloudeStoreg.ByteFromFile(_ReferralSign.PDFName);
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");
                string      filename   = "Sign Notes " + DateTime.Now.ToString("yyyyMMdd_hhss") + ".pdf";
                mail.From = new MailAddress(smtpEmail);
                mail.To.Add(recipient);
                mail.Subject = "Referral Notes PDF for " + patientNotes.LastName + ", " + patientNotes.FirstName;
                mail.Body    = "Sign note Attchment - " + patientNotes.LastName + ", " + patientNotes.FirstName;;
                var memStream = new MemoryStream(pdfBytes);
                memStream.Position = 0;
                var contentType      = new System.Net.Mime.ContentType(System.Net.Mime.MediaTypeNames.Application.Pdf);
                var reportAttachment = new Attachment(memStream, contentType);
                reportAttachment.ContentDisposition.FileName = filename;
                mail.Attachments.Add(reportAttachment);
                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential(smtpEmail, smtpPassword);
                SmtpServer.EnableSsl   = true;

                SmtpServer.Send(mail);
            }

            catch (Exception ex)
            {
                isMessageSent = false;
            }
            return(isMessageSent);
        }
Example #3
0
        public string UnSignNotes(int patientId, int noteId, int NPINumber)
        {
            int        count         = 0;
            string     message       = string.Empty;
            DocManager objDocManager = new DocManager();

            UnSignNotes objUnSignNotes = new UnSignNotes();
            string      userRole       = string.Empty;

            //if (userRole == "System Administrator")
            //{
            //}
            //else
            //{
            //    message = objDocManager.GetErrorMsg("AuthErr")



            if (NPINumber > 0)
            {
                var referrerNotes = _unitOfWork.ReferrerSignRepo.Get(o => o.PTrowid == patientId && o.Docrowid == noteId && o.NPINumber == NPINumber).FirstOrDefault();
                if (referrerNotes != null)
                {
                    _unitOfWork.ReferrerSignRepo.Delete(referrerNotes);
                    _unitOfWork.Save();
                    CloudeStoreg.DeleteFromFileStoreg(referrerNotes.PDFName);
                    message = "Note unsigned successfully";
                }
                else
                {
                    message = "Notes already unsigned";
                }
            }
            else
            {
                try
                {
                    tblDocMaster patientNotes = _unitOfWork.DocMasterRepo.Get(o => o.PTrowid == patientId && o.Docrowid == noteId).FirstOrDefault();

                    if (patientNotes.Signed)
                    {
                        message = objUnSignNotes.ValidateDocs(patientId, noteId);
                        objDocManager.IUDDocMaster("Z", noteId, 0, "", 0, "", "", "0", "", "", "0", "");
                        CloudeStoreg.DeleteFromFileStoreg(patientNotes.PDFName);
                        //int count = objUnSignNotes("Z", TryCast(Me.Master.FindControl("ctl00$ctl00$hdndocrowid"), HiddenField).Value, "0", "", 0, "", "", 0, "", "", 0, Session("User"));
                        if (string.IsNullOrEmpty(message))
                        {
                            message = "Note unsigned successfully";
                        }
                    }
                    else
                    {
                        message = "Notes already unsigned";
                    }
                }

                catch (Exception ex)
                {
                    CustomLogger.SendExcepToDB(ex, "/PatientRepository/UnSignNotes");
                    throw;
                }
            }
            return(message);
        }