protected void ButtonAddItem_Click(object sender, EventArgs e) { string instrID = Request.QueryString["instrumentID"]; int dispSeq = InstrumentItemManage.GetMaxDispSeq(instrID) + 1; int printSeq = InstrumentItemManage.GetMaxPrintSeq(instrID) + 1; List <string> sqls = new List <string>(); foreach (TreeNode tns in TreeViewItemList.Nodes) { foreach (TreeNode tn in tns.ChildNodes) { if (tn.Checked) { string itemCode = tn.Value; string s = InstrumentItemManage.GetAddSql(instrID, itemCode, dispSeq, printSeq); sqls.Add(s); dispSeq++; printSeq++; } } } InstrumentItemManage.AddItem(sqls); InitItem(instrID); InitItemCheckList(); }
protected void ButtonSave_Click(object sender, EventArgs e) { string op = Request.QueryString["op"]; string instrID = Request.QueryString["instrumentID"]; string type = DropDownListType.SelectedValue; string groupID = DropDownListGroupID.SelectedValue; string testType = DropDownListTestType.SelectedValue; string validFlg = DropDownListValidFlg.SelectedValue; string name = TextBoxName.Text; string regment = TextBoxRegment.Text; if ("add" == op) { int seq = 1; int maxID = CurrentInstrumentManage.GetMaxInstrID(); string instrumentID = (maxID + 1).ToString(); DataSet ds = GeneralInstrumentItem.GetItemByType(type); List <string> sqls = new List <string>(); string sqlInstr = CurrentInstrumentManage.GetAddSql(int.Parse(instrumentID), groupID, type, name, testType, validFlg, regment); sqls.Add(sqlInstr); foreach (DataRow dr in ds.Tables[0].Rows) { string s = InstrumentItemManage.GetAddSql(instrumentID, dr["ITEM_CODE"] as string, type, seq, seq); sqls.Add(s); seq++; } CurrentInstrumentManage.AddInstrument(sqls); LTP.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "CurrentInstrumentDetail.aspx?instrumentID=" + instrumentID); } else { CurrentInstrumentManage.UpdateInstrByInstrID(instrID, groupID, type, name, testType, validFlg, regment); LTP.Common.MessageBox.Show(this, "保存成功!"); } }