public static List <PERSON> GetNotifyPersonList(PLANT plant, string notifyScope, string notifyOnTask) { List <NOTIFYACTION> notifyList = SQMModelMgr.SelectNotifyActionList(new PSsqmEntities(), (decimal)plant.BUS_ORG_ID, 0).Where(l => l.NOTIFY_SCOPE == notifyScope && l.SCOPE_TASK == notifyOnTask).ToList(); notifyList.AddRange(SQMModelMgr.SelectNotifyActionList(new PSsqmEntities(), 0, (decimal)plant.PLANT_ID).Where(l => l.NOTIFY_SCOPE == notifyScope && l.SCOPE_TASK == notifyOnTask).ToList()); List <string> notifyGroupList = new List <string>(); foreach (NOTIFYACTION notify in notifyList.GroupBy(l => l.NOTIFYACTION_ID).Select(l => l.First()).ToList()) { foreach (string gp in notify.NOTIFY_DIST.Split(',')) { notifyGroupList.Add(gp); } } List <PERSON> notifyPersonList = SQMModelMgr.SelectPlantPrivgroupPersonList((decimal)plant.PLANT_ID, notifyGroupList.ToArray()); notifyPersonList.AddRange(SQMModelMgr.SelectBusOrgPrivgroupPersonList((decimal)plant.BUS_ORG_ID, notifyGroupList.ToArray())); return(notifyPersonList.GroupBy(l => l.PERSON_ID).Select(l => l.First()).ToList()); }