Пример #1
0
        public static PSUUserInfo CreateByADUserDetails(string[] ADUserDetails, bool isAuthenticated)
        {
            var profile = PSUUserInfo.Create(ADUserDetails[0], ADUserDetails[9], ADUserDetails[7], ADUserDetails[6], string.Empty, isAuthenticated);

            if (ADUserDetails != null || ADUserDetails.Length > 0)
            {
                profile.Title             = ADUserDetails[12];
                profile.Gender            = MapGender(ADUserDetails[4]);
                profile.FirstName         = ADUserDetails[1];
                profile.LastName          = ADUserDetails[2];
                profile.Email             = ADUserDetails[13];
                profile.CitizenID         = ADUserDetails[5];
                profile.StaffCode         = ADUserDetails[3];
                profile.Position          = string.Empty;
                profile.DistinguishedName = ADUserDetails[14];
                profile.OUs = new Dictionary <string, string>();
                profile.OUs.Add(ADUserDetails[6], string.Empty);
                profile.OUs.Add(ADUserDetails[7], ADUserDetails[8]);
                profile.OUs.Add(ADUserDetails[9], ADUserDetails[10]);
                string ouPrositioin = profile.DistinguishedName.Split(',')[4].Split('=')[1];
                profile.OUs.Add(ouPrositioin, ouPrositioin);
            }

            return(profile);
        }
Пример #2
0
        //#region constructor
        //public PSUUserInfo(string userName, string campusCode, string facultyCode, string departmentCode, string majorCode, bool isAuthenticated)
        //    : this(userName, isAuthenticated)
        //{
        //    Campus = getCampus(campusCode);
        //    Faculty = getFaculty(facultyCode);
        //    Department = getDepartment(departmentCode);
        //    Major = getMajor(majorCode);
        //}
        //#endregion
        public static PSUUserInfo Create(string userName, string campusCode, string facultyCode, string departmentCode, string majorCode, bool isAuthenticated)
        {
            var profile = new PSUUserInfo(userName);

            profile.Campus     = getCampus(campusCode);
            profile.Faculty    = getFaculty(facultyCode);
            profile.Department = getDepartment(departmentCode);
            profile.Major      = getMajor(majorCode);
            return(profile);
        }