protected void Button1_Click(object sender, EventArgs e) { ServiceReference.DiscussionForumServiceClient client = new ServiceReference.DiscussionForumServiceClient(); ServiceReference.Comment comment = new ServiceReference.Comment(); comment.TopicId = Id; comment.token = token; comment.Comments = TextBox1.Text; try { client.addComment(comment); Page.Response.Redirect(Page.Request.Url.ToString(), true); } catch (TimeoutException exception) { Label2.Text = "Timeout"; } catch (FaultException <ServiceReference.ForumException> exception) { Label2.Text = "Try chaging values"; } catch (FaultException exception) { Label2.Text = "Try changing value"; } catch (CommunicationException exception) { Label2.Text = "Try changing value"; } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["DiscussionForum"]; if (cookie != null) { token = cookie["token"].ToString(); } else { Response.Redirect("/Index.aspx"); } Id = Int32.Parse(Request.QueryString["Id"]); ServiceReference.DiscussionForumServiceClient client = new ServiceReference.DiscussionForumServiceClient(); try { topicPage = client.getTopicPage(Id); if (topicPage == null) { Response.Redirect("/Error.aspx"); } Label3.Text = "Title: " + topicPage.Name; Label4.Text = "Description: " + topicPage.Discussion; Label5.Text = "By: " + topicPage.Author; } catch (Exception ex) { Response.Write(ex.Message); } }
protected void Button1_Click(object sender, EventArgs e) { ServiceReference.DiscussionForumServiceClient client = new ServiceReference.DiscussionForumServiceClient(); ServiceReference.Topic topic = new ServiceReference.Topic(); topic.Name = TextBox1.Text; topic.Discussion = TextBox2.Text; topic.token = token; try { client.createTopic(topic); Response.Redirect("/TopicIndex.aspx"); } catch (TimeoutException exception) { Label3.Text = "Timeout"; } catch (FaultException <ServiceReference.ForumException> exception) { Label3.Text = "Try changing value"; } catch (FaultException exception) { Label3.Text = "Try changing value"; } catch (CommunicationException exception) { Label3.Text = "Try changing value"; } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["DiscussionForum"]; if (cookie == null) { Response.Redirect("/Index.aspx"); } ServiceReference.DiscussionForumServiceClient client = new ServiceReference.DiscussionForumServiceClient(); topicIndices = client.getTopics().ToList <ServiceReference.TopicIndex>(); }
protected void Button1_Click(object sender, EventArgs e) { ServiceReference.DiscussionForumServiceClient client = new ServiceReference.DiscussionForumServiceClient(); ServiceReference.Registration registration = new ServiceReference.Registration(); if (TextBox3.Text != TextBox4.Text) { Label5.Text = "Password and confirm password not matching."; return; } registration.UserName = TextBox1.Text; registration.Email = TextBox2.Text; registration.Password = TextBox3.Text; if (client.registerUser(registration)) { Response.Redirect("/Index.aspx"); } else { Label5.Text = "Try changing value"; } }
protected void Button1_Click(object sender, EventArgs e) { ServiceReference.DiscussionForumServiceClient client = new ServiceReference.DiscussionForumServiceClient(); ServiceReference.Login login = new ServiceReference.Login(); login.Email = TextBox1.Text; login.Password = TextBox2.Text; string token = client.login(login); if (token != "") { HttpCookie discussionForum = new HttpCookie("DiscussionForum"); discussionForum["token"] = token; discussionForum.Expires.Add(new TimeSpan(0, 30, 0)); Response.Cookies.Add(discussionForum); Response.Redirect("/TopicIndex.aspx"); } else { Label3.Text = "Failed"; } }