示例#1
0
        public static Decimal GetUserPayRate(UserInfo userInfo, int userId, int typeId)
        {
            BLL.User.usersetting       _bll     = new viviapi.BLL.User.usersetting();
            Model.User.usersettingInfo _setting = _bll.GetModel(userId);
            if (_setting != null)
            {
                if (_setting.special == 1)
                {
                    string payrate = _setting.payrate;
                    if (!string.IsNullOrEmpty(payrate))
                    {
                        string[] arr = payrate.Split('|');
                        foreach (string item in arr)
                        {
                            string[] arr1 = item.Split(':');
                            if (arr1[0] == typeId.ToString())
                            {
                                return(Convert.ToDecimal(arr1[1]));
                            }
                        }
                    }
                }
            }

            //商家费率
            RateTypeEnum rateType = RateTypeEnum.Member;

            if (userInfo.UserType == UserTypeEnum.代理)
            {
                rateType = viviapi.Model.Payment.RateTypeEnum.Agent;
            }

            return(BLL.Payment.PayRateFactory.GetPayRate(rateType, (int)userInfo.UserLevel, typeId));
        }
示例#2
0
        /// <summary>
        /// 取得
        /// </summary>
        /// <param name="rateType"></param>
        /// <param name="lev"></param>
        /// <param name="paytype"></param>
        /// <returns></returns>
        public static decimal GetPayRate(RateTypeEnum rateType, int lev, int paytype)
        {
            try
            {
                decimal   rate = 0;
                DataTable data = GetList(rateType, lev);
                if (data == null && data.Rows.Count < 1)
                {
                    return(rate);
                }

                DataRow[] dr = data.Select("userLevel=" + lev.ToString() + " and rateType=" + ((int)rateType).ToString());
                if (dr == null || dr.Length <= 0)
                {
                    return(0M);
                }

                return(Convert.ToDecimal(dr[0]["p" + paytype.ToString()]));
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex);
                return(0);
            }
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rateType"></param>
        /// <param name="lev"></param>
        /// <returns></returns>
        public static DataTable GetList(RateTypeEnum rateType, int lev)
        {
            try
            {
                string cacheKey = string.Format(PAYRATEFACTORY_CACHEKEY, (int)rateType, lev);

                DataSet ds = new DataSet();
                ds = (DataSet)viviapi.Cache.WebCache.GetCacheService().RetrieveObject(cacheKey);

                if (ds == null)
                {
                    IDictionary <string, object> sqldepparms = new Dictionary <string, object>();
                    sqldepparms.Add("rateType", (int)rateType);
                    sqldepparms.Add("userLevel", lev);
                    SqlDependency sqlDep = DataBase.AddSqlDependency(cacheKey, SQL_TABLE, SQL_TABLE_FIELD, "[rateType]=@rateType and userLevel=@userLevel", sqldepparms);

                    string sql = @"select [id],[rateType],[userLevel],[levName],[p100]
      ,[p101]
      ,[p102]
      ,[p103]
      ,[p104]
      ,[p105]
      ,[p106]
      ,[p107]
      ,[p108]
      ,[p109]
      ,[p110]
      ,[p111]
      ,[p112]
      ,[p113]
      ,[p114]
      ,[p115]
      ,[p116]
      ,[p117]
      ,[p118]
      ,[p119]
      ,[p300]
      ,[p200]
      ,[p201]
      ,[p202]
      ,[p203]
      ,[p204]
      ,[p205]
      ,[p206]
      ,[p207]
      ,[p208]
      ,[p209]
      ,[p210] from [payrate]";
                    ds = DataBase.ExecuteDataset(CommandType.Text, sql);
                    viviapi.Cache.WebCache.GetCacheService().AddObject(cacheKey, ds);
                }
                return(ds.Tables[0]);
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex);
                return(null);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OBWriteInternational2DataInitiationExchangeRateInformation" /> class.
 /// </summary>
 /// <param name="unitCurrency">Currency in which the rate of exchange is expressed in a currency exchange. In the example 1GBP &#x3D; xxxCUR, the unit currency is GBP. (required).</param>
 /// <param name="exchangeRate">The factor used for conversion of an amount from one currency to another. This reflects the price at which one currency was bought with another currency..</param>
 /// <param name="rateType">Specifies the type used to complete the currency exchange. (required).</param>
 /// <param name="contractIdentification">Unique and unambiguous reference to the foreign exchange contract agreed between the initiating party/creditor and the debtor agent..</param>
 public OBWriteInternational2DataInitiationExchangeRateInformation(string unitCurrency = default(string), decimal exchangeRate = default(decimal), RateTypeEnum rateType = default(RateTypeEnum), string contractIdentification = default(string))
 {
     // to ensure "unitCurrency" is required (not null)
     this.UnitCurrency           = unitCurrency ?? throw new ArgumentNullException("unitCurrency is a required property for OBWriteInternational2DataInitiationExchangeRateInformation and cannot be null");
     this.RateType               = rateType;
     this.ExchangeRate           = exchangeRate;
     this.ContractIdentification = contractIdentification;
 }
示例#5
0
        public CurrencyRate GetCurrencyRate(string year, string reviewCode, RateTypeEnum rateType, string currencyCode)
        {
            using (BudgetContext entityContext = new BudgetContext())
            {
                var query = from a in entityContext.CurrencyRateSet
                            where a.Year == year && a.ReviewCode == reviewCode && a.RateType == rateType && a.CurrencyCode == currencyCode
                            select a;

                return(query.FirstOrDefault());
            }
        }
示例#6
0
        public static DataTable GetLevName(RateTypeEnum rateType)
        {
            string sql = "SELECT id,userLevel,levName FROM payrate WHERE rateType = @rateType";

            SqlParameter[] parameters =
            {
                new SqlParameter("@rateType", SqlDbType.TinyInt, 1)
            };
            parameters[0].Value = (int)rateType;

            return(DataBase.ExecuteDataset(CommandType.Text, sql, parameters).Tables[0]);
        }
        public string add_Rate(string tenor, double rate, RateTypeEnum rateType = RateTypeEnum.Spot)
        {
            try
            {
                #region CheckParameter

                // 이건 나중에 수정해야함. yield 음수의 경우 yieldcurve class 를 새로 만들어야함. quantlib을 사용안해야함.
                if (!(rate > 0))
                {
                    throw new Exception("rate must be positive");
                }

                #endregion

                if (this.Excel_yieldCurveViewModel_.hasTenor(tenor))
                {
                    return(tenor + " is aleady exist");
                }
                else
                {
                    Excel_rateDataViewModel e_rdvm = new Excel_rateDataViewModel();

                    e_rdvm.RateType_ = rateType.ToString();
                    e_rdvm.Tenor_    = tenor;
                    e_rdvm.Value_    = rate.ToString();

                    this.Excel_yieldCurveViewModel_.Excel_rateDataViewModel_.Add(e_rdvm);

                    return("add complete");
                }
            }
            catch (Exception e)
            {
                return("add fail : " + e.Message);
            }
        }
示例#8
0
        public IEnumerable <CurrencyRate> GetCurrencyRates(string year, string reviewCode, RateTypeEnum rateType)
        {
            using (BudgetContext entityContext = new BudgetContext())
            {
                var query = from a in entityContext.CurrencyRateSet
                            where a.Year == year && a.ReviewCode == reviewCode && a.RateType == rateType
                            select a;

                return(query.ToFullyLoaded());
            }
        }
        public string add_Rate(string tenor, double rate, RateTypeEnum rateType = RateTypeEnum.Spot)
        {
            try
            {
                #region CheckParameter

                // 이건 나중에 수정해야함. yield 음수의 경우 yieldcurve class 를 새로 만들어야함. quantlib을 사용안해야함.
                if ( !(rate > 0) )
                    throw new Exception("rate must be positive");

                #endregion

                if ( this.Excel_yieldCurveViewModel_.hasTenor(tenor) )
                {
                    return tenor + " is aleady exist";
                }
                else
                {
                    Excel_rateDataViewModel e_rdvm = new Excel_rateDataViewModel();

                    e_rdvm.RateType_ = rateType.ToString();
                    e_rdvm.Tenor_ = tenor;
                    e_rdvm.Value_ = rate.ToString();

                    this.Excel_yieldCurveViewModel_.Excel_rateDataViewModel_.Add(e_rdvm);

                    return "add complete";
                }
                
            }
            catch (Exception e)
            {
                return "add fail : " + e.Message;
            }
        }
示例#10
0
 public CurrencyRate[] GetCurrencyRates(string year, string reviewCode, RateTypeEnum rateType)
 {
     return(Channel.GetCurrencyRates(year, reviewCode, rateType));
 }
示例#11
0
 public CurrencyRate GetCurrencyRateByCode(string year, string reviewCode, RateTypeEnum rateType, string currencyCode)
 {
     return(Channel.GetCurrencyRateByCode(year, reviewCode, rateType, currencyCode));
 }