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 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(); } } }
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 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 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(); } } }