示例#1
0
        /// <summary>
        /// </summary>
        /// <returns>Dataset of OutputType Details</returns>
        public static DataSet GetOutputType()
        {
            DataSet       dsOutputType;
            CalculatorDao calculatorDao = new CalculatorDao();

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

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

                FunctionInfo = exBase.AddObject(FunctionInfo, null);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
            return(dsOutputType);
        }
        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);
        }