public void Load() { ConfigurationList listConfig = new ConfigurationList(); listConfig.Load(strRootFolder); objUser.Load(); foreach (KeyValuePair <EventIdentifier, Configuration> kvp in listConfig) { Configuration itemConfig = kvp.Value; //if (!itemConfig.IsEventAvailably(objectType, global)) // continue; Role itemRole = itemConfig.FindRole(strRoles); if (itemRole == null) { continue; } //if (itemRole.Range == ObjectRange.MyObject && userId != objectUserID) // continue; RegistrationDefault itemReg = new RegistrationDefault(); itemReg.Identifier = itemConfig.Identifier; foreach (CarrierType soll in itemRole.CarrierTypes) { Carrier itemCarr = new Carrier(itemReg.Carriers); itemCarr.Type = soll; itemCarr.Availably = objUser.Carriers.Item(soll).IsValid; itemReg.Carriers.Add(itemCarr); } this.Add(itemReg); } Data.RegistrationDefault objData = new Data.RegistrationDefault(); objData.Load(this); }
public void Load(bool useConfig, Guid?objectID, Guid?userID, Guid?communityID, int objectType, int[] objectTypes, List <TagWord> tagWords, Guid currentUserID, bool global) { ConfigurationList listConfig = new ConfigurationList(); listConfig.Load(rootFolder); user.Load(); if (useConfig) { RegistrationDefaultList listDefault = new RegistrationDefaultList(currentUserID, currentRoles, rootFolder); listDefault.Load(); foreach (KeyValuePair <EventIdentifier, Configuration> kvp in listConfig) { Configuration itemConfig = kvp.Value; if (!itemConfig.IsEventAvailably(objectType, global)) { continue; } Role itemRole = itemConfig.FindRole(currentRoles); if (itemRole == null) { continue; } if (itemRole.Range == ObjectRange.MyObject && this.currentUserID != currentUserID) { continue; } RegistrationDefault itemDefault = listDefault.Item(kvp.Key); Registration itemReg = new Registration(currentUserID); itemReg.IsGlobal = global; itemReg.Identifier = itemConfig.Identifier; foreach (CarrierType soll in itemRole.CarrierTypes) { Carrier itemCarr = new Carrier(itemReg.Carriers); itemCarr.Type = soll; itemCarr.Availably = user.Carriers.Item(soll).IsValid; if (itemDefault != null) { Carrier itemCarrDefault = itemDefault.Carriers.Item(soll); if (itemCarrDefault != null) { itemCarr.Checked = itemCarrDefault.Checked; itemCarr.Collect = itemCarrDefault.Collect; } } itemReg.Carriers.Add(itemCarr); } foreach (ObjType itemObjectType in itemConfig.ObjTypes) { ObjType objType = new ObjType(itemReg.ObjectTypeList, itemObjectType.Identifier); if (!itemConfig.IsObjectTypeAvailably(itemObjectType.Identifier, global)) { objType.Availably = false; } else if (!global && itemObjectType.Identifier != objectType) { objType.Availably = false; } itemReg.ObjectTypeList.Add(objType); } itemReg.ObjectTypeList.SetChecked(itemReg.ObjectTypeList.GetChecked()); this.Add(itemReg); } } Data.Registration objData = new Data.Registration(); objData.Load(useConfig, this, currentUserID, objectID, userID, communityID, objectTypes, tagWords, global); }