/// <summary> /// /// </summary> /// <param name="tbInternalMail"></param> /// <returns></returns> private List<Business.InternalMail> MapInternalMail(DS.InternalMailDataTable tbInternalMail) { List<Business.InternalMail> result = new List<Business.InternalMail>(); if (tbInternalMail != null) { int count = tbInternalMail.Count; for (int i = 0; i < count; i++) { Business.InternalMail newInternailMail = new Business.InternalMail(); newInternailMail.Content = tbInternalMail[i].Content; newInternailMail.From = tbInternalMail[i].From; newInternailMail.FromName = tbInternalMail[i].FromName; newInternailMail.InternalMailID = tbInternalMail[i].InternalMailID; newInternailMail.Subject = tbInternalMail[i].Subject; newInternailMail.Time = tbInternalMail[i].Time; newInternailMail.To = tbInternalMail[i].To; newInternailMail.ToName = tbInternalMail[i].ToName; newInternailMail.IsNew = tbInternalMail[i].IsNew; result.Add(newInternailMail); } } return result; }
internal Business.InternalMail GetInternalMailToInvestorByID(int mailID) { List<Business.InternalMail> result = new List<Business.InternalMail>(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.InternalMailTableAdapter adap = new DSTableAdapters.InternalMailTableAdapter(); DS.InternalMailDataTable tab = new DS.InternalMailDataTable(); Business.InternalMail newInternailMail = new Business.InternalMail(); try { conn.Open(); adap.Connection = conn; tab = adap.GetInternalMailByID(mailID); newInternailMail.Content = tab[0].Content; newInternailMail.From = tab[0].From; newInternailMail.FromName = tab[0].FromName; newInternailMail.InternalMailID = tab[0].InternalMailID; newInternailMail.Subject = tab[0].Subject; newInternailMail.Time = tab[0].Time; newInternailMail.To = tab[0].To; newInternailMail.IsNew = tab[0].IsNew; } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return newInternailMail; }