当前位置: 首页>>代码示例>>C#>>正文


C# IObjectSpace.GetObjects方法代码示例

本文整理汇总了C#中IObjectSpace.GetObjects方法的典型用法代码示例。如果您正苦于以下问题:C# IObjectSpace.GetObjects方法的具体用法?C# IObjectSpace.GetObjects怎么用?C# IObjectSpace.GetObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IObjectSpace的用法示例。


在下文中一共展示了IObjectSpace.GetObjects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Download

        /// <summary>
        /// Downloads XafDelta messages into replication storage database.
        /// </summary>
        /// <param name="xafDeltaModule">The xaf delta module.</param>
        /// <param name="objectSpace">The object space.</param>
        /// <param name="worker">The worker.</param>
        public void Download(XafDeltaModule xafDeltaModule, IObjectSpace objectSpace, ActionWorker worker)
        {
            worker.ReportProgress(Localizer.DownloadStarted);

            var transportList = (from m in xafDeltaModule.ModuleManager.Modules
                                where m is IXafDeltaTransport && ((IXafDeltaTransport) m).UseForDownload
                                select m).Cast<IXafDeltaTransport>().ToList();

            worker.ReportProgress(string.Format(Localizer.TransportFound, transportList.Count()));
            foreach (var transport in transportList.TakeWhile(x => !worker.CancellationPending))
            {
                worker.ReportProgress(string.Format(Localizer.DownloadUsing, transport));
                try
                {
                    worker.ReportProgress(string.Format(Localizer.OpenTransport, transport));
                    transport.Open(TransportMode.Download, worker);

                    var existingReplicaNames = from c in objectSpace.GetObjects<Package>() select c.FileName;

                    var fileNames = transport.GetFileNames(worker,
                        @"(" + Ticket.FileMask + "|" + Package.FileMask + ")").ToList();

                    fileNames = fileNames.Except(existingReplicaNames).ToList();

                    worker.ReportProgress(string.Format(Localizer.FilesForDownload, fileNames.Count));
                    foreach (var fileName in fileNames.TakeWhile(x => !worker.CancellationPending))
                    {
                        // worker.ReportProgress(string.Format(Localizer.DownloadFile, fileName));
                        var fileData = transport.DownloadFile(fileName, worker);
                        if(fileData != null && fileData.Length > 0)
                        {
                            if (fileName.EndsWith(Package.PackageFileExtension))
                            {
                                var replica = Package.ImportFromBytes(objectSpace, fileName, fileData);
                                replica.Save();
                            }
                            else
                            {
                                var replicaTicket = Ticket.ImportTicket(objectSpace, fileData);
                                replicaTicket.Save();
                            }
                            if (!fileName.Contains(ReplicationNode.AllNodes))
                                transport.DeleteFile(fileName, worker);
                            objectSpace.CommitChanges();
                        }
                    }
                }
                catch (Exception exception)
                {
                    objectSpace.Rollback();
                    worker.ReportError(Localizer.DownloadError, exception.Message);
                }
                finally
                {
                    worker.ReportProgress(Localizer.CloseTransport, transport);
                    transport.Close();
                }
            }
            worker.ReportProgress(Color.Blue, Localizer.DownloadFinished);
        }
开发者ID:xafdelta,项目名称:xafdelta,代码行数:66,代码来源:DeliveryService.cs

示例2: InitializeDefaultSolution

 public static void InitializeDefaultSolution(IObjectSpace os)
 {
     var enumerable = ReflectionHelper.FindTypeDescendants(ReflectionHelper.FindTypeInfoByName(typeof(I单据编号).FullName));
     var dictionary = os.GetObjects<单据编号方案>(null, true).ToDictionary(p => p.应用单据);
     foreach (ITypeInfo info2 in enumerable)
     {
         if (!info2.IsAbstract && info2.IsPersistent)
         {
             var key = info2.Type;
             单据编号方案 i单据编号方案 = null;
             if (dictionary.ContainsKey(key))
             {
                 i单据编号方案 = dictionary[key];
             }
             else
             {
                 i单据编号方案 = os.CreateObject<单据编号方案>();
                 i单据编号方案.名称 = key.FullName;
                 i单据编号方案.应用单据 = info2.Type;
                 var item = os.CreateObject<单据编号自动编号规则>();
                 item.格式化字符串 = "00000";
                 i单据编号方案.编号规则.Add(item);
                 dictionary.Add(key, i单据编号方案);
             }
         }
     }
     os.CommitChanges();
 }
开发者ID:ZixiangBoy,项目名称:CIIP,代码行数:28,代码来源:SequenceGeneratorInitializer.cs

