/// <summary> /// 绑定项目列表 /// </summary> /// <param name="prodTypeID"></param> private void RpProListBindData(string prodTypeID) { try { EtNet_BLL.ProductManager product = new EtNet_BLL.ProductManager(); string where = string.Format("ProdTypeID='{0}'", prodTypeID); rpProList.DataSource = product.GetList(where); rpProList.DataBind(); } catch (Exception ex) { throw new Exception("初始化项目列表时发生异常:", ex); } }
/// <summary> /// 删除项目 /// </summary> /// <param name="ids"></param> private void DelProduct(string[] ids) { EtNet_BLL.ProductManager proBLL = new EtNet_BLL.ProductManager(); StringBuilder idlist = new StringBuilder(); foreach (string id in ids) { idlist.Append(id); idlist.Append(","); } if (idlist.ToString().EndsWith(",")) { idlist.Remove(idlist.Length - 1, 1); } if (proBLL.DeleteList(idlist.ToString())) { RpProListBindData(stvProType.SelectedValue); } }
/// <summary> /// 删除险种 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { if (stvProType.CheckedNodes.Count == 0) { ScriptManager.RegisterClientScriptBlock(this, GetType(), "key", "alert('请选择要删除的险种')", true); return; } EtNet_BLL.ProductManager product = new EtNet_BLL.ProductManager(); EtNet_BLL.ProductTypeManager productType = new ProductTypeManager(); foreach (TreeNode node in stvProType.CheckedNodes) { string where = string.Format("ProdTypeID='{0}'", node.Value); if (product.GetList(where).Rows.Count > 0) { ScriptManager.RegisterClientScriptBlock(this, GetType(), "key", "alert('所选险种下含有项目数据,不能删除')", true); return; } } StringBuilder ids = new StringBuilder(); foreach (TreeNode node in stvProType.CheckedNodes) { ids.Append("'"); ids.Append(node.Value); ids.Append("'"); ids.Append(","); } if (ids.ToString().EndsWith(",")) { ids.Remove(ids.Length - 1, 1); } if (productType.DeleteList(ids.ToString())) { stvProType.Nodes.Clear(); StvProTypeBindData(stvProType.Nodes, "0"); stvProType.ExpandAll(); } }