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)); }
public CustomDO AddSymptoms(string emailId, List <string> symptoms) { CustomDO custom = new CustomDO(); foreach (string symptom in symptoms) { /*UserSymptom userSymptom = new UserSymptom() * { * EmailAddress = emailId, * Symptoms = symptom * };*/ //healthAndFitnessDBEntities.UserSymptoms.Add(userSymptom); //int returnVal = healthAndFitnessDBEntities.SaveChanges(); UserSymptomsDO userSymptom = new UserSymptomsDO() { EmailAddress = emailId, Symptoms = symptom }; this.CSVHelper.InsertRecord <UserSymptomsDO, UserSymptomsMap>(userSymptom); custom.CustomId = 1; int returnVal = 1; if (returnVal > 0) { custom.CustomMessage = "Data Successfully Added"; } else { custom.CustomMessage = "Unable to Add User"; return(custom); } } return(custom); }
public CustomDO UpdateUserInfo(UserInfoDO userInfo) { CustomDO custom = new CustomDO(); //UserInfo user = healthAndFitnessDBEntities.UserInfoes.FirstOrDefault(x => x.EmailId.Equals(userInfo.EmailId)); UserInfoDO user = this.CSVHelper.Read <UserInfoDO, UserInfoMap>().FirstOrDefault(x => x.EmailId.Equals(userInfo.EmailId) && x.Password.Equals(userInfo.Password)); this.CSVHelper.DeleteRecord <UserInfoDO, UserInfoMap>(user, "UserName"); //user.UserAge = userInfo.UserAge; //user.Gender = userInfo.Gender; //user.UserHeight = userInfo.UserHeight; //user.UserWeight = userInfo.UserWeight; //int returnVal = healthAndFitnessDBEntities.SaveChanges(); this.CSVHelper.InsertRecord <UserInfoDO, UserInfoMap>(userInfo); int returnVal = 1; custom.CustomId = returnVal; if (returnVal > 0) { custom.CustomMessage = "Data Successfully Modified"; } else { custom.CustomMessage = "Unable to Add User"; } return(custom); }
public CustomDO AddUser(UserInfoDO userInfo) { CustomDO custom = new CustomDO(); /*UserInfo user = new UserInfo() * { * EmailId = userInfo.EmailId, * UserName = userInfo.UserName, * UserAge = userInfo.UserAge, * Gender = userInfo.Gender, * UserHeight = userInfo.UserHeight, * UserWeight = userInfo.UserWeight, * UserMobile = userInfo.UserMobile, * Password = userInfo.Password * };*/ //healthAndFitnessDBEntities.UserInfoes.Add(user); //int returnVal = healthAndFitnessDBEntities.SaveChanges(); this.CSVHelper.InsertRecord <UserInfoDO, UserInfoMap>(userInfo); custom.CustomId = 1; if (custom.CustomId > 0) { custom.CustomMessage = "Data Successfully Added"; } else { custom.CustomMessage = "Unable to Add User"; } return(custom); }
public ActionResult PregnancyTracker(FormCollection formCollection) { DateTime StartDate = Convert.ToDateTime(formCollection["PregnancyDate"]); UserInfoDO userInfo = Session["UserInfo"] as UserInfoDO; UserHealthInfoBL userHealthInfo = new UserHealthInfoBL(); UserHealthInfoDO userHealthInfoDO = userHealthInfo.GetUserHealthInfo(userInfo.EmailId); userHealthInfoDO.PregnancyDate = StartDate; CustomDO customDO = userHealthInfo.UpdateUserHealthInfo(userHealthInfoDO); return(RedirectToAction("DashBoard")); }
public ActionResult MenstrualAndFertilityTracker(FormCollection formCollection) { DateTime StartDate = Convert.ToDateTime(formCollection["MenstrualStartDate"]); int monthlyCycle = Convert.ToInt32(formCollection["MonthlyCycle"]); UserInfoDO userInfo = Session["UserInfo"] as UserInfoDO; UserHealthInfoBL userHealthInfo = new UserHealthInfoBL(); UserHealthInfoDO userHealthInfoDO = userHealthInfo.GetUserHealthInfo(userInfo.EmailId); userHealthInfoDO.PeriodDate = StartDate; userHealthInfoDO.MenstrualCycleDuration = monthlyCycle; CustomDO customDO = userHealthInfo.UpdateUserHealthInfo(userHealthInfoDO); return(RedirectToAction("DashBoard")); }
public ActionResult EnergyIndicator(FormCollection formCollection) { string amount = formCollection["Amount"]; string item = formCollection["FoodItems"]; UserInfoDO userInfo = Session["UserInfo"] as UserInfoDO; List <FoodItemsDO> FoodItemList = Session["foodItemList"] as List <FoodItemsDO>; UserHealthInfoBL userHealthInfo = new UserHealthInfoBL(); UserHealthInfoDO userHealthInfoDO = userHealthInfo.GetUserHealthInfo(userInfo.EmailId); FoodItemsDO fooditem = FoodItemList.FirstOrDefault(x => x.FoodItems.Equals(item)); userHealthInfoDO.CurrentCalories += fooditem.Calories * Convert.ToInt32(amount); CustomDO customDO = userHealthInfo.UpdateUserHealthInfo(userHealthInfoDO); return(RedirectToAction("DashBoard")); }
public ActionResult HealthMonitor(FormCollection formCollection) { string height = formCollection["Height"]; string weight = formCollection["Weight"]; if (height.Length > 0 && weight.Length > 0) { UserInfoDO userInfo = Session["UserInfo"] as UserInfoDO; userInfo.UserHeight = height; userInfo.UserWeight = weight; UserInfoBL userInfoBL = new UserInfoBL(); CustomDO customDO = userInfoBL.UpdateUserInfo(userInfo); } return(RedirectToAction("DashBoard")); }
public CustomDO AddUserHealthInfo(UserHealthInfoDO userHealthInfo) { CustomDO custom = new CustomDO(); /* * UserHealthInfo userHealth = new UserHealthInfo() * { * EmailId = userHealthInfo.EmailId, * Calories_Day_1 = userHealthInfo.Calories_Day_1, * Calories_Day_2 = userHealthInfo.Calories_Day_2, * Calories_Day_3 = userHealthInfo.Calories_Day_3, * Calories_Day_4 = userHealthInfo.Calories_Day_4, * Calories_Day_5 = userHealthInfo.Calories_Day_5, * Calories_Day_6 = userHealthInfo.Calories_Day_6, * Calories_Day_7 = userHealthInfo.Calories_Day_7, * CurrentCalories = userHealthInfo.CurrentCalories, * PeriodDate = userHealthInfo.PeriodDate, * FertilityDate = userHealthInfo.FertilityDate, * Medication1 = userHealthInfo.Medication1, * StartDateM1 = userHealthInfo.StartDateM1, * DurationM1 = userHealthInfo.DurationM1, * Medication2 = userHealthInfo.Medication2, * StartDateM2 = userHealthInfo.StartDateM2, * DurationM2 = userHealthInfo.DurationM2, * MenstrualCycleDuration = userHealthInfo.MenstrualCycleDuration, * PregnancyDate = userHealthInfo.PregnancyDate * }; */ this.CSVHelper.InsertRecord <UserHealthInfoDO, UserHealthInfoMap>(userHealthInfo); custom.CustomId = 1; //healthAndFitnessDBEntities.UserHealthInfoes.Add(userHealth); //int returnVal = healthAndFitnessDBEntities.SaveChanges(); int returnVal = 1; custom.CustomId = returnVal; if (returnVal > 0) { custom.CustomMessage = "Data Successfully Added"; } else { custom.CustomMessage = "Unable to Add User"; } return(custom); }
public CustomDO UpdateUserHealthInfo(UserHealthInfoDO modifiedUserHealthInfo) { CustomDO custom = new CustomDO(); /*UserHealthInfo userHealthInfo = healthAndFitnessDBEntities.UserHealthInfoes.FirstOrDefault(x => x.EmailId.Equals(modifiedUserHealthInfo.EmailId)); * userHealthInfo.EmailId = modifiedUserHealthInfo.EmailId; * userHealthInfo.Calories_Day_1 = modifiedUserHealthInfo.Calories_Day_1; * userHealthInfo.Calories_Day_2 = modifiedUserHealthInfo.Calories_Day_2; * userHealthInfo.Calories_Day_3 = modifiedUserHealthInfo.Calories_Day_3; * userHealthInfo.Calories_Day_4 = modifiedUserHealthInfo.Calories_Day_4; * userHealthInfo.Calories_Day_5 = modifiedUserHealthInfo.Calories_Day_5; * userHealthInfo.Calories_Day_6 = modifiedUserHealthInfo.Calories_Day_6; * userHealthInfo.Calories_Day_7 = modifiedUserHealthInfo.Calories_Day_7; * userHealthInfo.CurrentCalories = modifiedUserHealthInfo.CurrentCalories; * userHealthInfo.PeriodDate = modifiedUserHealthInfo.PeriodDate; * userHealthInfo.FertilityDate = modifiedUserHealthInfo.FertilityDate; * userHealthInfo.Medication1 = modifiedUserHealthInfo.Medication1; * userHealthInfo.StartDateM1 = modifiedUserHealthInfo.StartDateM1; * userHealthInfo.DurationM1 = modifiedUserHealthInfo.DurationM1; * userHealthInfo.Medication2 = modifiedUserHealthInfo.Medication2; * userHealthInfo.StartDateM2 = modifiedUserHealthInfo.StartDateM2; * userHealthInfo.DurationM2 = modifiedUserHealthInfo.DurationM2; * userHealthInfo.MenstrualCycleDuration = modifiedUserHealthInfo.MenstrualCycleDuration; * userHealthInfo.PregnancyDate = modifiedUserHealthInfo.PregnancyDate; * int returnVal = healthAndFitnessDBEntities.SaveChanges();*/ UserHealthInfoDO userHealthInfo = this.CSVHelper.Read <UserHealthInfoDO, UserHealthInfoMap>().FirstOrDefault(x => x.EmailId.Equals(modifiedUserHealthInfo.EmailId)); this.CSVHelper.DeleteRecord <UserHealthInfoDO, UserHealthInfoMap>(userHealthInfo, "EmailId"); this.CSVHelper.InsertRecord <UserHealthInfoDO, UserHealthInfoMap>(modifiedUserHealthInfo); int returnVal = 1; custom.CustomId = returnVal; if (returnVal > 0) { custom.CustomMessage = "Data Successfully Modified"; } else { custom.CustomMessage = "Unable to Add User"; } return(custom); }
public ActionResult MedicationTracker(FormCollection formCollection) { string medicine1 = formCollection["Medication1"]; string medicine2 = formCollection["Medication2"]; UserInfoDO userInfo = Session["UserInfo"] as UserInfoDO; UserHealthInfoBL userHealthInfo = new UserHealthInfoBL(); UserHealthInfoDO userHealthInfoDO = userHealthInfo.GetUserHealthInfo(userInfo.EmailId); if (medicine1 != null && medicine1.Length > 0) { userHealthInfoDO.Medication1 = medicine1; userHealthInfoDO.StartDateM1 = Convert.ToDateTime(formCollection["StartDateM1"]); userHealthInfoDO.DurationM1 = Convert.ToInt32(formCollection["DurationM1"]); } if (medicine2 != null && medicine2.Length > 0) { userHealthInfoDO.Medication2 = medicine2; userHealthInfoDO.StartDateM2 = Convert.ToDateTime(formCollection["StartDateM2"]); userHealthInfoDO.DurationM2 = Convert.ToInt32(formCollection["DurationM2"]); } CustomDO customDO = userHealthInfo.UpdateUserHealthInfo(userHealthInfoDO); return(RedirectToAction("DashBoard")); }