Example #1
0
        public LoginPanel()
        {
            InitializeComponent();
            Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 25, 25));
            LogBase login = new LogBase();

            login.OpenConnection();
            login.CloseConnection();
        }
Example #2
0
        private void delete_Click(object sender, System.EventArgs e)
        {
            Application.VisualStyleState = VisualStyleState.ClientAndNonClientAreasEnabled;
            int     ID       = Convert.ToInt32(all.SelectedCells[0].Value);
            LogBase userData = new LogBase();

            userData.OpenConnection();
            string        query  = "DELETE FROM DATAS WHERE ROWID='" + ID + "'";
            SQLiteCommand delete = new SQLiteCommand(query, userData.myConnection);

            delete.ExecuteNonQuery();
            userData.CloseConnection();
            Table();
        }
Example #3
0
        private void pw_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                e.Handled = true;
                LogBase data = new LogBase();

                if (String.IsNullOrEmpty(userName.Text))
                {
                    MessageBox.Show("Nem adott meg felhasználónevet!", "Hiányos adat!");
                }
                else if (string.IsNullOrEmpty(pw.Text))
                {
                    MessageBox.Show("Nem adott meg jelszót!", "Hiányos adat!");
                }
                else
                {
                    data.OpenConnection();
                    SQLiteCommand    search = new SQLiteCommand("SELECT * FROM USER WHERE USERNAME='******'", data.myConnection);
                    SQLiteDataReader result = search.ExecuteReader();
                    if (result.HasRows)
                    {
                        string jelszo = "";
                        while (result.Read())
                        {
                            jelszo = result["Password"].ToString();
                        }
                        if (BCrypt.Net.BCrypt.Verify(pw.Text.ToString(), jelszo))
                        {
                            Food log = new Food(userName.Text.ToString());
                            log.Show();
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show("A felhasználónév vagy jelszó hibás!", "Hibás adat");
                        }
                    }
                    else
                    {
                        MessageBox.Show("A felhasználónév nem létezik!");
                    }
                }
            }
        }
Example #4
0
        public void add_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(comboCat.GetItemText(comboCat.SelectedItem)) == true)
            {
                MessageBox.Show("Nem választott kategóriát!", "");
            }
            if (String.IsNullOrEmpty(foods.GetItemText(foods.SelectedItem)) == true)
            {
                MessageBox.Show("Nem választott ételt/italt!", "");
            }
            else
            {
                LogBase  userData = new LogBase();
                Database foodData = new Database();

                string query = "SELECT * FROM '" + comboCat.GetItemText(comboCat.SelectedItem) + "' WHERE NAME='" + foods.GetItemText(foods.SelectedItem) + "'";
                foodData.OpenConnection();
                SQLiteCommand    leker  = new SQLiteCommand(query, foodData.myConnection);
                SQLiteDataReader result = leker.ExecuteReader();
                if (result.HasRows)
                {
                    query = "SELECT * FROM USER WHERE USERNAME='******'";
                    userData.OpenConnection();
                    SQLiteCommand    getDatas = new SQLiteCommand(query, userData.myConnection);
                    SQLiteDataReader dataRes  = getDatas.ExecuteReader();
                    if (dataRes.HasRows)
                    {
                        while (dataRes.Read())
                        {
                            while (result.Read())
                            {
                                query = "INSERT INTO DATAS ('Username', 'Food', 'Prot', 'Carb', 'Cal', 'Fat', 'Date', 'Weight', 'Height', 'Age', 'Sex', 'Goal') VALUES (@Username, @Food, @Prot, @Carb, @Cal, @Fat, @Date, @Weight, @Height, @Age, @Sex, @Goal)";
                                userData.OpenConnection();
                                SQLiteCommand insert = new SQLiteCommand(query, userData.myConnection);
                                insert.Parameters.AddWithValue("@Username", this.username);
                                insert.Parameters.AddWithValue("@Food", result["Name"].ToString());
                                insert.Parameters.AddWithValue("@Cal", result["Cal"].ToString());
                                insert.Parameters.AddWithValue("@Prot", Convert.ToDouble(result["Prot"]));
                                insert.Parameters.AddWithValue("@Carb", Convert.ToDouble(result["Carb"]));
                                insert.Parameters.AddWithValue("@Fat", Convert.ToDouble(result["Fat"]));
                                insert.Parameters.AddWithValue("@Date", DateTime.Now.ToString("yyyyMMdd"));
                                insert.Parameters.AddWithValue("@Weight", dataRes["Weight"].ToString());
                                insert.Parameters.AddWithValue("@Height", dataRes["Height"].ToString());
                                insert.Parameters.AddWithValue("@Age", dataRes["Age"].ToString());
                                insert.Parameters.AddWithValue("@Sex", dataRes["Sex"].ToString());
                                insert.Parameters.AddWithValue("@Goal", dataRes["Goal"].ToString());
                                var inResult = insert.ExecuteNonQuery();
                                if (inResult > 0)
                                {
                                    this.Hide();
                                    MessageBox.Show("A hozzáadás sikeres!");
                                }
                            }
                        }



                        userData.CloseConnection();
                    }
                    userData.CloseConnection();
                }
                foodData.CloseConnection();
            }
        }
