public static BulletinPackage ToCache(BulletinInstance obj) { BulletinPackage result = null; BCT.Execute(d => { var groupSignature = GroupHelper.GetGroupSignature(obj.Id); var access = AccessHelper.GetFreeAccess(obj.Id); var valueFields = ValueFieldHelper.GetValueFields(obj.Id); var accessFields = AccessFieldHelper.GetAccessFields(obj.Id); var state = obj.State; result = new BulletinPackage { BulletinId = obj.BulletinId, BulletinInstanceId = obj.Id, Url = obj.Url, Signature = groupSignature, Access = access, ValueFields = valueFields, AccessFields = accessFields, State = state, Title = obj.Url, }; }); return(result); }
public static TaskCache_old ToCache(Data.Task obj) { TaskCache_old result = null; BCT.Execute(d => { var bulletinPackage = new BulletinPackage(); var accessPackage = new AccessCache(); if (obj.TargetType == typeof(BulletinInstance).ToString()) { var dbInstance = d.BulletinDb.BulletinInstances.FirstOrDefault(q => q.Id == obj.InstanceId); var dbAccess = d.BulletinDb.Accesses.FirstOrDefault(q => q.Id == obj.AccessId); var groupSignature = GroupHelper.GetGroupSignature2(dbInstance.BulletinId); var valueFields = ValueFieldHelper.GetValueFields2(dbInstance.BulletinId); var accessFields = AccessFieldHelper.GetAccessFields2(dbInstance.BulletinId); bulletinPackage.Signature = groupSignature; bulletinPackage.ValueFields = valueFields; bulletinPackage.AccessFields = accessFields; bulletinPackage.Access = Access.ToCache(dbAccess); bulletinPackage.State = dbInstance.State; bulletinPackage.Url = dbInstance.Url; } else if (obj.TargetType == typeof(Access).ToString()) { } result = new TaskCache_old { BulletinId = obj.InstanceId, AccessId = obj.AccessId, TargetType = obj.TargetType, TargetTime = obj.TargetDate, Command = obj.Command, BulletinPackage = bulletinPackage, AccessPackage = accessPackage, }; }); return(result); }