public bool AddBum() { bool b = true; blist = bm.GetModelList("b_hid=" + DropDownList1.SelectedValue + ""); foreach (Tunnel.Model.Tunnel_bum item in blist) { if (item.b_name == txtname.Text.Trim()) { b = false; //同级存在同名 } } if (b) { bmm.b_name = txtname.Text.Trim(); bmm.b_hid = Convert.ToInt32(DropDownList1.SelectedValue); bmm.b_depict = txtname2.Text; int i = bm.Add(bmm); tbb.by_bid = i.ToString(); tb.Add(tbb); } return(b); }
/// <summary> /// 更新权限 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { switch (typeId) { #region 添加/更新用户权限 case 1: Tunnel.BLL.Tunnel_uyingshe tyu = new Tunnel.BLL.Tunnel_uyingshe(); Tunnel.Model.Tunnel_uyingshe tyuu = new Tunnel.Model.Tunnel_uyingshe(); List <Tunnel.Model.Tunnel_uyingshe> uslist = new List <Tunnel.Model.Tunnel_uyingshe>(); uslist = tyu.GetModelList("uy_uid='" + tmpId + "'"); if (uslist.Count > 0) { tyuu.uy_id = uslist[0].uy_id; tyuu.uy_uid = tmpId.ToString(); tyuu.uy_list = getString(); tyu.Update(tyuu); Tunnel.Common.Message.Show("更新用户权限成功"); //更新用户权限 } else { tyuu.uy_uid = tmpId.ToString(); tyuu.uy_list = getString(); tyu.Add(tyuu); Tunnel.Common.Message.Show("添加用户权限成功"); //更新用户权限 } ListBox2.Items.Clear(); break; #endregion #region 添加/更新角色权限 case 2: Tunnel.BLL.Tunnel_yingshe tyj = new Tunnel.BLL.Tunnel_yingshe(); Tunnel.Model.Tunnel_yingshe tyjj = new Tunnel.Model.Tunnel_yingshe(); List <Tunnel.Model.Tunnel_yingshe> jslist = new List <Tunnel.Model.Tunnel_yingshe>(); jslist = tyj.GetModelList("y_jsid=" + tmpId + ""); if (jslist.Count > 0) { tyjj.y_id = jslist[0].y_id; tyjj.y_jsid = tmpId; tyjj.y_qxlist = getString(); tyj.Update(tyjj); Tunnel.Common.Message.Show("更新角色权限成功"); //更新角色权限 } else { tyjj.y_jsid = tmpId; tyjj.y_qxlist = getString(); tyj.Add(tyjj); Tunnel.Common.Message.Show("添加角色权限成功"); //添加角色权限 } ListBox2.Items.Clear(); break; #endregion #region 添加/更新职位权限 case 3: Tunnel.BLL.Tunnel_dyingshe tyd = new Tunnel.BLL.Tunnel_dyingshe(); Tunnel.Model.Tunnel_dyingshe tydd = new Tunnel.Model.Tunnel_dyingshe(); List <Tunnel.Model.Tunnel_dyingshe> dulist = new List <Tunnel.Model.Tunnel_dyingshe>(); dulist = tyd.GetModelList("dy_did='" + tmpId + "'"); if (dulist.Count > 0) { tydd.dy_id = dulist[0].dy_id; tydd.dy_did = tmpId.ToString(); tydd.dy_list = getString(); tyd.Update(tydd); Tunnel.Common.Message.Show("更新职位权限成功"); //更新职务权限 } else { tydd.dy_did = tmpId.ToString(); tydd.dy_list = getString(); tyd.Add(tydd); Tunnel.Common.Message.Show("添加职位权限成功"); //添加职务权限 } ListBox2.Items.Clear(); break; #endregion #region 添加/更新部门权限 case 4: Tunnel.BLL.Tunnel_byingshe tyb = new Tunnel.BLL.Tunnel_byingshe(); Tunnel.Model.Tunnel_byingshe tybb = new Tunnel.Model.Tunnel_byingshe(); List <Tunnel.Model.Tunnel_byingshe> bulist = new List <Tunnel.Model.Tunnel_byingshe>(); bulist = tyb.GetModelList("by_bid='" + tmpId + "'"); //判断是修改还是添加权限 if (bulist.Count > 0) { tybb.by_id = bulist[0].by_id; tybb.by_bid = tmpId.ToString(); tybb.by_list = getString(); tyb.Update(tybb); Tunnel.Common.Message.Show("更新部门权限成功"); //更新部门权限 } else { tybb.by_bid = tmpId.ToString(); tybb.by_list = getString(); tyb.Add(tybb); Tunnel.Common.Message.Show("添加部门权限成功"); //添加部门权限 } ListBox2.Items.Clear(); break; #endregion default: break; } }