Example #5
0
        private void reg_Click(object sender, EventArgs e)
        {
            LogBase       log   = new LogBase();
            string        query = "SELECT * FROM  USER WHERE USERNAME='******'";
            SQLiteCommand check = new SQLiteCommand(query, log.myConnection);

            if (String.IsNullOrEmpty(userName.Text) || String.IsNullOrEmpty(pw.Text) || (Male.Checked == false && Female.Checked == false) ||
                String.IsNullOrEmpty(Weight.Text) || String.IsNullOrEmpty(Height.Text) || String.IsNullOrEmpty(Age.Text) || (Stay.Checked == false && Reduce.Checked == false && Grow.Checked == false))
            {
                MessageBox.Show("Hiányosan töltötte ki az adatokat", "Hiányos adat!");
            }

            else
            {
                log.OpenConnection();
                SQLiteDataReader result = check.ExecuteReader();
                if (result.HasRows)
                {
                    MessageBox.Show("A felhasználónév már foglalt!", "Regisztráció");
                    userName.Clear();
                    pw.Clear();
                    log.CloseConnection();
                }
                else
                {
                    query = "INSERT INTO USER ('Username', 'Password', 'Weight', 'Height', 'Age', 'Sex', 'Goal') VALUES (@Username, @Password, @Weight, @Height, @Age, @Sex, @Goal)";
                    SQLiteCommand register = new SQLiteCommand(query, log.myConnection);
                    register.Parameters.AddWithValue("@Username", userName.Text.ToString());
                    register.Parameters.AddWithValue("@Password", BCrypt.Net.BCrypt.HashPassword(pw.Text.ToString()));
                    register.Parameters.AddWithValue("@Weight", int.Parse(Weight.Text));
                    register.Parameters.AddWithValue("@Height", int.Parse(Height.Text));
                    register.Parameters.AddWithValue("@Age", int.Parse(Age.Text));
                    if (Male.Checked == true)
                    {
                        register.Parameters.AddWithValue("@Sex", 1);
                    }
                    if (Female.Checked == true)
                    {
                        register.Parameters.AddWithValue("@Sex", 0);
                    }
                    if (Reduce.Checked == true)
                    {
                        register.Parameters.AddWithValue("@Goal", 0);
                    }
                    if (Grow.Checked == true)
                    {
                        register.Parameters.AddWithValue("@Goal", 1);
                    }
                    if (Stay.Checked == true)
                    {
                        register.Parameters.AddWithValue("@Goal", 2);
                    }
                    var res = register.ExecuteNonQuery();
                    log.CloseConnection();
                    if (res > 0)
                    {
                        MessageBox.Show("A regisztráció sikeres volt!", "Regisztráció");
                    }
                }
            }
        }
