コード例 #1
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (file.HasFile)
            {
                if (!string.IsNullOrEmpty(FileDescription.Text))
                {
                    if (NewFileClient.SelectedItem != null)
                    {
                        try
                        {
                            DBUserConnection dBUserConnection = new DBUserConnection();
                            User             FileUser         = dBUserConnection.GetUser(Convert.ToInt32(NewFileClient.SelectedValue));

                            bool DirExists = System.IO.Directory.Exists(Server.MapPath("/Files/" + FileUser.UniqueUserID + "/"));
                            if (!DirExists)
                            {
                                System.IO.Directory.CreateDirectory(Server.MapPath("/Files/" + FileUser.UniqueUserID + "/"));
                            }
                            file.SaveAs(Server.MapPath("/Files/" + FileUser.UniqueUserID + "/" + file.FileName));
                            DBFileConnection dBFileConnection = new DBFileConnection();
                            Entities.File    NewFile          = new Entities.File();
                            NewFile.Description = FileDescription.Text;
                            NewFile.FileName    = file.FileName;
                            NewFile.FilePath    = "/Files/" + FileUser.UniqueUserID + "/" + file.FileName;
                            dBFileConnection.Save(LoggedInUser, NewFile, FileUser.ID);
                            Message.Text = "Bestand is opgeslagen";
                        }
                        catch (Exception ex)
                        {
                            Message.Text = "Er is een uitzondering opgetreden bij het opslaan van " + file.FileName + "<br/>" + ex.Message;
                        }
                    }
                    else
                    {
                        Message.Text = "Er is geen gebruiker geselecteerd";
                    }
                }
                else
                {
                    Message.Text = "Er is geen beschrijving ingevuld";
                }
            }
            else
            {
                Message.Text = "Er is geen bestand gekozen";
            }
        }
コード例 #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 NewDeseaseClient_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (NewDeseaseClient.SelectedValue != "0")
     {
         if ((User)Session["User"] != null)
         {
             FilesMain.InnerHtml = "";
             UserFiles           = null;
             DBFileConnection dBFileConnection = new DBFileConnection();
             DBUserConnection dBUserConnection = new DBUserConnection();
             User             FileUser         = dBUserConnection.GetUser(Convert.ToInt32(NewDeseaseClient.SelectedValue));
             List <File>      files            = dBFileConnection.GetFiles(FileUser);
             UserFiles = files.OrderByDescending(o => o.Date).ToList();
             string html = setHTMLFiles(UserFiles);
             FilesMain.InnerHtml = html;
         }
     }
     else
     {
         FilesMain.InnerHtml = "";
     }
 }