示例3: AddRoles

 void AddRoles(IModelRegistration modelRegistration, ITypeInfo userTypeInfo, ISecurityUserWithRoles securityUserWithRoles,
                      IObjectSpace objectSpace) {
     var roles = (XPBaseCollection) userTypeInfo.FindMember("Roles").GetValue(securityUserWithRoles);
     var roleType = modelRegistration.RoleModelClass.TypeInfo.Type;
     var criteria = CriteriaOperator.Parse(modelRegistration.RoleCriteria);
     var objects = objectSpace.GetObjects(roleType, criteria);
     roles.BaseAddRange(objects);
 }
开发者ID:noxe,项目名称:eXpand,代码行数:8,代码来源:Parameters.cs

示例4: OnDeleting

        public static void OnDeleting(ISendByOrganization organization, IObjectSpace objectSpace)
        {
            var oid = (organization as DevExpress.ExpressApp.DC.DCBaseObject).Oid;

            CriteriaOperator criteria = new BinaryOperator("SentBy.Oid", oid, BinaryOperatorType.Equal);
            if (ReferenceEquals(criteria, null)==false)//(criteria != null)
            {
                var examination = objectSpace.GetObjects<IExamination>(criteria);

                if (examination != null)
                {
                    if (examination.Count>0)
                    {
                        throw new UserFriendlyException(DevExpress.ExpressApp.Utils.CaptionHelper.GetLocalizedText("Messages", "RelatedObjectsDelWarning"));
                    }
                }
            }
        }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:18,代码来源:ISendByOrganization.cs

示例5: OnDeleting

        public static void OnDeleting(ITermsOfPayment payment, IObjectSpace objectSpace)
        {
            var oid = (payment as DevExpress.ExpressApp.DC.DCBaseObject).Oid;

            CriteriaOperator criteria = new BinaryOperator("TermsOfPayment.Oid", oid, BinaryOperatorType.Equal);
            if (ReferenceEquals(criteria, null)==false)
            {
                var patient = objectSpace.GetObjects<IPatient>(criteria);

                if (patient != null)
                {
                    if (patient.Any() ==true)
                    {
                        throw new UserFriendlyException(DevExpress.ExpressApp.Utils.CaptionHelper.GetLocalizedText("Messages", "RelatedObjectsDelWarning"));
                    }
                }
            }
        }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:18,代码来源:ITermsOfPayment.cs

示例6: Get_PersonIdentityCards

 public static IList<IPersonIdentityCard> Get_PersonIdentityCards(IIdentifyCardType cardType, IObjectSpace objectSpace)
 {
     var criteria = CriteriaOperator.Parse("[IdentityCardType] = ?", cardType);
     return objectSpace.GetObjects<IPersonIdentityCard>(criteria);
 }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:5,代码来源:IdentifyCardType.cs

示例7: Get_Examinations

 public static IList<IExamination> Get_Examinations(IPatient patient, IObjectSpace objectSpace)
 {
     var criteria = CriteriaOperator.Parse("[Patient] = ?", patient);
     return objectSpace.GetObjects<IExamination>(criteria);
 }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:5,代码来源:IPatient.cs

示例8: GetObjects

 private static IList GetObjects(IObjectSpace objectSpace, Type dashBoardObjectType)
 {
     var proxyCollection = new ProxyCollection(objectSpace, XafTypesInfo.CastTypeToTypeInfo(dashBoardObjectType), objectSpace.GetObjects(dashBoardObjectType));
     proxyCollection.DisplayableMembers = string.Join(";", proxyCollection.DisplayableMembers.Split(';').Where(s => !s.EndsWith("!")));
     return proxyCollection;
 }
开发者ID:ZixiangBoy,项目名称:CIIP,代码行数:6,代码来源:TemplateHelper.cs

示例9: Get_Employees

 public static IList<Employee> Get_Employees(IDepartment department, IObjectSpace objectSpace)
 {
     var criteria = CriteriaOperator.Parse("[Department] = ?", department);
     return objectSpace.GetObjects<Employee>(criteria);
 }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:5,代码来源:IDepartment.cs

示例10: Get_RegisteredPatient

 public static IList<IPatient> Get_RegisteredPatient(IDepartment department, IObjectSpace objectSpace)
 {
     var criteria = CriteriaOperator.Parse("[Department] = ?", department);
     return objectSpace.GetObjects<IPatient>(criteria);
 }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:5,代码来源:IDepartment.cs

示例11: MassUpdateDataType

 public static void MassUpdateDataType(IObjectSpace objectSpace, string oldDataType, Type newDataType)
 {
     foreach (ReportData reportData in objectSpace.GetObjects<ReportData>(new BinaryOperator("dataTypeName", oldDataType)))
     {
         XafReport report = reportData.LoadXtraReport(objectSpace);
         report.DataType = newDataType;
         reportData.SaveXtraReport(report);
     }
     objectSpace.CommitChanges();
 }
开发者ID:rencarnacion,项目名称:JanusERP,代码行数:10,代码来源:BaseReportData.cs

