protected void UpdateCoursePlan(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('CourseProgress')", true); if (Page.IsValid) { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.CoursePlan cc1 = new Entities.CoursePlan() { year = DateTime.Now.Year.ToString(), Goal = Goal.Value, progressId = DropDownList7.SelectedIndex + 1, }; Entities.Section s1 = new Entities.Section() { sectionName = DropDownList10.SelectedValue, }; Entities.Class c1 = new Entities.Class() { className = DropDownList8.SelectedValue, }; Entities.Subjects s2 = new Entities.Subjects() { subjectName = DropDownList9.SelectedValue, }; Entities.personalInfo p1 = new Entities.personalInfo() { pKId = Session["School"].ToString(), }; db.CoursePlan(cc1, s2, s1, c1, p1); } }
public void CoursePlan(Entities.CoursePlan c1, Entities.Subjects s2, Entities.Section s3, Entities.Class c2, Entities.personalInfo p1) { using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spInsertCourseProgress]")) { s1.AddParameter("@subjectName", System.Data.SqlDbType.NVarChar, s2.subjectName); s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, s3.sectionName); s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c2.className); s1.AddParameter("@pKId", System.Data.SqlDbType.NVarChar, p1.pKId); s1.AddParameter("@progressId", System.Data.SqlDbType.Int, c1.progressId); s1.AddParameter("@year", System.Data.SqlDbType.NVarChar, c1.year); s1.AddParameter("@goal", System.Data.SqlDbType.NVarChar, c1.Goal); s1.Execute(); } }