public int Add(string moduleId, string permissionItemId) { int returnValue = 0; List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BasePermissionEntity.FieldResourceCategory, BaseModuleEntity.TableName)); parameters.Add(new KeyValuePair <string, object>(BasePermissionEntity.FieldResourceId, moduleId)); parameters.Add(new KeyValuePair <string, object>(BasePermissionEntity.FieldPermissionItemId, permissionItemId)); parameters.Add(new KeyValuePair <string, object>(BasePermissionEntity.FieldDeletionStateCode, 0)); // 检查记录是否重复 if (!this.Exists(parameters)) { BasePermissionEntity permissionEntity = new BasePermissionEntity(); permissionEntity.ResourceId = moduleId; permissionEntity.ResourceCategory = BaseModuleEntity.TableName; permissionEntity.Enabled = 1; permissionEntity.DeletionStateCode = 0; permissionEntity.PermissionId = int.Parse(permissionItemId); BasePermissionManager permissionManager = new BasePermissionManager(this.DbHelper, this.UserInfo, this.CurrentTableName); permissionManager.AddEntity(permissionEntity); returnValue++; } return(returnValue); }