Example #6
0
        private void Table()
        {
            Application.VisualStyleState = VisualStyleState.NoneEnabled;

            pnlNav.Height          = sum.Height;
            pnlNav.Top             = sum.Top;
            pnlNav.Left            = sum.Left;
            Info.BackColor         = Color.FromArgb(24, 30, 54);
            sum.BackColor          = Color.FromArgb(46, 51, 73);
            btnCal.BackColor       = Color.FromArgb(24, 30, 54);
            btnDashboard.BackColor = Color.FromArgb(24, 30, 54);
            statPanel.Hide();
            carbPanel.Hide();
            fatPanel.Hide();
            protPanel.Hide();
            infoLabel.Hide();
            calPanel.Hide();
            add.Hide();
            calendar.Hide();
            all.Columns.Clear();
            all.Columns.Add("ID", "ID");
            all.Columns.Add("Username", "Felhasználónév");
            all.Columns.Add("Food", "Étel/Ital");
            all.Columns.Add("cal", "Kalória");
            all.Columns.Add("prot", "Fehérje");
            all.Columns.Add("fat", "Zsír");
            all.Columns.Add("carb", "Szénhidrát");
            all.Columns.Add("date", "Dátum");
            all.Columns["ID"].Visible = false;
            all.Size                      = new Size(625, 400);
            all.Location                  = new Point(statusLabel.Left, 75);
            all.AllowUserToAddRows        = false;
            all.AllowUserToDeleteRows     = false;
            all.ForeColor                 = Color.White;
            all.GridColor                 = Color.FromArgb(158, 161, 176);
            all.BorderStyle               = BorderStyle.None;
            all.SelectionMode             = DataGridViewSelectionMode.FullRowSelect;
            all.ScrollBars                = ScrollBars.Vertical;
            all.EnableHeadersVisualStyles = false;
            all.MultiSelect               = false;
            all.RowHeadersVisible         = false;
            all.AutoSizeColumnsMode       = DataGridViewAutoSizeColumnsMode.Fill;
            all.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            all.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
            all.ColumnHeadersDefaultCellStyle.SelectionBackColor = Color.FromArgb(46, 51, 73);
            all.DefaultCellStyle.BackColor = Color.FromArgb(46, 51, 73);
            all.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(46, 51, 73);
            all.ColumnHeadersDefaultCellStyle.BackColor   = Color.FromArgb(46, 51, 73);
            all.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
            all.RowHeadersDefaultCellStyle.BackColor      = Color.FromArgb(46, 51, 73);
            all.AutoSizeColumnsMode       = DataGridViewAutoSizeColumnsMode.AllCells;
            all.Columns["Food"].ValueType = typeof(String);
            all.BackgroundColor           = Color.FromArgb(46, 51, 73);
            all.BackColor = Color.FromArgb(46, 51, 73);
            this.Controls.Add(all);

            LogBase userData = new LogBase();

            userData.OpenConnection();
            string           query  = "SELECT ROWID, * FROM DATAS WHERE USERNAME='******' AND DATE='" + DateTime.Now.ToString("yyyyMMdd") + "'";
            SQLiteCommand    ossz   = new SQLiteCommand(query, userData.myConnection);
            SQLiteDataReader result = ossz.ExecuteReader();

            if (result.HasRows)
            {
                while (result.Read())
                {
                    string[] temp     = Convert.ToString(result["Cal"]).Split('/');
                    var      tempDate = DateTime.ParseExact(result["Date"].ToString(), "yyyyMMdd", CultureInfo.InvariantCulture).ToString("yyyy. MM. dd.");
                    all.Rows.Add(result["ROWID"], result["Username"], result["Food"], temp[1] + " kcal", result["Prot"] + " g", result["Fat"] + " g", result["carb"] + " g", tempDate.ToString());
                    this.Controls.Add(all);
                }
            }

            delete.Location = new Point(862, 515);
            delete.Size     = new Size(100, 50);
            delete.Image    = Image.FromFile("delete.png");
            delete.SizeMode = PictureBoxSizeMode.Zoom;
            delete.Cursor   = Cursors.Hand;
            this.Controls.Add(delete);
            delete.Show();
        }
