Beispiel #1
0
        public void ModifyOrganization(OrganizationDTO organization)
        {
            var updateOrganization = _organizationRepository.Get(organization.Id); //获取需要更新的对象。
            OrganizationFactory.SetOrganization(updateOrganization, organization.Code, organization.Name,
                organization.Sort, organization.Description, organization.IsValid);

            var dtoOrganizationRoles = organization.OrganizationRoles;
            var organizationRoles = updateOrganization.OrganizationRoles;
            DataHelper.DetailHandle(dtoOrganizationRoles.ToArray(),
                organizationRoles.ToArray(),
                c => c.Id, p => p.Id,
                i => InsertOrganizationRole(updateOrganization, i),
                UpdateOrganizationRole,
                d => _organizationRepository.DeleteOrganizationRole(d));
            _organizationRepository.Modify(updateOrganization);
        }
Beispiel #2
0
 public void SyncOrganizationInfo()
 {
     var organizations = new List<OrganizationDTO>();
     var found = new FoundLdapGroupInfoClient();
     var message = found.foundLdapGroup(ConfigurationManager.AppSettings["SyncUserLdapHost"],
         ConfigurationManager.AppSettings["SyncUserLdapPort"],
         ConfigurationManager.AppSettings["SyncUserAdminAccount"],
         ConfigurationManager.AppSettings["SyncUserAdminPwd"], ConfigurationManager.AppSettings["SyncUserOrgNo"]);
     if (string.IsNullOrEmpty(message))
     {
         return;
     }
     var doc = new XmlDocument();
     doc.LoadXml(message);
     var organizationNodeList = doc.SelectNodes("/root/row");
     if (organizationNodeList != null)
     {
         foreach (var organizationNode in organizationNodeList)
         {
             var organization = new OrganizationDTO();
             var element = organizationNode as XmlElement;
             if (element != null)
                 foreach (var childNode in element.ChildNodes)
                 {
                     var childElement = childNode as XmlElement;
                     if (childElement != null)
                         switch (childElement.Name.ToLower())
                         {
                             case "empid":
                                 organization.Id = Int32.Parse(childElement.InnerText);
                                 break;
                             case "deptno":
                                 organization.Code = childElement.InnerText;
                                 break;
                             case "deptname":
                                 organization.Name = childElement.InnerText;
                                 break;
                             case "deptsortno":
                                 organization.Sort = Int32.Parse(childElement.InnerText);
                                 break;
                         }
                 }
             organizations.Add(organization);
         }
         _organizationApp.SyncOrganizationInfo(organizations);
     }
 }
Beispiel #3
0
 public void InsertOrganization(OrganizationDTO organization)
 {
     var newOrganization = OrganizationFactory.CreateOrganization(organization.Code, organization.Name,
         organization.Sort, organization.Description, organization.IsValid);
     _organizationRepository.Add(newOrganization);
 }