Example #1
0
        protected void SignInButton_Click(object sender, EventArgs e)
        {
            string Emailadress = SignInEmailTB.Text.ToLower();
            string PassWord    = SignInPasswordTB.Text;

            Entities.User result1 = new Entities.User();
            //vul user credentials met email en wachtwoord+hashtouniqueid
            string uniqueId = "";

            using (MD5 md5 = MD5.Create())
            {
                byte[] hash = md5.ComputeHash(Encoding.Default.GetBytes(Emailadress));
                uniqueId = PassWordSecurity.NameUUIDFromBytes(hash);
            }
            UserCredentials = new Entities.User();
            UserCredentials.PassWordHash = uniqueId + BLL.PassWordSecurity.Hash(PassWord);
            UserCredentials.EmailAdress  = Emailadress;
            if (UserCredentials != null)
            {
                if (!string.IsNullOrEmpty(UserCredentials.EmailAdress) && !string.IsNullOrEmpty(UserCredentials.PassWordHash))
                {
                    BLL.LogInHelper logInHelper = new BLL.LogInHelper();
                    try
                    {
                        //probeer in te loggen met ingevulde gegevens

                        result1 = logInHelper.LoginAtPageLoad(UserCredentials);
                        if (result1 != null || result1.ID != 0)
                        {
                            //inlog geaccepteerd
                            ShowMessagerAlert("U bent ingelogd");
                            Session["User"] = result1;
                            SiteMaster.setLoggedInText(UserCredentials.EmailAdress, "/Account");
                            Response.Redirect("/Account.aspx");
                        }
                        else
                        {
                            SiteMaster.setLoggedInText("Inloggen", "/SignIn");
                            ShowMessagerAlert("Deze combinatie van gebruikersnaam en wachtwoord is niet gevonden");
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowMessagerAlert("Probleem bij ophalen van gebruikergegevens: " + ex.Message);
                    }
                }
                else
                {
                    ShowMessagerAlert("Er zijn geen gebruikersnaam of wachtwoord ingevuld");
                }
            }
            else
            {
                SiteMaster.setLoggedInText("Inloggen", "/SignIn");
                ShowMessagerAlert("Er zijn geen gebruikersnaam of wachtwoord ingevuld");
            }
            //do postback zodat inloggen vervangen wordt door emailadress
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "DoPostBack", "__doPostBack(sender, e)", true);
        }
Example #2
0
        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");
                }
            }
        }
Example #3
0
        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");
                }
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DAL.DBTestConnection dBTestConnection = new DAL.DBTestConnection();
                try
                {
                    dBTestConnection.TestDBConnection();
                }
                catch (Exception ex)
                {
                    if (Request.Url.AbsolutePath != "/ErrorPage")
                    {
                        Response.Redirect("/ErrorPage.aspx");
                    }
                }

                if (Session["User"] != null)
                {
                    Entities.User LoggedInUser = Session["User"] as Entities.User;
                    if (LoggedInUser != null)
                    {
                        DAL.DBUserConnection dBUserConnection = new DAL.DBUserConnection();
                        Entities.UserData    data             = dBUserConnection.GetUserData(LoggedInUser);
                        if (data.ProfilePicUrl == null)
                        {
                            ProfileImg.Visible = false;
                        }
                        else
                        {
                            ProfileImg.ImageUrl = data.ProfilePicUrl;
                        }
                        BLL.LogInHelper logInHelper = new BLL.LogInHelper();
                        Entities.User   result      = new Entities.User();
                        try
                        {
                            result = logInHelper.LoginAtPageLoad(LoggedInUser);
                        }
                        catch (Exception)
                        {
                            LoggedInUserLbl.Text = "Inloggen";
                            LogginLink.HRef      = "/SignIn";
                            ProfileImg.Visible   = false;
                            Logout.Visible       = false;
                        }
                        if (result != null)
                        {
                            LoggedInUserLbl.Text = LoggedInUser.EmailAdress;
                            LogginLink.HRef      = "/Account";
                        }
                        else
                        {
                            LoggedInUserLbl.Text = "Inloggen";
                            LogginLink.HRef      = "/SignIn";
                            ProfileImg.Visible   = false;
                            Logout.Visible       = false;
                        }
                    }
                    else
                    {
                        LoggedInUserLbl.Text = "Inloggen";
                        LogginLink.HRef      = "/SignIn";
                        ProfileImg.Visible   = false;
                        Logout.Visible       = false;
                    }
                }
                else
                {
                    LoggedInUserLbl.Text = "Inloggen";
                    LogginLink.HRef      = "/SignIn";
                    Logout.Visible       = false;
                    ProfileImg.Visible   = false;
                }
            }
        }