示例12: Upload

        /// <summary>
        /// Uploads pending XafDelta messages to intermidiate net storages.
        /// </summary>
        /// <param name="xafDeltaModule">The xaf delta module.</param>
        /// <param name="objectSpace">The object space.</param>
        /// <param name="worker">The worker.</param>
        public void Upload(XafDeltaModule xafDeltaModule, IObjectSpace objectSpace, ActionWorker worker)
        {
            worker.ReportProgress(Localizer.UploadStarted);

            var transportList = (from m in XafDeltaModule.XafApp.Modules
                                 where m is IXafDeltaTransport && ((IXafDeltaTransport)m).UseForUpload
                                 select m).Cast<IXafDeltaTransport>().ToList().AsReadOnly();

            if (transportList.Count > 0)
            {
                var replicas = (from r in objectSpace.GetObjects<Package>() where r.IsOutput
                                    && r.GetEventDateTime(PackageEventType.Sent) == DateTime.MinValue
                                    orderby r.PackageDateTime
                                select r).ToList();

                var tickets = (from t in objectSpace.GetObjects<Ticket>(CriteriaOperator.Parse("IsNull(ProcessingDateTime)"), true)
                               where t.Package != null && t.Package.IsInput
                               orderby t.TicketDateTime select t).ToList();

                var messages = replicas.Cast<IReplicationMessage>().Union(tickets.Cast<IReplicationMessage>()).ToList();

                var uploadData = new Dictionary<IXafDeltaTransport, List<IReplicationMessage>>();

                worker.ReportProgress(string.Format(Localizer.FoundForUpload, messages.Count()));
                foreach (var message in messages.TakeWhile(x => !worker.CancellationPending))
                {
                    var args = new SelectUploadTransportArgs(message, transportList[0]);
                    Owner.OnSelectUploadTransport(args);
                    if(args.Transport != null)
                    {
                        List<IReplicationMessage> list;
                        if(!uploadData.TryGetValue(args.Transport, out list))
                        {
                            list = new List<IReplicationMessage>();
                            uploadData.Add(args.Transport, list);
                        }
                        list.Add(message);
                    }
                }

                if(!worker.CancellationPending && uploadData.Keys.Count > 0)
                {
                    foreach (var transport in uploadData.Keys.TakeWhile(x => !worker.CancellationPending))
                    {
                        try
                        {
                            worker.ReportProgress(string.Format(Localizer.OpenTransport, transport));
                            transport.Open(TransportMode.Upload, worker);
                            var messageList = uploadData[transport];
                            foreach (var message in messageList)
                            {
                                var recipientAddress = message.RecipientAddress;
                                // worker.ReportProgress(string.Format(Localizer.UploadingFile, message));
                                transport.UploadFile(message.ToString(), message.GetData(), recipientAddress, worker);
                                if (message is Package)
                                    ((Package)message).CreateLogRecord(PackageEventType.Sent);
                                else
                                    ((Ticket) message).ProcessingDateTime = DateTime.Now;

                                objectSpace.CommitChanges();
                            }
                        }
                        catch (Exception exception)
                        {
                            objectSpace.Rollback();
                            worker.ReportError(Localizer.UploadError, exception.Message);
                        }
                        finally
                        {
                            worker.ReportProgress(string.Format(Localizer.CloseTransport, transport));
                            transport.Close();
                        }
                    }
                }
            }
            else
                worker.ReportProgress(Color.BlueViolet, Localizer.UploadTransportNotFound);
            worker.ReportProgress(Color.Blue, Localizer.UploadFinished);
        }
开发者ID:xafdelta,项目名称:xafdelta,代码行数:85,代码来源:DeliveryService.cs

示例13: Get_Patients

 public static IList<IPatient> Get_Patients(IInsurance insurance, IObjectSpace objectSpace)
 {
     var criteria = CriteriaOperator.Parse("[Insurance] = ?", insurance);
     return objectSpace.GetObjects<IPatient>(criteria);
 }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:5,代码来源:IInsurance.cs

示例14: snapshotPostLoad

 private void snapshotPostLoad(IObjectSpace objectSpace)
 {
     var schedEvents = objectSpace.GetObjects<Event>(null, true);
     schedEvents.ToList().ForEach(x =>
     {
         x.UpdateResourceIds();
         x.Save();
     });
     var args = new SnapshotPostOperationArgs(objectSpace);
     Owner.OnSnapshotPostLoad(args);
 }
开发者ID:xafdelta,项目名称:xafdelta,代码行数:11,代码来源:SnapshotService.cs

示例15: Get_Departments

 public static IList<IDepartment> Get_Departments(IOrganization organization, IObjectSpace objectSpace)
 {
     var criteria = CriteriaOperator.Parse("[Department] = ?", organization);
     return objectSpace.GetObjects<IDepartment>(criteria);
 }
开发者ID:Rukhlov,项目名称:DataStudio,代码行数:5,代码来源:IOrganization.cs


注:本文中的IObjectSpace.GetObjects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。