public string getCities(string countryCode) { Classes.Locations l = new Classes.Locations(); string result = l.citiesListValues(countryCode); return(result); }
protected void Page_Load(object sender, EventArgs e) { //check login int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Events/Add"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Events/Add"); } if (!IsPostBack) { Classes.Locations l = new Classes.Locations(); DataTable dtCountries = l.countriesList(); List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString())); } Classes.UserInfo ui = new Classes.UserInfo(); int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"])); if (locationId == 0) { DropDownListCountry.SelectedValue = "0"; } else { int cityId = locationId; DataTable dtLocation = l.locationInfoOnlyId(locationId); locationCity(Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString())); locationState(Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString())); DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString(); DropDownListState.SelectedValue = dtLocation.Rows[0]["StateId"].ToString(); DropDownListCity.SelectedValue = locationId.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { //check login int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Events/Add"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Events/Add"); } if (!IsPostBack) { Classes.Locations l = new Classes.Locations(); DataTable dtCountries = l.countriesList(); List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString())); } Classes.UserInfo ui = new Classes.UserInfo(); int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"])); if (locationId == 0) { DropDownListCountry.SelectedValue = "0"; } else { int cityId = locationId; DataTable dtLocation = l.locationInfoOnlyId(locationId); locationCity(Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString())); locationState(Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString())); DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString(); DropDownListState.SelectedValue = dtLocation.Rows[0]["StateId"].ToString(); DropDownListCity.SelectedValue = locationId.ToString(); } } }
protected void DropDownListCountry_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.statesList(Convert.ToInt32(DropDownListCountry.SelectedValue)); List<System.Web.UI.WebControls.ListItem> states = new List<System.Web.UI.WebControls.ListItem>(); DropDownListState.Items.Clear(); DropDownListState.Items.Add(new ListItem("Select State", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListState.Items.Add(new ListItem(dt.Rows[i]["StateName"].ToString(), dt.Rows[i]["StateId"].ToString())); } }
void locationCity(string countryCode) { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.citiesList(countryCode); DropDownListCity.Items.Clear(); DropDownListCity.Items.Add(new ListItem("Select City", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListCity.Items.Add(new ListItem(dt.Rows[i]["CityName"].ToString(), dt.Rows[i]["LocationId"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { //check login int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Events/Add"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Events/Add"); } Classes.UserInfo ui = new Classes.UserInfo(); int locationId = ui.locationIdByUserId(UserId); Classes.Locations l = new Classes.Locations(); Tuple <int, string> result1 = l.locationUsersCount(locationId); int locationUsersCount = result1.Item1; string locationName = result1.Item2; int minLocationUsers = Convert.ToInt32(ConfigurationManager.AppSettings["MinLocationUsers"].ToString()); Page.Title = "Hi!"; HiddenFieldTitle.Value = "Hi!"; HiddenFieldSmiley.Value = ":)"; HiddenFieldMessage.Value = "How are you doing today? Where can I redirect you?!"; HiddenFieldLinksNumber.Value = "1"; HiddenFieldLocationUsersCount.Value = locationUsersCount.ToString(); HiddenFieldMinLocationUsers.Value = minLocationUsers.ToString(); HiddenFieldLocation.Value = locationName; Classes.Done d = new Classes.Done(); Tuple <string, string, string, string> result = d.doneItem("A", ""); HiddenFieldLink1Text.Value = result.Item1; HiddenFieldLink1Url.Value = result.Item2; HiddenFieldLink1Image.Value = result.Item3; HiddenFieldLink1Color.Value = result.Item4; }
protected void DropDownListCountry_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.citiesList(DropDownListCountry.SelectedValue); DropDownListCity.Items.Clear(); DropDownListCity.Items.Add(new ListItem("Select City", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListCity.Items.Add(new ListItem(dt.Rows[i]["CityName"].ToString(), dt.Rows[i]["LocationId"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { //check login int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Events/Add"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Events/Add"); } Classes.UserInfo ui = new Classes.UserInfo(); int locationId = ui.locationIdByUserId(UserId); Classes.Locations l = new Classes.Locations(); Tuple<int, string> result1 = l.locationUsersCount(locationId); int locationUsersCount = result1.Item1; string locationName = result1.Item2; int minLocationUsers = Convert.ToInt32(ConfigurationManager.AppSettings["MinLocationUsers"].ToString()); Page.Title = "Hi!"; HiddenFieldTitle.Value = "Hi!"; HiddenFieldSmiley.Value = ":)"; HiddenFieldMessage.Value = "How are you doing today? Where can I redirect you?!"; HiddenFieldLinksNumber.Value = "1"; HiddenFieldLocationUsersCount.Value = locationUsersCount.ToString(); HiddenFieldMinLocationUsers.Value = minLocationUsers.ToString(); HiddenFieldLocation.Value = locationName; Classes.Done d = new Classes.Done(); Tuple<string, string, string, string> result = d.doneItem("A", ""); HiddenFieldLink1Text.Value = result.Item1; HiddenFieldLink1Url.Value = result.Item2; HiddenFieldLink1Image.Value = result.Item3; HiddenFieldLink1Color.Value = result.Item4; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dtCountries; Classes.Locations l = new Classes.Locations(); dtCountries = l.countriesList(); List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString())); } } }
protected void DropDownListState_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.citiesList(Convert.ToInt32(DropDownListState.SelectedValue)); List <System.Web.UI.WebControls.ListItem> states = new List <System.Web.UI.WebControls.ListItem>(); DropDownListCity.Items.Clear(); DropDownListCity.Items.Add(new ListItem("Select City", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListCity.Items.Add(new ListItem(dt.Rows[i]["CityName"].ToString(), dt.Rows[i]["CityId"].ToString())); } }
void locationState(int countryId) { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.statesList(Convert.ToInt32(DropDownListCountry.SelectedValue)); List <System.Web.UI.WebControls.ListItem> states = new List <System.Web.UI.WebControls.ListItem>(); DropDownListState.Items.Clear(); DropDownListState.Items.Add(new ListItem("Select State", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListState.Items.Add(new ListItem(dt.Rows[i]["StateName"].ToString(), dt.Rows[i]["StateId"].ToString())); } }
void locationCountry() { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.countriesList(); List <System.Web.UI.WebControls.ListItem> states = new List <System.Web.UI.WebControls.ListItem>(); DropDownListState.Items.Clear(); DropDownListState.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListState.Items.Add(new ListItem(dt.Rows[i]["CountryName"].ToString(), dt.Rows[i]["CountryId"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dtCountries; Classes.Locations l = new Classes.Locations(); dtCountries = l.countriesList(); List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString())); } } }
protected void Page_Load(object sender, EventArgs e) { //check login int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Completion"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Completion"); } //check if user entered these information before Classes.UserInfo ui = new Classes.UserInfo(); if (ui.getUserStatus(UserId) != 0) //if user not logged in redirect to login { //Response.Redirect("~/Explore"); } if (!IsPostBack) { DataTable dtCountries; Classes.Locations l = new Classes.Locations(); dtCountries = l.countriesList(); List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString())); } } }
protected void Page_Load(object sender, EventArgs e) { //check login int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Completion"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Completion"); } //check if user entered these information before Classes.UserInfo ui = new Classes.UserInfo(); if (ui.getUserStatus(UserId) != 0) //if user not logged in redirect to login { //Response.Redirect("~/Explore"); } if (!IsPostBack) { DataTable dtCountries; Classes.Locations l = new Classes.Locations(); dtCountries = l.countriesList(); List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString())); } } }
protected void getDataLocation() { hidePanels(); PanelLocation.Visible = true; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_settingsLocationGet", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]); //try //{ sda.Fill(ds); dt = ds.Tables[0]; //} //catch (Exception ex) //{ //} //finally //{ sqlConn.Close(); sda.Dispose(); sqlConn.Dispose(); //} if (dt.Rows.Count == 0)// Profile doesn't exist { Response.Redirect("~/Error/NoProfileForSettings"); } else { if (!IsPostBack) { Classes.Locations l = new Classes.Locations(); DataTable dtCountries = l.countriesList(); List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString())); } Classes.UserInfo ui = new Classes.UserInfo(); int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"])); if (locationId == 0) { DropDownListCountry.SelectedValue = "0"; } else { string countryCode = l.locationInfoOnlyId(locationId); locationCity(countryCode); DropDownListCountry.SelectedValue = countryCode; DropDownListCity.SelectedValue = locationId.ToString(); } DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString(); } } if (dt.Rows[0]["LocationId"].ToString() == "0") { DropDownListCountry.SelectedValue = "0"; } else { int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()); DataTable dtLocation = new DataTable(); DataSet dsLocation = new DataSet(); SqlConnection sqlConnLocation = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sdaLocation = new SqlDataAdapter("sp_locationInfoOnlyId", sqlConnLocation); sdaLocation.SelectCommand.CommandType = CommandType.StoredProcedure; sdaLocation.SelectCommand.Parameters.Add("@CityId", SqlDbType.Int).Value = cityId; //try //{ sdaLocation.Fill(dsLocation); dtLocation = dsLocation.Tables[0]; //} //catch (Exception ex) //{ //} //finally //{ sqlConnLocation.Close(); sdaLocation.Dispose(); sqlConnLocation.Dispose(); //} locationCity(dtLocation.Rows[0]["CountryCode"].ToString()); DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryCode"].ToString(); DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString(); } } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { Int16 locationStatus = Convert.ToInt16(HiddenFieldLocationStatus.Value); int locationId = 0; int userId = Convert.ToInt32(Session["UserId"]); if (locationStatus == 1) { locationId = Convert.ToInt32(HiddenFieldLocationId.Value); } else { locationId = 0; Classes.Locations l = new Classes.Locations(); int status2 = l.request(userId, TextBoxRequestLocationCountry.Text, TextBoxRequestLocationCity.Text); } //save photo photoUpload(); //validate //save int status; Classes.UserProfileSet ups = new Classes.UserProfileSet(); status = ups.completion( userId, TextBoxUsername.Text, TextBoxFirstName.Text, TextBoxLastName.Text, Convert.ToInt16(DropDownListGender.SelectedValue), locationId, HiddenFieldDOB.Value, Convert.ToBoolean(HiddenFieldHasPhoto.Value)); if (status == 1) { DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_fbFriendsList", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = userId; //try //{ sda.Fill(ds); dt = ds.Tables[0]; //} //catch (Exception ex) //{ //} //finally //{ sqlConn.Close(); sda.Dispose(); sqlConn.Dispose(); //} for (int i = 0; i < dt.Rows.Count; i++) { SqlConnection sqlConn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlCommand sqlCmd2 = new SqlCommand("sp_fbFriendsApply", sqlConn2); sqlCmd2.CommandType = CommandType.StoredProcedure; sqlCmd2.Parameters.Add("@FbId", SqlDbType.VarChar).Value = dt.Rows[i]["FriendFbId"].ToString(); sqlCmd2.Parameters.Add("@UserId", SqlDbType.Int).Value = userId; //try //{ sqlConn2.Open(); sqlCmd2.ExecuteNonQuery(); //} //catch //{ //} //finally //{ sqlConn2.Close(); sqlConn2.Dispose(); sqlCmd2.Dispose(); //} } Response.Redirect("~/Introduction"); } else if (status == -1) { LabelMessage.Visible = true; LabelMessage.Text = "Username is not available, please select another one!"; } else if (status == -2) { LabelMessage.Visible = true; LabelMessage.Text = "Username must has at least 1 letter!"; } else if (status == -3) { LabelMessage.Visible = true; LabelMessage.Text = "Username must not contains special characters!"; } }
protected void Page_Load(object sender, EventArgs e) { if (Convert.ToInt32(Application["Status"]) == 2) Response.Redirect("~/Maintenance.html"); //check login int UserId = 0; int userStatus = 0; Classes.UserInfo ui = new Classes.UserInfo(); if (Session["UserId"] != null) { UserId = Convert.ToInt32(Session["UserId"]); userStatus = ui.getUserStatus(UserId); } else { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Completion"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Completion"); } } if (!IsPostBack) { //check if user entered these information before userStatus = ui.getUserStatus(UserId); if (userStatus != 0) { if (userStatus != 4) Response.Redirect("~/Done/Welcome"); } if (userStatus == 4) { Tuple<string, string, string, string> result = ui.fbCompletion(UserId); TextBoxFirstName.Text = result.Item1; TextBoxLastName.Text = result.Item2; HiddenFieldHasPhoto.Value = result.Item3; DropDownListGender.SelectedValue = result.Item4; if(Convert.ToBoolean(result.Item3)) { HiddenFieldPhotoUrl.Value = "Files/Temp/" + UserId.ToString() + "-100.jpg"; } } DataTable dtCountries; Classes.Locations l = new Classes.Locations(); dtCountries = l.countriesList(); List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString())); } } }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) { Response.Redirect("~/Login"); } } if (!IsPostBack) { // get info Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventModifyInfo(Convert.ToInt64(Page.RouteData.Values["EventId"].ToString())); if (dt.Rows.Count == 0)// event doesn't exist { Response.Redirect("~/Error/EventNotFound"); } else { //check if user is the owner if (UserId.ToString() != dt.Rows[0]["OwnerId"].ToString()) { Response.Redirect("~/Error/UserNotEventOwner"); } //count available spots int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); //get time string timeHour = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Hour.ToString(); string timeMinute = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Minute.ToString(); DropDownListTimeHour.SelectedValue = timeHour; DropDownListTimeMinute.SelectedValue = timeMinute; TextBoxName.Text = dt.Rows[0]["Name"].ToString(); DropDownListType.SelectedValue = dt.Rows[0]["TypeId"].ToString(); TextBoxDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); DropDownListPrivacy.SelectedValue = dt.Rows[0]["Privacy"].ToString(); //show if price selected HiddenFieldParticipants.Value = dt.Rows[0]["Participants"].ToString(); HiddenFieldParticipantsAccepted.Value = dt.Rows[0]["ParticipantsAccepted"].ToString(); HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString(); HiddenFieldLanguages.Value = dt.Rows[0]["Languages"].ToString(); /////////////////// event photo Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.locationInfoOnlyId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); int countryId = Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString()); int stateId = Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString()); int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()); locationCountry(); DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString(); locationState(countryId); DropDownListState.SelectedValue = dtLocation.Rows[0]["StateId"].ToString(); locationCity(stateId); DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString(); } } }
void locationCity(int stateId) { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.citiesList(Convert.ToInt32(DropDownListState.SelectedValue)); List<System.Web.UI.WebControls.ListItem> states = new List<System.Web.UI.WebControls.ListItem>(); DropDownListCity.Items.Clear(); DropDownListCity.Items.Add(new ListItem("Select City", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListCity.Items.Add(new ListItem(dt.Rows[i]["CityName"].ToString(), dt.Rows[i]["CityId"].ToString())); } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { int userId = Convert.ToInt32(Session["UserId"]); Classes.UserProfileSet ups = new Classes.UserProfileSet(); int status = 0; switch (HiddenFieldMode.Value.ToLower()) { case "firstname": status = ups.firstName(userId, TextBoxFirstName.Text); break; case "lastname": status = ups.lastName(userId, TextBoxLastName.Text); break; case "username": //-1 exists before -2 username not valid -3 no special char -4 enter username 1 successful status = ups.username(userId, TextBoxUsername.Text); HiddenFieldStatus.Value = status.ToString(); if (status != 1) { Classes.UserInfo ui = new Classes.UserInfo(); TextBoxUsername.Text = ui.getUsernameByUserId(userId); } break; case "gender": status = ups.gender(userId, Convert.ToInt16(DropDownListGender.SelectedValue)); break; case "dob": status = ups.birthDate(userId, HiddenFieldDOB.Value); break; case "about": status = ups.about(userId, TextBoxAbout.Text); break; case "photo": bool hasPhoto = Convert.ToBoolean(HiddenFieldValue.Value); status = ups.hasPhoto(userId, hasPhoto); break; case "cover": status = ups.cover(userId, Convert.ToInt16(HiddenFieldValue.Value)); break; case "location": status = ups.location(userId, Convert.ToInt32(HiddenFieldLocationId.Value)); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(DropDownListCity.SelectedValue)); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString(); } break; case "notifications": bool getNotifications = Convert.ToBoolean(HiddenFieldNotifications.Value); status = ups.notifications(userId, getNotifications); break; case "mobile": status = ups.mobile(userId, Convert.ToInt64(TextBoxMobile.Text)); break; } }
protected void Page_Load(object sender, EventArgs e) { //check login int UserId = 0; if (Session["UserId"] != null) { UserId = Convert.ToInt32(Session["UserId"]); } else { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Explore"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Explore"); } } //check user status string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue)) { Classes.UserInfo ui = new Classes.UserInfo(); int userStatus = ui.getUserStatus(UserId); switch (userStatus) { case 1: Session["DoneCompletion"] = "1"; break; case 0: case 4: Response.Redirect("~/Completion"); break; case 2: Response.Redirect("~/Error/UserDisabled"); break; case 3: Response.Redirect("~/Error/UserDeactivated"); break; } } if (!IsPostBack) { Classes.Explore ex = new Classes.Explore(); Tuple<int, Int64> result = ex.startRecommending(UserId); int status = result.Item1; Int64 eventId = result.Item2; if (status == 1) { Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventInfo(eventId, UserId); HiddenFieldStatus.Value = "1"; int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); int participants = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()); HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString(); HiddenFieldEventId.Value = dt.Rows[0]["EventId"].ToString(); LabelEventName.Text = dt.Rows[0]["Name"].ToString(); Page.Title = dt.Rows[0]["Name"].ToString(); HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString(); LabelParticipants.Text = (participants + 1).ToString(); LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString(); LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); LabelAddress.Text = dt.Rows[0]["Address"].ToString(); HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString(); HiddenFieldOwnerFullname.Value = dt.Rows[0]["OwnerName"].ToString(); HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString(); HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString(); int OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString(); } //Owner photo url if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString())) { HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg"; } else { HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png"; } //owner rate int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString()); int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString()); int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString()); if (RateCount >= RateSufficient) { int RatePercent = (20 * RateScore / RateCount); HiddenFieldOwnerRateScore.Value = RatePercent.ToString(); HiddenFieldOwnerRateCount.Value = RateCount.ToString(); } else { HiddenFieldOwnerRateScore.Value = "0"; HiddenFieldOwnerRateCount.Value = "0"; } switch (dt.Rows[0]["Status"].ToString()) { case "1": LabelStatus.Text = "Available"; break; case "2": LabelStatus.Text = "Full"; break; case "3": LabelStatus.Text = "Passed"; break; } //bookmark bool bookmarkStatus = ev.checkBookmark(UserId, eventId); if (bookmarkStatus == true) { ButtonBookmark.Text = "Remove Bookmark"; } else { ButtonBookmark.Text = "Add Bookmark"; } } else { HiddenFieldStatus.Value = "0"; HiddenFieldSmiley.Value = ":)"; HiddenFieldMessage.Value = "Unfortunatly there is no event to show now!"; HiddenFieldLinksNumber.Value = "4"; Classes.Done d = new Classes.Done(); Tuple<string, string, string, string> result2 = d.doneItem("A", ""); HiddenFieldLink1Text.Value = result2.Item1; HiddenFieldLink1Url.Value = result2.Item2; HiddenFieldLink1Image.Value = result2.Item3; HiddenFieldLink1Color.Value = result2.Item4; result2 = d.doneItem("B", ""); HiddenFieldLink2Text.Value = result2.Item1; HiddenFieldLink2Url.Value = result2.Item2; HiddenFieldLink2Image.Value = result2.Item3; HiddenFieldLink2Color.Value = result2.Item4; result2 = d.doneItem("C", ""); HiddenFieldLink3Text.Value = result2.Item1; HiddenFieldLink3Url.Value = result2.Item2; HiddenFieldLink3Image.Value = result2.Item3; HiddenFieldLink3Color.Value = result2.Item4; result2 = d.doneItem("E", ""); HiddenFieldLink4Text.Value = result2.Item1; HiddenFieldLink4Url.Value = result2.Item2; HiddenFieldLink4Image.Value = result2.Item3; HiddenFieldLink4Color.Value = result2.Item4; } } }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) { Response.Redirect("~/Login"); } } if (!IsPostBack) { // get info Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventInfo(Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()), UserId); if (dt.Rows.Count == 0)// event doesn't exist { Response.Redirect("~/Error/EventNotFound"); } else { //count available spots int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString(); LabelName.Text = dt.Rows[0]["Name"].ToString(); Page.Title = dt.Rows[0]["Name"].ToString(); HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString(); HiddenFieldDuration.Value = dt.Rows[0]["Duration"].ToString(); LabelParticipants.Text = dt.Rows[0]["Participants"].ToString(); LabelParticipantsAvailable.Text = participantsAvailable.ToString(); LabelLanguages.Text = dt.Rows[0]["Languages"].ToString(); //enhance LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString(); HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString(); HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString(); int OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString() + " - " + dtLocation.Rows[0]["StateName"].ToString() + " - " + dtLocation.Rows[0]["CountryName"].ToString(); } //Event photo url //if (Convert.ToBoolean(dt.Rows[0]["EventHasPhoto"].ToString())) //{ // HiddenFieldEventPhotoUrl.Value = "Files/Events/" + Page.RouteData.Values["EventId"] + ".jpg"; //} //else //{ // HiddenFieldEventPhotoUrl.Value = "Images/Moods/" + dt.Rows[0]["MoodId"].ToString() + "-big.png"; //} //Owner photo url if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString())) { HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-220.jpg"; } else { HiddenFieldOwnerPhotoUrl.Value = "Images/ProfilesPhotos/nophoto220.png"; } //owner rate int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString()); int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString()); int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString()); if (RateCount >= RateSufficient) { int RatePercent = (20 * RateScore / RateCount); HiddenFieldOwnerRateScore.Value = RatePercent.ToString(); HiddenFieldOwnerRateCount.Value = RateCount.ToString(); } else { HiddenFieldOwnerRateScore.Value = "0"; HiddenFieldOwnerRateCount.Value = "0"; } switch (dt.Rows[0]["Status"].ToString()) { case "1": LabelStatus.Text = "Available"; break; case "2": LabelStatus.Text = "Full"; break; case "3": LabelStatus.Text = "Passed"; break; } //check to see if the user logged in or is a guest if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString()) { HyperLinkModify.Visible = true; HyperLinkModify.NavigateUrl = "~/Events/Modify/" + Page.RouteData.Values["EventId"].ToString(); } //bookmark int bookmarkStatus = ev.eventBookmark(UserId, Convert.ToInt64(Page.RouteData.Values["EventId"])); if (bookmarkStatus == 1) { ButtonBookmark.Text = "Remove Bookmark"; } else if (bookmarkStatus == 2) { ButtonBookmark.Text = "Add Bookmark"; } } ////////////////// participants list DataTable dtParticipants = ev.eventParticipants(Convert.ToInt32(Page.RouteData.Values["EventId"])); RepeaterParticipants.DataSource = dtParticipants; RepeaterParticipants.DataBind(); if (RepeaterParticipants.Items.Count == 0) { LabelNoRecord.Visible = true; } /////////////////////////////////////////////board messages getBoardMessages(Convert.ToInt64(Page.RouteData.Values["EventId"]), Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) { Response.Redirect("~/Login"); } } if (!IsPostBack) { // get info Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventModifyInfo(Convert.ToInt64(Page.RouteData.Values["EventId"].ToString())); if (dt.Rows.Count == 0)// event doesn't exist { Response.Redirect("~/Error/EventNotFound"); } else { //check if user is the owner if (UserId.ToString() != dt.Rows[0]["OwnerId"].ToString()) { Response.Redirect("~/Error/UserNotEventOwner"); } //count available spots int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); //get time string timeHour = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Hour.ToString(); string timeMinute = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Minute.ToString(); DropDownListTimeHour.SelectedValue = timeHour; DropDownListTimeMinute.SelectedValue = timeMinute; TextBoxName.Text = dt.Rows[0]["Name"].ToString(); DropDownListType.SelectedValue = dt.Rows[0]["TypeId"].ToString(); TextBoxDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); DropDownListPrivacy.SelectedValue = dt.Rows[0]["Privacy"].ToString(); //show if price selected HiddenFieldParticipants.Value = dt.Rows[0]["Participants"].ToString(); HiddenFieldParticipantsAccepted.Value = dt.Rows[0]["ParticipantsAccepted"].ToString(); HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString(); HiddenFieldLanguages.Value = dt.Rows[0]["Languages"].ToString(); /////////////////// event photo Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.locationInfoOnlyId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); int countryId = Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString()); int stateId = Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString()); int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()); locationCountry(); DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString(); locationState(countryId); DropDownListState.SelectedValue = dtLocation.Rows[0]["StateId"].ToString(); locationCity(stateId); DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int UserId = 0; if (Session["UserId"] != null) { UserId = Convert.ToInt32(Session["UserId"]); } else { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) { //Response.Redirect("~/Login"); } } } int buttonsStatus = 2; //0 guest 1 owner 2 user not requested 3 user requested 4 user participant int OwnerId = -1; if (UserId == 0) { buttonsStatus = 0; } Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()); if (!IsPostBack) { // get info Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventInfo(eventId, UserId); if (dt.Rows.Count == 0)// event doesn't exist { Response.Redirect("~/Error/EventNotFound"); } else { int eventStatus = Convert.ToInt32(dt.Rows[0]["Status"].ToString()); if (eventStatus == 4)// event is banned { Response.Redirect("~/Error/EventNotFound"); } //count available spots int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); int participants = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()); HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString(); HiddenFieldEventId.Value = Page.RouteData.Values["EventId"].ToString(); LabelName.Text = dt.Rows[0]["Name"].ToString(); Page.Title = dt.Rows[0]["Name"].ToString(); HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString(); LabelParticipants.Text = (participants + 1).ToString(); LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString(); LabelAddress.Text = dt.Rows[0]["Address"].ToString(); LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString(); HiddenFieldOwnerFullname.Value = dt.Rows[0]["OwnerName"].ToString(); HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString(); HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString(); OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString(); } //Owner photo url if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString())) { HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg"; } else { HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png"; } //owner rate int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString()); int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString()); int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString()); if (RateCount >= RateSufficient) { int RatePercent = (20 * RateScore / RateCount); HiddenFieldOwnerRateScore.Value = RatePercent.ToString(); HiddenFieldOwnerRateCount.Value = RateCount.ToString(); } else { HiddenFieldOwnerRateScore.Value = "0"; HiddenFieldOwnerRateCount.Value = "0"; } switch (dt.Rows[0]["Status"].ToString()) { case "1": LabelStatus.Text = "Available"; break; case "2": LabelStatus.Text = "Full"; break; case "3": LabelStatus.Text = "Passed"; break; } if (UserId != 0) { //check to see if the user logged in or is a guest if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString()) { HyperLinkModify.Visible = true; HyperLinkModify.NavigateUrl = "~/Events/Modify/" + eventId.ToString(); buttonsStatus = 1; } //bookmark bool bookmarkStatus = ev.checkBookmark(UserId, eventId); if (bookmarkStatus == true) { ButtonBookmark.Text = "Remove Bookmark"; } else { ButtonBookmark.Text = "Add Bookmark"; } HiddenFieldButtonStatus.Value = buttonsStatus.ToString(); } } ////////////////// participants list DataTable dtParticipants = ev.eventParticipants(eventId); RepeaterParticipants.DataSource = dtParticipants; RepeaterParticipants.DataBind(); if (RepeaterParticipants.Items.Count == 0) { LabelNoRecord.Visible = true; } /////////////////////////////////////////////board messages bool status = ev.allowBoard(UserId, eventId); if (status) { getBoardMessages(eventId, Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString())); HiddenFieldBoardStatus.Value = "1"; } else { HiddenFieldBoardStatus.Value = "0"; } } else { Page.Title = LabelName.Text; } if (UserId != 0) { if (UserId.ToString() == OwnerId.ToString()) { buttonsStatus = 1; } else { Classes.Requests r = new Classes.Requests(); int requestStatus = r.checkRequest(UserId, eventId); if (requestStatus == 0) { buttonsStatus = 2; } else if (requestStatus == 1) { buttonsStatus = 3; } else if (requestStatus == 2) { buttonsStatus = 4; } } } HiddenFieldRequestStatus.Value = buttonsStatus.ToString(); HiddenFieldButtonStatus.Value = buttonsStatus.ToString(); }
void locationCity(string countryCode) { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.citiesList(DropDownListCountry.SelectedValue); DropDownListCity.Items.Clear(); DropDownListCity.Items.Add(new ListItem("Select City", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListCity.Items.Add(new ListItem(dt.Rows[i]["CityName"].ToString(), dt.Rows[i]["LocationId"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { if (Convert.ToInt32(Application["Status"]) == 2) { Response.Redirect("~/Maintenance.html"); } //check login int UserId = 0; int userStatus = 0; Classes.UserInfo ui = new Classes.UserInfo(); if (Session["UserId"] != null) { UserId = Convert.ToInt32(Session["UserId"]); userStatus = ui.getUserStatus(UserId); } else { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Completion"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Completion"); } } if (!IsPostBack) { //check if user entered these information before userStatus = ui.getUserStatus(UserId); if (userStatus != 0) { if (userStatus != 4) { Response.Redirect("~/Done/Welcome"); } } if (userStatus == 4) { Tuple <string, string, string, string> result = ui.fbCompletion(UserId); TextBoxFirstName.Text = result.Item1; TextBoxLastName.Text = result.Item2; HiddenFieldHasPhoto.Value = result.Item3; DropDownListGender.SelectedValue = result.Item4; if (Convert.ToBoolean(result.Item3)) { HiddenFieldPhotoUrl.Value = "Files/Temp/" + UserId.ToString() + "-100.jpg"; } } DataTable dtCountries; Classes.Locations l = new Classes.Locations(); dtCountries = l.countriesList(); List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString())); } } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { Int16 locationStatus = Convert.ToInt16(HiddenFieldLocationStatus.Value); int locationId = 0; int userId = Convert.ToInt32(Session["UserId"]); if (locationStatus == 1) { locationId = Convert.ToInt32(HiddenFieldLocationId.Value); } else { locationId = 0; Classes.Locations l = new Classes.Locations(); int status2 = l.request(userId, TextBoxRequestLocationCountry.Text, TextBoxRequestLocationCity.Text); } //save photo photoUpload(); //validate //save int status; Classes.UserProfileSet ups = new Classes.UserProfileSet(); status = ups.completion( userId, TextBoxUsername.Text, TextBoxFirstName.Text, TextBoxLastName.Text, Convert.ToInt16(DropDownListGender.SelectedValue), locationId, HiddenFieldDOB.Value, Convert.ToBoolean(HiddenFieldHasPhoto.Value)); if (status == 1) { DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_fbFriendsList", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = userId; //try //{ sda.Fill(ds); dt = ds.Tables[0]; //} //catch (Exception ex) //{ //} //finally //{ sqlConn.Close(); sda.Dispose(); sqlConn.Dispose(); //} for (int i = 0; i < dt.Rows.Count; i++) { SqlConnection sqlConn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlCommand sqlCmd2 = new SqlCommand("sp_fbFriendsApply", sqlConn2); sqlCmd2.CommandType = CommandType.StoredProcedure; sqlCmd2.Parameters.Add("@FbId", SqlDbType.VarChar).Value = dt.Rows[i]["FriendFbId"].ToString(); sqlCmd2.Parameters.Add("@UserId", SqlDbType.Int).Value = userId; //try //{ sqlConn2.Open(); sqlCmd2.ExecuteNonQuery(); //} //catch //{ //} //finally //{ sqlConn2.Close(); sqlConn2.Dispose(); sqlCmd2.Dispose(); //} } Response.Redirect("~/Introduction"); } else if (status == -1) { LabelMessage.Visible = true; LabelMessage.Text = "Username is not available, please select another one!"; } else if (status == -2) { LabelMessage.Visible = true; LabelMessage.Text = "Username must has at least 1 letter!"; } else if (status == -3) { LabelMessage.Visible = true; LabelMessage.Text = "Username must not contains special characters!"; } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { int userId = Convert.ToInt32(Session["UserId"]); Classes.UserProfileSet ups = new Classes.UserProfileSet(); int status = 0; switch (HiddenFieldMode.Value.ToLower()) { case "firstname": status = ups.firstName(userId, TextBoxFirstName.Text); break; case "lastname": status = ups.lastName(userId, TextBoxLastName.Text); break; case "username": //-1 exists before -2 username not valid -3 no special char -4 enter username 1 successful status = ups.username(userId, TextBoxUsername.Text); HiddenFieldStatus.Value = status.ToString(); if (status != 1) { Classes.UserInfo ui = new Classes.UserInfo(); TextBoxUsername.Text = ui.getUsernameByUserId(userId); } break; case "gender": status = ups.gender(userId, Convert.ToInt16(DropDownListGender.SelectedValue)); break; case "dob": status = ups.birthDate(userId, HiddenFieldDOB.Value); break; case "about": status = ups.about(userId, TextBoxAbout.Text); break; case "photo": bool hasPhoto = Convert.ToBoolean(HiddenFieldValue.Value); status = ups.hasPhoto(userId, hasPhoto); break; case "cover": status = ups.cover(userId, Convert.ToInt16(HiddenFieldValue.Value)); break; case "location": status = ups.location(userId, Convert.ToInt32(HiddenFieldLocationId.Value)); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(DropDownListCity.SelectedValue)); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString(); } break; case "notifications": bool getNotifications = Convert.ToBoolean(HiddenFieldNotifications.Value); status = ups.notifications(userId, getNotifications); break; case "mobile": status = ups.mobile(userId, Convert.ToInt64(TextBoxMobile.Text)); break; } }
protected void DropDownListCountry_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.citiesList(DropDownListCountry.SelectedValue); DropDownListCity.Items.Clear(); DropDownListCity.Items.Add(new ListItem("Select City", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListCity.Items.Add(new ListItem(dt.Rows[i]["CityName"].ToString(), dt.Rows[i]["LocationId"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int UserId = 0; if (Session["UserId"] != null) { UserId = Convert.ToInt32(Session["UserId"]); } else { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) { //Response.Redirect("~/Login"); } } } int buttonsStatus = 2; //0 guest 1 owner 2 user not requested 3 user requested 4 user participant int OwnerId = -1; if (UserId == 0) { buttonsStatus = 0; } Int64 eventId = Convert.ToInt64(Page.RouteData.Values["EventId"].ToString()); if (!IsPostBack) { // get info Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventInfo(eventId, UserId); if (dt.Rows.Count == 0)// event doesn't exist { Response.Redirect("~/Error/EventNotFound"); } else { int eventStatus = Convert.ToInt32(dt.Rows[0]["Status"].ToString()); if (eventStatus == 4)// event is banned { Response.Redirect("~/Error/EventNotFound"); } //count available spots int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); int participants = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()); HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString(); HiddenFieldEventId.Value = Page.RouteData.Values["EventId"].ToString(); LabelName.Text = dt.Rows[0]["Name"].ToString(); Page.Title = dt.Rows[0]["Name"].ToString(); HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString(); LabelParticipants.Text = (participants + 1).ToString(); LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString(); LabelAddress.Text = dt.Rows[0]["Address"].ToString(); LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString(); HiddenFieldOwnerFullname.Value = dt.Rows[0]["OwnerName"].ToString(); HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString(); HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString(); OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString(); } //Owner photo url if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString())) { HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg"; } else { HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png"; } //owner rate int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString()); int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString()); int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString()); if (RateCount >= RateSufficient) { int RatePercent = (20 * RateScore / RateCount); HiddenFieldOwnerRateScore.Value = RatePercent.ToString(); HiddenFieldOwnerRateCount.Value = RateCount.ToString(); } else { HiddenFieldOwnerRateScore.Value = "0"; HiddenFieldOwnerRateCount.Value = "0"; } switch (dt.Rows[0]["Status"].ToString()) { case "1": LabelStatus.Text = "Available"; break; case "2": LabelStatus.Text = "Full"; break; case "3": LabelStatus.Text = "Passed"; break; } if (UserId != 0) { //check to see if the user logged in or is a guest if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString()) { HyperLinkModify.Visible = true; HyperLinkModify.NavigateUrl = "~/Events/Modify/" + eventId.ToString(); buttonsStatus = 1; } //bookmark bool bookmarkStatus = ev.checkBookmark(UserId, eventId); if (bookmarkStatus == true) { ButtonBookmark.Text = "Remove Bookmark"; } else { ButtonBookmark.Text = "Add Bookmark"; } HiddenFieldButtonStatus.Value = buttonsStatus.ToString(); } } ////////////////// participants list DataTable dtParticipants = ev.eventParticipants(eventId); RepeaterParticipants.DataSource = dtParticipants; RepeaterParticipants.DataBind(); if (RepeaterParticipants.Items.Count == 0) { LabelNoRecord.Visible = true; } /////////////////////////////////////////////board messages bool status = ev.allowBoard(UserId, eventId); if (status) { getBoardMessages(eventId, Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString())); HiddenFieldBoardStatus.Value = "1"; } else { HiddenFieldBoardStatus.Value = "0"; } } else { Page.Title = LabelName.Text; } if (UserId != 0) { if (UserId.ToString() == OwnerId.ToString()) { buttonsStatus = 1; } else { Classes.Requests r = new Classes.Requests(); int requestStatus = r.checkRequest(UserId, eventId); if (requestStatus == 0) { buttonsStatus = 2; } else if (requestStatus == 1) { buttonsStatus = 3; } else if (requestStatus == 2) { buttonsStatus = 4; } } } HiddenFieldRequestStatus.Value = buttonsStatus.ToString(); HiddenFieldButtonStatus.Value = buttonsStatus.ToString(); }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int UserId = 0; if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) { Response.Redirect("~/Login"); } } if (!IsPostBack) { // get info Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventInfo(Convert.ToInt32(Page.RouteData.Values["EventId"].ToString()), UserId); if (dt.Rows.Count == 0)// event doesn't exist { Response.Redirect("~/Error/EventNotFound"); } else { //count available spots int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString(); LabelName.Text = dt.Rows[0]["Name"].ToString(); Page.Title = dt.Rows[0]["Name"].ToString(); HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString(); HiddenFieldDuration.Value = dt.Rows[0]["Duration"].ToString(); LabelParticipants.Text = dt.Rows[0]["Participants"].ToString(); LabelParticipantsAvailable.Text = participantsAvailable.ToString(); LabelLanguages.Text = dt.Rows[0]["Languages"].ToString(); //enhance LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString(); HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString(); HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString(); int OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString() + " - " + dtLocation.Rows[0]["StateName"].ToString() + " - " + dtLocation.Rows[0]["CountryName"].ToString(); } //Event photo url //if (Convert.ToBoolean(dt.Rows[0]["EventHasPhoto"].ToString())) //{ // HiddenFieldEventPhotoUrl.Value = "Files/Events/" + Page.RouteData.Values["EventId"] + ".jpg"; //} //else //{ // HiddenFieldEventPhotoUrl.Value = "Images/Moods/" + dt.Rows[0]["MoodId"].ToString() + "-big.png"; //} //Owner photo url if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString())) { HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-220.jpg"; } else { HiddenFieldOwnerPhotoUrl.Value = "Images/ProfilesPhotos/nophoto220.png"; } //owner rate int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString()); int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString()); int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString()); if (RateCount >= RateSufficient) { int RatePercent = (20 * RateScore / RateCount); HiddenFieldOwnerRateScore.Value = RatePercent.ToString(); HiddenFieldOwnerRateCount.Value = RateCount.ToString(); } else { HiddenFieldOwnerRateScore.Value = "0"; HiddenFieldOwnerRateCount.Value = "0"; } switch (dt.Rows[0]["Status"].ToString()) { case "1": LabelStatus.Text = "Available"; break; case "2": LabelStatus.Text = "Full"; break; case "3": LabelStatus.Text = "Passed"; break; } //check to see if the user logged in or is a guest if (UserId.ToString() == dt.Rows[0]["OwnerId"].ToString()) { HyperLinkModify.Visible = true; HyperLinkModify.NavigateUrl = "~/Events/Modify/" + Page.RouteData.Values["EventId"].ToString(); } //bookmark int bookmarkStatus = ev.eventBookmark(UserId, Convert.ToInt64(Page.RouteData.Values["EventId"])); if (bookmarkStatus == 1) { ButtonBookmark.Text = "Remove Bookmark"; } else if (bookmarkStatus == 2) { ButtonBookmark.Text = "Add Bookmark"; } } ////////////////// participants list DataTable dtParticipants = ev.eventParticipants(Convert.ToInt32(Page.RouteData.Values["EventId"])); RepeaterParticipants.DataSource = dtParticipants; RepeaterParticipants.DataBind(); if (RepeaterParticipants.Items.Count == 0) { LabelNoRecord.Visible = true; } /////////////////////////////////////////////board messages getBoardMessages(Convert.ToInt64(Page.RouteData.Values["EventId"]), Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString())); } }
protected void getDataLocation() { hidePanels(); PanelLocation.Visible = true; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_settingsLocationGet", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]); //try //{ sda.Fill(ds); dt = ds.Tables[0]; //} //catch (Exception ex) //{ //} //finally //{ sqlConn.Close(); sda.Dispose(); sqlConn.Dispose(); //} if (dt.Rows.Count == 0)// Profile doesn't exist { Response.Redirect("~/Error/NoProfileForSettings"); } else { if (!IsPostBack) { Classes.Locations l = new Classes.Locations(); DataTable dtCountries = l.countriesList(); List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dtCountries.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString())); } Classes.UserInfo ui = new Classes.UserInfo(); int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"])); if (locationId == 0) { DropDownListCountry.SelectedValue = "0"; } else { string countryCode = l.locationInfoOnlyId(locationId); locationCity(countryCode); DropDownListCountry.SelectedValue = countryCode; DropDownListCity.SelectedValue = locationId.ToString(); } DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString(); } } if (dt.Rows[0]["LocationId"].ToString() == "0") { DropDownListCountry.SelectedValue = "0"; } else { int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()); DataTable dtLocation = new DataTable(); DataSet dsLocation = new DataSet(); SqlConnection sqlConnLocation = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString); SqlDataAdapter sdaLocation = new SqlDataAdapter("sp_locationInfoOnlyId", sqlConnLocation); sdaLocation.SelectCommand.CommandType = CommandType.StoredProcedure; sdaLocation.SelectCommand.Parameters.Add("@CityId", SqlDbType.Int).Value = cityId; //try //{ sdaLocation.Fill(dsLocation); dtLocation = dsLocation.Tables[0]; //} //catch (Exception ex) //{ //} //finally //{ sqlConnLocation.Close(); sdaLocation.Dispose(); sqlConnLocation.Dispose(); //} locationCity(dtLocation.Rows[0]["CountryCode"].ToString()); DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryCode"].ToString(); DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { //check login int UserId = 0; if (Session["UserId"] != null) { UserId = Convert.ToInt32(Session["UserId"]); } else { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) //if user not logged in redirect to login { Response.Redirect("~/Login/Explore"); } else { Session["UserId"] = UserId.ToString(); } } else { Response.Redirect("~/Login/Explore"); } } //check user status string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue)) { Classes.UserInfo ui = new Classes.UserInfo(); int userStatus = ui.getUserStatus(UserId); switch (userStatus) { case 1: Session["DoneCompletion"] = "1"; break; case 0: case 4: Response.Redirect("~/Completion"); break; case 2: Response.Redirect("~/Error/UserDisabled"); break; case 3: Response.Redirect("~/Error/UserDeactivated"); break; } } if (!IsPostBack) { Classes.Explore ex = new Classes.Explore(); Tuple <int, Int64> result = ex.startRecommending(UserId); int status = result.Item1; Int64 eventId = result.Item2; if (status == 1) { Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventInfo(eventId, UserId); HiddenFieldStatus.Value = "1"; int participantsAvailable = Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); int participants = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()); HiddenFieldOwnerId.Value = dt.Rows[0]["OwnerId"].ToString(); HiddenFieldEventId.Value = dt.Rows[0]["EventId"].ToString(); LabelEventName.Text = dt.Rows[0]["Name"].ToString(); Page.Title = dt.Rows[0]["Name"].ToString(); HiddenFieldDate.Value = dt.Rows[0]["Date"].ToString(); LabelParticipants.Text = (participants + 1).ToString(); LabelParticipantsAvailable.Text = (participantsAvailable + 1).ToString(); LabelDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); LabelAddress.Text = dt.Rows[0]["Address"].ToString(); HiddenFieldUsername.Value = dt.Rows[0]["Username"].ToString(); HiddenFieldOwnerFullname.Value = dt.Rows[0]["OwnerName"].ToString(); HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString(); HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString(); int OwnerId = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString()); Classes.Locations l = new Classes.Locations(); DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); if (dtLocation.Rows.Count == 0) { LabelLocation.Text = "Not Available!"; } else { LabelLocation.Text = dtLocation.Rows[0]["CountryName"].ToString() + " - " + dtLocation.Rows[0]["CityName"].ToString(); } //Owner photo url if (Convert.ToBoolean(dt.Rows[0]["OwnerHasPhoto"].ToString())) { HiddenFieldOwnerPhotoUrl.Value = "Files/ProfilesPhotos/" + dt.Rows[0]["OwnerId"].ToString() + "-100.jpg"; } else { HiddenFieldOwnerPhotoUrl.Value = "Images/nophoto.png"; } //owner rate int RateCount = Convert.ToInt32(dt.Rows[0]["RateCount"].ToString()); int RateScore = Convert.ToInt32(dt.Rows[0]["RateScore"].ToString()); int RateSufficient = Convert.ToInt32(ConfigurationManager.AppSettings["RateSufficient"].ToString()); if (RateCount >= RateSufficient) { int RatePercent = (20 * RateScore / RateCount); HiddenFieldOwnerRateScore.Value = RatePercent.ToString(); HiddenFieldOwnerRateCount.Value = RateCount.ToString(); } else { HiddenFieldOwnerRateScore.Value = "0"; HiddenFieldOwnerRateCount.Value = "0"; } switch (dt.Rows[0]["Status"].ToString()) { case "1": LabelStatus.Text = "Available"; break; case "2": LabelStatus.Text = "Full"; break; case "3": LabelStatus.Text = "Passed"; break; } //bookmark bool bookmarkStatus = ev.checkBookmark(UserId, eventId); if (bookmarkStatus == true) { ButtonBookmark.Text = "Remove Bookmark"; } else { ButtonBookmark.Text = "Add Bookmark"; } } else { HiddenFieldStatus.Value = "0"; HiddenFieldSmiley.Value = ":)"; HiddenFieldMessage.Value = "Unfortunatly there is no event to show now!"; HiddenFieldLinksNumber.Value = "4"; Classes.Done d = new Classes.Done(); Tuple <string, string, string, string> result2 = d.doneItem("A", ""); HiddenFieldLink1Text.Value = result2.Item1; HiddenFieldLink1Url.Value = result2.Item2; HiddenFieldLink1Image.Value = result2.Item3; HiddenFieldLink1Color.Value = result2.Item4; result2 = d.doneItem("B", ""); HiddenFieldLink2Text.Value = result2.Item1; HiddenFieldLink2Url.Value = result2.Item2; HiddenFieldLink2Image.Value = result2.Item3; HiddenFieldLink2Color.Value = result2.Item4; result2 = d.doneItem("C", ""); HiddenFieldLink3Text.Value = result2.Item1; HiddenFieldLink3Url.Value = result2.Item2; HiddenFieldLink3Image.Value = result2.Item3; HiddenFieldLink3Color.Value = result2.Item4; result2 = d.doneItem("E", ""); HiddenFieldLink4Text.Value = result2.Item1; HiddenFieldLink4Url.Value = result2.Item2; HiddenFieldLink4Image.Value = result2.Item3; HiddenFieldLink4Color.Value = result2.Item4; } } }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int UserId = 0; if (Session["UserId"] != null) { UserId = Convert.ToInt32(Session["UserId"]); } else { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) { Response.Redirect("~/Login"); } } } //check user status string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue)) { Classes.UserInfo ui = new Classes.UserInfo(); int userStatus = ui.getUserStatus(UserId); switch (userStatus) { case 1: Session["DoneCompletion"] = "1"; break; case 0: case 4: Response.Redirect("~/Completion"); break; case 2: Response.Redirect("~/Error/UserDisabled"); break; case 3: Response.Redirect("~/Error/UserDeactivated"); break; } } if (!IsPostBack) { // get info Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventModifyInfo(Convert.ToInt64(Page.RouteData.Values["EventId"].ToString())); if (dt.Rows.Count == 0)// event doesn't exist { Response.Redirect("~/Error/EventNotFound"); } else { //check if user is the owner if (UserId.ToString() != dt.Rows[0]["OwnerId"].ToString()) { Response.Redirect("~/Error/UserNotEventOwner"); } //count available spots int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); //get time string timeHour = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Hour.ToString(); string timeMinute = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Minute.ToString(); DropDownListTimeHour.SelectedValue = timeHour; DropDownListTimeMinute.SelectedValue = timeMinute; TextBoxName.Text = dt.Rows[0]["Name"].ToString(); HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString(); TextBoxDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); TextBoxAddress.Text = dt.Rows[0]["Address"].ToString(); HiddenFieldParticipants.Value = dt.Rows[0]["Participants"].ToString(); HiddenFieldParticipantsAccepted.Value = dt.Rows[0]["ParticipantsAccepted"].ToString(); HiddenFieldDate.Value = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).ToString("d/M/yyyy hh:mm:ss tt"); HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString(); /////////////////// event photo Classes.Locations l = new Classes.Locations(); string countryCode = l.locationInfoOnlyId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()); locationCountry(); DropDownListCountry.SelectedValue = countryCode; locationCity(countryCode); DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString(); } } }
void locationCountry() { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.countriesList(); List<System.Web.UI.WebControls.ListItem> states = new List<System.Web.UI.WebControls.ListItem>(); DropDownListState.Items.Clear(); DropDownListState.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListState.Items.Add(new ListItem(dt.Rows[i]["CountryName"].ToString(), dt.Rows[i]["CountryId"].ToString())); } }
void locationCountry() { DataTable dt; Classes.Locations l = new Classes.Locations(); dt = l.countriesList(); DropDownListCountry.Items.Clear(); DropDownListCountry.Items.Add(new ListItem("Select Country", "0")); for (int i = 0; i < dt.Rows.Count; i++) { DropDownListCountry.Items.Add(new ListItem(dt.Rows[i]["CountryName"].ToString(), dt.Rows[i]["CountryCode"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { //check to see if the user logged in or is a guest int UserId = 0; if (Session["UserId"] != null) { UserId = Convert.ToInt32(Session["UserId"]); } else { if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); UserId = ls.getUserId(VC); if (UserId == 0) { Response.Redirect("~/Login"); } } } //check user status string completionValue = Session["DoneCompletion"] as string; if (String.IsNullOrEmpty(completionValue)) { Classes.UserInfo ui = new Classes.UserInfo(); int userStatus = ui.getUserStatus(UserId); switch (userStatus) { case 1: Session["DoneCompletion"] = "1"; break; case 0: case 4: Response.Redirect("~/Completion"); break; case 2: Response.Redirect("~/Error/UserDisabled"); break; case 3: Response.Redirect("~/Error/UserDeactivated"); break; } } if (!IsPostBack) { // get info Classes.Events ev = new Classes.Events(); DataTable dt = ev.eventModifyInfo(Convert.ToInt64(Page.RouteData.Values["EventId"].ToString())); if (dt.Rows.Count == 0)// event doesn't exist { Response.Redirect("~/Error/EventNotFound"); } else { //check if user is the owner if (UserId.ToString() != dt.Rows[0]["OwnerId"].ToString()) { Response.Redirect("~/Error/UserNotEventOwner"); } //count available spots int participantsAvailable = Convert.ToInt32(dt.Rows[0]["Participants"].ToString()) - Convert.ToInt32(dt.Rows[0]["ParticipantsAccepted"].ToString()); //get time string timeHour = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Hour.ToString(); string timeMinute = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).Minute.ToString(); DropDownListTimeHour.SelectedValue = timeHour; DropDownListTimeMinute.SelectedValue = timeMinute; TextBoxName.Text = dt.Rows[0]["Name"].ToString(); HiddenFieldTypeId.Value = dt.Rows[0]["TypeId"].ToString(); TextBoxDescriptions.Text = dt.Rows[0]["Descriptions"].ToString(); TextBoxAddress.Text = dt.Rows[0]["Address"].ToString(); HiddenFieldParticipants.Value = dt.Rows[0]["Participants"].ToString(); HiddenFieldParticipantsAccepted.Value = dt.Rows[0]["ParticipantsAccepted"].ToString(); HiddenFieldDate.Value = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()).ToString("d/M/yyyy hh:mm:ss tt"); HiddenFieldCoverId.Value = dt.Rows[0]["CoverId"].ToString(); /////////////////// event photo Classes.Locations l = new Classes.Locations(); string countryCode = l.locationInfoOnlyId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString())); int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()); locationCountry(); DropDownListCountry.SelectedValue = countryCode; locationCity(countryCode); DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString(); } } }