private bool HasValidInput() { return(CheckInputValid.isHeightValid(height) && CheckInputValid.isWeightValid(weight) && CheckInputValid.isICValid(ic) && CheckInputValid.isProfessionValid(profession)); }
private bool HasValidInput() { return(CheckInputValid.isEmailValid(m_email) && CheckInputValid.isUsernameValid(m_username) && CheckInputValid.isFullNameValid(m_fullName) && CheckInputValid.isPasswordValid(m_password) && CheckInputValid.isConPasswordValid(m_password, m_confirmPassword)); }
public void SignUp() { int isValidRegister = CheckInputValid.ManuallySignUpCheckInputValid( m_username, m_password, m_confirmPassword, m_fullName, m_gender, m_dob, m_email, m_phone); bool isSignUpBySocial = !string.IsNullOrEmpty(m_fbToken); if (isValidRegister != 0 && isSignUpBySocial == false) { m_view.OnSignUpFailed(400, isValidRegister.ToString()); return; } if (!m_view.IsNavigating && !m_view.IsPerformingAction) { User user = new User(m_username, m_password, m_email, m_dob, m_phone, m_fullName, m_gender); user.fbToken = m_fbToken; m_view.OnActionStarted(); var userRepository = dataManager.GetUserRepository(); Dictionary <int, string> resp = new Dictionary <int, string>(); Task.Factory.StartNew(() => { resp = userRepository.Register(user, isSignUpBySocial); }).ContinueWith(task => { m_view.OnActionFinished(); if (resp.ContainsKey(200)) { string token; resp.TryGetValue(200, out token); dataManager.SetToken(token); m_view.OnNavigationStarted(); navigationService.PushPresenter(new VerificationPresenter(navigationService)); } else { if (resp.ContainsKey(400)) { string error; resp.TryGetValue(400, out error); m_view.OnSignUpFailed(400, error.Split(",")[1]); } else { m_view.OnSignUpFailed(500, "There was a problem creating your account, please try again later."); } } }, TaskScheduler.FromCurrentSynchronizationContext()); } }
//public void UpdateHealthInfor(HealthInfor health) //{ // //List<Appointment> list = new List<Appointment>(); // Task.Factory.StartNew(() => dataManager.GetUserRepository().UpdateHealthInformation(health, dataManager.GetToken())) // .ContinueWith(task => // { // //m_view.updateListService(services); // }, TaskScheduler.FromCurrentSynchronizationContext()); //} public void ProvideInfor() { int isValidInfor = CheckInputValid.ProvideInformationCheckInputValid( profession, ic, weight, height); if (isValidInfor != 0) { view.OnProvideFailed(400, isValidInfor.ToString()); return; } if (!view.IsNavigating && !view.IsPerformingAction && HasValidInput()) { HealthInfor infor = new HealthInfor( profession, ic, weight, height, basicLifeStyle, habit, bodyMass, bmi, fat, muscle, stomachFat); view.OnActionStarted(); var userRepository = dataManager.GetUserRepository(); Dictionary <int, string> resp = new Dictionary <int, string>(); Task.Factory.StartNew(() => { resp = userRepository.UpdateHealthInformation(infor, dataManager.GetToken()); }).ContinueWith(task => { view.OnActionFinished(); if (resp.ContainsKey(200)) { view.OnNavigationStarted(); navigationService.PushPresenter(new MainPresenter(navigationService)); } else { view.OnProvideFailed(500, "There was a problem creating your information, please try again later."); } }, TaskScheduler.FromCurrentSynchronizationContext()); } }