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 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()); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { var task = Task.Run(() => UserInfoBL.SelectUserInfoByAccount(Account)); task.Wait(); List <UserInfo> UserInfoList = task.Result; MyInfo.Content = UserInfoList.FirstOrDefault()?.UserName; }
//This function will load BMI related details of the user on loading the dashboard public void MonitorHealthHelper() { UserInfoBL userInfoBL = new UserInfoBL(); UserInfoDO userInfo = Session["UserInfo"] as UserInfoDO; ViewBag.Name = userInfo.UserName; double height = Convert.ToDouble(userInfo.UserHeight); double weight = Convert.ToDouble(userInfo.UserWeight); int age = Convert.ToInt32(userInfo.UserAge); string StatusMonitorHealth = userInfoBL.BMICalculation(height, weight, age); String[] strlist = StatusMonitorHealth.Split(); ViewBag.Status = strlist[0]; ViewBag.BMI = strlist[1]; }
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")); }
/// <summary> /// 修改按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Update_Click(object sender, RoutedEventArgs e) { UserInfo UI = new UserInfo(); UI.Account = Account; UI.UserName = UserName_TextBox.Text; UI.Email = Email_TextBox.Text; UI.UserAddress = Address_TextBox.Text; UI.Phone = Phone_TextBox.Text; if (UserName_TextBox.Text == null || UserName_TextBox.Text == "") { MessageBox.Show("请输入昵称"); return; } if (Email_TextBox.Text == null || Email_TextBox.Text == "") { MessageBox.Show("请输入邮箱"); return; } if (Address_TextBox.Text == null || Address_TextBox.Text == "") { MessageBox.Show("请输入地址"); return; } if (Phone_TextBox.Text == null || Phone_TextBox.Text == "") { MessageBox.Show("请输入电话"); return; } var task = Task.Run(() => UserInfoBL.UpdateUserInfoByAccount(UI.Account, UI.UserName, UI.Email, UI.UserAddress, UI.Phone)); task.Wait(); int Result = Convert.ToInt32(task.Result); if (Result == 1) { MessageBox.Show("修改信息成功"); //测试成功(用户名与窗口移动pint.X/Y变量有冲突.) this.Close(); } else { MessageBox.Show("修改信息失败"); } }
private void MyInfo_Loaded(object sender, RoutedEventArgs e) { ///获取账号还没做完 var task = Task.Run(() => UserInfoBL.SelectUserInfoByAccount(Account)); task.Wait(); List <UserInfo> UserInfoList = task.Result; UserName_TextBox.Text = UserInfoList.FirstOrDefault()?.UserName; if (UserInfoList.FirstOrDefault()?.Gender == "1") { Gender_Text.Content = "男"; } if (UserInfoList.FirstOrDefault()?.Gender == "2") { Gender_Text.Content = "女"; } IDCard_Text.Content = UserInfoList.FirstOrDefault()?.IDCard; Email_TextBox.Text = UserInfoList.FirstOrDefault()?.Email; Address_TextBox.Text = UserInfoList.FirstOrDefault()?.UserAddress; Phone_TextBox.Text = UserInfoList.FirstOrDefault()?.Phone; }