Пример #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();
     }
 }
Пример #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);
        }
Пример #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();
     }
 }
Пример #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);
        }
Пример #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;
        }
Пример #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);
 }
Пример #7
0
 public void UpdateVendContactContext(sp_VendContact_DM vendcontact)
 {
     DAL.UpdateVendContactContext(vendcontact);
 }
Пример #8
0
 public void InsertVendContactContext(sp_VendContact_DM vendcontact)
 {
     DAL.InsertVendContactContext(vendcontact);
 }
Пример #9
0
 public void DeleteVendContactContext(sp_VendContact_DM vendcontact)
 {
     DAL.DeleteVendContactContext(vendcontact);
 }
Пример #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();
         }
     }
 }