/// <summary> /// Gets the Deseases by logged in User role /// </summary> /// <param name="LoggedInUser"></param> /// <returns></returns> public List <Desease> getDeseases(User LoggedInUser) { MySql.Data.MySqlClient.MySqlCommand Using; List <Desease> Deseases = new List <Desease>(); DBRoleConnection dBRoleConnection = new DBRoleConnection(); var result = dBRoleConnection.GetUserRights(LoggedInUser); if (result.ShowAllDeseases) { Using = new MySql.Data.MySqlClient.MySqlCommand("select deseases.ID,deseases.BSNNumber,deseases.Description,deseases.DeterminerID from deseases", con); } else if (!result.ShowAllDeseases) { Using = new MySql.Data.MySqlClient.MySqlCommand("select deseases.ID,deseases.BSNNumber,deseases.Description,deseases.DeterminerID from deseases where deseases.DeterminerID=@therapistid", con); } else { throw new Exception("No rights to perform this action"); } using (MySql.Data.MySqlClient.MySqlCommand cmd = Using) { cmd.Parameters.AddWithValue("@therapistid", (LoggedInUser.ID != 0) ? LoggedInUser.ID : throw new Exception("No rights to perform this action (User.ID = null)")); try { con.Open(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Desease desease = new Desease(); desease.ID = (int)reader["ID"]; desease.Description = (string)reader["Description"] + " - BSN: " + (int)reader["BSNNumber"]; desease.determiner = (int)reader["DeterminerID"]; Deseases.Add(desease); } } catch (Exception ex) { if (con.State != System.Data.ConnectionState.Closed) { con.Close(); } throw new Exception(ex.Message); } if (con.State != System.Data.ConnectionState.Closed) { con.Close(); } } return(Deseases); }
protected void Page_Load(object sender, EventArgs e) { ProfileImageUpload.Visible = false; if (IsPostBack && ProfileImageUpload.PostedFile != null) { if (ProfileImageUpload.PostedFile.FileName.Length > 0) { try { bool DirExists = System.IO.Directory.Exists(Server.MapPath("/Files/" + LoggedInUser.UniqueUserID + "/PF")); if (!DirExists) { System.IO.Directory.CreateDirectory(Server.MapPath("/Files/" + LoggedInUser.UniqueUserID + "/PF")); } ProfileImageUpload.SaveAs(Server.MapPath("/Files/" + LoggedInUser.UniqueUserID + "/PF/" + ProfileImageUpload.FileName)); string location = "/Files/" + LoggedInUser.UniqueUserID + "/PF/" + ProfileImageUpload.FileName; DAL.DBUserConnection dBUserConnection = new DAL.DBUserConnection(); string result = dBUserConnection.SetUserData(LoggedInUser, UserData.Types.ProfilePicUrl, location); ShowPFMessage(result + "<br/>Wanneer u opnieuw inlogd zal de foto zichtbaar zijn.", "Resultaat"); ProfileImageUpload.Dispose(); ProfileImageUpload.PostedFile.InputStream.Dispose(); ProfileImageUpload.Attributes.Clear(); } catch (Exception ex) { ShowPFMessage("Fout:" + ex.Message, "Resultaat"); } } } if (!IsPostBack) { messagerPF.Style.Add("display", "none!important"); if (Session["User"] != null) { LoggedInUser = Session["User"] as Entities.User; if (LoggedInUser != null) { BLL.LogInHelper logInHelper = new BLL.LogInHelper(); Entities.User result = new Entities.User(); try { result = logInHelper.LoginAtPageLoad(LoggedInUser); } catch (Exception ex) { Response.Redirect("/SignIn"); } if (result != null) { //akkoord om op de pagina te zijn IngelogdAls.Text = LoggedInUser.FirstName + " " + LoggedInUser.LastName + " BSN:" + LoggedInUser.BsnNumber; Data = LoggedInUser; if (Data != null) { //get user measures from database if (!IsPostBack) { BSNNumberQR.Text = Data.BsnNumber; List <Measure> measures = dBUserConnection.GetUserMeasures(Data); List <string> items = new List <string>(); List <string> itemsCategories = new List <string>(); List <decimal> itemSeries = new List <decimal>(); foreach (var measure in measures) { items.Add(measure.Date.ToString("dd/MM/yyyy hh:mm") + " | Temperatuur: " + measure.Temperature.ToString() + " Bloeddruk: " + measure.BloodPressure); itemSeries.Add(Convert.ToDecimal(measure.Temperature)); itemsCategories.Add(measure.Date.ToString("dd MMMM hh:mm")); } CareControlMeasuresLineChart.Series.Add(new AjaxControlToolkit.LineChartSeries() { Data = itemSeries.ToArray(), Name = "Temperatuur in Celsius", LineColor = "#127a7b" }); CareControlMeasures.DataSource = items; CareControlMeasures.DataBind(); CareControlMeasuresLineChart.CategoriesAxis = string.Join(",", itemsCategories.ToArray()); CareControlMeasuresLineChart.DataBind(); UserData data = UserData.GetUserDataFromDB(Data); DAL.DBRoleConnection dBRoleConnection = new DAL.DBRoleConnection(); string roleDescription = null; try { var resultRights = dBRoleConnection.GetUserRights(LoggedInUser); roleDescription = "<br/>Rol: " + resultRights.Description; } catch (Exception) { } ProfileInformation.InnerHtml = ""; ProfileInformation.InnerHtml = "E-mailadress: " + LoggedInUser.EmailAdress + "<br/>Telefoonummer: " + LoggedInUser.PhoneNumber + "<br/>BSN nummer: " + LoggedInUser.BsnNumber + (roleDescription ?? ""); UserName.Text = LoggedInUser.FirstName + " " + LoggedInUser.LastName; fillUserData(data); } } } else { Response.Redirect("/SignIn"); } } else { Response.Redirect("/SignIn"); } } else { Response.Redirect("/SignIn"); } } }
protected void Page_Load(object sender, EventArgs e) { if (ShowWorkbar) { SideNavH.Visible = true; CollapseButton.Text = "<span class='glyphicon glyphicon-chevron-left'></span>"; Collumn2.Style.Value = ""; CollapseButton.ToolTip = "Werkbalk verbergen"; ShowWorkbar = true; } else { SideNavH.Visible = false; CollapseButton.Text = "<span class='glyphicon glyphicon-chevron-right'></span>"; Collumn2.Style.Value = "width:100%;"; CollapseButton.ToolTip = "Werkbalk uitvouwen"; ShowWorkbar = false; } Page.Title = "Portaal " + System.IO.Path.GetFileName(Request.Url.AbsolutePath); if (!IsPostBack) { HideVisibles(); if (Session["User"] != null) { LoggedInUser = Session["User"] as Entities.User; if (LoggedInUser != null) { BLL.LogInHelper logInHelper = new BLL.LogInHelper(); Entities.User result = new Entities.User(); try { result = logInHelper.LoginAtPageLoad(LoggedInUser); } catch (Exception) { Response.Redirect("/SignIn"); } if (result != null) { //akkoord om op de pagina te zijn+controle rechten rollen //Select user.RoleID, rights.ShowOwnDeseases, rights.ShowOwnTherapies, rights.ShowAllDeseases, rights.ShowAllTherapies, rights.ShowNewTherapy, rights.ShowNewDesease, rights.ShowNewMedication, rights.ShowOwnMedication, rights.ShowNewRapport, rights.ShowOwnRapports, rights.ShowAllRapports, rights.ChangeClientNAW, rights.ShowAllMedications from user inner join roles on roles.ID = user.RoleID inner join rights on rights.ID= roles.RightsID where user.BsnNumber='0123456790'and user.UniqueID='82a7969a-3570-f75b-a2cd-76c7ff0a396d' DAL.DBRoleConnection dBRoleConnection = new DAL.DBRoleConnection(); role = dBRoleConnection.GetUserRights(LoggedInUser); //haal alle gegevens aan het begin op met laad scherm string previousPageName = ""; if (Request.UrlReferrer != null) { previousPageName = Request.UrlReferrer.AbsolutePath; } string url = Request.Url.AbsolutePath; string currentPage = Path.GetFileName(Request.PhysicalPath); List <string> listurl = url.Split('/').ToList(); List <string> Finallisturl = new List <string>(); { Finallisturl.Add(previousPageName); Finallisturl.AddRange(listurl); } foreach (string item in Finallisturl) { if (item != "" && item != "PortalContent" && !item.StartsWith("/")) { BreadCrumb.InnerHtml += "<li><a href='" + item + "'>" + item + "</a></li>"; } else if (item == "PortalContent") { BreadCrumb.InnerHtml += "<li><a href='DashBoard'>" + item + "</a></li>"; } else if (item.StartsWith("/")) { BreadCrumb.InnerHtml += "<li><a href='" + item + "'><span class='glyphicon glyphicon-arrow-left'></span></a></li>"; } } } else { Response.Redirect("/SignIn"); } } else { Response.Redirect("/SignIn"); } } else { Response.Redirect("/SignIn"); } if (role != null) { ShowOwnDeseases.Visible = role.ShowOwnDeseases; ShowOwnTherapies.Visible = role.ShowOwnTherapies; ShowOwnMedications.Visible = role.ShowOwnMedication; ShowAllDeseases.Visible = role.ShowAllDeseases; ShowAllTherapies.Visible = role.ShowAllTherapies; ShowAllMedications.Visible = role.ShowAllMedications; ShowNewDeseases.Visible = role.ShowNewDesease; ShowNewTherapies.Visible = role.ShowNewTherapy; ShowNewMedication.Visible = role.ShowNewMedication; Rapports.Visible = role.ShowNewRapport; Management.Visible = role.Management; ShowAllFiles.Visible = role.ShowAllFiles; ShowNewFile.Visible = role.ShowNewFile; ShowOwnFiles.Visible = role.ShowOwnFiles; ShowClientData.Visible = role.ShowClientData; } else { Response.Redirect("/ErrorPage"); } } }