/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { ArrayList selected = GetSelectedGV(); if (selected.Count == 0) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择实习任务!');</script>"); return; } else { foreach (GridViewRow row in GV.Rows) { if (((CheckBox)row.FindControl("chkSelected")).Checked) { SXRW.Delete(row.Cells[1].Text, row.Cells[3].Text, row.Cells[5].Text, row.Cells[8].Text, row.Cells[9].Text); } } ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除成功');</script>"); Query(); } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_ServerClick(object sender, EventArgs e) { if (btnAdd.Disabled == true) { Hashtable hash = new Hashtable(); if (SXRW.HasSXRW(txtJsbh.Value, txtBjbh.Value, selSxlx.Value, txtKbxn.Value, selKbxq.Value)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加失败,实习任务已存在!');</script>"); return; } //if (GetSelectedJS().Count != 1) //{ // Response.Write("<Script Language=JavaScript>alert('请选择一个教师!');</Script>"); // return; //} //foreach (GridViewRow row in GVJS.Rows) //{ // if (((CheckBox)row.FindControl("chkSelected")).Checked) // { // hash.Add("jsbh",SqlStringConstructor.GetQuotedString(Convert.ToString(row.Cells[1].Text))); // } //} //if (GetSelectedBJ().Count != 1) //{ // Response.Write("<Script Language=JavaScript>alert('请选择一个班级!');</Script>"); // return; //} //foreach (GridViewRow row in GVBJ.Rows) //{ // if (((CheckBox)row.FindControl("chkSelected")).Checked) // { // hash.Add("bjbh",SqlStringConstructor.GetQuotedString(Convert.ToString(row.Cells[1].Text))); // } //} hash.Add("bjbh", SqlStringConstructor.GetQuotedString(txtBjbh.Value)); hash.Add("jsbh", SqlStringConstructor.GetQuotedString(txtJsbh.Value)); hash.Add("yxbh", SqlStringConstructor.GetQuotedString(selKbyx.Value)); hash.Add("sxmc", SqlStringConstructor.GetQuotedString(txtSxmc.Value)); hash.Add("sxlx", SqlStringConstructor.GetQuotedString(selSxlx.Value)); hash.Add("sxzsts", Convert.ToDouble(txtSxsc.Value)); hash.Add("kbxn", SqlStringConstructor.GetQuotedString(txtKbxn.Value)); hash.Add("kbxq", SqlStringConstructor.GetQuotedString(selKbxq.Value)); Gzl.BusinessLogicLayer.SXRW.Add(hash); txtBjbh.Value = ""; txtJsbh.Value = ""; txtBjmc.Value = ""; txtSxmc.Value = ""; txtSxsc.Value = ""; txtZdjs.Value = ""; selKbxq.Disabled = true; txtSxmc.Disabled = true; selKbyx.Disabled = true; txtSxsc.Disabled = true; selSxlx.Disabled = true; btnBjsz.Disabled = true; btnJssz.Disabled = true; btnAdd.Disabled = false; btnSave.Disabled = true; btnCancel.Disabled = true; ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功');</script>"); Query(); //QueryBJ(); //QueryJS(); } if (btnChag.Disabled == true) { Hashtable hash = new Hashtable(); //if (GetSelectedJS().Count != 1) //{ // Response.Write("<Script Language=JavaScript>alert('请选择一个教师!');</Script>"); // return; //} //foreach (GridViewRow row in GVJS.Rows) //{ // if (((CheckBox)row.FindControl("chkSelected")).Checked) // { // hash.Add("jsbh",SqlStringConstructor.GetQuotedString(Convert.ToString(row.Cells[1].Text))); // } //} //if (GetSelectedBJ().Count != 1) //{ // Response.Write("<Script Language=JavaScript>alert('请选择一个班级!');</Script>"); // return; //} //foreach (GridViewRow row in GVBJ.Rows) //{ // if (((CheckBox)row.FindControl("chkSelected")).Checked) // { // hash.Add("bjbh", SqlStringConstructor.GetQuotedString(Convert.ToString(row.Cells[1].Text))); // } //} hash.Add("bjbh", SqlStringConstructor.GetQuotedString(txtBjbh.Value)); hash.Add("jsbh", SqlStringConstructor.GetQuotedString(txtJsbh.Value)); hash.Add("yxbh", SqlStringConstructor.GetQuotedString(selKbyx.Value)); hash.Add("sxmc", SqlStringConstructor.GetQuotedString(txtSxmc.Value)); hash.Add("sxlx", SqlStringConstructor.GetQuotedString(selSxlx.Value)); hash.Add("sxzsts", Convert.ToDouble(txtSxsc.Value)); hash.Add("kbxn", SqlStringConstructor.GetQuotedString(txtKbxn.Value)); hash.Add("kbxq", SqlStringConstructor.GetQuotedString(selKbxq.Value)); string where = "Where jsbh = " + SqlStringConstructor.GetQuotedString(Tjsbh.Value) + " And bjbh = " + SqlStringConstructor.GetQuotedString(Tbjbh.Value) + " And sxlx =" + SqlStringConstructor.GetQuotedString(Tsxlx.Value) + " And kbxn = " + SqlStringConstructor.GetQuotedString(Tkbxn.Value) + " And kbxq =" + SqlStringConstructor.GetQuotedString(Tkbxq.Value); Gzl.BusinessLogicLayer.SXRW.Update(hash, where); txtBjbh.Value = ""; txtJsbh.Value = ""; txtBjmc.Value = ""; txtSxmc.Value = ""; txtSxsc.Value = ""; txtZdjs.Value = ""; selKbxq.Disabled = true; txtSxmc.Disabled = true; selKbyx.Disabled = true; txtSxsc.Disabled = true; selSxlx.Disabled = true; btnSave.Disabled = true; btnBjsz.Disabled = true; btnJssz.Disabled = true; btnCancel.Disabled = true; btnChag.Disabled = false; ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改成功');</script>"); Query(); //QueryBJ(); //QueryJS(); } }
/// <summary> /// "修改" /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnChag_ServerClick(object sender, EventArgs e) { ArrayList selected = GetSelectedGV(); SXRW sxrw = new SXRW(); if (selected.Count != 1) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择一个实习任务!');</script>"); return; } string jsbh = ""; string bjmc = ""; string sxlx = ""; string kbxn = ""; string kbxq = ""; foreach (GridViewRow row in GV.Rows) { if (((CheckBox)row.FindControl("chkSelected")).Checked) { jsbh = Convert.ToString(row.Cells[1].Text); bjmc = Convert.ToString(row.Cells[3].Text); sxlx = Convert.ToString(row.Cells[5].Text); kbxn = Convert.ToString(row.Cells[8].Text); kbxq = Convert.ToString(row.Cells[9].Text); } } sxrw.LoadData(jsbh, bjmc, sxlx, kbxn, kbxq); Tjsbh.Value = sxrw.Jsbh; Tbjbh.Value = sxrw.Bjbh; Tsxlx.Value = sxrw.Sxlx; Tkbxn.Value = sxrw.Kbxn; Tkbxq.Value = sxrw.Kbxq; txtJsbh.Value = sxrw.Jsbh; txtZdjs.Value = sxrw.Jsxm; //QueryJS2(sxrw.Jsbh); //foreach (GridViewRow row in GVJS.Rows) //{ // ((CheckBox)row.FindControl("chkSelected")).Checked = true; //} txtBjbh.Value = sxrw.Bjbh; txtBjmc.Value = sxrw.Bjmc; //QueryBJ2(); //foreach (GridViewRow row in GVBJ.Rows) //{ // ((CheckBox)row.FindControl("chkSelected")).Checked = true; //} txtSxmc.Value = sxrw.Sxmc; txtSxsc.Value = Convert.ToString(sxrw.Sxzsts); txtKbxn.Value = sxrw.Kbxn; foreach (ListItem item in selKbyx.Items) { if (item.Selected == true) { item.Selected = false; } if (item.Text == sxrw.Yxmc) { item.Selected = true; } } foreach (ListItem item in selSxlx.Items) { if (item.Selected == true) { item.Selected = false; } if (item.Text == sxrw.Sxlx) { item.Selected = true; } } foreach (ListItem item in selKbxq.Items) { if (item.Selected == true) { item.Selected = false; } if (item.Text == sxrw.Kbxq) { item.Selected = true; } } selKbxq.Disabled = false; txtSxmc.Disabled = false; selKbyx.Disabled = false; txtSxsc.Disabled = false; selSxlx.Disabled = false; btnBjsz.Disabled = false; btnJssz.Disabled = false; btnChag.Disabled = true; btnAdd.Disabled = false; btnSave.Disabled = false; btnCancel.Disabled = false; }