예제 #1
0
        private void GetMailQueueReserverCollection()
        {
            string sql = "select * from T_QueueLog_ReserverDetail";

            sqlo.getSomeDate(sql);
            foreach (DataRow dr in sqlo.dt.Rows)
            {
                MailQueueReserverEntity queueReserverEntity = new MailQueueReserverEntity(dr["GUID"].ToString());
                queueReserverEntity.ReserverAddress      = dr["ReserverAddress"].ToString();
                queueReserverEntity.IsLocalServer        = (bool)dr["IsLocalServer"];
                queueReserverEntity.IsSuccessful         = (bool)dr["IsSuccessful"];
                queueReserverEntity.OutSideServerAddress = dr["OutSideServerAddress"].ToString();
                queueReserverEntity.SetMailGuid(dr["MailGuid"].ToString());
                MailQueueReserverCollection.Add(queueReserverEntity);
            }
        }
예제 #2
0
        private void SetSingleModelByLineList(List <MailReadLineEntity> linelist)
        {
            MailQueueViewModel queueViewModel = new MailQueueViewModel();

            queueViewModel.QueueModel = new MailQueueModel()
            {
                MailID          = linelist.Where(p => p.Command == "新邮件递送").Select(p => p.Content).FirstOrDefault().Trim(new char[] { '[', ']' }),
                StartTime       = linelist.FirstOrDefault().NoteTime,
                EndTime         = linelist.Last().NoteTime,
                SendMailAddress = linelist.Where(p => p.Command == "邮件字节数:").Select(s => s.Content).FirstOrDefault().Split(' ')[2].Trim(new char[] { '<', '>' }),
                Mask            = linelist.FirstOrDefault().Mask,
                Details         = string.Join("\n", linelist.Select(s => s.Detail).ToList())
            };
            double d = 0;

            double.TryParse(linelist.Where(p => p.Command == "邮件字节数:").Select(s => s.Content).FirstOrDefault().Split(' ')[0], out d);
            queueViewModel.QueueModel.SendSize = d;

            var senderlist  = linelist.FindAll(f => f.Command.Contains("开始递送,"));
            var resaultlist = linelist.FindAll(f => f.Command == "递送成功:" || f.Command == "递送失败:");

            if (senderlist.Count == resaultlist.Count)
            {
                for (int i = 0; i < senderlist.Count; i++)
                {
                    List <MailReadLineEntity> unityList      = linelist.GetRange(linelist.IndexOf(senderlist[i]), linelist.IndexOf(resaultlist[i]) - linelist.IndexOf(senderlist[i]) + 1);
                    MailQueueReserverEntity   reserverEntity = new MailQueueReserverEntity()
                    {
                        ReserverAddress = unityList.FirstOrDefault().Content.Split(' ')[0].Trim(new char[] { '<', '>' }),
                        IsSuccessful    = unityList.Any(a => a.Command == "递送成功:")
                    };
                    reserverEntity.SetMailGuid(queueViewModel.Guid);
                    reserverEntity.OutSideServerAddress = unityList.Any(w => w.Command == "递送给远程主机") ? unityList.Where(w => w.Command == "递送给远程主机").FirstOrDefault().Content : "";
                    queueViewModel.ReserverEntities.Add(reserverEntity);
                }
            }

            if (ShareDataEntity.GetSingleton().MailQueueCollection.Where(w => w.MailID == queueViewModel.MailID && w.StartTime == queueViewModel.StartTime && w.Mask == queueViewModel.Mask).Count() == 0)
            {
                QueueModelList.Add(queueViewModel);
            }
        }