示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Data != null)
            {
                Session["UserData"] = Data;

                //get user measures from database
                if (!IsPostBack)
                {
                    qrBSN = 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);
                    fillUserData(data);
                }
            }
            else
            {
                //userdata=null

                if (Session["UserData"] != null)
                {
                    Data = Session["UserData"] as User;
                }
            }
        }
示例#2
0
        protected void NewUserData_SelectedIndexChanged(object sender, EventArgs e)
        {
            DBUserConnection dBUserConnection = new DBUserConnection();
            User             UserDataData     = dBUserConnection.GetUser(Convert.ToInt32(NewUserData.SelectedValue));

            Data = UserDataData;
            if (NewUserData.SelectedValue != "0")
            {
                if (Data != null)
                {
                    //get user measures from database

                    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);
                    fillUserData(data);

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>makeCode(" + (Data.BsnNumber ?? "0") + ");</script>", false);
                }
            }
        }
示例#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");
                }
            }
        }