コード例 #1
0
ファイル: Alerts2.cs プロジェクト: 0anion0/IBN
        private static void CollectEventsAndRecipients(RecipientsType type, ArrayList recipients, Hashtable events, Hashtable users, string param1, DateTime param2)
        {
            EventInfo eInfo;
            UserInfo uInfo;

            // Load recipients info
            using (IDataReader reader = GetRecipientsReader(type, param1, param2))
            {
                RecipientInfo rInfo;
                while (reader.Read())
                {
                    rInfo = new RecipientInfo();
                    rInfo.Load(reader);
                    recipients.Add(rInfo);
                }
            }

            foreach (RecipientInfo rInfo in recipients)
            {
                eInfo = (EventInfo)events[rInfo.SystemEventId];
                if (eInfo == null)
                {
                    // Load events info
                    using (IDataReader reader = DBSystemEvents.GetEvent(rInfo.SystemEventId))
                    {
                        while (reader.Read())
                        {
                            eInfo = new EventInfo();
                            eInfo.Load(reader);
                            events[rInfo.SystemEventId] = eInfo;
                        }
                    }
                }

                if (rInfo.UserId > 0)
                {
                    eInfo.AddRecipient(rInfo.RecipientId);
                    eInfo.AddUser(rInfo.UserId);

                    uInfo = (UserInfo)users[rInfo.UserId];
                    if (uInfo == null)
                    {
                        uInfo = new UserInfo();
                        uInfo.Load(rInfo.UserId);
                        users[rInfo.UserId] = uInfo;
                    }
                    uInfo.AddEvent(eInfo);
                    uInfo.AddRecipient(rInfo);
                }
            }
        }
コード例 #2
0
ファイル: Alerts2.cs プロジェクト: 0anion0/IBN
 static IDataReader GetRecipientsReader(RecipientsType type, string param1, DateTime param2)
 {
     switch (type)
     {
         case RecipientsType.Batch:
             return DBSystemEvents.RecipientsGetBatch(int.Parse(param1, provDefault), param2);
         case RecipientsType.Transaction:
             return DBSystemEvents.RecipientsGetTran(param1);
         default:
             return null;
     }
 }