Пример #1
0
        /// <summary>
        /// </summary>
        /// <returns>Dataset of InterestFrequency Details</returns>
        public static DataSet GetInterestFrequency()
        {
            DataSet       dsInterestFreq;
            CalculatorDao calculatorDao = new CalculatorDao();

            try
            {
                dsInterestFreq = calculatorDao.GetInterestFrequency();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "CalculatorBo.cs:GetInterestFrequency()");

                FunctionInfo = exBase.AddObject(FunctionInfo, null);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
            return(dsInterestFreq);
        }
        public static DataSet GetDataFromDB(string tableName, string cacheName)
        {
            CalculatorDao calDAO   = new CalculatorDao();
            DataSet       dsDbData = null;

            try
            {
                if (tableName == "InstrumentTypeMaster")
                {
                    dsDbData = calDAO.GetInstrumentType();
                }
                else if (tableName == "OutputMaster")
                {
                    dsDbData = calDAO.GetOutputType();
                }
                else if (tableName == "InputMaster")
                {
                    dsDbData = calDAO.GetInputForSelOutput();
                }
                else if (tableName == "InterestFrequency")
                {
                    dsDbData = calDAO.GetInterestFrequency();
                }
                else if (tableName == "FormulaMaster")
                {
                    dsDbData = calDAO.GetFormula();
                }

                SqlCacheDependency sqlDep = new SqlCacheDependency(ConfigurationManager.AppSettings["DBName"], tableName);
                HttpContext.Current.Cache.Insert(cacheName, dsDbData, sqlDep);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "Caching.cs:GetDataFromDB()");

                FunctionInfo = exBase.AddObject(FunctionInfo, null);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
            return(dsDbData);
        }