public void DeleteModelInMailSmtpCollection(MailSmtpModel smtpModel) { string sql = "delete from T_SmtpLog where GUID ='" + smtpModel.Guid + "'"; sqlo.getSomeDate(sql); MailSmtpCollection.Remove(smtpModel); }
private void GetMailSmtpCollection() { string sql = "select * from T_SmtpLog"; sqlo.getSomeDate(sql); foreach (DataRow dr in sqlo.dt.Rows) { MailSmtpModel smtpModel = new MailSmtpModel(dr["GUID"].ToString()); smtpModel.StartTime = (DateTime)dr["StartTime"]; smtpModel.EndTime = (DateTime)dr["EndTime"]; smtpModel.IPAddress = dr["IPAddress"].ToString(); smtpModel.Mask = Convert.ToInt32(dr["Mask"].ToString()); smtpModel.SendMailAddress = dr["SendMailAddress"].ToString(); smtpModel.ReserveMailAddress = dr["ReserveMailAddress"].ToString(); smtpModel.MaxSize = Convert.ToDouble(dr["MaxSize"]); smtpModel.ReserveSize = Convert.ToDouble(dr["ReserveSize"]); smtpModel.Details = dr["Details"].ToString(); MailSmtpCollection.Add(smtpModel); } }
private void SetSingleModelByLineList(List <MailReadLineEntity> linelist) { MailSmtpModel smtpModel = new MailSmtpModel { IPAddress = linelist.Where(p => p.Command == "来自").Select(s => s.Content).FirstOrDefault().Split(' ')[0], StartTime = linelist.Where(p => p.Command == "来自").Select(s => s.NoteTime).FirstOrDefault(), EndTime = linelist.Last().NoteTime, SendMailAddress = linelist.Where(p => p.Command == "发件人").Select(s => s.Content).FirstOrDefault().Split(' ')[1], ReserveMailAddress = linelist.Where(p => p.Command == "收件人").Select(s => s.Content).FirstOrDefault().Split(' ')[1], MaxSize = Convert.ToDouble(linelist.Where(p => p.Command == "允许的最大邮件字节数").Select(s => s.Content).FirstOrDefault().Split(' ')[1].Trim()), 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(' ')[1], out d); smtpModel.ReserveSize = d; if (ShareDataEntity.GetSingleton().MailSmtpCollection.Where(w => w.StartTime == smtpModel.StartTime && w.Mask == smtpModel.Mask).Count() == 0) { SmtpModelList.Add(smtpModel); } }