Example #7
0
        private void Food_Activated(object sender, EventArgs e)
        {
            LogBase userData = new LogBase();
            string  query    = "SELECT * FROM USER WHERE USERNAME='******'";

            userData.OpenConnection();
            SQLiteCommand    getUser   = new SQLiteCommand(query, userData.myConnection);
            SQLiteDataReader result    = getUser.ExecuteReader();
            double           calFull   = 0;
            double           calBevitt = 0;

            if (result.HasRows)
            {
                while (result.Read())
                {
                    if (Convert.ToInt32(result["Sex"]) == 1)
                    {
                        calFull = 66.46 + (13.7 * Convert.ToInt32(result["Weight"])) + (5 * Convert.ToInt32(result["Height"])) - (6.8 * Convert.ToInt32(result["Age"]));
                    }
                    if (Convert.ToInt32(result["Sex"]) == 0)
                    {
                        calFull = 655.1 + (9.6 * Convert.ToInt32(result["Weight"])) + (1.8 * Convert.ToInt32(result["Height"])) - (4.7 * Convert.ToInt32(result["Age"]));
                    }
                    goal = Convert.ToInt32(result["Goal"]);
                }
            }

            query = "SELECT * FROM DATAS WHERE USERNAME='******'";
            SQLiteCommand getData = new SQLiteCommand(query, userData.myConnection);

            result = getData.ExecuteReader();
            double carbBevitt = 0;
            double protBevitt = 0;
            double fatBevitt  = 0;

            if (result.HasRows)
            {
                while (result.Read())
                {
                    if (DateTime.Now.ToString("yyyyMMdd") == result["Date"].ToString())
                    {
                        string[] temp = Convert.ToString(result["Cal"]).Split('/');
                        calBevitt  = Convert.ToDouble(temp[1]) + calBevitt;
                        carbBevitt = carbBevitt + Convert.ToDouble(result["Carb"]);
                        protBevitt = protBevitt + Convert.ToDouble(result["Prot"]);
                        fatBevitt  = fatBevitt + Convert.ToDouble(result["Fat"]);
                    }
                }
            }

            userData.CloseConnection();
            if (goal == 0)
            {
                calFull -= 200;
            }
            if (goal == 1)
            {
                calFull += 500;
            }

            double carbFull = (calFull * 0.45) / 4;
            double protFull = (calFull * 0.35) / 4;
            double fatFull  = (calFull * 0.20) / 8;


            double percent = Math.Round((calBevitt / calFull) * 100, MidpointRounding.AwayFromZero);

            if (percent < 100)
            {
                statPercent.Text  = percent.ToString() + "%";
                statPercent.Value = Convert.ToInt32(percent);
            }
            else
            {
                statPercent.Text  = percent.ToString() + "%";
                statPercent.Value = 100;
            }

            fatLabel.Text  = Math.Round(fatBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(fatFull, MidpointRounding.AwayFromZero) + " g";
            protLabel.Text = Math.Round(protBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(protFull, MidpointRounding.AwayFromZero) + " g";
            carbLabel.Text = Math.Round(carbBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(carbFull, MidpointRounding.AwayFromZero) + " g";
            cal.Text       = calBevitt + "/" + Math.Ceiling(calFull) + " kcal";
        }
Example #8
0
        public Food(string name)
        {
            this.calendar.ValueChanged += new System.EventHandler(this.calendar_ValueChanged);
            this.delete.Click          += new System.EventHandler(this.delete_Click);
            username = name;
            InitializeComponent();
            Region            = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 25, 25));
            userName.Text     = name;
            pnlNav.Height     = btnDashboard.Height;
            pnlNav.Top        = btnDashboard.Top;
            pnlNav.Left       = btnDashboard.Left;
            calendar.Location = new Point(statusLabel.Left, 55);
            this.Controls.Add(calendar);
            calendar.Hide();
            btnDashboard.BackColor = Color.FromArgb(46, 51, 73);
            LogBase userData = new LogBase();
            string  query    = "SELECT * FROM USER WHERE USERNAME='******'";

            userData.OpenConnection();
            SQLiteCommand    getUser   = new SQLiteCommand(query, userData.myConnection);
            SQLiteDataReader result    = getUser.ExecuteReader();
            double           calFull   = 0;
            double           calBevitt = 0;

            if (result.HasRows)
            {
                while (result.Read())
                {
                    if (Convert.ToInt32(result["Sex"]) == 1)
                    {
                        calFull = 66.46 + (13.7 * Convert.ToInt32(result["Weight"])) + (5 * Convert.ToInt32(result["Height"])) - (6.8 * Convert.ToInt32(result["Age"]));
                    }
                    if (Convert.ToInt32(result["Sex"]) == 0)
                    {
                        calFull = 655.1 + (9.6 * Convert.ToInt32(result["Weight"])) + (1.8 * Convert.ToInt32(result["Height"])) - (4.7 * Convert.ToInt32(result["Age"]));
                    }
                    goal = Convert.ToInt32(result["Goal"]);
                }
            }

            query = "SELECT * FROM DATAS WHERE USERNAME='******'";
            SQLiteCommand getData = new SQLiteCommand(query, userData.myConnection);

            result = getData.ExecuteReader();
            double carbBevitt = 0;
            double protBevitt = 0;
            double fatBevitt  = 0;

            if (result.HasRows)
            {
                while (result.Read())
                {
                    if (DateTime.Now.ToString("yyyyMMdd") == result["Date"].ToString())
                    {
                        string[] temp = Convert.ToString(result["Cal"]).Split('/');
                        calBevitt  = Convert.ToDouble(temp[1]) + calBevitt;
                        carbBevitt = carbBevitt + Convert.ToDouble(result["Carb"]);
                        protBevitt = protBevitt + Convert.ToDouble(result["Prot"]);
                        fatBevitt  = fatBevitt + Convert.ToDouble(result["Fat"]);
                    }
                }
            }

            userData.CloseConnection();
            if (goal == 0)
            {
                calFull -= 200;
            }
            if (goal == 1)
            {
                calFull += 500;
            }

            double carbFull = (calFull * 0.45) / 4;
            double protFull = (calFull * 0.35) / 4;
            double fatFull  = (calFull * 0.20) / 8;


            double percent = Math.Round((calBevitt / calFull) * 100, MidpointRounding.AwayFromZero);

            if (percent < 100)
            {
                statPercent.Text  = percent.ToString() + "%";
                statPercent.Value = Convert.ToInt32(percent);
            }
            else
            {
                statPercent.Text  = percent.ToString() + "%";
                statPercent.Value = 100;
            }

            fatLabel.Text  = Math.Round(fatBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(fatFull, MidpointRounding.AwayFromZero) + " g";
            protLabel.Text = Math.Round(protBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(protFull, MidpointRounding.AwayFromZero) + " g";
            carbLabel.Text = Math.Round(carbBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(carbFull, MidpointRounding.AwayFromZero) + " g";
            cal.Text       = calBevitt + "/" + Math.Ceiling(calFull) + " kcal";
        }
Example #9
0
        private void setCalendar()
        {
            if (Convert.ToDateTime(calendar.Value) > DateTime.Now)
            {
                Application.VisualStyleState = VisualStyleState.ClientAndNonClientAreasEnabled;
                MessageBox.Show("A kiválasztott dátum nem lehet későbbi mint a mai dátum!");
            }
            else
            {
                LogBase userData = new LogBase();
                statPanel.Show();
                carbPanel.Show();
                fatPanel.Show();
                protPanel.Show();
                calPanel.Show();
                string query = "SELECT * FROM USER WHERE USERNAME='******'";
                userData.OpenConnection();
                SQLiteCommand    getUser   = new SQLiteCommand(query, userData.myConnection);
                SQLiteDataReader result    = getUser.ExecuteReader();
                double           calFull   = 0;
                double           calBevitt = 0;

                if (result.HasRows)
                {
                    while (result.Read())
                    {
                        if (Convert.ToInt32(result["Sex"]) == 1)
                        {
                            calFull = 66.46 + (13.7 * Convert.ToInt32(result["Weight"])) + (5 * Convert.ToInt32(result["Height"])) - (6.8 * Convert.ToInt32(result["Age"]));
                        }
                        if (Convert.ToInt32(result["Sex"]) == 0)
                        {
                            calFull = 655.1 + (9.6 * Convert.ToInt32(result["Weight"])) + (1.8 * Convert.ToInt32(result["Height"])) - (4.7 * Convert.ToInt32(result["Age"]));
                        }
                        goal = Convert.ToInt32(result["Goal"]);
                    }
                }
                query = "SELECT * FROM DATAS WHERE USERNAME='******' AND DATE='" + Convert.ToDateTime(calendar.Value).ToString("yyyyMMdd") + "'";
                SQLiteCommand keres = new SQLiteCommand(query, userData.myConnection);
                result = keres.ExecuteReader();
                double carbBevitt = 0;
                double protBevitt = 0;
                double fatBevitt  = 0;

                if (result.HasRows)
                {
                    while (result.Read())
                    {
                        string[] temp = Convert.ToString(result["Cal"]).Split('/');
                        calBevitt  = Convert.ToDouble(temp[1]) + calBevitt;
                        carbBevitt = carbBevitt + Convert.ToDouble(result["Carb"]);
                        protBevitt = protBevitt + Convert.ToDouble(result["Prot"]);
                        fatBevitt  = fatBevitt + Convert.ToDouble(result["Fat"]);
                    }
                }

                userData.CloseConnection();
                if (goal == 0)
                {
                    calFull -= 200;
                }
                if (goal == 1)
                {
                    calFull += 500;
                }

                double carbFull = (calFull * 0.45) / 4;
                double protFull = (calFull * 0.35) / 4;
                double fatFull  = (calFull * 0.20) / 8;


                double percent = Math.Round((calBevitt / calFull) * 100, MidpointRounding.AwayFromZero);
                if (percent < 100)
                {
                    statPercent.Text  = percent.ToString() + "%";
                    statPercent.Value = Convert.ToInt32(percent);
                }
                else
                {
                    statPercent.Text  = percent.ToString() + "%";
                    statPercent.Value = 100;
                }

                fatLabel.Text     = Math.Round(fatBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(fatFull, MidpointRounding.AwayFromZero) + " g";
                protLabel.Text    = Math.Round(protBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(protFull, MidpointRounding.AwayFromZero) + " g";
                carbLabel.Text    = Math.Round(carbBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(carbFull, MidpointRounding.AwayFromZero) + " g";
                cal.Text          = calBevitt + "/" + Math.Ceiling(calFull) + " kcal";
                dailyCal.Text     = "Összesen elfogyasztott kalória\n" + Convert.ToDateTime(calendar.Value).ToString("yyyy. MM. dd.");
                dailyFat.Text     = "Összesen elfogyasztott zsír\n" + Convert.ToDateTime(calendar.Value).ToString("yyyy. MM. dd.");
                dailyProt.Text    = "Összesen elfogyasztott fehérje\n" + Convert.ToDateTime(calendar.Value).ToString("yyyy. MM. dd.");
                dailyCarb.Text    = "Összesen elfogyasztott szénhidrát\n" + Convert.ToDateTime(calendar.Value).ToString("yyyy. MM. dd.");
                dailyPercent.Text = "Összesen elfogyasztott kalória %\n" + Convert.ToDateTime(calendar.Value).ToString("yyyy. MM. dd.");
            }
        }
Example #10
0
        private void btnDashboard_Click(object sender, EventArgs e)
        {
            Application.VisualStyleState = VisualStyleState.ClientAndNonClientAreasEnabled;
            pnlNav.Height          = btnDashboard.Height;
            pnlNav.Top             = btnDashboard.Top;
            pnlNav.Left            = btnDashboard.Left;
            btnDashboard.BackColor = Color.FromArgb(46, 51, 73);
            btnCal.BackColor       = Color.FromArgb(24, 30, 54);
            Info.BackColor         = Color.FromArgb(24, 30, 54);
            infoLabel.Hide();
            statPanel.Show();
            carbPanel.Show();
            fatPanel.Show();
            protPanel.Show();
            calPanel.Show();
            add.Show();
            calendar.Hide();
            all.Hide();
            delete.Hide();
            dailyCal.Text     = "Összesen elfogyasztott kalória";
            dailyFat.Text     = "Összesen elfogyasztott zsír";
            dailyProt.Text    = "Összesen elfogyasztott fehérje";
            dailyCarb.Text    = "Összesen elfogyasztott szénhidrát";
            dailyPercent.Text = "Összesen elfogyasztott kalória %";
            sum.BackColor     = Color.FromArgb(24, 30, 54);

            LogBase userData = new LogBase();
            string  query    = "SELECT * FROM USER WHERE USERNAME='******'";

            userData.OpenConnection();
            SQLiteCommand    getUser   = new SQLiteCommand(query, userData.myConnection);
            SQLiteDataReader result    = getUser.ExecuteReader();
            double           calFull   = 0;
            double           calBevitt = 0;

            if (result.HasRows)
            {
                while (result.Read())
                {
                    if (Convert.ToInt32(result["Sex"]) == 1)
                    {
                        calFull = 66.46 + (13.7 * Convert.ToInt32(result["Weight"])) + (5 * Convert.ToInt32(result["Height"])) - (6.8 * Convert.ToInt32(result["Age"]));
                    }
                    if (Convert.ToInt32(result["Sex"]) == 0)
                    {
                        calFull = 655.1 + (9.6 * Convert.ToInt32(result["Weight"])) + (1.8 * Convert.ToInt32(result["Height"])) - (4.7 * Convert.ToInt32(result["Age"]));
                    }
                    goal = Convert.ToInt32(result["Goal"]);
                }
            }

            query = "SELECT * FROM DATAS WHERE USERNAME='******'";
            SQLiteCommand getData = new SQLiteCommand(query, userData.myConnection);

            result = getData.ExecuteReader();
            double carbBevitt = 0;
            double protBevitt = 0;
            double fatBevitt  = 0;

            if (result.HasRows)
            {
                while (result.Read())
                {
                    if (DateTime.Now.ToString("yyyyMMdd") == result["Date"].ToString())
                    {
                        string[] temp = Convert.ToString(result["Cal"]).Split('/');
                        calBevitt  = Convert.ToDouble(temp[1]) + calBevitt;
                        carbBevitt = carbBevitt + Convert.ToDouble(result["Carb"]);
                        protBevitt = protBevitt + Convert.ToDouble(result["Prot"]);
                        fatBevitt  = fatBevitt + Convert.ToDouble(result["Fat"]);
                    }
                }
            }


            userData.CloseConnection();
            if (goal == 0)
            {
                calFull -= 200;
            }
            if (goal == 1)
            {
                calFull += 500;
            }

            double carbFull = (calFull * 0.45) / 4;
            double protFull = (calFull * 0.35) / 4;
            double fatFull  = (calFull * 0.20) / 8;


            double percent = Math.Round((calBevitt / calFull) * 100, MidpointRounding.AwayFromZero);

            if (percent < 100)
            {
                statPercent.Text  = percent.ToString() + "%";
                statPercent.Value = Convert.ToInt32(percent);
            }
            else
            {
                statPercent.Text  = percent.ToString() + "%";
                statPercent.Value = 100;
            }

            fatLabel.Text    = Math.Round(fatBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(fatFull, MidpointRounding.AwayFromZero) + " g";
            protLabel.Text   = Math.Round(protBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(protFull, MidpointRounding.AwayFromZero) + " g";
            carbLabel.Text   = Math.Round(carbBevitt, MidpointRounding.AwayFromZero) + "/" + Math.Round(carbFull, MidpointRounding.AwayFromZero) + " g";
            cal.Text         = calBevitt + "/" + Math.Ceiling(calFull) + " kcal";
            statusLabel.Text = "Főoldal";
        }