private void SubmitPost_button1_Click(object sender, EventArgs e) { if (replies_textBox1.Text == "") { MessageBox.Show("Please enter your reply first"); } else { int c = int.Parse(controllerObj.GetCountReplyPosts_Student().ToString()); int ReplypostNo = c + 10 /*+ 700000*/; Community_RepliesOnly C = new Community_RepliesOnly(); //string p = C.textBox1.Text.ToString(); Community_PostsOnly Cp = new Community_PostsOnly(); object i = controllerObj.GetStudentIDFromName(YourName_Label.Text.ToString()); object f = controllerObj.GetDoctorIDFromName(YourName_Label.Text.ToString()); object b = controllerObj.GetSponsorIDFromName(YourName_Label.Text.ToString()); int text = controllerObj.AddPost(ReplypostNo, replies_textBox1.Text.ToString()); if (i != null) { int r = controllerObj.StudentAddReply(i.ToString(), no_textBox1.Text.ToString(), ReplypostNo); } else if (f != null) { int q = controllerObj.DoctorAddReply(f.ToString(), no_textBox1.Text.ToString(), ReplypostNo); } else if (b != null) { int u = controllerObj.SponsorAddReply(b.ToString(), no_textBox1.Text.ToString(), ReplypostNo); } if (text != 0) { MessageBox.Show("Thank you for your participation, your reply is added succesfully"); /////////////////////////// DataTable R = controllerObj.GetAllRepliesOnASpecificPost(no_textBox1.Text.ToString()); if (R != null) { C.Replies_dataGridView1.DataSource = R; C.Replies_dataGridView1.Refresh(); C.YourName_Label.Text = YourName_Label.Text; C.textBox1.Text = no_textBox1.Text; C.Show(); } else { C.Messagelabel.Visible = true; } } else { //MessageBox.Show("Couldn't add your reply succesfully, please try again"); } } }
private void button2_Click(object sender, EventArgs e) { Community_PostsOnly C = new Community_PostsOnly(); C.YourName_Label.Text = YourName_Label.Text; DataTable dt = controllerObj.GetAllQuestions(); if (dt != null) { C.Posts_dataGridView1.DataSource = dt; C.Posts_dataGridView1.Refresh(); } else { C.Messagelabel.Visible = true; } C.Show(); }
private void SubmitPost_button1_Click(object sender, EventArgs e) { if (posts_textBox1.Text == "") { MessageBox.Show("Please write your question first"); } else { object i = controllerObj.GetStudentIDFromName(YourName_Label.Text.ToString()); int c = int.Parse(controllerObj.GetCountOfPosts().ToString()); int postNo = c + 1 + 8000; int r = controllerObj.AddPost(postNo, posts_textBox1.Text.ToString()); int s = controllerObj.StudentAddPost(i.ToString(), postNo); if (r != 0 && s != 0) { MessageBox.Show("Your question is added succesfully, wait for someone to help!"); Community_PostsOnly C = new Community_PostsOnly(); C.YourName_Label.Text = YourName_Label.Text; C.AddPost_button1.Visible = true; DataTable dt = controllerObj.GetAllQuestions(); if (dt != null) { C.Posts_dataGridView1.DataSource = dt; C.Posts_dataGridView1.Refresh(); C.Show(); } else { C.Messagelabel.Visible = true; } } else { MessageBox.Show("Something went wrong while adding your question, please try again"); } } }