public CommandResult Update(Role newVal) { Role original = GetRoleInfoByID(newVal.ID).QueryObject; if (original != null) { return provider.Update(newVal, original); } else { return new CommandResult(ResultCode.NoRecord, ResultCodeDecription.GetDescription(ResultCode.NoRecord)); } }
public CommandResult Delete(Role info) { if (!info.CanDelete) { return new CommandResult(ResultCode.Fail, string.Format(Resource1.RoleBll_CannotDelete, info.Name)); } else { OperatorBll bll = new OperatorBll(_RepoUri); QueryResultList<Operator> result = bll.GetAllOperators(); if (result.Result == ResultCode.Successful && result.QueryObjects.Exists(opt => opt.RoleID == info.ID)) { return new CommandResult(ResultCode.Fail, string.Format(Resource1.RoleBll_RoleBeUsed, info.ID, info.ID)); } } return provider.Delete(info); }
protected override object GetItemFromInput() { Role info; if (UpdatingItem == null) { info = new Role(); info.ID = this.txtName.Text.Trim(); } else { info = UpdatingItem as Role; } info.Name = this.txtName.Text.Trim(); info.Memo = this.txtDescription.Text; info.Permission = this.funcTree.SelectedRights; return info; }
public CommandResult Add(Role info) { return ProviderFactory.Create<IRoleProvider>(_RepoUri).Insert(info); }