Example #1
0
        public static List <CustomGroupList> CustomGroupList2(string person)
        {
            List <CustomGroupList> list = new List <CustomGroupList>();

            string query = string.Format("select g_name, g_member from TB_CUSTOM_GROUP where g_owner = N'{0}' and g_member != '-'", person);

            using (GlobalService.Reader = DataService.GetInstance().ExecuteReader(query))
            {
                while (GlobalService.Reader.Read())
                {
                    list.Add(new CustomGroupList {
                        Group = GlobalService.Reader.GetString(0), Member = GlobalService.Reader.GetString(1), Division = ""
                    });
                }
            }

            List <CustomGroupList> tmpList = list;

            foreach (CustomGroupList item in list)
            {
                var obj = tmpList.FirstOrDefault(x => x.Member == item.Member);
                if (obj != null)
                {
                    obj.Division = UserUtil.IsCnMember(item.Member.Trim()) ? UserUtil.GetCnDivision(item.Member.Trim())
                        : UserUtil.IsJpMember(item.Member.Trim()) ? UserUtil.GetJpDivision(item.Member.Trim())
                        : UserUtil.IsVnMember(item.Member.Trim()) ? UserUtil.GetVnDivision(item.Member.Trim()) : UserUtil.GetDivision(item.Member.Trim());
                }
            }

            return(list);
        }