예제 #1
0
        /// <summary>
        /// Return a list of Sample addresses using LINQ to SQL
        /// </summary>
        /// <returns></returns>
        public List<sp_Vol_Address_DM> ListAddresses()
        {
            List<sp_Vol_Address_DM> list = new List<sp_Vol_Address_DM>();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    list = (from result in context.sp_Vol_Address_Select(null)
                            select new sp_Vol_Address_DM
                            {
                                AddrID = result.AddrID,
                                ActiveFlg = result.ActiveFlg,
                                AddrLine1 = result.AddrLine1,
                                AddrLine2 = result.AddrLine2,
                                AddrLine3 = result.AddrLine3,
                                City = result.City,
                                St = result.St,
                                Zip = result.Zip,
                                Zip4 = result.Zip4

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

            return list;
        }
예제 #2
0
        public sp_Vol_Address_DM ListPrimaryAddress(sp_Vol_Address_DM cVolAddr)
        {
            sp_Vol_Address_DM item = new sp_Vol_Address_DM();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    item = (from result in context.sp_Vol_Address_Select(cVolAddr.VolID, null, true)
                            select new sp_Vol_Address_DM
                            {
                                AddrID = result.AddrID,
                                ActiveFlg = result.ActiveFlg,
                                AddrLine1 = result.AddrLine1,
                                AddrLine2 = result.AddrLine2,
                                AddrLine3 = result.AddrLine3,
                                City = result.City,
                                St = result.St,
                                Zip = result.Zip,
                                Zip4 = result.Zip4,
                                GeoCodeGetSet = result.GeoCodeGetSet,
                                PrimaryAddr = result.PrimaryAddr,
                                VolID = cVolAddr.VolID

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

            return item;
        }