コード例 #1
0
ファイル: DealsBal.cs プロジェクト: rammohanravi/IHD
        public DealsDto[] GetAllActiveDeals(bool canLoadCachedDeals)
        {
            try
            {
                var configLoader = new ConfigHelper();
                if (!canLoadCachedDeals)
                {
                    CacheItemPolicy policy = new CacheItemPolicy();
                    policy.AbsoluteExpiration =
                    DateTimeOffset.Now.AddMinutes(configLoader.GetAppSettingsIntlValue("DealCacheDuration"));
                    var dealsToBind = dDal.GetAllActiveDeals();
                    cacheDealObject.Set("Deals", dealsToBind, policy);
                    return dealsToBind;
                }

                DealsDto[] dealsToBindFromCache = cacheDealObject["Deals"] as DealsDto[];
                if (dealsToBindFromCache == null)
                {
                    CacheItemPolicy policy = new CacheItemPolicy();
                    policy.AbsoluteExpiration =
                    DateTimeOffset.Now.AddMinutes(configLoader.GetAppSettingsIntlValue("DealCacheDuration"));
                    dealsToBindFromCache = dDal.GetAllActiveDeals();
                    cacheDealObject.Set("Deals", dealsToBindFromCache, policy);

                }
                return dealsToBindFromCache;
            }
            catch (Exception ex)
            {
                lBal.LogMessage(ex.InnerException.Message + "at " + ex.StackTrace, LogMessageTypes.Error);
                return null;
            }
        }
コード例 #2
0
ファイル: ID2DStatasticsBal.cs プロジェクト: rammohanravi/IHD
        public object GetPriceCategories()
        {
            try
            {
                var configLoader = new ConfigHelper();
                List<PriceCategoryDTO> _dealPriceCategories = cachePriceObject["Categories"] as List<PriceCategoryDTO>;
                if (_dealPriceCategories == null)
                {
                    CacheItemPolicy policy = new CacheItemPolicy();
                    policy.AbsoluteExpiration =
                    DateTimeOffset.Now.Date.AddDays(configLoader.GetAppSettingsIntlValue("CategoryPriceCacheDuration"));
                    _dealPriceCategories = iDal.GetPriceCategories();
                    cacheCategoryObject.Set("Categories", _dealPriceCategories, policy);
                }

                return _dealPriceCategories;
            }
            catch (Exception ex)
            {
                lBal.LogMessage(ex.InnerException.Message + "at " + ex.StackTrace, LogMessageTypes.Error);
                return null;
            }
        }
コード例 #3
0
ファイル: DealsBal.cs プロジェクト: rammohanravi/IHD
 public string GetEncryptedData(string dealID)
 {
     try
     {
         var configLoader = new ConfigHelper();
         var passPhrase = configLoader.GetAppSettingsStringValue("Phrase");
         return EncryptString.Encrypt(dealID, passPhrase);
     }
     catch (Exception ex)
     {
         lBal.LogMessage(ex.InnerException.Message + "at " + ex.StackTrace, LogMessageTypes.Error);
         return string.Empty;
     }
 }
コード例 #4
0
ファイル: DataAccess.cs プロジェクト: rammohanravi/IHD
 static DataAccess()
 {
     var configLoader = new ConfigHelper();
     IndiaDeals2DayDBConnection = configLoader.GetConnectionStringFromKey(DatabaseConstants.DBname);
 }
コード例 #5
0
ファイル: UserBal.cs プロジェクト: rammohanravi/IHD
        public string SendEmailWithPassword(string userName)
        {
            try
            {
            string registeredEmailAddress = uDal.GetRegisteredEmailAddress(userName);
            string password = uDal.GetPassword(userName);
            var configLoader = new ConfigHelper();
            SmtpClient client = new SmtpClient(configLoader.GetAppSettingsStringValue("MailServer"), int.Parse(configLoader.GetAppSettingsStringValue("MailPort")));
            MailAddress from = new MailAddress(configLoader.GetAppSettingsStringValue("EmailSender"),configLoader.GetAppSettingsStringValue("DisplayNameStart")+(char)0xD8+configLoader.GetAppSettingsStringValue("DisplayNameEnd"),System.Text.Encoding.UTF8);
            MailAddress to = new MailAddress(registeredEmailAddress.Trim());
            MailMessage message = new MailMessage(from, to);
            message.Body = "Your password is : " + password;
            message.BodyEncoding = System.Text.Encoding.UTF8;
            message.Subject = "Your password to access Deals4uindia.com";
            client.Credentials = CredentialCache.DefaultNetworkCredentials;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.Send(message);
            return registeredEmailAddress;
            }

            catch (Exception ex)
            {
                lBal.LogMessage(ex.InnerException.Message + "at " + ex.StackTrace, LogMessageTypes.Error);
                return ex.InnerException.Message;
            }
        }