public static RoleComponentPermission RoleComponentPermission(System.Data.IDataReader reader) { RoleComponentPermission result = null; if (null != reader && reader.Read()) { result = new RoleComponentPermission(); PopulateRoleComponentPermission(result, reader); } return result; }
public static void PopulateRoleComponentPermission(RoleComponentPermission input, System.Data.IDataReader reader) { PopulateRecord(input, reader); input.RecordId = input.RoleComponentPermissionId = Utilities.ToInt(reader[Mimosa.Apartment.Common.RoleComponentPermission.ColumnNames.RoleComponentPermissionId]); input.RoleId = Utilities.ToGuid(reader[Mimosa.Apartment.Common.RoleComponentPermission.ColumnNames.RoleId]); input.ComponentId = Utilities.ToInt(reader[Mimosa.Apartment.Common.RoleComponentPermission.ColumnNames.ComponentId]); input.WriteRight = Utilities.ToNBool(reader[Mimosa.Apartment.Common.RoleComponentPermission.ColumnNames.WriteRight]); input.RoleName = Utilities.ToString(reader[Mimosa.Apartment.Common.RoleComponentPermission.ColumnNamesExtended.RoleName]); input.ComponentName = Utilities.ToString(reader[Mimosa.Apartment.Common.RoleComponentPermission.ColumnNamesExtended.ComponentName]); }
public List<RoleComponentPermission> GetSaveList() { List<RoleComponentPermission> saveList = new List<RoleComponentPermission>(); if (_flatTreeViewItemSource != null && _flatTreeViewItemSource.Count > 0) { foreach (RoleComponentVM treeItem in _flatTreeViewItemSource) { if (treeItem.RoleComponentPermissionId > 0) { RoleComponentPermission originalItem = this.RoleComponentItemSource.FirstOrDefault(i => i.RoleComponentPermissionId == treeItem.RoleComponentPermissionId); if (originalItem != null) { if (treeItem.HasAccess) { if (treeItem.HasWriteRight == false && originalItem.WriteRight == true || treeItem.HasWriteRight == true && (!originalItem.WriteRight.HasValue || originalItem.WriteRight == false)) { originalItem.WriteRight = treeItem.HasWriteRight; originalItem.IsChanged = true; originalItem.UpdatedBy = Globals.UserLogin.UserName; saveList.Add(originalItem); } } else { originalItem.IsDeleted = true; saveList.Add(originalItem); } } } else { if (treeItem.HasAccess && treeItem.RoleId != Guid.Empty && treeItem.ComponentId > 0) { RoleComponentPermission newItem = new RoleComponentPermission(); newItem.ComponentId = treeItem.ComponentId; newItem.RoleId = treeItem.RoleId; newItem.WriteRight = treeItem.HasWriteRight; newItem.IsChanged = true; newItem.CreatedBy = Globals.UserLogin.UserName; saveList.Add(newItem); } } } } return saveList; }