Ejemplo n.º 1
0
        public ActionResult Register(UserInfoDO userInfoDO)
        {
            Session["MedicalDetails"] = "";
            if (ModelState.IsValid)
            {
                // Add user info
                UserInfoBL userInfoBL = new UserInfoBL();
                userInfoDO.Password = GetMD5(userInfoDO.Password);
                CustomDO customDO = userInfoBL.AddUser(userInfoDO);

                // Add user health info
                UserHealthInfoBL userHealthInfo   = new UserHealthInfoBL();
                UserHealthInfoDO userHealthInfoDO = new UserHealthInfoDO();
                userHealthInfoDO.EmailId                = userInfoDO.EmailId;
                userHealthInfoDO.CurrentCalories        = 0;
                userHealthInfoDO.MenstrualCycleDuration = 28;
                userHealthInfoDO.PeriodDate             = DateTime.Today.Date;
                userHealthInfoDO.PregnancyDate          = DateTime.Today.Date;
                userHealthInfoDO.StartDateM1            = DateTime.Today.Date;
                userHealthInfoDO.StartDateM2            = DateTime.Today.Date;
                CustomDO customDO1 = userHealthInfo.AddUserHealthInfo(userHealthInfoDO);

                Session["UserInfo"] = userInfoDO;
                AgeGrpWorkoutDO ageGrpWorkout = this.HelperRegularFitness(userInfoDO.UserAge);
                Session["ageGrpWorkout"] = ageGrpWorkout;
                return(RedirectToAction("DashBoard"));
            }
            return(View(userInfoDO));
        }
Ejemplo n.º 2
0
        //This function will load the Regular Fitness details of the user on loading the dashboard
        public AgeGrpWorkoutDO HelperRegularFitness(int age)
        {
            AgeGrpWorkoutBL ageGrpWorkoutBL = new AgeGrpWorkoutBL();
            AgeGrpWorkoutDO ageGrpWorkout   = ageGrpWorkoutBL.GetAgrGrpWorkout(age);

            return(ageGrpWorkout);
        }
Ejemplo n.º 3
0
 public ActionResult Index(string emailId, string password)
 {
     Session["MedicalDetails"] = "";
     if (ModelState.IsValid && emailId.Length > 0 && password.Length > 0)
     {
         UserInfoBL userInfoBL = new UserInfoBL();
         UserInfoDO userInfo   = userInfoBL.GetUser(emailId, GetMD5(password));
         if (userInfo != null)
         {
             Session["UserInfo"] = userInfo;
             AgeGrpWorkoutDO ageGrpWorkout = this.HelperRegularFitness(userInfo.UserAge);
             Session["ageGrpWorkout"] = ageGrpWorkout;
             return(RedirectToAction("DashBoard"));
         }
         else
         {
             ViewBag.ErrorMessage = "Login failed";
             return(View());
         }
     }
     else
     {
         ViewBag.ErrorMessage = "Login failed";
         return(View());
     }
 }
Ejemplo n.º 4
0
        //This function will load the regular fitness of the user on loading the dashboard
        public void RegularFitnessHelper()
        {
            AgeGrpWorkoutBL ageGrpWorkoutBL = new AgeGrpWorkoutBL();
            AgeGrpWorkoutDO ageGrpWorkout   = Session["ageGrpWorkout"] as AgeGrpWorkoutDO;
            int             currentPlan     = Convert.ToInt32(ageGrpWorkout.Workout_Plan.Last().ToString());
            string          newPlanWorkout  = ageGrpWorkoutBL.getModifiedPlan(0, Convert.ToInt32(ageGrpWorkout.Calories), currentPlan);

            ViewBag.Workout = "https://www.youtube.com/embed/" + newPlanWorkout;
        }
Ejemplo n.º 5
0
        //This function will load the Food intake details of the user on loading the dashboard
        public void EnergyIndicatorHelper()
        {
            UserInfoDO       userInfo         = Session["UserInfo"] as UserInfoDO;
            AgeGrpWorkoutDO  ageGrpWorkout    = Session["ageGrpWorkout"] as AgeGrpWorkoutDO;
            UserHealthInfoBL userHealthInfo   = new UserHealthInfoBL();
            UserHealthInfoDO userHealthInfoDO = userHealthInfo.GetUserHealthInfo(userInfo.EmailId);
            int    currentCalories            = userHealthInfoDO.CurrentCalories ?? 0;
            int    requiredCalories           = Convert.ToInt32(ageGrpWorkout.Calories);
            double PercentageCalories         = ((double)currentCalories / requiredCalories) * 100;
            double Calories = Math.Round(PercentageCalories);

            if (currentCalories <= requiredCalories)
            {
                ViewBag.Calories     = Calories.ToString() + "%";
                ViewBag.NeedCalories = "You need to consume " + (requiredCalories - currentCalories).ToString() + " calories more to achieve daily goal.";
            }
            else
            {
                ViewBag.Calories     = "100%";
                ViewBag.NeedCalories = "Congratulations you have completd your goal. Extra Calories :" + (currentCalories - requiredCalories).ToString() + " calories.";
            }
            FoodItemsBL        foodItemsBL  = new FoodItemsBL();
            List <FoodItemsDO> FoodItemList = foodItemsBL.GetFoodItems();
            List <string>      items        = new List <string>();

            List <SelectListItem> selectListItems1 = new List <SelectListItem>();
            List <SelectListItem> selectListItems2 = new List <SelectListItem>();
            int i = 1;

            foreach (FoodItemsDO foodItems in FoodItemList)
            {
                selectListItems1.Add(new SelectListItem {
                    Text = foodItems.FoodItems, Value = foodItems.FoodItems
                });
                selectListItems2.Add(new SelectListItem {
                    Text = i.ToString(), Value = i.ToString()
                });
                i++;
            }
            while (i <= 20)
            {
                selectListItems2.Add(new SelectListItem {
                    Text = i.ToString(), Value = i.ToString()
                });
                i++;
            }
            selectListItems1.First().Selected = true;
            selectListItems2.First().Selected = true;

            ViewBag.FoodItems       = selectListItems1;
            ViewBag.Amount          = selectListItems2;
            Session["foodItemList"] = FoodItemList;
        }
Ejemplo n.º 6
0
        public AgeGrpWorkoutDO GetAgrGrpWorkout(int age)
        {
            AgeGrpWorkoutDO ageGrpWorkout = new AgeGrpWorkoutDO();
            //AgeGrpWorkout ageGrpDetails = healthAndFitnessDBEntities.AgeGrpWorkouts.FirstOrDefault(x => x.Start_Age <= age && x.End_Age >= age);
            AgeGrpWorkoutDO ageGrpDetails = this.CSVHelper.Read <AgeGrpWorkoutDO, AgeGrpWorkoutMap>().FirstOrDefault(x => x.Start_Age <= age && x.End_Age >= age);

            /*
             * if (ageGrpDetails != null)
             * {
             *  ageGrpWorkout.Start_Age = ageGrpDetails.Start_Age;
             *  ageGrpWorkout.End_Age = ageGrpDetails.End_Age;
             *  ageGrpWorkout.Workout_Plan = ageGrpDetails.Workout_Plan;
             *  ageGrpWorkout.Calories = ageGrpDetails.Calories;
             * }*/
            //return ageGrpWorkout;
            return(ageGrpDetails);
        }