}//end of research void buttonFac_click(object obj, EventArgs e) { //getting parent button Button b = (Button)obj; // get About information string jsonAbout = getRestData("/research/"); // need a way to get the JSON form into a Research object Research res = JToken.Parse(jsonAbout).ToObject <Research>(); int count = res.byFaculty.Count(); ByFaculty facVal = new ByFaculty(); for (int i = 0; i < count; i++) { String uname = res.byFaculty[i].username; if (String.Compare(b.Name, uname) == 0) { facVal = res.byFaculty[i]; } else { ftext.Text = res.byFaculty[i].username; } } //adding citation according to click ftext.Text = facVal.citations[0] + "\n";; for (int j = 0; j < res.byFaculty[j].citations.Count(); j++) { ftext.Text += res.byFaculty[j].citations[0] + "\n";; } }//end of onclick
}//void getresearchdatabyinterest(Object sender, EventArgs e) //get the research data by faculty void getresearchdatabyfaculty(Object sender, EventArgs e) { Button clickedButton = (Button)sender; string researchname = clickedButton.Name; string researchinterest = getRestData("/research/byFaculty/username=" + researchname); ByFaculty researchdata = JToken.Parse(researchinterest).ToObject <ByFaculty>(); //class object to pass the data to another view ResearchByFaculty researchdailog = new ResearchByFaculty(researchdata); researchdailog.ShowDialog(); }// void getresearchdatabyfaculty(Object sender, EventArgs e)
public ResearchByFaculty(object sender) { InitializeComponent(); ByFaculty researchbyfaculty = sender as ByFaculty; label1.Text = researchbyfaculty.facultyName; String details = ""; int count = 1; for (int i = 0; i < researchbyfaculty.citations.Count(); i++) { details += count + ": " + researchbyfaculty.citations[i] + Environment.NewLine; count++; } richTextBox1.Text = details; }