/// <summary> /// Creates a product /// </summary> /// <param name="productEntity"></param> /// <returns></returns> public int CreateAppUser(AppUsersEntity appUserEntity) { using (var scope = new TransactionScope()) { var AppUsers = new tblAppUser { AUrowid = appUserEntity.AUrowid, FirstName = appUserEntity.FirstName, LastName = appUserEntity.LastName, PhoneNumber = appUserEntity.PhoneNumber, EmailId = appUserEntity.EmailId, NPINumber = appUserEntity.NPINumber, Access = appUserEntity.Access, // createdby = appUserEntity.createdby, createdby = "Admin", createdts = DateTime.Now, updatedby = "Admin", updatedts = DateTime.Now }; _unitOfWork.AppUserRepo.Insert(AppUsers); _unitOfWork.Save(); scope.Complete(); return(AppUsers.AUrowid); } }
public tblAppUser RegisterUser(DevicesEntity deviceModel) { bool flag = false; List <tblAppUser> user = new List <tblAppUser>(); List <tblDevice> tblDevice = new List <tblDevice>(); try { user = _unitOfWork.AppUserRepo.Get(c => c.PhoneNumber.Equals(deviceModel.PhoneNumber)).ToList(); if (user.Count() > 0) { tblDevice = _unitOfWork.DeviceRepo.Get(c => c.EmailId.Equals(deviceModel.EmailId) && c.PhoneNumber.Equals(deviceModel.PhoneNumber)).ToList(); if (tblDevice.Count() == 0) { using (var scope = new TransactionScope()) { var TblDevice = new tblDevice { //Drowid = 1, DeviceId = deviceModel.DeviceId, EmailId = deviceModel.EmailId, PhoneNumber = deviceModel.PhoneNumber, SignPath = deviceModel.SignPath, }; _unitOfWork.DeviceRepo.Insert(TblDevice); _unitOfWork.Save(); scope.Complete(); } } flag = true; } if (flag) { return(user.FirstOrDefault()); } else { tblAppUser emptyUser = new tblAppUser(); return(emptyUser); } } catch (Exception ex) { CustomLogger.LogError("AuthRepository in RegisterUser " + Convert.ToString(ex.Message)); CustomLogger.SendExcepToDB(ex, "AuthRepository"); throw; } finally { } }
public IActionResult Delete(int id) { var objFromDB = _unitOfWork.Category.Get(id); if (objFromDB == null) { return(Json(new { success = "false", message = "Error while deleting" })); } _unitOfWork.Category.Remove(objFromDB); _unitOfWork.Save(); return(Json(new { success = "true", message = "Delete Success" })); }
public int DeleteUser(int ipID) { //_unitOfWork.BlockedIpRepo.Delete(lstFailureInfo); //return 1; // var success = false; if (ipID > 0) { using (var scope = new TransactionScope()) { // var blockedIp = _unitOfWork.BlockedIpRepo.GetByID(ipID); var blockedIP = _unitOfWork.BlockedIpRepo.Get(o => o.BlockedIPID.Equals(ipID)).FirstOrDefault(); if (blockedIP != null) { _unitOfWork.BlockedIpRepo.Delete(blockedIP); _unitOfWork.Save(); scope.Complete(); // success = true; } } } return(1); }
public bool UpdateNotification(string NotificationID) { var success = false; if (!string.IsNullOrEmpty(NotificationID)) { using (var scope = new TransactionScope()) { tblAppNotification notificationEntity = new tblAppNotification(); // var notificationEntity = _unitOfWork.NotificationRepo.Get(o => o.Prowid.Equals(NotificationID)).FirstOrDefault(); if (!string.IsNullOrEmpty(NotificationID)) { //product.ProductName = productEntity.ProductName; _unitOfWork.NotificationRepo.Update(notificationEntity); _unitOfWork.Save(); scope.Complete(); success = true; } } } return(success); }
/// <summary> /// Creates a product /// </summary> /// <param name="productEntity"></param> /// <returns></returns> public int CreateDTPatient(int incommingMsgID, string userID, string status, int attachmentID) { try { tblPatients patient = new tblPatients(); tblReferrer referrerRecord = new tblReferrer(); tblRefAddr referrerAddr = new tblRefAddr(); // tbl_DT_Incoming_Message_Individual_Attachments tblAttachment = new tbl_DT_Incoming_Message_Individual_Attachments(); tbl_DT_PatientReferral_Processed processedPatient = new tbl_DT_PatientReferral_Processed(); var incomingMessagPprocessEntity = (from p in _unitOfWork.DT_Incoming_MessageRepo.Get() join e in _unitOfWork.DT_Individial_AttachRepo.Get() on p.ID equals e.InComingMessageID where p.ID == incommingMsgID && e.ID == attachmentID select new DT_IncomingMessagOperationEntity { FileData = e.FileData, EmailID = p.From }).ToList().FirstOrDefault(); var DT_Referrer = (from p in _unitOfWork.DT_Referrer_EmailsRepo.Get() where p.DT_Email_Address == incomingMessagPprocessEntity.EmailID select p.Institute_ID).FirstOrDefault(); string xmlString = incomingMessagPprocessEntity.FileData.ToString(); //referrer = _unitOfWork.DT_Referrer_EmailsRepo.Get(o => o.Institute_ID == PatientWIP.Institute_ID).FirstOrDefault(); using (StreamReader reader = new StreamReader(GenerateStreamFromString(xmlString), Encoding.Unicode)) { string oldstr = "xmlns=\"urn:hl7-org:v3\""; string oldstr1 = "xmlns:sdtc=\"urn:hl7-org:sdtc\""; xmlString = xmlString.Replace(oldstr, ""); xmlString = xmlString.Replace(oldstr1, ""); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlString); var nameNode = xmlDoc.SelectNodes("ClinicalDocument/recordTarget/patientRole/patient/name"); var DOBNode = xmlDoc.SelectNodes("ClinicalDocument/recordTarget/patientRole/patient"); var CityNode = xmlDoc.SelectNodes("ClinicalDocument/recordTarget/patientRole/addr"); var referrerNode = xmlDoc.SelectNodes("ClinicalDocument/legalAuthenticator/assignedEntity/assignedPerson/name"); var referrerAddrNode = xmlDoc.SelectNodes("ClinicalDocument/legalAuthenticator/assignedEntity/addr"); var referrerPhoneNode = xmlDoc.SelectNodes("ClinicalDocument/legalAuthenticator/assignedEntity/telecom"); XmlNodeList xnListtelecom = xmlDoc.SelectNodes("/ClinicalDocument/recordTarget/patientRole/telecom"); ////ClinicalDocument//recordTarget//patientRole//patientRole//name foreach (XmlNode subNode in nameNode) { patient.FirstName = subNode["given"].InnerText; patient.LastName = subNode["family"].InnerText; patient.NickName = patient.FirstName; } foreach (XmlNode subNode in referrerNode) { string given2 = string.Empty; if (subNode["given"].NextSibling != null) { given2 = subNode["given"].NextSibling.InnerText.ToStringOrEmpty(); } referrerRecord.FirstName = subNode["given"].InnerText.ToStringOrEmpty() + " " + given2; referrerRecord.LastName = subNode["family"].InnerText.ToStringOrEmpty(); referrerRecord.PrintName = subNode["family"].InnerText.ToStringOrEmpty() + ", " + subNode["given"].InnerText.ToStringOrEmpty() + " " + given2 + subNode["suffix"].InnerText.ToStringOrEmpty(); referrerRecord.Credentials = subNode["suffix"].InnerText.ToStringOrEmpty(); } referrerRecord.ReferralType = "DT"; referrerRecord.SendPOCBy = "DT"; referrerRecord.createdby = "DT-Load"; referrerRecord.createdts = DateTime.Now; referrerRecord.updatedby = "DT-Load"; referrerRecord.updatedts = DateTime.Now; referrerRecord.NoFax = false; referrerRecord.ReferralInstitute = DT_Referrer; referrerRecord.Title = "Dr"; referrerRecord.NPINumber = ""; referrerRecord.Email = incomingMessagPprocessEntity.EmailID; foreach (XmlNode subNode in DOBNode) { patient.BirthDate = subNode["birthTime"].Attributes["value"].Value; DateTime dt; if (DateTime.TryParseExact(patient.BirthDate.ToString(), "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt)) { //Console.WriteLine(dt); // patient.BirthDate = dt.ToString(); patient.BirthDate = dt.ToShortDateString(); } string gender = subNode["administrativeGenderCode"].Attributes["code"].Value; if (gender.ToLower() == "f") { patient.Gender = "Female"; } patient.Title = "Miss"; if (gender.ToLower() == "m") { patient.Gender = "Male"; } patient.Title = "MR"; } foreach (XmlNode subNode in CityNode) { patient.City = subNode["city"].InnerText; patient.State = subNode["state"].InnerText; patient.Address1 = subNode["streetAddressLine"].InnerText; patient.ZipCode = subNode["postalCode"].InnerText; } foreach (XmlNode subNode in referrerAddrNode) { referrerAddr.City = subNode["city"].InnerText; referrerAddr.State = subNode["state"].InnerText; referrerAddr.StreetAddress = subNode["streetAddressLine"].InnerText; referrerAddr.ZipCode = subNode["postalCode"].InnerText; referrerAddr.startdt = DateTime.Now; referrerAddr.enddt = DateTime.Now; referrerAddr.createdby = "DT-Load"; referrerAddr.createdts = DateTime.Now; referrerAddr.updatedby = "DT-Load"; referrerAddr.updatedts = DateTime.Now; } foreach (XmlNode xn in referrerPhoneNode) { if (xn.Attributes[0].Value == "WP") { var ph = xn.Attributes[1].Value.Replace("-", "").Replace("(", "").Replace(")", ""); referrerAddr.PhoneNo = ph.ToStringOrEmpty().Length > 0 ? ph.Substring(6) : ""; } } referrerAddr.FaxNo = ""; DateTime NowTime = DateTime.Now; int M_Current_Day = NowTime.Day; // Current Date with Day Display int M_Current_Month = Convert.ToInt32(DateTime.Today.Month); //Current Month as a Single Integer Display int CurrentYear = DateTime.Today.Year; // Display Year as Integer patient.ReferralDate = DateTime.Now.ToShortDateString(); //**what is referral date? patient.updatedts = DateTime.Now.ToShortDateString().StringToDate(); patient.createdts = DateTime.Now.ToShortDateString().StringToDate(); //patient.ReferralDate = CurrentYear.ToString()+M_Current_Month.ToString()+M_Current_Day.ToString(); //need to find referral date. // patient.ReferralSource = incomingMessagPprocessEntity.EmailID == null ? "noemail" : incomingMessagPprocessEntity.EmailID.Substring(0, 9); // patient.HomePh = "000000000"; //need to find patient phone. foreach (XmlNode xn in xnListtelecom) { if (xn.Attributes[0].Value == "HP") { patient.HomePh = xn.Attributes[1].Value.ToStringOrEmpty().Length > 0 ? xn.Attributes[1].Value.Substring(4) : ""; } if (xn.Attributes[0].Value == "WP") { patient.WorkPh = xn.Attributes[1].Value.ToStringOrEmpty().Length > 0 ? xn.Attributes[1].Value.Substring(4) : ""; } if (xn.Attributes[0].Value == "MC") { patient.CellPh = xn.Attributes[1].Value.ToStringOrEmpty().Length > 0 ? xn.Attributes[1].Value.Substring(4) : ""; } } //patient.ClinicNo = 7; using (RehabEntities rehab = new RehabEntities()) { var clinicnumber = (from inc in rehab.tbl_DT_ClinicUserMapping where inc.EmailId == incomingMessagPprocessEntity.EmailID.ToString() select inc.ClinicNo).FirstOrDefault(); if (clinicnumber == null) { patient.ClinicNo = Convert.ToInt16(clinicnumber); } else { patient.ClinicNo = 0; } } } using (var scopeCreate = new TransactionScope()) { _unitOfWork.ReferrerRepo.Insert(referrerRecord); _unitOfWork.Save(); referrerAddr.Rrowid = referrerRecord.Rrowid; _unitOfWork.RefAddrRepo.Insert(referrerAddr); _unitOfWork.Save(); patient.ReferralSource = referrerRecord.Rrowid.ToStringOrEmpty(); _unitOfWork.PatientEntityRepo.Insert(patient); _unitOfWork.Save(); ImportPatient(patient.Prowid, incommingMsgID, userID, status, attachmentID); scopeCreate.Complete(); return(patient.Prowid); } } catch (Exception ex) { throw; } }
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); }