protected void Button2_Click(object sender, EventArgs e) { int courseID=Convert.ToInt32( DropDownList1.SelectedValue); if (RadioButton1.Checked) { try { AdminLogic.createEnrollments(courseID, DropDownList2.SelectedValue); } catch (Exception) { ; } finally { this.Gridview1_DataBind(); } } else { try { AdminLogic.createEnrollments(courseID, DropDownList2.SelectedValue); //if (!TextBox1.Text.Equals("")) //{ // AdminLogic.inputTextStreamResults(courseID, TextBox1.Text, DropDownList2.SelectedValue); //} string textStream = TextBox1.Text; string[] words = textStream.Split(' '); int count = words.Length; for (int i = 0; i <= count - 2; i++) { if (PerformanceAnalyzer2.BusinessLogicLayer.AdminLogic.validateIndex(words[i]) && PerformanceAnalyzer2.BusinessLogicLayer.AdminLogic.validateResult(words[i+1])) { PerformanceAnalyzerDataContext dbContext = new PerformanceAnalyzerDataContext(); dbContext.insertResultByText2(words[i], words[i + 1], DropDownList2.SelectedValue); } } } catch (Exception) { ; } finally { this.Gridview1_DataBind(); } } }
protected void Button2_Click(object sender, EventArgs e) { int courseID = Convert.ToInt32(DropDownList1.SelectedValue); if (RadioButton1.Checked) { try { AdminLogic.createEnrollments(courseID, DropDownList2.SelectedValue); } catch (Exception) { ; } finally { this.Gridview1_DataBind(); } } else { try { AdminLogic.createEnrollments(courseID, DropDownList2.SelectedValue); //if (!TextBox1.Text.Equals("")) //{ // AdminLogic.inputTextStreamResults(courseID, TextBox1.Text, DropDownList2.SelectedValue); //} string textStream = TextBox1.Text; string[] words = textStream.Split(' '); int count = words.Length; for (int i = 0; i <= count - 2; i++) { if (PerformanceAnalyzer2.BusinessLogicLayer.AdminLogic.validateIndex(words[i]) && PerformanceAnalyzer2.BusinessLogicLayer.AdminLogic.validateResult(words[i + 1])) { PerformanceAnalyzerDataContext dbContext = new PerformanceAnalyzerDataContext(); dbContext.insertResultByText2(words[i], words[i + 1], DropDownList2.SelectedValue); } } } catch (Exception) { ; } finally { this.Gridview1_DataBind(); } } }
/* ==============input Text Stream Results using data access laer and send back to the presentation layer =========*/ public static void inputTextStreamResults(int courseID, string textStream, string moduleCode) { string[] words = textStream.Split(' '); int count = words.Length; for (int i = 0; i <= count - 2; i++) { if (validateIndex(words[i]) && validateResult(words[i++])) { PerformanceAnalyzerDataContext dbContext = new PerformanceAnalyzerDataContext(); dbContext.insertResultByText2(words[i], words[i + 1], moduleCode); } } }