public bool VerifyOTP(string phoneNumber, string OTPCode) { tblOTP OTP = new tblOTP(); bool verifiedStatus = false; try { OTP = _unitOfWork.OTPRepo.Get(o => o.PhoneNumber.Equals(phoneNumber)).FirstOrDefault(); //OTP = (from _OTP in _unitOfWork.OTPRepo.Get(o => o.PhoneNumber.Equals(phoneNumber)) // //join _refreshtokens in _unitOfWork.RefreshTokenRepo.Get() on _devices.DeviceId equals _refreshtokens.DeviceId // //where _devices.PhoneNumber == phoneNumber // select new tblOTP // { // OTPCode = _OTP.OTPCode // }).FirstOrDefault(); if (OTPCode == Convert.ToString(OTP.OTPCode)) { verifiedStatus = true; } } catch (Exception ex) { CustomLogger.SendExcepToDB(ex, "AuthRepository"); CustomLogger.LogError(Convert.ToString("VerifyOTP in AuthRepository- " + ex.Message)); throw; } return(verifiedStatus); }
public tblRefreshTokens GetRefreshTokenByDeviceID(string deviceId) { tblRefreshTokens tblDevice = new tblRefreshTokens(); try { //UserDevicesEntity tblDevice = _unitOfWork.RefreshTokenRepo.Get(o => o.DeviceId.Equals(deviceId)).FirstOrDefault(); } catch (Exception ex) { CustomLogger.LogError("Error in GetRefreshTokenByDeviceID " + Convert.ToString(ex.Message)); CustomLogger.SendExcepToDB(ex, "AuthRepository"); throw; } ////===============Mapper=========================================== //var config = new MapperConfiguration(cfg => { // cfg.CreateMap<tblDevice, DevicesEntity>(); //}); //IMapper mapper = config.CreateMapper(); //deviceEntity = mapper.Map<tblDevice, DevicesEntity>(patient); ////===============mapper end========================================== return(tblDevice); }
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 void LogAppError(tblAppError AppError) { try { _unitOfWork.AppErrorsRepo.Insert(AppError); _unitOfWork.Save(); } catch (Exception ex) { CustomLogger.LogError("CommonRepository in UpdateRefreshToken " + Convert.ToString(ex.Message)); CustomLogger.SendExcepToDB(ex, "CommonRepository"); throw; } }
/// <summary> /// Updates a product /// </summary> /// <param name="productId"></param> /// <param name="productEntity"></param> /// <returns></returns> public async Task <bool> UpdateRefreshToken(RefreshToken refreshToken) { var success = false; try { if (refreshToken != null) { // using (var scope = new TransactionScope()) // { var rToken = _ctx.tblRefreshTokens.Find(refreshToken.Id); // rToken.VerificationCode = refreshToken.VarificationCode; if (rToken != null) { rToken.Id = refreshToken.Id; rToken.Subject = refreshToken.Subject; rToken.ClientId = refreshToken.ClientId; rToken.IssuedUtc = refreshToken.IssuedUtc; rToken.ExpiresUtc = refreshToken.ExpiresUtc; rToken.ProtectedTicket = refreshToken.ProtectedTicket; _ctx.tblRefreshTokens.Attach(rToken); _ctx.Entry(rToken).State = EntityState.Modified; success = await _ctx.SaveChangesAsync() > 0; // scope.Complete(); // success = true; //} } } } catch (Exception ex) { CustomLogger.LogError("AuthRepository in UpdateRefreshToken " + Convert.ToString(ex.Message)); CustomLogger.SendExcepToDB(ex, "AuthRepository"); throw; } return(success); }
public SP_PatientNotes_Result GetPatientNotesByID(int patientId, int noteId) { List <SP_PatientNotes_Result> patientNotes = new List <SP_PatientNotes_Result>(); SP_PatientNotes_Result patient = new SP_PatientNotes_Result(); try { patientNotes = GetPatientNotes(patientId); patient = patientNotes.Find(o => o.Docrowid.Equals(noteId)); } catch (Exception ex) { CustomLogger.SendExcepToDB(ex, "Data/SignNotes/SignDischarge"); throw; } //byte[] buffer = GetPdf(patient.PDFName); //string converted = Encoding.UTF8.GetString(buffer, 0, buffer.Length); //patient.PDFName = converted; return(patient); }
public bool UpdateDevices(tblOTP devices) { devices.IssuedUtc = DateTime.UtcNow; tblOTP otpEntity = new tblOTP(); var success = false; try { if (devices != null) { // using (var scope = new TransactionScope()) // { //var rToken = _ctx.tblDevices.Find(devices.PhoneNumber); var rToken = _ctx.tblOTPs.Where(x => x.PhoneNumber == devices.PhoneNumber).FirstOrDefault(); // rToken.OTPCode = devices.OTPCode; if (rToken != null) { rToken.OTPCode = devices.OTPCode; rToken.IssuedUtc = DateTime.UtcNow; _ctx.Entry(rToken).State = EntityState.Modified; _ctx.SaveChanges(); } else { _ctx.tblOTPs.Add(devices); _ctx.SaveChanges(); } } } catch (Exception ex) { CustomLogger.LogError("AuthRepository in UpdateDevices " + Convert.ToString(ex.Message)); CustomLogger.SendExcepToDB(ex, "AuthRepository"); throw; } return(success); }
public List <TriPatientNotesEntity> GetPatientNotes(int patientId) { List <TriPatientNotesEntity> triPatientNotesEntity = new List <TriPatientNotesEntity>(); try { //var patient = _unitOfWork.DocMasterRepo.Get(o => o.PTrowid == patientId).FirstOrDefault(); //if (patient != null) //{ List <SP_PatientNotes_Result> patientNotes = new List <SP_PatientNotes_Result>(); //List<SP_PatientNotes_Result> patients = _unitOfWork.PatientNotesEntityRepo.Get(); patientNotes = _unitOfWork.PatientNotesEntityRepo.ExecWithStoreProcedure("SP_GetDocMaster @Patientid", new SqlParameter("Patientid", SqlDbType.BigInt) { Value = patientId }).ToList(); //===============Mapper=========================================== var config = new MapperConfiguration(cfg => { cfg.CreateMap <SP_PatientNotes_Result, TriPatientNotesEntity>(); }); IMapper mapper = config.CreateMapper(); triPatientNotesEntity = mapper.Map <List <SP_PatientNotes_Result>, List <TriPatientNotesEntity> >(patientNotes); //===============mapper end========================================== // } } catch (Exception ex) { CustomLogger.LogMessage(ex.Message, ""); CustomLogger.SendExcepToDB(ex, "TNotesRepository"); throw; } return(triPatientNotesEntity); }
public string ValidateDocs(int Patientid, int type) { string NoteType = Convert.ToString(type); DocManager objDocManager = new Data.DocManager(); string message = string.Empty; DataSet ds; string noteType = string.Empty; try { ds = objDocManager.GetDocMaster(Patientid); string[] noteflag = new string[8]; for (var i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { noteType = ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty(); switch (noteType) { case "Initial Eval": { noteflag[0] = "1"; break; } case "Initial Eval2": { noteflag[1] = "1"; break; } case "Daily Note": { noteflag[2] = "1"; break; } case "FCE": { noteflag[3] = "1"; break; } } if (NoteType == "PPOC") { if (noteflag[3] == "1") { //message = "This is a Work Conditioning Patient - Cannot open Eval." return(message = objDocManager.GetErrorMsg("WCPEval")); } } if (NoteType == "PFCE") { if (noteflag[0] == "1" | noteflag[1] == "1") { //message = "Eval exists for the Patient, Open a New Chart for FCE." return(message = objDocManager.GetErrorMsg("WCPEvalExist")); HttpContext.Current.Response.Redirect("DocMaster.aspx?PatId=" + Patientid, false); } } if (NoteType == "PTREAT") { if (ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Initial Eval" | ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Initial Eval2" | ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "FCE" | ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Medical Necessity") { if (Convert.ToBoolean(ds.Tables[0].Rows[i]["Signed"]) == false) { //message = "Initial Evaluation or Initial Evaluation 2 or FCE or Medical Necessity Notes are not signed, hence Daily Note will not be created." return(message = objDocManager.GetErrorMsg("SignNoDaily")); } } } // If NoteType = "PPOC2" Then // If ds.Tables[0].Rows[i].Item("NoteDet") = "Re-Eval" Or _ // ds.Tables[0].Rows[i].Item("NoteDet") = "Daily Note" Or _ // ds.Tables[0].Rows[i].Item("NoteDet") = "Discharge" Or _ // ds.Tables[0].Rows[i].Item("NoteDet") = "Medical Necessity" Then // If HttpContext.Current.Session("Docrowid") = Nothing Or HttpContext.Current.Session("Docrowid") = 0 Then //message = "Initial Evaluation 2 cannot be created as Re-Eval, Daily, Medical Necessity notes are found" // HttpContext.Current.Response.Redirect("DocMaster.aspx?patientid=" & Patientid, False) // Else // End If // End If // End If if (NoteType == "PMN") { if (ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Initial Eval" | ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Initial Eval2" | ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "FCE") { // ds.Tables[0].Rows[i].Item("NoteDet") = "Daily Note" Or _ or Daily if (Convert.ToBoolean(ds.Tables[0].Rows[i]["Signed"]) == false) { //message = "Initial Evaluation or Initial Evaluation 2 or FCE Notes are not signed, hence Medical Necessity Note will not be created or updated." return(message = objDocManager.GetErrorMsg("SignNoMed")); } } } if (NoteType == "PDIS") { if (ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Initial Eval" | ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Initial Eval2" | ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "FCE" | ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Daily Note" | ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Medical Necessity") { if (Convert.ToBoolean(ds.Tables[0].Rows[i]["Signed"]) == false) { //message = "Initial Evaluation or Initial Evaluation 2 or FCE or Daily Notes are not signed, hence Discharge Note will not be created or updated." return(message = objDocManager.GetErrorMsg("SignNoDis")); } } } if (ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty() == "Discharge") { if (NoteType == "PDIS") { } else if (Convert.ToBoolean(ds.Tables[0].Rows[i]["Signed"]) == true) { //message = "Patient is discharged, hence other notes can't be created or updated." return(message = objDocManager.GetErrorMsg("PatDischarge")); } } } if (NoteType == "PTREAT") { if (noteflag[0] == "1" | noteflag[1] == "1" | noteflag[3] == "1") { } else { //message = "Initial Evaluation or Initial Evaluation 2 or PFC Notes not found, hence Daily Note will not be created." return(message = objDocManager.GetErrorMsg("NoDailyCre")); } } // If NoteType = "PMN" Then // If (noteflag(0) = "1" Or noteflag(1) = "1") And noteflag(2) = "1" Then // Else //message = "Initial Evaluation or Daily not found, hence Medical Necessity Note will not be created." // HttpContext.Current.Response.Redirect("DocMaster.aspx?patientid=" & Patientid) // End If // End If int j = 0; if (NoteType == "PTREAT") { for (var i = ds.Tables[0].Rows.Count - 1; i >= 0; i += -1) { noteType = ds.Tables[0].Rows[i]["NoteDet"].ToStringOrEmpty(); switch (noteType) { case "Discharge": { if (Convert.ToBoolean(ds.Tables[0].Rows[i]["Signed"]) == true) { //message = "Patient is discharged, hence note cannot not be created." return(message = objDocManager.GetErrorMsg("PatDischarge")); } break; } case "Daily": { if (ds.Tables[0].Rows[i - 1]["NoteDet"].ToStringOrEmpty() == "Daily") { //message = "2 Daily Notes found, hence pl create Medical Necessity Note." return(message = objDocManager.GetErrorMsg("2DailyFound")); } break; } } ds.Tables[0].Rows[i]["NoteDet"] = "Daily Note"; } } } catch (Exception ex) { CustomLogger.SendExcepToDB(ex, "Data/UnSignNotes/ValidateDocs"); throw; } return(message); }
public bool SendOTP(string StrPhone, string strTimeZone) { string responseStr = ""; // string StrPhone = "9049991221"; string cultureName = "en-US"; string fulldate = "12-08-2018 19:08:54"; string[] time = strTimeZone.Split(' '); string datepart = time[0]; string[] tt = datepart.Split('-'); string finaldate = tt[1] + "/" + tt[0] + "/" + tt[2] + " " + time[1]; try { // Get list of Patients to send a note Random rnd = new Random(); int myRandomNo = rnd.Next(100000, 999999); // creates a 8 digit random no. //var culture = new CultureInfo(cultureName); //object Tday = DateTime.Now.ToString(culture); DateTime mobileDate = Convert.ToDateTime(finaldate); object Tday = mobileDate.ToString("yyyy-MM-dd HH:mm"); int mm = Convert.ToInt32(mobileDate.ToString("mm")); int ss = Convert.ToInt32(mobileDate.ToString("ss")); int hh = Convert.ToInt32(mobileDate.ToString("HH")); //ss = ss + 30; //if (ss < 60) //{ // Tday = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); // Tday = (Tday + ":"+ Convert.ToString(ss)); //} //else //{ // Tday = DateTime.Now.ToString("yyyy-MM-dd HH"); // ss = ss - 60; // mm = mm + 1; // Tday = (Tday + ":" + Convert.ToString(mm)); // //Tday = (Tday + ":" + Convert.ToString(ss)); //} Tday = mobileDate.ToString("yyyy-MM-dd "); ss = ss - 60; mm = mm + 1; string minute = string.Empty; if (mm < 10) { minute = "0" + mm; } else { minute = Convert.ToString(mm); } hh = hh - 1; string hours = string.Empty; if (hh < 10) { hours = "0" + hh; } else { hours = Convert.ToString(hh); } Tday = (Tday + hours + ":" + minute); Tday = (Tday + "-05"); //string msg = "OTP is" + myRandomNo;111 //HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://sms.mahabeautyplus.com/sendsms/sendsms.php?username=memahatra&password=mes1231&type=TEXT&sender=Alerts&mobile="+ StrPhone + "&message=" + msg + ""); //// HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://sms.mahabeautyplus.com/sendsms/sendsms.php?username=memesthn&password=mes2014&type=TEXT&sender=Alerts&mobile=8879333715&message=hello"); //HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse(); //System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream()); //string responseString = respStreamReader.ReadToEnd(); //respStreamReader.Close(); //myResp.Close(); //===========================USA========================================= string url1 = "https://api.remindercall.net/v3.2/dispatch.xml"; // Enter code for sending text message //00b4def6b655ce6026fbdc66014f779b6789da1321b9a43cad42f1804269134d // ----------- FORM XML START ------------------------------------------------------------------------------------------ XDocument doc = new XDocument( new XElement("request", new XElement("key", "cb5aba79e96ccfd59c5b3265e0786bb74c15598b2d2fc35fbef99ffed62a4825"), new XElement("text", new XAttribute("action", "create"), new XElement("id", myRandomNo), new XElement("delivery", Tday.ToString()), new XElement("number", StrPhone), new XElement("message", "OTP is " + myRandomNo)))); // ----------- FORM XML END ------------------------------------------------------------------------------------------ HttpWebRequest request = ((HttpWebRequest)(WebRequest.Create(url1))); byte[] bytes; string xmlString = doc.ToString(); bytes = System.Text.Encoding.ASCII.GetBytes(xmlString); request.ContentType = "text/xml; encoding=\'utf-8\'"; request.ContentLength = bytes.Length; request.Method = "POST"; Stream requestStream = request.GetRequestStream(); requestStream.Write(bytes, 0, bytes.Length); requestStream.Close(); HttpWebResponse resp; resp = ((HttpWebResponse)(request.GetResponse())); if ((resp.StatusCode == HttpStatusCode.OK)) { Stream responseStream = resp.GetResponseStream(); responseStr = new StreamReader(responseStream).ReadToEnd(); } // TODO: Warning!!!! NULL EXPRESSION DETECTED... // responseStr = "<?xml version=""1.0"" encoding=""UTF-8""?> // <response> // <status> // <text> // <id>2</id> // <result>success</result> // <status>new</status> // </text> // </status> // </response>" string genre = string.Empty; using (XmlReader reader = XmlReader.Create(new StringReader(responseStr))) { reader.ReadToFollowing("text"); reader.MoveToFirstAttribute(); reader.ReadToFollowing("result"); genre = reader.ReadElementContentAsString(); } //=============================USA END tblOTP otpEntity = new tblOTP(); otpEntity.PhoneNumber = StrPhone; otpEntity.OTPCode = Convert.ToString(myRandomNo); var result = UpdateDevices(otpEntity); } catch (Exception ex) { CustomLogger.LogMessage(ex.Message, ""); CustomLogger.SendExcepToDB(ex, "AuthRepository"); throw; } return(true); }
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); }
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); }
public List <NotesSummaryEntity> GetNotesSummary(int patientId) { List <NotesSummaryEntity> notesSummary = new List <NotesSummaryEntity>(); List <NotesSummaryEntity> notesSummaryFinal = new List <NotesSummaryEntity>(); Team.Rehab.DataModel.RehabEntities rehab = new RehabEntities(); List <NotificationsEntity> notificationsEntity = new List <NotificationsEntity>(); try { notesSummary = (from notes in rehab.tblDocMasters.Where(a => a.PTrowid == patientId) join thpst in rehab.tblTherapists on notes.TreatingTherapistId equals thpst.TherapistID join clinic in rehab.tblClinics on thpst.DefaultClinic equals clinic.Crowid join usr in rehab.tblUsers on new { thpst.FirstName, thpst.LastName } equals new { usr.FirstName, usr.LastName } select new NotesSummaryEntity { Docrowid = notes.Docrowid, NotesType = notes.NoteType, DateOfService = notes.DateOfService, FirstName = thpst.FirstName, LastName = thpst.LastName, // TherpistPhone = thpst.TherpistPhone, TherapistEmail = usr.UserEmail, ClinicName = clinic.ClinicName, ClinicPhone = clinic.PhoneNumber // ClinicEmail = clinic.ClinicEmail, } ).ToList(); foreach (NotesSummaryEntity obj in notesSummary) { if (obj.NotesType == "PPOC") { obj.NotesType = "Initial Eval"; } if (obj.NotesType == "PPOC2") { obj.NotesType = "Initial Eval2"; } if (obj.NotesType == "PPOCRE") { obj.NotesType = "Re-Eval"; } if (obj.NotesType == "PTREAT") { obj.NotesType = "Daily Note"; } if (obj.NotesType == "PMN") { obj.NotesType = "Medical Necessity"; } if (obj.NotesType == "PDIS") { obj.NotesType = "Discharge"; } if (obj.NotesType == "PCOMM") { obj.NotesType = "Communication"; } if (obj.NotesType == "PMV") { obj.NotesType = "Missed"; } if (obj.NotesType == "PFCE") { obj.NotesType = "FCE"; } notesSummaryFinal.Add(obj); //WHEN 'PFCE' then 'FCE' // Else 'Others' } } catch (Exception ex) { CustomLogger.SendExcepToDB(ex, "PatinetRepository"); CustomLogger.LogError(Convert.ToString("NoteSummary in PatinetRepository- " + ex.Message)); } return(notesSummaryFinal); }
public override void OnException(HttpActionExecutedContext context) { GlobalConfiguration.Configuration.Services.Replace(typeof(ITraceWriter), new NLogger()); var trace = GlobalConfiguration.Configuration.Services.GetTraceWriter(); trace.Error(context.Request, "Controller : " + context.ActionContext.ControllerContext.ControllerDescriptor.ControllerType.FullName + Environment.NewLine + "Action : " + context.ActionContext.ActionDescriptor.ActionName, context.Exception); var exceptionType = context.Exception.GetType(); CustomLogger.SendExcepToDB(context.Exception, context.Request.RequestUri.ToString()); if (exceptionType == typeof(ValidationException)) { var resp = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(context.Exception.Message), ReasonPhrase = "ValidationException", }; throw new HttpResponseException(resp); } else if (exceptionType == typeof(UnauthorizedAccessException)) { throw new HttpResponseException(context.Request.CreateResponse(HttpStatusCode.Unauthorized, new ServiceStatus() { StatusCode = (int)HttpStatusCode.Unauthorized, StatusMessage = "UnAuthorized", ReasonPhrase = "UnAuthorized Access" })); } else if (exceptionType == typeof(ApiException)) { var webapiException = context.Exception as ApiException; if (webapiException != null) { throw new HttpResponseException(context.Request.CreateResponse(webapiException.HttpStatus, new ServiceStatus() { StatusCode = webapiException.ErrorCode, StatusMessage = webapiException.ErrorDescription, ReasonPhrase = webapiException.ReasonPhrase })); } } else if (exceptionType == typeof(ApiBusinessException)) { var businessException = context.Exception as ApiBusinessException; if (businessException != null) { throw new HttpResponseException(context.Request.CreateResponse(businessException.HttpStatus, new ServiceStatus() { StatusCode = businessException.ErrorCode, StatusMessage = businessException.ErrorDescription, ReasonPhrase = businessException.ReasonPhrase })); } } else if (exceptionType == typeof(ApiDataException)) { var dataException = context.Exception as ApiDataException; if (dataException != null) { throw new HttpResponseException(context.Request.CreateResponse(dataException.HttpStatus, new ServiceStatus() { StatusCode = dataException.ErrorCode, StatusMessage = dataException.ErrorDescription, ReasonPhrase = dataException.ReasonPhrase })); } } else { throw new HttpResponseException(context.Request.CreateResponse(HttpStatusCode.InternalServerError)); } }