public QuanxianModel(Quanxian quanxian, bool shiJichengDe) { this.id = quanxian.Id; this.chengyuanMingcheng = quanxian.Chengyuan.Mingcheng; this.youYijiDaanQuanxian = quanxian.Zhi.HasFlag(QuanxianZhi.YijiDaan) ? "有权限" : "无权限"; this.youErjiDaanQuanxian = quanxian.Zhi.HasFlag(QuanxianZhi.ErjiDaan) ? "有权限" : "无权限"; this.youSanjiDaanQuanxian = quanxian.Zhi.HasFlag(QuanxianZhi.SanjiDaan) ? "有权限" : "无权限"; this.youSijiDaanQuanxian = quanxian.Zhi.HasFlag(QuanxianZhi.SijiDaan) ? "有权限" : "无权限"; this.youWujiDaanQuanxian = quanxian.Zhi.HasFlag(QuanxianZhi.WujiDaan) ? "有权限" : "无权限"; this.strShiJichengDe = shiJichengDe ? "是" : "否"; this.shiJichengDe = shiJichengDe; this.zhi = (int)quanxian.Zhi; }
private void Quanxian_ShanchuHou(Quanxian quanxian) { lock (_lock) { List<Quanxian> quanxianList = _quanxianList.ToList(); quanxianList.Remove(quanxian); _quanxianList = quanxianList; } }
public void TianjiaQuanxian(int chengyuanId, string chengyuanMingcheng, ChengyuanLeixing chengyuanLeixing, QuanxianZhi quanxianZhi) { lock (_lock) { if (_quanxianList.Any(x => x.Chengyuan.Id == chengyuanId && x.Chengyuan.Leixing == chengyuanLeixing)) { throw new ChengyuanQuanxianChongfuException(); } var model = new QuanxianDataModel(); model.ChengyuanId = chengyuanId; model.ChengyuanLeixing = (int) chengyuanLeixing; model.ChengyuanMingcheng = chengyuanMingcheng; model.Mulu = Id; model.Zhi = (int) quanxianZhi; model.Id = (int) NHibernateHelper.CurrentSession.Save(model); var quanxian = new Quanxian(model.Id, quanxianZhi, ZuzhiChengyuanHelper.Chuangjian(chengyuanId, chengyuanMingcheng, chengyuanLeixing)); quanxian.ShanchuHou += Quanxian_ShanchuHou; List<Quanxian> quanxianList = _quanxianList.ToList(); quanxianList.Add(quanxian); _quanxianList = quanxianList; } }
private List<Quanxian> JiazaiQuanxian(int muluId) { List<Quanxian> list = new List<Quanxian>(); List<QuanxianDataModel> dataModels = NHibernateHelper.CurrentSession.QueryOver<QuanxianDataModel>().Where(x => x.Mulu == muluId).List().ToList(); foreach (QuanxianDataModel model in dataModels) { List<string> yonghuList = new List<string>(); ZuzhiChengyuan zuzhiChengyuan = ZuzhiChengyuanHelper.Chuangjian(model.ChengyuanId, model.ChengyuanMingcheng, (ChengyuanLeixing)model.ChengyuanLeixing); Quanxian quanxian = new Quanxian(model.Id, (QuanxianZhi)model.Zhi, zuzhiChengyuan); list.Add(quanxian); } return list; }