Esempio n. 1
0
        /// <summary>
        /// Return a list of Sample addresses using LINQ to SQL
        /// </summary>
        /// <returns></returns>
        public List<sp_Email_DM> ListEmails()
        {
            List<sp_Email_DM> list = new List<sp_Email_DM>();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    list = (from result in context.sp_Vol_Email_Select(null)
                            select new sp_Email_DM
                            {
                                EmailID = result.EmailID,
                                EmailAddr = result.EmailAddr,
                                VolID = result.VolID,
                                ActiveFlg = result.ActiveFlg

                            }).ToList();
                } // Guaranteed to close the Connection
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return list;
        }
Esempio n. 2
0
        public sp_Email_DM ListPrimaryEmail(sp_Email_DM cVolEmail)
        {
            sp_Email_DM item = new sp_Email_DM();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    item = (from result in context.sp_Vol_Email_Select(cVolEmail.VolID, null, true)
                            select new sp_Email_DM
                            {
                                EmailID = result.EmailID,
                                EmailAddr = result.EmailAddr,
                                VolID = result.VolID,
                                ActiveFlg = result.ActiveFlg,
                                PrimaryFlg = result.PrimaryFlg
                            }).FirstOrDefault();
                } // Guaranteed to close the Connection
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return item;
        }