Beispiel #1
0
 public void DeleteEmailContext(sp_VendEmail_DM InputEmail)
 {
     using (VolTeerEntities context = new VolTeerEntities())
     {
         var VendEmailToRemove = (from n in context.tblVendEmails where n.EmailID == InputEmail.EmailID select n).FirstOrDefault();
         context.tblVendEmails.Remove(VendEmailToRemove);
         context.SaveChanges();
     }
 }
        public void DeleteEmailContext(sp_VendEmail_DM _caEmail)
        {
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_VendEmail_DM cacheEmail;
            cacheEmail = (sp_VendEmail_DM)cache[_caEmail.EmailID.ToString()];

            if (cacheEmail != null)
            {
                cache.Remove(_caEmail.EmailID.ToString());
            }
            BLL.DeleteEmailContext(_caEmail);
        }
Beispiel #3
0
        public void UpdateEmailContext(sp_VendEmail_DM InputEmail)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                var existingEmail = context.tblVendEmails.Find(InputEmail.EmailID);

                if (InputEmail != null)
                {
                    existingEmail.EmailAddr = InputEmail.EmailAddr;
                    existingEmail.ActiveFlg = InputEmail.ActiveFlg;
                    context.SaveChanges();
                }
            }
        }
Beispiel #4
0
 public void TestVendEmailDelete()
 {
     DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "tblVendEmail.xlsx"));
     foreach (DataRow row in dt.Rows) // Loop over the rows.
     {
         int EmailID = Convert.ToInt32(row["EmailID"].ToString());
         sp_VendEmail_DM data = new sp_VendEmail_DM();
         sp_VendEmail_BLL vend = new sp_VendEmail_BLL();
         data.EmailID = EmailID;
         vend.DeleteEmailContext(data);
         data = vend.ListEmails(EmailID);
         Assert.AreEqual(false, data.ActiveFlg, "ActiveFlag not set as expected");
     }
 }
Beispiel #5
0
 public int InsertEmailContext(sp_VendEmail_DM InputEmail)
 {
     using (VolTeerEntities context = new VolTeerEntities())
     {
         var NewEmail = new tblVendEmail
         {
             EmailAddr = InputEmail.EmailAddr,
             ActiveFlg = InputEmail.ActiveFlg
         };
         context.tblVendEmails.Add(NewEmail);
         context.SaveChanges();
         //Return the id of the newly created record
         return NewEmail.EmailID;
     }
 }
        public void UpdateEmailContext(sp_VendEmail_DM _caEmail)
        {
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_VendEmail_DM cacheEmail;
            cacheEmail = (sp_VendEmail_DM)cache[_caEmail.EmailID.ToString()];

            if (cacheEmail != null)
            {
                cache.Remove(_caEmail.EmailID.ToString());
            }

            cache.Insert(_caEmail.EmailID.ToString(), _caEmail, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            BLL.UpdateEmailContext(_caEmail);
        }
        /// <summary>
        /// ListEmails - There's a good chance the same record may be requested often.  Cache the Email object...
        /// 
        /// </summary>
        /// <param name="Emails"></param>
        /// <returns></returns>
        public sp_VendEmail_DM ListEmails(int VendEmail)
        {
            sp_VendEmail_DM caEmail = new sp_VendEmail_DM();

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

            sp_VendEmail_DM cacheEmail;
            cacheEmail = (sp_VendEmail_DM)cache[VendEmail.ToString()];

            if (cacheEmail == null)
            {
                caEmail = BLL.ListEmails(VendEmail);
                cache.Insert(caEmail.EmailID.ToString(), caEmail, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            else
            {
                caEmail = cacheEmail;
            }

            return caEmail;
        }
Beispiel #8
0
        public void TestVendEmailInsert()
        {
            //Test Our Read
            sp_VendEmail_DM data = new sp_VendEmail_DM();
            string EmailAddr = "*****@*****.**";

            data.EmailAddr = EmailAddr;
            data.ActiveFlg = true;
            sp_VendEmail_BLL vend = new sp_VendEmail_BLL();
            vend.InsertEmailContext(data);
            Assert.AreEqual(EmailAddr, data.EmailAddr, "EmailAddr Not Set As Expected");
        }
Beispiel #9
0
        public void TestVendEmailUpdate()
        {
            //Test Our Read
            DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "tblVendEmail.xlsx"));
            foreach (DataRow row in dt.Rows) // Loop over the rows.
            {
                string EmailAddr = "*****@*****.**";

                int EmailID = Convert.ToInt32(row["EmailID"].ToString());
                sp_VendEmail_DM data = new sp_VendEmail_DM();
                data.EmailID = EmailID;
                data.EmailAddr = EmailAddr;
                sp_VendEmail_BLL vend = new sp_VendEmail_BLL();
                vend.UpdateEmailContext(data);
                data = vend.ListEmails(EmailID);
                Assert.AreEqual(EmailAddr, data.EmailAddr, "EmailAddr Not Set As Expected");

            }
        }
 public void InsertEmailContext(sp_VendEmail_DM _caEmail)
 {
     BLL.InsertEmailContext(_caEmail);
     System.Web.Caching.Cache cache = HttpRuntime.Cache;
     cache.Insert(_caEmail.EmailID.ToString(), _caEmail, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
 }
Beispiel #11
0
 public void UpdateEmailContext(sp_VendEmail_DM InputEmail)
 {
     DAL.UpdateEmailContext(InputEmail);
 }
Beispiel #12
0
 public int InsertEmailContext(sp_VendEmail_DM InputEmail)
 {
     return DAL.InsertEmailContext(InputEmail);
 }
Beispiel #13
0
 public void DeleteEmailContext(sp_VendEmail_DM InputEmail)
 {
     DAL.DeleteEmailContext(InputEmail);
 }