Ejemplo n.º 1
0
        //public string username
        //{
        //    get
        //    {
        //        return username;
        //    }
        //    set
        //    {
        //        if (username != value)
        //        {
        //            PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Username"));
        //            username = value;
        //        }
        //    }
        //}
        public UserName_model Return_info(string username)
        {
            UserName_model user    = new UserName_model();
            string         sql     = "SELECT ID_User,Username,Weight,Height,Sex,Age,ActivityLevel,BMI,BMR FROM Users WHERE Username = @user";
            var            command = new SqlCommand(sql, DB.Connection());

            command.Parameters.AddWithValue("@user", username);
            SqlDataReader reader = command.ExecuteReader();

            DB.Connection_Close(DB.Connection());

            while (reader.Read())
            {
                user.ID_User       = reader.GetInt32(0);
                user.Username      = reader.GetString(1);
                user.Weight        = reader.GetDouble(2);
                user.Height        = reader.GetDouble(3);
                user._sex          = reader.GetString(4);
                user.Age           = reader.GetByte(5);
                user.ActivityLevel = reader.GetString(6);
                user.BMI           = reader.GetDecimal(7);
                user.BMR           = reader.GetDecimal(8);
            }
            Sex = (user._sex == "Man") ? EnumSex.Man : EnumSex.Woman;

            return(user);
        }
Ejemplo n.º 2
0
 public UserWindow()
 {
     InitializeComponent();
     username.Content = Global_Methods.username;
     user_model       = user_model.Return_info(Global_Methods.username);
     id_diary         = queries.ReturnUserIDdiary(user_model.ID_User);
     CalculateStartAndEndDate();
     RefreshChart();
 }
Ejemplo n.º 3
0
 public Add_Product()
 {
     InitializeComponent();
     user_model = user_model.Return_info(Global_Methods.username);
     Fill_data();
     textBoxes = new List <TextBox>()
     {
         txt_carbohydrates, txt_fat, txt_kcal, txt_protein
     };
 }