protected void Page_Load(object sender, EventArgs e) { if (Session["email"] != null && Session["AuthToken"] != null && Request.Cookies["AuthToken"] != null) { if (!Session["AuthToken"].ToString().Equals(Request.Cookies["AuthToken"].Value)) { Response.Redirect("User_Login.aspx", false); } else { review_date.Text = DateTime.Now.ToString(); user = (string)Session["email"]; gemid = Request.QueryString["gem"]; // retrieve from gem id listing DBServiceReference.Service1Client client = new DBServiceReference.Service1Client(); var gems = client.GetGemById(Convert.ToInt32(gemid)); gemtitle = gems.Title; gem_image.Attributes["src"] = "/Images/Gem/" + gems.Image; } } else { Response.Redirect("User_Login.aspx", false); } //user = (string)Session["email"]; //gem_id = (string)Request.QueryString["post"]; // id retrieve from gem listing }
protected void Page_Load(object sender, EventArgs e) { gemid = Request.QueryString["gemId"]; if (gemid != null) { this.Session["gem_id"] = gemid; lbl_gemId.Text = gemid; DBServiceReference.Service1Client client = new DBServiceReference.Service1Client(); System.Diagnostics.Debug.WriteLine(gemid); var gems = client.GetGemById(Convert.ToInt32(gemid)); System.Diagnostics.Debug.WriteLine(gems.ToString()); gem_title.Text = gems.Title; gem_desc.Text = gems.Description; gem_image.Attributes["src"] = "/Images/Gem/" + gems.Image; gemadd = gems.Location; } else { Response.Redirect("Gem_Catalogue.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { gemid = Request.QueryString["gemId"]; if (gemid != null) { this.Session["gem_id"] = gemid; lbl_gemId.Text = gemid; DBServiceReference.Service1Client client = new DBServiceReference.Service1Client(); var gems = client.GetGemById(Convert.ToInt32(gemid)); gem_title.Text = gems.Title; gem_desc.Text = gems.Description; gem_image.Attributes["src"] = "/Images/Gem/" + gems.Image; gem_add.Text = "Address : " + gems.Location; gem_company.Text = gems.Partner; } else { Response.Redirect("Partner_Gem_List.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["LoggedIn"] != null && Session["Role"] != null && Session["AuthToken"] != null && Request.Cookies["AuthToken"] != null) { if (!Session["AuthToken"].ToString().Equals(Request.Cookies["AuthToken"].Value)) { Session.Clear(); Session.Abandon(); Session.RemoveAll(); Response.Redirect("Staff_Login.aspx"); if (Request.Cookies["ASP.NET_SessionId"] != null) { Response.Cookies["ASP.NET_SessionId"].Value = string.Empty; Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(-20); } if (Request.Cookies["AuthToken"] != null) { Response.Cookies["AuthToken"].Value = string.Empty; Response.Cookies["AuthToken"].Expires = DateTime.Now.AddMonths(-20); } } else { if (Session["Role"].ToString() == "Staff") { // on page load codes here DBServiceReference.Service1Client client = new DBServiceReference.Service1Client(); var gem = client.GetGemById(Convert.ToInt32(Request.QueryString["id"])); gem_img.Attributes["src"] = "/Images/Gem/" + gem.Image; title_lb.Text = gem.Title; status_lb.Text = gem.Status; id_lb.Text = gem.Gem_Id.ToString(); // adds anchor tags/hyperlinks to the following text partner_lb.Text = "<a style='color: black; text-decoration: underline;' target='_blank' href='Staff_Account_Details.aspx?email=" + gem.Partner_Email + "'>" + gem.Partner + "</a>"; type_lb.Text = gem.Type; date_lb.Text = gem.Date == null ? null : Convert.ToDateTime(gem.Date).ToString("dd/MM/yyyy"); location_lb.Text = gem.Location; description_lb.Text = gem.Description; // checks if the gem has been dealt with if (gem.Status == "Approved" || gem.Status == "Rejected") { approve_btn.Visible = false; disapprove_btn.Visible = false; } } else { Session.Clear(); Session.Abandon(); Session.RemoveAll(); Response.Redirect("Staff_Login.aspx"); if (Request.Cookies["ASP.NET_SessionId"] != null) { Response.Cookies["ASP.NET_SessionId"].Value = string.Empty; Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(-20); } if (Request.Cookies["AuthToken"] != null) { Response.Cookies["AuthToken"].Value = string.Empty; Response.Cookies["AuthToken"].Expires = DateTime.Now.AddMonths(-20); } } } } else { Session.Clear(); Session.Abandon(); Session.RemoveAll(); Response.Redirect("Staff_Login.aspx"); if (Request.Cookies["ASP.NET_SessionId"] != null) { Response.Cookies["ASP.NET_SessionId"].Value = string.Empty; Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(-20); } if (Request.Cookies["AuthToken"] != null) { Response.Cookies["AuthToken"].Value = string.Empty; Response.Cookies["AuthToken"].Expires = DateTime.Now.AddMonths(-20); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["LoggedIn"] != null && Session["Role"] != null && Session["AuthToken"] != null && Request.Cookies["AuthToken"] != null) { if (!Session["AuthToken"].ToString().Equals(Request.Cookies["AuthToken"].Value)) { Session.Clear(); Session.Abandon(); Session.RemoveAll(); Response.Redirect("Staff_Login.aspx"); if (Request.Cookies["ASP.NET_SessionId"] != null) { Response.Cookies["ASP.NET_SessionId"].Value = string.Empty; Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(-20); } if (Request.Cookies["AuthToken"] != null) { Response.Cookies["AuthToken"].Value = string.Empty; Response.Cookies["AuthToken"].Expires = DateTime.Now.AddMonths(-20); } } else { if (Session["Role"].ToString() == "Staff") { // on page load codes here if (!String.IsNullOrEmpty(Request.QueryString["id"])) { DBServiceReference.Service1Client client = new DBServiceReference.Service1Client(); var report = client.GetReportById(Convert.ToInt32(Request.QueryString["id"])); if (report.Type.Trim() == "gem") { var gem = client.GetGemById(Convert.ToInt32(report.Post)); System.Diagnostics.Debug.WriteLine("post" + report.Post); var id = report.Post; var title = gem.Title; System.Diagnostics.Debug.WriteLine("id" + id); System.Diagnostics.Debug.WriteLine("title" + title); report_lb.Text = report_lb.Text + report.Report_Id; status_lb.Text = report.Status; date_lb.Text = report.Date_reported.ToString("dd/MM/yyyy"); // adds anchor tags/hyperlinks to the following text reporter_lb.Text = "<a style='color: black; text-decoration: underline;' target='_blank' href='Staff_Account_Details.aspx?email=" + report.Reported_by + "'>" + report.Reported_by + "</a>"; // links to account details page of reporter type_lb.Text = report.Type; reported_lb.Text = "<a style='color: black; text-decoration: underline;' target='_blank' href='Gem_Listing.aspx?gemId=" + id + "&gemT=" + title + "'>" + title + "</a>"; // links to reported gem/review reason_lb.Text = report.Reason; remarks_lb.Text = report.Remarks; } else { var review = client.GetReviewById(Convert.ToInt32(report.Post)); var id = Convert.ToInt32(review.Gem_Id); var title = review.Gem_Title; report_lb.Text = report_lb.Text + report.Report_Id; status_lb.Text = report.Status; date_lb.Text = report.Date_reported.ToString("dd/MM/yyyy"); // adds anchor tags/hyperlinks to the following text reporter_lb.Text = "<a style='color: black; text-decoration: underline;' target='_blank' href='Staff_Account_Details.aspx?email=" + report.Reported_by + "'>" + report.Reported_by + "</a>"; // links to account details page of reporter type_lb.Text = report.Type; reported_lb.Text = "<a style='color: black; text-decoration: underline;' target='_blank' href='Gem_Listing.aspx?gemId=" + id + "&gemT=" + title + "'>" + title + "</a>"; // links to reported gem/review reason_lb.Text = report.Reason; remarks_lb.Text = report.Remarks; } // checks if the review has already been dealt if (report.Status.Trim() == "Resolved") { resolve_btn.Visible = false; } } else { // if there is no report selected, send back to reports table. Response.Redirect("Staff_Reports_Table.aspx"); } } else { Session.Clear(); Session.Abandon(); Session.RemoveAll(); Response.Redirect("Staff_Login.aspx"); if (Request.Cookies["ASP.NET_SessionId"] != null) { Response.Cookies["ASP.NET_SessionId"].Value = string.Empty; Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(-20); } if (Request.Cookies["AuthToken"] != null) { Response.Cookies["AuthToken"].Value = string.Empty; Response.Cookies["AuthToken"].Expires = DateTime.Now.AddMonths(-20); } } } } else { Session.Clear(); Session.Abandon(); Session.RemoveAll(); Response.Redirect("Staff_Login.aspx"); if (Request.Cookies["ASP.NET_SessionId"] != null) { Response.Cookies["ASP.NET_SessionId"].Value = string.Empty; Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(-20); } if (Request.Cookies["AuthToken"] != null) { Response.Cookies["AuthToken"].Value = string.Empty; Response.Cookies["AuthToken"].Expires = DateTime.Now.AddMonths(-20); } } }