Beispiel #1
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);
        }
Beispiel #2
0
        public string SignNotes(int patientId, int noteId, int NPINumber)
        {
            DocManager objDocManager = new DocManager();
            string     NoteType      = string.Empty;
            string     response      = string.Empty;
            bool       signStatus    = false;
            bool       refSignStatus = false;

            try
            {
                tblDocMaster patientNotes = _unitOfWork.DocMasterRepo.Get(o => o.PTrowid == patientId && o.Docrowid == noteId).FirstOrDefault();
                if (patientNotes != null)
                {
                    NoteType   = patientNotes.NoteType;
                    signStatus = patientNotes.Signed;
                }


                if (NPINumber > 0)
                {
                    if (signStatus)
                    {
                        var referrerNotes = _unitOfWork.ReferrerSignRepo.Get(o => o.PTrowid == patientId && o.Docrowid == noteId && o.NPINumber == NPINumber).FirstOrDefault();
                        if (referrerNotes != null)
                        {
                            NoteType      = referrerNotes.NoteType;
                            refSignStatus = referrerNotes.Signed ?? false;
                        }
                        if (refSignStatus)
                        {
                            response = "Notes already signed";
                        }
                        else
                        {
                            ITextMgrNotes objnotes = new ITextMgrNotes();
                            response = objnotes.ReferrerSign(patientNotes.PDFName, NPINumber);
                            if (!string.IsNullOrEmpty(response))
                            {
                                if (response.Substring(response.IndexOf(".")).ToLower() == ".pdf")
                                {
                                    tblReferrerSign rfsign = new tblReferrerSign();
                                    rfsign.Docrowid   = noteId;
                                    rfsign.PTrowid    = patientId;
                                    rfsign.NoteType   = NoteType;
                                    rfsign.NPINumber  = NPINumber;
                                    rfsign.PDFName    = response;
                                    rfsign.Signed     = true;
                                    rfsign.SignedDate = DateTime.Now;
                                    rfsign.createdts  = DateTime.Now;
                                    rfsign.createdby  = NPINumber.ToString();
                                    rfsign.updatedts  = DateTime.Now;
                                    rfsign.updatedby  = NPINumber.ToString();
                                    _unitOfWork.ReferrerSignRepo.Insert(rfsign);
                                    _unitOfWork.Save();
                                }
                            }
                        }
                    }
                    else
                    {
                        response = "Notes not yet signed by Therapiest";
                    }
                }
            }

            catch (Exception ex)
            {
                CustomLogger.SendExcepToDB(ex, "/PatientRepository/SignNotes");
                string msg = ex.Message;
                throw;
            }

            //  response = "under construction";
            return(response);
        }