protected void Page_Load(object sender, EventArgs e) { //_OtherUserID set in script //pass url like Profile?ramana#aboutme if (!Page.IsPostBack) { string _queryString = HttpContext.Current.Request.RawUrl; string m_SitePath = ConfigurationManager.AppSettings["SitePath"].ToString(); if (_queryString.IndexOf('?') != -1) { string _Scripts = string.Empty; string _hideTabNames = string.Empty; string _otherUserName = _queryString.Split('?')[1].ToString(); User _OtherUserDetails = new User().GetUserDetails(_otherUserName, false); int UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); if (_OtherUserDetails != null) { //check this user exist in 7 days(today's) match bool m_IsUserWithInTodaysBank = new UserTodayMatch().IsUserWithInBank(UserID, _OtherUserDetails.UserID); //check this user exist in 7 days rematch bool m_IsUserWithInRematchBank = new ProfileRematch().IsMatchExistInBank(UserID, _OtherUserDetails.UserID); if (!m_IsUserWithInTodaysBank && !m_IsUserWithInRematchBank) { Response.Redirect(m_SitePath + "web/PageNotFound"); } else { if (UserID != _OtherUserDetails.UserID) { _Scripts = _Scripts + "\n" + "<script type=\"text/javascript\">var _OtherUserID=\"" + _OtherUserDetails.UserID.ToString() + "\"</script>"; _Scripts = _Scripts + "\n" + "<script type=\"text/javascript\">var _OtherUserGender=\"" + _OtherUserDetails.Gender.ToString() + "\"</script>"; ltJScripts.Text = _Scripts; new IntellidateR1.ProfileView().AddNewProfileView(UserID, _OtherUserDetails.UserID); } else { Response.Redirect(m_SitePath + "web/Home"); } } } else { Response.Redirect(m_SitePath + "web/PageNotFound"); } } } }
public bool Get() { try { int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); UserTodayMatch m_TodaysMatch = new UserTodayMatch().GetTodaysMatch(_UserID); if (m_TodaysMatch != null) { return(true); } else { return(false); } } catch (Exception) { return(false); } }
// POST api/<controller> public CriteriaUserAnswerWeek Post([FromBody] AddCriteriaUserAnswer ac) { int UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); CriteriaUserAnswerWeek m_CriteriaUserAnswer = new CriteriaUserAnswerWeek(); bool IsHasUserMatch = new UserTodayMatch().IsGetUserMatch(UserID); switch (ac.CriteriaType) { case "1": { AnswerTypeSingle m_AnswerTypeSingle = new AnswerTypeSingle { _id = ac.UserOption }; if (IsHasUserMatch) { m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeSingle); } else { new CriteriaUserAnswer().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeSingle); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeSingle); } break; } case "2": { AnswerTypeMultiple m_AnswerTypeMultiple = new AnswerTypeMultiple(); m_AnswerTypeMultiple._ids = ac.UserOptions; if (IsHasUserMatch) { m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeMultiple); } else { new CriteriaUserAnswer().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeMultiple); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeMultiple); } break; } case "5": { AnswerTypeSingle m_AnswerTypeSingle = new AnswerTypeSingle { _id = ac.UserOption }; if (IsHasUserMatch) { m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeSingle); } else { new CriteriaUserAnswer().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeSingle); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeSingle); } break; } case "7": { AnswerTypeDate m_AnswerTypeDate = new AnswerTypeDate { Day = ac.UserOption_Day, Month = ac.UserOption_Month, Year = ac.UserOption_Year }; if (IsHasUserMatch) { m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeDate); } else { new CriteriaUserAnswer().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeDate); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeDate); } // Reset DOB DateTime _DateOfBirth = new DateTime(Convert.ToInt32(m_AnswerTypeDate.Year), Convert.ToInt32(m_AnswerTypeDate.Month), Convert.ToInt32(m_AnswerTypeDate.Day)); new IntellidateR1.User().ChangeUserDateOfBirth(UserID, _DateOfBirth); break; } case "8": { AnswerTypeText m_AnswerTypeText = new AnswerTypeText { Value = ac.UserOption }; if (IsHasUserMatch) { m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeText); } else { new CriteriaUserAnswer().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeText); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeText); } break; } case "9": { AnswerTypeText m_AnswerTypeText = new AnswerTypeText { Value = ac.UserOption }; if (IsHasUserMatch) { m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeText); } else { new CriteriaUserAnswer().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeText); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserAnswer(ac.Criteria_id, UserID, m_AnswerTypeText); } break; } } switch (ac.CriteriaPreferenceType) { case "1": { AnswerTypeMultiple m_AnswerTypeMultiple = new AnswerTypeMultiple(); m_AnswerTypeMultiple._ids = ac.Preferences; if (IsHasUserMatch) { m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserPreference(ac.Criteria_id, UserID, m_AnswerTypeMultiple, ac.HasAllPreferencesSelected); } else { new CriteriaUserAnswer().UpdateCriteriaUserPreference(ac.Criteria_id, UserID, m_AnswerTypeMultiple, ac.HasAllPreferencesSelected); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserPreference(ac.Criteria_id, UserID, m_AnswerTypeMultiple, ac.HasAllPreferencesSelected); } break; } case "3": { AnswerTypeRange m_AnserTypeRange = new AnswerTypeRange { Min = ac.PreferenceRangeMin, Max = ac.PreferenceRangeMax }; if (IsHasUserMatch) { m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserPreference(ac.Criteria_id, UserID, m_AnserTypeRange, ac.HasAllPreferencesSelected); } else { new CriteriaUserAnswer().UpdateCriteriaUserPreference(ac.Criteria_id, UserID, m_AnserTypeRange, ac.HasAllPreferencesSelected); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserPreference(ac.Criteria_id, UserID, m_AnserTypeRange, ac.HasAllPreferencesSelected); } break; } case "4": { AnswerTypeRange m_AnserTypeRange = new AnswerTypeRange { Min = ac.PreferenceRangeMin, Max = ac.PreferenceRangeMax }; if (IsHasUserMatch) { m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserPreference(ac.Criteria_id, UserID, m_AnserTypeRange, ac.HasAllPreferencesSelected); } else { new CriteriaUserAnswer().UpdateCriteriaUserPreference(ac.Criteria_id, UserID, m_AnserTypeRange, ac.HasAllPreferencesSelected); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserPreference(ac.Criteria_id, UserID, m_AnserTypeRange, ac.HasAllPreferencesSelected); } break; } } new CriteriaUserAnswer().UpdateCriteriaUserComment(UserID, ac.Criteria_id, ac.Comment); m_CriteriaUserAnswer = new CriteriaUserAnswerWeek().UpdateCriteriaUserComment(UserID, ac.Criteria_id, ac.Comment); return(m_CriteriaUserAnswer); }