Example #1
0
        /// <summary>
        /// Ec
        /// </summary>
        /// <param name="gopher"></param>
        /// <param name="rateType"></param>
        /// <returns></returns>
        public async Task <bool> Rate(IGopher gopher, RateType rateType)
        {
            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Authorization = AuthenticationHeaderValue.Parse($"{_token.TokenType} {_token.Token}");
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var response = await client.PostAsync(RateUri,
                                                      new FormUrlEncodedContent(new Dictionary <string, string>
                {
                    {
                        "suslik_uuid", gopher.Guid.ToString()
                    },
                    {
                        "type", rateType.ToString()
                    }
                }));

                var jsonString = await response.Content.ReadAsStringAsync();

                Debug.WriteLine(jsonString);

                return(await Task.FromResult(response.IsSuccessStatusCode));
            }
        }
Example #2
0
        public static string ToMoneyFormat(this decimal value, RateType rateType)
        {
            FieldInfo         fi  = rateType.GetType().GetField(rateType.ToString());
            RateInfoAttribute ria = fi.GetCustomAttribute <RateInfoAttribute>();

            CultureInfo ci = new CultureInfo(ria.CultureName);

            return(value.ToString("C", ci));
        }
Example #3
0
        /// <summary>
        /// 获取指定类别的利率
        /// </summary>
        /// <param name="rateType">利率类别</param>
        /// <returns>对应类别的利率值</returns>
        public static double GetRate(RateType rateType)
        {
            BankDataContext c = new BankDataContext();
            var             q = (from t in c.RateInfo
                                 where t.类别 == rateType.ToString()
                                 select t.利率).Single();

            return(q);
        }
        /// <summary>
        /// 获取指定类别的利率
        /// </summary>
        /// <param name="rateType">利率类别</param>
        /// <returns>对应类别的利率值</returns>
        public static double GetRate(RateType rateType)
        {
            string         type = rateType.ToString();
            BMS_DBEntities c    = new BMS_DBEntities();
            var            q    = (from t in c.RateInfoes
                                   where t.DepositType == type
                                   select t.Rate).Single();

            return(q.Value);
        }
Example #5
0
        /// <summary>
        /// 获取指定类别的利率
        /// </summary>
        /// <param name="rateType">利率类别</param>
        /// <returns>对应类别的利率值</returns>
        public static double GetRate(RateType rateType)
        {
            string        type = rateType.ToString();
            BankEntities1 c    = new BankEntities1();
            var           q    = (from t in c.RateInfo
                                  where t.rationType == type
                                  select t.rationValue).Single();

            return(q.Value);
        }
        /// <summary>
        /// this method calculates actual billing amount
        /// </summary>
        /// <param name="priceTier">price tier applicable as per the entry n exit times</param>
        /// <param name="entryTime"></param>
        /// <param name="exitTime"></param>
        /// <returns></returns>
        private Charge DetermineCharge(RateType priceTier, DateTime entryTime, DateTime exitTime)
        {
            decimal cost = (decimal)0.0;

            switch (priceTier)
            {
            case RateType.EarlyBird:
                cost = (decimal)13.0;
                break;

            case RateType.Night:
                cost = (decimal)6.5;
                break;

            case RateType.Weekend:
                cost = (decimal)10.0;
                break;
            }

            var     totalHours        = exitTime.Subtract(entryTime).TotalHours;
            var     totalCalendarDays = exitTime.Day - entryTime.Day == 0 ? 1: exitTime.Day - entryTime.Day;
            decimal standardCost;

            if (totalHours < 1)
            {
                standardCost = (decimal)5.0;
            }
            else if (totalHours < 2)
            {
                standardCost = (decimal)10.0;
            }
            else if (totalHours < 3)
            {
                standardCost = (decimal)15.0;
            }
            else
            {
                standardCost = (decimal)(totalCalendarDays * 20); //flat rate for each calendar day.
            }
            //look for the cheapest option for customer; if standard cost is less, pass on the same
            if (cost != 0 && cost < standardCost)
            {
                return(new Charge()
                {
                    Rate = priceTier.ToString(), TotalPrice = cost
                });
            }
            else
            {
                return new Charge()
                       {
                           Rate = RateType.Standard.ToString(), TotalPrice = standardCost
                       }
            };
        }
Example #7
0
        /// <summary>
        /// 获取指定类别的利率
        /// </summary>
        /// <param name="rateType">利率类别</param>
        /// <returns>对应类别的利率值</returns>
        public static double GetRate(RateType rateType)
        {
            bool         mark    = true;
            string       type    = rateType.ToString();
            BankEntities context = new BankEntities();
            var          qq      = from t in context.AccountInfo
                                   where t.accountNo == DataOperation.str
                                   select t;
            var m = qq.FirstOrDefault();

            if (type == "零存整取1年" || type == "零存整取3年" || type == "零存整取5年")
            {
                if (type == "零存整取1年")
                {
                    for (int i = 2; i <= 12; i++)
                    {
                        if (!m.accountMark.Contains(i.ToString()))
                        {
                            mark = false;
                        }
                    }
                }
                else if (type == "零存整取3年")
                {
                    for (int i = 2; i <= 36; i++)
                    {
                        if (!m.accountMark.Contains(i.ToString()))
                        {
                            mark = false;
                        }
                    }
                }
                else
                {
                    for (int i = 2; i <= 60; i++)
                    {
                        if (!m.accountMark.Contains(i.ToString()))
                        {
                            mark = false;
                        }
                    }
                }
                if (mark == false)
                {
                    type = "零存整取违规";
                }
            }
            BankEntities c = new BankEntities();
            var          q = (from t in c.RateInfo
                              where t.rationType == type
                              select t.rationValue).Single();

            return(q.Value);
        }
Example #8
0
        /// <summary>
        /// Abre la ventana de busqueda
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 13/04/2016
        /// </history>
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            frmSearch frmSearch = new frmSearch();

            frmSearch.Owner      = this;
            frmSearch.enumWindow = EnumWindow.DefaultInt;
            frmSearch.strID      = (_rateTypeFilter.raID > 0) ? _rateTypeFilter.ToString() : "";
            frmSearch.strDesc    = _rateTypeFilter.raN;
            frmSearch.nStatus    = _nStatus;
            if (frmSearch.ShowDialog() == true)
            {
                _nStatus             = frmSearch.nStatus;
                _rateTypeFilter.raID = Convert.ToInt32(frmSearch.strID);
                _rateTypeFilter.raN  = frmSearch.strDesc;
                LoadRateTypes();
            }
        }
Example #9
0
 public CarparkRate(string name, float rate, RateType type)
 {
     this.Name = name;
     this.Type = type.ToString();
     this.Rate = rate;
 }
Example #10
0
 /// <summary>
 /// 获取指定类别的利率
 /// </summary>
 /// <param name="rateType">利率类别</param>
 /// <returns>对应类别的利率值</returns>
 public static double GetRate(RateType rateType)
 {
     string type = rateType.ToString();
     BankEntities c = new BankEntities();
     var q = (from t in c.RateInfo
              where t.rationType == type
              select t.rationValue).Single();
     return q.Value;
 }
        public ParkingRate GetParkingRate(RateType rateType)
        {
            var parkingRate = _carParkDbContext.ParkingRates.FirstOrDefault(pr => pr.RateCode == rateType.ToString());

            return(parkingRate);
        }