本文整理汇总了C#中OrganizationService.AddOrganizationHierarchy方法的典型用法代码示例。如果您正苦于以下问题:C# OrganizationService.AddOrganizationHierarchy方法的具体用法?C# OrganizationService.AddOrganizationHierarchy怎么用?C# OrganizationService.AddOrganizationHierarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrganizationService
的用法示例。
在下文中一共展示了OrganizationService.AddOrganizationHierarchy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAddOrganization
public void TestAddOrganization()
{
using (UnitOfWork unitwork = new UnitOfWork(store, dbContextFactory))
{
IRepository<Organization, Guid> organRepository = new Repository<Organization, Guid>(store);
IRepository<OrganizationHierarchy, Guid> organHireRepository = new Repository<OrganizationHierarchy, Guid>(store);
Organization org1 = new Organization() { Name = "總經理室" };
Organization org2 = new Organization() { Name = "人資部" };
Organization org3 = new Organization() { Name = "業務部" };
Organization org4 = new Organization() { Name = "企畫課" };
Organization org5 = new Organization() { Name = "管理課" };
Organization org6 = new Organization() { Name = "業務一課" };
Organization org7 = new Organization() { Name = "業務二課" };
Organization org8 = new Organization() { Name = "業務三課" };
organRepository.SaveOrUpdate(org1);
organRepository.SaveOrUpdate(org2);
organRepository.SaveOrUpdate(org3);
organRepository.SaveOrUpdate(org4);
organRepository.SaveOrUpdate(org5);
organRepository.SaveOrUpdate(org6);
organRepository.SaveOrUpdate(org7);
organRepository.SaveOrUpdate(org8);
unitwork.SaveChanges();
OrganizationService service = new OrganizationService(organHireRepository);
service.AddOrganizationHierarchy(org1, org2, OrganizationHierarchyType.AM);
unitwork.SaveChanges();
service.AddOrganizationHierarchy(org1, org3, OrganizationHierarchyType.AM);
unitwork.SaveChanges();
service.AddOrganizationHierarchy(org2, org4, OrganizationHierarchyType.AM);
unitwork.SaveChanges();
service.AddOrganizationHierarchy(org2, org5, OrganizationHierarchyType.AM);
unitwork.SaveChanges();
service.AddOrganizationHierarchy(org3, org6, OrganizationHierarchyType.AM);
unitwork.SaveChanges();
service.AddOrganizationHierarchy(org3, org7, OrganizationHierarchyType.AM);
unitwork.SaveChanges();
service.AddOrganizationHierarchy(org3, org8, OrganizationHierarchyType.AM);
unitwork.SaveChanges();
}
}
示例2: TestCreateParentOrgan
public void TestCreateParentOrgan()
{
using (UnitOfWork unitwork = new UnitOfWork(store, dbContextFactory))
{
IRepository<Organization,Guid> organRepository = new Repository<Organization,Guid>(store);
IRepository<OrganizationHierarchy,Guid> organHireRepository = new Repository<OrganizationHierarchy,Guid>(store);
Organization organ1 = new Organization()
{
Name = "總經理室"
};
Organization organ2 = new Organization()
{
Name = "業務部"
};
Organization organ3 = new Organization()
{
Name = "人資部"
};
Organization organ4 = new Organization()
{
Name = "企畫課"
};
organRepository.SaveOrUpdate(organ1);
organRepository.SaveOrUpdate(organ2);
organRepository.SaveOrUpdate(organ3);
organRepository.SaveOrUpdate(organ4);
unitwork.SaveChanges();
OrganizationService service = new OrganizationService(organHireRepository);
service.AddOrganizationHierarchy(organ1, organ2, OrganizationHierarchyType.AM);
unitwork.SaveChanges();
service.AddOrganizationHierarchy(organ1, organ3, OrganizationHierarchyType.AM);
unitwork.SaveChanges();
service.AddOrganizationHierarchy(organ3, organ4,OrganizationHierarchyType.AM);
unitwork.SaveChanges();
}
}