protected void Page_Init(object sender, EventArgs e) { RequireRole( "view_provider" ); string strID = Request.QueryString["id"]; long id; if( string.IsNullOrEmpty( strID ) || !long.TryParse( strID, out id ) ) RedirectHash( "provider/prescribers/list", true, "Invalid Prescriber" ); else Prescriber = new Prescriber( id ); Provider = Lib.Systems.Security.GetCurrentProvider(); ProviderUser = ProviderUser.FindByProvider(Provider.ID.Value).First(); PrescriberProfile = PrescriberProfile.FindByPrescriberAndProvider(Prescriber, ProviderUser.OrganizationID); ProviderFacilities = ProviderFacility.FindByProvider(Provider); States = State.FindAll(); Specialities = Speciality.FindAll(); SpecialityId = Prescriber.SpecialityID ?? 0; PrescriberTypes = PrescriberType.FindAll(); TypeId = PrescriberProfile.PrescriberTypeID ?? 0; if(PrescriberProfile != null) { PrescriberFacilities = PrescriberProfile.GetFacilities(); Drugs = Lib.Systems.Lists.GetUsersDrugs(PrescriberProfile.ID ?? 0); } else RedirectHash( "provider/prescribers/list", true, "Invalid Prescriber" ); }
public string GetPrescriberType(Prescriber prescriber) { IList<PrescriberProfile> profiles = PrescriberProfile.FindByPrescriber(prescriber); PrescriberProfile profile = (from p in profiles where p.ProviderID == Provider.ID select p).FirstOrDefault(); return (profile != null && profile.PrescriberTypeID != null) ? profile.PrescriberType.DisplayName : String.Empty; }
protected void Page_Init(object sender, EventArgs e) { BackHash = Request.QueryString["back-hash"]; ParentType = Request.QueryString["parent-type"]; ParentId = Request.QueryString["parent-id"]; string strId = Request.QueryString["id"]; long id; if (string.IsNullOrEmpty(strId) || !long.TryParse(strId, out id)) Prescriber = new Prescriber(); else Prescriber = new Prescriber(id); }
public static IList<Drug> GetDrugsWithNoSelection(Prescriber prescriber) { Database db = Database.Get("FDARems"); StringBuilder sql = new StringBuilder(); sql.Append("SELECT * "); sql.Append("FROM "+db.DelimTable("Drugs")+" "); sql.Append("WHERE "+db.DelimTable("Drugs")+"."+db.DelimColumn("ID")+" NOT IN "); sql.Append(" (SELECT "+db.DelimColumn("DrugID")+" "); sql.Append(" FROM "+db.DelimTable("DrugSelections")+" "); sql.Append(" WHERE "+db.DelimTable("DrugSelections")+"."+db.DelimColumn("PrescriberID")+" = "+db.DelimParameter("PrescriberId")+") AND "); sql.Append(" "+db.DelimTable("Drugs")+"."+db.DelimColumn("Active")+" = 1;"); var ps = new List<Parameter>(); ps.Add(new Parameter("PrescriberId", prescriber.ID)); return db.ExecuteQuery<Drug>(sql.ToString(), ps.ToArray()); }
protected void Page_Init(object sender, EventArgs e) { string token = Request.QueryString["token"]; bool reset = Request.QueryString["reset"] != null; PrescriberProfile profile = PrescriberProfile.FindByToken(token); // allow the user to go through the process again. if(reset) { // load prescriber Prescriber prescriber = new Prescriber(profile.PrescriberID); if(prescriber.ID > 0) { IList<PrescriberProfile> linkedProfiles = PrescriberProfile.FindByPrescriber(prescriber); // if it's the only profile, we need to delte the user and prescriber // otherwise just disasociate the profile. if(linkedProfiles.Count == 1) { UserProfile userProfile = prescriber.Profile; User user = userProfile.User; user.ClearGroups(); userProfile.Delete(); user.Delete(); prescriber.Delete(); } } // reset the profile profile.PrescriberID = null; profile.Save(); } PrescriberProfile = profile; PrescriberTypes = PrescriberType.FindAll(); Specialities = Speciality.FindAll(); States = State.FindAll(); }
public override void Run() { Lib.Data.Drug drug = new Lib.Data.Drug(DrugId); Prescriber prescriber = new Prescriber(PrescriberId); User user = new User(prescriber.Profile.UserID); StringBuilder message = new StringBuilder(); message.Append("Your certification for "); message.Append(drug.GenericName); message.Append(" needs to be renewed."); Notification n = NotificationService.Create( "Certification renewal notice", message.ToString(), true, NotificationService.DataType.Drug, DrugId); NotificationService.Send(n, user, NotificationService.Templates.HCOReminder); }
protected void Page_Init(object sender, EventArgs e) { long prescriberProfileId = long.Parse(Request.QueryString["prescriber-profile-id"]); States = State.FindAll(); Specialities = Speciality.FindAll(); PrescriberTypes = PrescriberType.FindAll(); if(prescriberProfileId <= 0) { PrescriberProfile = new PrescriberProfile(); Prescriber = new Lib.Data.Prescriber(); SpecialityId = 0; TypeId = 0; User = new Framework.Security.User(); Account = new Account { ExpiresOn = DateTime.Now }; } else { PrescriberProfile = new PrescriberProfile(prescriberProfileId); Prescriber = PrescriberProfile.Prescriber; SpecialityId = Prescriber.SpecialityID ?? 0; TypeId = PrescriberProfile.PrescriberTypeID ?? 0; UserProfile userProfile = new UserProfile(Prescriber.ProfileID); User = userProfile.User; Account = _accountSvc.GetByUserProfileId(userProfile.ID ?? 0); } }
public string GetPrescriberSpecialty(Prescriber prescriber) { return (prescriber != null && prescriber.Speciality != null) ? prescriber.Speciality.Name : String.Empty; }
public PrescriberProfile GetPrescriberProfile(Prescriber prescriber) { return PrescriberProfile.FindByOrganization(_providerUser.OrganizationID, prescriber.ID ?? 0); }
public static PrescriberProfile FindByPrescriberAndProvider( Prescriber p, long providerId ) { return FindFirstBy<PrescriberProfile>( new Dictionary<string, object> { { "ProviderID",providerId }, { "PrescriberID", p.ID.Value } }, new[] { "-Expires" } ); }
public static IList<PrescriberProfile> FindByPrescriber(Prescriber p) { return FindAllBy<PrescriberProfile>( new Dictionary<string, object> { { "PrescriberID", p.ID.Value } }, new[] { "-Expires" } ); }
internal static void ClearSelections(Prescriber prescriber) { Lib.Data.Drug.ClearSelections(prescriber); }
internal static void ClearSelections(Prescriber prescriber) { if(prescriber == null) return; var db = Database.Get("FDARems"); var sql = "DELETE FROM "+db.DelimTable("DrugSelections")+" "+ " WHERE " + db.DelimColumn("PrescriberID") + " = " + db.DelimParameter("prescriberId"); var ps = new List<Parameter>(); ps.Add(new Parameter("prescriberId", prescriber.ID)); db.ExecuteQuery(sql, ps.ToArray()); }