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