protected void btnSure_ServerClick(object sender, EventArgs e) { string jxbbh = Convert.ToDateTime(DateTime.Now.ToString()).ToString("yyyyMMddHHmmss"); Hashtable hash = new Hashtable(); string rs = txtJxbrs.Value; hash.Add("jxbzrs", Convert.ToInt32(txtJxbrs.Value)); hash.Add("jxbbh", SqlStringConstructor.GetQuotedString(selJxblx.SelectedValue + jxbbh)); switch (selJxblx.SelectedValue) { case "gx": { Hashtable ht = new Hashtable(); ht.Add("jxbbh", "gx"); hash.Add("jxbmc", SqlStringConstructor.GetQuotedString(selJxblx.SelectedItem.Text + Convert.ToString(JXB.QueryJXB(ht).Rows.Count + 1))); JXB.AddGXX(hash); jxbbh = "gx" + jxbbh; break; } case "xx": { Hashtable ht = new Hashtable(); ht.Add("jxbbh", "xx"); hash.Add("jxbmc", SqlStringConstructor.GetQuotedString(selJxblx.SelectedItem.Text + Convert.ToString(JXB.QueryJXB(ht).Rows.Count + 1))); JXB.AddGXX(hash); jxbbh = "xx" + jxbbh; break; } case "bx": { string jxbmc = ""; foreach (ListItem li in listRight.Items) { jxbmc = jxbmc + li.Text + "|"; } if (JXB.HasJXB(jxbmc)) { JXB jxb = new JXB(); jxb.LoadDataJXB2(jxbmc); jxbbh = jxb.Jxbbh; txtJxbrs.Value = jxb.Jxbzrs; DataTable dt = JXB.LoadDataGX(jxb.Jxbbh); listRight.Items.Clear(); foreach (DataRow dr in dt.Rows) { listRight.Items.Add(new ListItem(dr["bjmc"].ToString(), dr["bjbh"].ToString())); } break; } else { hash.Add("jxbmc", SqlStringConstructor.GetQuotedString(jxbmc)); JXB.AddGXX(hash); foreach (ListItem li in listRight.Items) { Hashtable ht = new Hashtable(); ht.Add("jxbbh", SqlStringConstructor.GetQuotedString(selJxblx.SelectedValue + jxbbh)); ht.Add("bjbh", SqlStringConstructor.GetQuotedString(li.Value)); JXB.AddBX(ht); } jxbbh = "bx" + jxbbh; txtJxbrs.Value = rs; break; } } } Response.Write("<script language=javascript>var aa = window.opener.document;aa.all.txtJxbbh.value= '" + jxbbh + "';aa.all.txtJxbrs.value='" + txtJxbrs.Value + "';self.close();</script>"); }
protected void btnChag_ServerClick(object sender, EventArgs e) { ArrayList selectedJXB = GetSelected(); JXB jxb = new JXB(); if (selectedJXB.Count != 1) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择一个教学班!');</script>"); return; } string jxbbh = selectedJXB[0].ToString(); if (jxbbh.Substring(0, 2) == "bx") { jxb.LoadDataJXB(jxbbh); txtJxbrs.Value = jxb.Jxbzrs; foreach (ListItem item in selJxblx.Items) { if (item.Selected == true) { item.Selected = false; } if (item.Value == jxb.Jxbbh.Substring(0,2)) { item.Selected = true; } } DataTable dt =JXB.LoadDataGX(jxbbh); listRight.Items.Clear(); foreach (DataRow dr in dt.Rows) { listRight.Items.Add(new ListItem(dr["bjmc"].ToString(), dr["bjbh"].ToString())); } leftTree.Enabled = true; listRight.Enabled = true; btnLeftToRight.Disabled = false; btnRightToLeft.Disabled = false; txtJxbrs.Disabled = true; } else { jxb.LoadDataJXB(jxbbh); txtJxbrs.Value = jxb.Jxbzrs; foreach (ListItem item in selJxblx.Items) { if (item.Selected == true) { item.Selected = false; } if (item.Value == jxb.Jxbbh.Substring(0, 2)) { item.Selected = true; } } leftTree.Enabled = false; listRight.Enabled = false; btnLeftToRight.Disabled = true; btnRightToLeft.Disabled = true; txtJxbrs.Disabled = false; } btnAdd.Disabled = false; btnChag.Disabled = true; btnDel.Enabled = true; btnSave.Disabled = false; btnCancel.Disabled = false; selJxblx.Enabled = false; }
protected void btnSave_ServerClick(object sender, EventArgs e) { if (btnAdd.Disabled == true) { string jxbbh = Convert.ToDateTime(DateTime.Now.ToString()).ToString("yyyyMMddHHmmss"); Hashtable hash = new Hashtable(); hash.Add("jxbzrs", Convert.ToInt32(txtJxbrs.Value)); hash.Add("jxbbh", SqlStringConstructor.GetQuotedString(selJxblx.SelectedValue + jxbbh)); switch (selJxblx.SelectedValue) { case "gx": { Hashtable ht = new Hashtable(); ht.Add("jxbbh","gx"); hash.Add("jxbmc", SqlStringConstructor.GetQuotedString(selJxblx.SelectedItem.Text + Convert.ToString(JXB.QueryJXB(ht).Rows.Count + 1))); JXB.AddGXX(hash); break; } case "xx": { Hashtable ht = new Hashtable(); ht.Add("jxbbh", "xx"); hash.Add("jxbmc", SqlStringConstructor.GetQuotedString(selJxblx.SelectedItem.Text + Convert.ToString(JXB.QueryJXB(ht).Rows.Count + 1))); JXB.AddGXX(hash); break; } case "bx": { string jxbmc = ""; foreach (ListItem li in listRight.Items) { jxbmc = jxbmc + li.Text + "|"; } if (JXB.HasJXB(jxbmc)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('教学班已存在');</script>"); listRight.Items.Clear(); foreach (TreeNode tn in leftTree.CheckedNodes) { if (tn.Checked) { tn.Checked = false; } } break; } else { hash.Add("jxbmc", SqlStringConstructor.GetQuotedString(jxbmc)); JXB.AddGXX(hash); foreach (ListItem li in listRight.Items) { Hashtable ht = new Hashtable(); ht.Add("jxbbh", SqlStringConstructor.GetQuotedString(selJxblx.SelectedValue + jxbbh)); ht.Add("bjbh", SqlStringConstructor.GetQuotedString(li.Value)); JXB.AddBX(ht); } foreach (TreeNode tn in leftTree.Nodes) { if (tn.Checked) { tn.Checked = false; } } leftTree.CollapseAll(); listRight.Items.Clear(); break; } } } txtJxbrs.Disabled = true; btnLeftToRight.Disabled = true; btnRightToLeft.Disabled = true; selJxblx.Enabled = false; leftTree.Enabled = false; listRight.Enabled = false; txtJxbrs.Value = ""; btnAdd.Disabled = false; btnSave.Disabled = true; btnCancel.Disabled = true; ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功');</script>"); Query(); } if (btnChag.Disabled == true) { ArrayList selectedJXB = GetSelected(); JXB jxb = new JXB(); string jxbbh = selectedJXB[0].ToString(); jxb.LoadDataJXB(jxbbh); if (jxbbh.Substring(0, 2) == "bx") { string jxbmc = ""; foreach (ListItem lt in listRight.Items) { jxbmc = jxbmc + lt.Text + "|"; } if (JXB.HasJXB(jxbmc)) { listRight.Items.Clear(); foreach (TreeNode tn in leftTree.Nodes) { if (tn.Checked) { tn.Checked = false; } } } else { Hashtable hash = new Hashtable(); hash.Add("jxbzrs", Convert.ToInt32(txtJxbrs.Value)); string where = "Where jxbbh = " + SqlStringConstructor.GetQuotedString(jxb.Jxbbh); Gzl.BusinessLogicLayer.JXB.DeleteBJ(jxb.Jxbbh); foreach (ListItem li in listRight.Items) { Hashtable ht = new Hashtable(); ht.Add("jxbbh", SqlStringConstructor.GetQuotedString(jxb.Jxbbh)); ht.Add("bjbh", SqlStringConstructor.GetQuotedString(li.Value)); JXB.AddBX(ht); } hash.Add("jxbmc", SqlStringConstructor.GetQuotedString(jxbmc)); JXB.UpdateGXX(hash, where); ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改成功');</script>"); txtJxbrs.Disabled = true; leftTree.Enabled = true; listRight.Enabled = true; btnLeftToRight.Disabled = false; btnRightToLeft.Disabled = false; foreach (TreeNode tn in leftTree.Nodes) { if (tn.Checked) { tn.Checked = false; } } leftTree.CollapseAll(); listRight.Items.Clear(); } } else { Hashtable hash = new Hashtable(); hash.Add("jxbzrs", Convert.ToInt32(txtJxbrs.Value)); string where = "Where jxbbh = " + SqlStringConstructor.GetQuotedString(jxb.Jxbbh); JXB.UpdateGXX(hash, where); ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改成功');</script>"); } txtJxbrs.Disabled = true; btnLeftToRight.Disabled = true; btnRightToLeft.Disabled = true; selJxblx.Enabled = false; leftTree.Enabled = false; listRight.Enabled = false; txtJxbrs.Value = ""; btnSave.Disabled = true; btnCancel.Disabled = true; btnChag.Disabled = false; Query(); } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnChag_ServerClick(object sender, EventArgs e) { ArrayList selected = GetSelectedGV(); KCSJRW kcsjrw = new KCSJRW(); if (selected.Count != 1) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择一个课程设计任务!');</script>"); return; } string jsbh = ""; string kcsjmc = ""; string jxbmc = ""; string kbxn = ""; string kbxq = ""; foreach (GridViewRow row in GV.Rows) { if (((CheckBox)row.FindControl("chkSelected")).Checked) { jsbh = Convert.ToString(row.Cells[1].Text); kcsjmc = Convert.ToString(row.Cells[3].Text); jxbmc = Convert.ToString(row.Cells[4].Text); kbxn = Convert.ToString(row.Cells[5].Text); kbxq = Convert.ToString(row.Cells[6].Text); } } kcsjrw.LoadData(jsbh, kcsjmc, jxbmc, kbxn, kbxq); Tjsbh.Text = kcsjrw.Jsbh; Tkcsjbh.Text = kcsjrw.Kcsjbh; Tjxbbh.Text = kcsjrw.Jxbbh; Tkbxn.Text = kcsjrw.Kbxn; Tkbxq.Text = kcsjrw.Kbxq; txtJsbh.Value = kcsjrw.Jsbh; txtZdjs.Value = kcsjrw.Jsxm; //QueryJS2(kcsjrw.Jsbh); //foreach (GridViewRow row in GVJS.Rows) //{ // ((CheckBox)row.FindControl("chkSelected")).Checked = true; //} txtKcsjbh.Value = kcsjrw.Kcsjbh; txtKcsjmc.Value = kcsjrw.Kcsjmc; //QueryKCSJ2(); //foreach (GridViewRow row in GVKCSJ.Rows) //{ // ((CheckBox)row.FindControl("chkSelected")).Checked = true; //} txtKbxn.Value = kcsjrw.Kbxn; foreach (ListItem item in selKbxq.Items) { if (item.Selected == true) { item.Selected = false; } if (item.Text == kcsjrw.Kbxq) { item.Selected = true; } } //foreach (ListItem item in selKbyx.Items) //{ // if (item.Selected == true) // { // item.Selected = false; // } // if (item.Value == kcsjrw.Kcsjbh.Substring(0,2)) // { // item.Selected = true; // } //} txtJxbbh.Value = kcsjrw.Jxbbh; JXB jxb = new JXB(); //if (kcsjrw.Jxbbh.Substring(0, 2) == "bx") //{ jxb.LoadDataJXB(kcsjrw.Jxbbh); txtJxbrs.Value = jxb.Jxbzrs; //foreach (ListItem item in selJxblx.Items) //{ // if (item.Selected == true) // { // item.Selected = false; // } // if (item.Value == kcsjrw.Jxbbh.Substring(0, 2)) // { // item.Selected = true; // } //} //DataTable dt = JXB.LoadDataGX(kcsjrw.Jxbbh); //listRight.Items.Clear(); //foreach (DataRow dr in dt.Rows) //{ // listRight.Items.Add(new ListItem(dr["bjmc"].ToString(), dr["bjbh"].ToString())); //} //leftTree.Enabled = true; //listRight.Enabled = true; //btnLeftToRight.Enabled = true; //btnRightToLeft.Enabled = true; // txtJxbrs.Disabled = true; //} //else //{ // jxb.LoadDataJXB(kcsjrw.Jxbbh); // txtJxbrs.Value = jxb.Jxbzrs; //foreach (ListItem item in selJxblx.Items) //{ // if (item.Selected == true) // { // item.Selected = false; // } // if (item.Value == kcsjrw.Jxbbh.Substring(0, 2)) // { // item.Selected = true; // } //} //leftTree.Enabled = false; //listRight.Enabled = false; //btnLeftToRight.Enabled = true; //btnRightToLeft.Enabled = true; //txtJxbrs.Disabled = false; //} selKbxq.Disabled = false; btnJssz.Disabled = false; btnJxbsz.Enabled = true; btnKcsjsz.Disabled = false; btnAdd.Disabled = false; btnChag.Disabled = true; btnDel.Enabled = true; btnSave.Disabled = false; btnCancel.Disabled = false; //selJxblx.Enabled = false; }