Esempio n. 1
0
 public void DeleteVendContactContext(sp_VendContact_DM vendcontact)
 {
     using (VolTeerEntities context = new VolTeerEntities())
     {
         var VendContacttoRemove = (from n in context.tblVendContacts where n.ContactID == vendcontact.ContactID & n.VendorID == vendcontact.VendorID select n).FirstOrDefault();
         context.tblVendContacts.Remove(VendContacttoRemove);
         context.SaveChanges();
     }
 }
Esempio n. 2
0
        public void DeleteContactContext(sp_VendContact_DM _caContact)
        {
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_VendContact_DM cacheContact;
            cacheContact = (sp_VendContact_DM)cache[_caContact.ContactID.ToString()];

            if (cacheContact != null)
            {
                cache.Remove(_caContact.ContactID.ToString());
            }
            BLL.DeleteContactContext(_caContact);
        }
Esempio n. 3
0
 public void InsertVendContactContext(sp_VendContact_DM vendcontact)
 {
     using (VolTeerEntities context = new VolTeerEntities())
     {
         var NewVendContact = new tblVendContact
         {
             VendorID = vendcontact.VendorID,
             ContactID = vendcontact.ContactID,
             PrimaryContact = vendcontact.PrimaryContact
         };
         context.tblVendContacts.Add(NewVendContact);
         context.SaveChanges();
     }
 }
Esempio n. 4
0
        public void UpdateContactContext(sp_VendContact_DM _caContact)
        {
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_VendContact_DM cacheContact;
            cacheContact = (sp_VendContact_DM)cache[_caContact.ContactID.ToString()];

            if (cacheContact != null)
            {
                cache.Remove(_caContact.ContactID.ToString());
            }

            cache.Insert(_caContact.ContactID.ToString(), _caContact, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            BLL.UpdateContactContext(_caContact);
        }
Esempio n. 5
0
        /// <summary>
        /// ListContacts - There's a good chance the same record may be requested often.  Cache the contact object...
        /// 
        /// </summary>
        /// <param name="Contacts"></param>
        /// <returns></returns>
        public sp_VendContact_DM ListContacts(int? VendContact)
        {
            sp_VendContact_DM cRating = new sp_VendContact_DM();

            //Cache cache = HttpRuntime.Cache;
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_VendContact_DM cacheRating;
            cacheContact = (sp_VendContact_DM)cache[VendContact.ToString()];

            if (cacheContact == null)
            {
                caContact = BLL.ListContacts(VendContact);
                cache.Insert(caContact.ContactID.ToString(), caContact, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            else
            {
                caContact = cacheContact;
            }

            return caContact;
        }
Esempio n. 6
0
 public void InsertContactContext(sp_VendContact_DM _caContact)
 {
     BLL.InsertContactContext(_caContact);
     System.Web.Caching.Cache cache = HttpRuntime.Cache;
     cache.Insert(_caContact.ContactID.ToString(), _caContact, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
 }
Esempio n. 7
0
 public void UpdateVendContactContext(sp_VendContact_DM vendcontact)
 {
     DAL.UpdateVendContactContext(vendcontact);
 }
Esempio n. 8
0
 public void InsertVendContactContext(sp_VendContact_DM vendcontact)
 {
     DAL.InsertVendContactContext(vendcontact);
 }
Esempio n. 9
0
 public void DeleteVendContactContext(sp_VendContact_DM vendcontact)
 {
     DAL.DeleteVendContactContext(vendcontact);
 }
Esempio n. 10
0
 public void UpdateVendContactContext(sp_VendContact_DM vendcontact)
 {
     using (VolTeerEntities context = new VolTeerEntities())
     {
         var ExistingVendContact = context.tblVendContacts.Find(vendcontact.VendorID, vendcontact.ContactID);
         if (ExistingVendContact != null)
         {
             ExistingVendContact.PrimaryContact = vendcontact.PrimaryContact;
             context.SaveChanges();
         }
     }
 }