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


C# Location.AddRelationship方法代码示例

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


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

示例1: BuildRMLocations

        static void BuildRMLocations(List<Position> full)
        {
            TrimApplication.Initialize();

            try
            {
                using (Database db = new Database())
                {
                    //5503
                    Location locUseProfileof = new Location(db, 19509);
                    Location LocHighLevel = new Location(db, 5503);
                    db.Id = "03";
                    db.Connect();
                    FieldDefinition fd = new FieldDefinition(db, 501);
                    //
                    //Classification cla = new Classification(db);
                    
                    foreach (Position p in full)
                    {
                        //if (p.RMUri == 0)
                        //{
                            Location posloc = new Location(db, LocationType.Position);
                            //{
                            posloc.Surname = p.Title + " - " + p.Position_Number.ToString();
                            posloc.SetNotes("Entered by auto process: Source ID: " + p.Position_Number.ToString(), NotesUpdateType.AppendWithNewLine);
                            posloc.AddRelationship(LocHighLevel, LocRelationshipType.MemberOf, false);
                            //bu3loc.SetFieldValue(fd, new UserFieldValue("Business Unit 3"));
                            posloc.IsWithin = true;
                            //posloc.UseProfileOf = locUseProfileof;
                            posloc.Save();
                            p.RMUri = posloc.Uri;
                            Console.WriteLine("Created " + p.Title + " - " + p.Position_Number.ToString());
                            //
                            foreach (User u in p.user.Where(x => x.RMUri == 0))
                            {
                                //if (u.RMUri == 0)
                                //{
                                    try
                                    {
                                        Location userloc = new Location(db, LocationType.Person);
                                        //{
                                        userloc.Surname = u.Surname;
                                        userloc.GivenNames = u.FirstName;
                                        userloc.EmailAddress = u.Email;
                                        userloc.CanLogin = true;
                                        userloc.LogsInAs = u.FirstName[0].ToString() + u.Surname[0].ToString() + u.Employee_Number.ToString();
                                        userloc.AdditionalLogin = u.Email;
                                        string dlogon = lstDomain.Where(x=>x.email==u.Email).First().DomainLogon;
                                        if(dlogon.Length>1)
                                        {
                                        userloc.LogsInAs = "MSC\\"+dlogon;
                                        }
                                        else
                                        {
                                            userloc.LogsInAs = "MSC\\";
                                        }
                                        //userloc.UserType = UserTypes.Contributor;

                                        userloc.SetNotes("Entered by auto process: Source ID: " + u.Employee_Number, NotesUpdateType.AppendWithNewLine);
                                        userloc.AddRelationship(posloc, LocRelationshipType.MemberOf, false);
                                        //bu3loc.SetFieldValue(fd, new UserFieldValue("Business Unit 3"));
                                        userloc.IsWithin = true;
                                        userloc.UseProfileOf = locUseProfileof;
                                        userloc.Save();
                                        u.RMUri = userloc.Uri;
                                        BuildRMpersonalFolders(userloc);
                                        Console.WriteLine("Created " + u.Surname);
                                        //}
                                    }
                                    catch (Exception exp)
                                    {
                                        Console.WriteLine("Error creating person location: " + exp.Message.ToString());
                                    }
                                //}
                                //else
                                //{
                                //    Location userloc = new Location(db, u.RMUri);
                                //    userloc.AddRelationship(posloc, LocRelationshipType.MemberOf, false);
                                //    userloc.Save();
                                //}
                            }
                        //}
                        //else
                        //{
                        //    Location posloc = new Location(db, p.RMUri);
                        //    //posloc.AddRelationship(bu2loc, LocRelationshipType.MemberOf, false);
                        //    posloc.Save();
                        //}
                    }




                    //
                    //Build SCC org
                    //Location lOrg = new Location(db, LocationType.Organization);
                    //lOrg.Surname = "Sunshine Coast Council";
                    //lOrg.IsWithin = true;
                    //lOrg.SetFieldValue(fd, new UserFieldValue("Organisation"));
                    //lOrg.UseProfileOf = locUseProfileof;
//.........这里部分代码省略.........
开发者ID:WyldLynxGitHub,项目名称:SunshineCoastCouncil-master,代码行数:101,代码来源:Program.cs


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