protected void Button1_Click(object sender, EventArgs e) { CAssessFactory factory = new CAssessFactory(); string name = (sender as Button).Text; int id = factory.getId(name); Response.Redirect("running.aspx"); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "edit") { CAssessFactory assessFactory = new CAssessFactory(); CPatientFactory patientFactory = new CPatientFactory(); int index = Convert.ToInt32(e.CommandArgument); GridView GridViewTest = (GridView)e.CommandSource; GridViewRow row = GridViewTest.Rows[index]; string name = row.Cells[2].Text; int assess_id = assessFactory.getId(name); string patient_id = patientFactory.getById(row.Cells[1].Text).id; int schedule_id = Convert.ToInt32(row.Cells[6].Text); Response.Write("<script>Submit();</script>"); Response.Redirect("assess.aspx?pid=" + patient_id + "&aid=" + assess_id + "&sid=" + schedule_id); } }
protected void Page_Load(object sender, EventArgs e) { CAssessFactory assessFactory = new CAssessFactory("lite"); int formCount = Request.Form.Count; if (Request.Form["assessName"] != null) { CAssess assess = new CAssess(); assess.name = Request.Form["assessName"]; assess.items = new List <CItem>(); for (int i = 1; i < formCount; i++) { string groupName = "groupName" + i; if (Request.Form[groupName] != null) { CGroup group = new CGroup(); group.name = Request.Form[groupName]; for (int j = 1; j < formCount; j++) { string itemNameInGroup = "itemName" + i + "-" + j; if (Request.Form[itemNameInGroup] != null) { CItem item = new CItem(); item.name = Request.Form[itemNameInGroup]; item.group = group; item.sqlSchemeName = "ItemScore"; item.contents = new List <CContent>(); for (int k = 1; k < formCount; k++) { string contentNameInGroup = "contentName" + i + "-" + j + "-" + k; string contentScoreInGroup = "contentScore" + i + "-" + j + "-" + k; if (Request.Form[contentNameInGroup] != null && Request.Form[contentScoreInGroup] != null) { CContent content = new CContent(); content.content = Request.Form[contentNameInGroup]; content.score = Convert.ToInt32(Request.Form[contentScoreInGroup]); item.contents.Add(content); } } assess.items.Add(item); continue; } string textNameInGroup = "textName" + i + "-" + j; if (Request.Form[textNameInGroup] != null) { CItem item = new CItem(); item.name = Request.Form[textNameInGroup]; item.group = group; item.sqlSchemeName = "ItemText"; assess.items.Add(item); continue; } } continue; } string itemName = "itemName" + i; if (Request.Form[itemName] != null) { CItem item = new CItem(); item.name = Request.Form[itemName]; item.sqlSchemeName = "ItemScore"; item.contents = new List <CContent>(); for (int j = 1; j < formCount; j++) { string contentNameInGroup = "contentName" + i + "-" + j; string contentScoreInGroup = "contentScore" + i + "-" + j; if (Request.Form[contentNameInGroup] != null && Request.Form[contentScoreInGroup] != null) { CContent content = new CContent(); content.content = Request.Form[contentNameInGroup]; content.score = Convert.ToInt32(Request.Form[contentScoreInGroup]); item.contents.Add(content); } } assess.items.Add(item); continue; } string textName = "textName" + i; if (Request.Form[textName] != null) { CItem item = new CItem(); item.name = Request.Form[textName]; item.sqlSchemeName = "ItemText"; assess.items.Add(item); continue; } } assessFactory.addAssessStyle(assess); Response.Write("新增評估表樣式完成"); } }