Пример #1
0
        /// <summary>
        ///存款
        /// </summary>
        public override void Diposit(string genType, double money, int year)
        {
            BankEntities context = new BankEntities();

            base.Diposit("存款", money, year);
            if (year == 1)
            {
                //定期类型
                type = RateType.定期1年;
                base.Diposit("结息", DataOperation.GetRate(RateType.定期1年) * money, year);
                //到期利息
                preRate = DataOperation.GetRate(RateType.定期1年) * money;
            }
            if (year == 2)
            {
                base.Diposit("结息", DataOperation.GetRate(RateType.定期3年) * money, year);
                type    = RateType.定期3年;
                preRate = DataOperation.GetRate(RateType.定期3年) * money;
            }
            if (year == 3)
            {
                base.Diposit("结息", DataOperation.GetRate(RateType.定期5年) * money, year);
                type    = RateType.定期5年;
                preRate = DataOperation.GetRate(RateType.定期5年) * money;
            }
        }
Пример #2
0
 public UserRating(int no, AggregateId ratedBy, decimal rate, RateType type)
 {
     No      = no;
     RatedBy = ratedBy;
     Rate    = rate;
     Type    = type;
 }
Пример #3
0
 public RateRoute(RateType RateType)
 {
     this.RateType = RateType;
     Rows          = new List <RateRow>();
     HeaderRow     = new RateHeaderRow(RateType);
     Mode          = RateRouteMode.Edit;
 }
Пример #4
0
        private IEnumerable <RateType> CreateMockRateTypeCollection()
        {
            var rateType1 = new RateType
            {
                Id          = 1,
                DisplayName = RateTypes.Standard,
                Type        = "STD"
            };

            var rateType2 = new RateType
            {
                Id          = 2,
                DisplayName = RateTypes.OvertimeStandard,
                Type        = "OVT"
            };

            var rateType3 = new RateType
            {
                Id          = 3,
                DisplayName = RateTypes.OvertimeNight,
                Type        = "OVN"
            };

            var rateType4 = new RateType
            {
                Id          = 4,
                DisplayName = RateTypes.Holiday,
                Type        = "OVN"
            };

            return(new List <RateType> {
                rateType1, rateType2, rateType3, rateType4
            });
        }
Пример #5
0
 public void UpdateRates(RateType type, List <Rate> rates)
 {
     using (var db = new RacingDbContext())
     {
         var dbRates = db.Rate.Where(r => r.RateType == type).OrderBy(r => r.Rank).ToList();
         foreach (var dbRate in dbRates)
         {
             var rate = rates.Where(r => r.RateId == dbRate.RateId).FirstOrDefault();
             if (rate != null)
             {
                 dbRate.Rate1  = rate.Rate1;
                 dbRate.Rate2  = rate.Rate2;
                 dbRate.Rate3  = rate.Rate3;
                 dbRate.Rate4  = rate.Rate4;
                 dbRate.Rate5  = rate.Rate5;
                 dbRate.Rate6  = rate.Rate6;
                 dbRate.Rate7  = rate.Rate7;
                 dbRate.Rate8  = rate.Rate8;
                 dbRate.Rate9  = rate.Rate9;
                 dbRate.Rate10 = rate.Rate10;
                 dbRate.Big    = rate.Big;
                 dbRate.Small  = rate.Small;
                 dbRate.Odd    = rate.Odd;
                 dbRate.Even   = rate.Even;
             }
         }
         db.SaveChanges();
     }
 }
Пример #6
0
 private void initializeTestData()
 {
     rate     = GetRandom.Decimal(1, 10);
     currency = new Currency(GetRandom.Object <CurrencyData>());
     rateType = new RateType(GetRandom.Object <RateTypeData>());
     date     = GetRandom.DateTime();
 }
Пример #7
0
 public List <Rate> GetRatesByType(RateType type)
 {
     using (var db = new RacingDbContext())
     {
         return(db.Rate.Where(r => r.RateType == type).OrderBy(r => r.Rank).ToList());
     }
 }
Пример #8
0
        public static double DFFromRate(double t, double r, RateType rateType)
        {
            switch (rateType)
            {
            case RateType.Exponential:
                return(Exp(-r * t));

            case RateType.Linear:
                return(1.0 / (1.0 + r * t));

            case RateType.SemiAnnualCompounded:
                return(Pow(1.0 + r / 2.0, -2.0 * t));

            case RateType.QuarterlyCompounded:
                return(Pow(1.0 + r / 4.0, -4.0 * t));

            case RateType.MonthlyCompounded:
                return(Pow(1.0 + r / 12.0, -12.0 * t));

            case RateType.YearlyCompounded:
                return(Pow(1.0 + r, t));

            case RateType.DiscountFactor:
                return(r);

            default:
                throw new NotImplementedException();
            }
        }
Пример #9
0
        [TestInitialize] public override void TestInitialize()
        {
            var name = Guid.NewGuid()
                       .ToString();
            var serviceProvider = new ServiceCollection()
                                  .AddEntityFrameworkInMemoryDatabase()
                                  .BuildServiceProvider();
            var builder = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(name)
                          .UseInternalServiceProvider(serviceProvider);

            ConvertMoney.rates = new RatesRepository(new ApplicationDbContext(builder.Options));
            base.TestInitialize();
            usd = new Currency(new CurrencyData {
                Code = "USD"
            });
            eur = new Currency(new CurrencyData {
                Code = "EUR"
            });
            eek = new Currency(new CurrencyData {
                Code = "EEK"
            });
            dt1 = DateTime.Now.AddDays(-1);
            dt2 = DateTime.Now.AddDays(-2);
            var t = new RateType(new RateTypeData {
                Code = RateFactory.EuroRate
            });

            ConvertMoney.rates.AddObject(RateFactory.Create(eur, 1M, dt1, t));
            ConvertMoney.rates.AddObject(RateFactory.Create(usd, 2M, dt1, t));
            ConvertMoney.rates.AddObject(RateFactory.Create(usd, 3M, dt2, t));
            ConvertMoney.rates.AddObject(RateFactory.Create(eek, 10M, dt1, t));
            ConvertMoney.rates.AddObject(RateFactory.Create(eek, 15M, dt2, t));
        }
Пример #10
0
        /// <summary>
        /// Muestra la ventana detalle en modo edit
        /// </summary>
        /// <history>
        /// [emoguel] 14/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            RateType          rateType          = (RateType)dgrRateTypes.SelectedItem;
            frmRateTypeDetail frmRateTypeDetail = new frmRateTypeDetail();

            frmRateTypeDetail.Owner       = this;
            frmRateTypeDetail.enumMode    = EnumMode.Edit;
            frmRateTypeDetail.oldRateType = rateType;
            if (frmRateTypeDetail.ShowDialog() == true)
            {
                int             nIndex       = 0;
                List <RateType> lstRateTypes = (List <RateType>)dgrRateTypes.ItemsSource;
                if (ValidateFilter(frmRateTypeDetail.rateType))
                {
                    ObjectHelper.CopyProperties(rateType, frmRateTypeDetail.rateType); //Actualizamos los datos del registro
                    lstRateTypes.Sort((x, y) => string.Compare(x.raN, y.raN));         //Ordenamos los registros
                    nIndex = lstRateTypes.IndexOf(rateType);                           //obtenemos la posición del registro
                }
                else
                {
                    lstRateTypes.Remove(rateType);//Eliminamos el registro
                }
                dgrRateTypes.Items.Refresh();
                GridHelper.SelectRow(dgrRateTypes, nIndex);
                StatusBarReg.Content = lstRateTypes.Count + " Rate Types.";
            }
        }
Пример #11
0
        public double GetForwardRate(DateTime startDate, DateTime endDate, RateType rateType, double tbasis)
        {
            var ccRate = GetForwardRate(startDate, endDate);
            var output = -1.0;

            var t365 = startDate.CalculateYearFraction(endDate, _basis);
            var cf   = Exp(ccRate * t365);

            switch (rateType)
            {
            case RateType.Exponential:
                output = Log(cf) / tbasis;
                break;

            case RateType.Linear:
                output = (cf - 1.0) / tbasis;
                break;

            case RateType.DailyCompounded:
            case RateType.MonthlyCompounded:
            case RateType.YearlyCompounded:
                throw new NotImplementedException();
            }
            return(output);
        }
Пример #12
0
        public RateType GetRateTypeRecord(string recordID, string UserSNo)
        {
            SqlDataReader dr = null;

            try
            {
                RateType       RateType   = new RateType();
                SqlParameter[] Parameters = { new SqlParameter("@SNo", Convert.ToInt32(recordID)), new SqlParameter("@UserID", Convert.ToInt32(UserSNo)) };
                dr = SqlHelper.ExecuteReader(ReadConnectionString.WebConfigConnectionString, CommandType.StoredProcedure, "GetRecordRateType", Parameters);

                if (dr.Read())
                {
                    RateType.SNo          = Convert.ToInt32(dr["SNo"]);
                    RateType.RateTypeName = dr["RateTypeName"].ToString();

                    // F.IsActive = Convert.ToBoolean(dr["IsActive"].ToString());
                    RateType.Active    = dr["Active"].ToString();
                    RateType.UpdatedBy = dr["UpdatedUser"].ToString();
                    RateType.CreatedBy = dr["CreatedUser"].ToString();
                }
                dr.Close();
                return(RateType);
            }
            catch (Exception ex)//
            {
                throw ex;
            }
        }
Пример #13
0
        /// <summary>
        /// Realiza los calculos de acuerdo a los parametros introducidos
        /// </summary>
        /// <history>
        /// [vipacheco] 31/Marzo/2016 Created
        /// </history>
        private void cboType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            RateType       _rateType       = cboRateType.SelectedItem as RateType;
            MealTicketType _mealTicketType = cboType.SelectedItem as MealTicketType;

            if (_mealTicketType != null)
            {
                if (!_mealTicketType.myWPax)
                {
                    txtAdults.Text      = $"{1}";
                    txtMinors.Text      = $"{0}";
                    txtAdults.IsEnabled = txtMinors.IsEnabled = false;
                    txtTAdults.Text     = string.Format("{0:$0.00}", CalculateAdult(((_rateType == null) ? 1 : _rateType.raID), ((_meQty >= 0) ? _meQty : 0), ((txtAdults.Text != "") ? Convert.ToInt32(txtAdults.Text) : 0)));
                    decimal _minors = (_meQty * ((txtMinors.Text != "") ? Convert.ToInt32(txtMinors.Text) : 0) * ((_mealTicketType != null) ? _mealTicketType.myPriceM : 0));
                    txtTMinors.Text = string.Format("{0:$0.00}", Convert.ToDouble(_minors));
                }
                else
                {
                    txtAdults.IsEnabled = txtMinors.IsEnabled = true;
                    txtAdults.Text      = ((txtAdults.Text != "") ? txtAdults.Text : "0");
                    txtMinors.Text      = ((txtMinors.Text != "") ? txtMinors.Text : "0");
                    txtTAdults.Text     = ((txtTAdults.Text != "") ? txtTAdults.Text : "$0.00");
                    txtTMinors.Text     = ((txtTMinors.Text != "") ? txtTMinors.Text : "$0.00");
                    txtAdults_LostFocus(null, null);
                    txtMinors_LostFocus(null, null);
                }
            }
        }
Пример #14
0
        /// <summary>
        /// Valida que un objeto tipo Rate Type cumpla con los filtros actuales
        /// </summary>
        /// <param name="rateType">objeto a validar</param>
        /// <returns>True. Si cumple | False. No cumple</returns>
        /// <history>
        /// [emoguel] created 13/04/2016
        /// </history>
        private bool ValidateFilter(RateType rateType)
        {
            if (_nStatus != -1)//Filtro por estatus
            {
                if (rateType.raA != Convert.ToBoolean(_nStatus))
                {
                    return(false);
                }
            }

            if (_rateTypeFilter.raID > 0)//Filtro por ID
            {
                if (_rateTypeFilter.raID != rateType.raID)
                {
                    return(false);
                }
            }

            if (!string.IsNullOrWhiteSpace(_rateTypeFilter.raN))//Filtro por estatus
            {
                if (!rateType.raN.Contains(_rateTypeFilter.raN, StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #15
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));
            }
        }
Пример #16
0
        /// <summary>
        /// Funcion para inicializar los controles
        /// </summary>
        /// <history>
        /// [vipacheco] 23/03/2016 Created
        /// </history>
        private void cboRateType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            RateType _rateType = cboRateType.SelectedItem as RateType;

            if (_openBy == EnumOpenBy.Button)
            {
                if (_rateType != null)                             // Se verifica que el SelectedItem no sea null
                {
                    if (_rateType.raID >= 2 && _rateType.raID < 4) // Si es diferente de tipo External!
                    {
                        controlVisibility(Visibility.Collapsed, Visibility.Visible, Visibility.Collapsed);
                    }
                    else if (_rateType.raID == 4) // Es external
                    {
                        controlVisibility(Visibility.Visible, Visibility.Collapsed, Visibility.Visible);
                    }
                }
                else if (_modeOpen != EnumMode.ReadOnly)
                {
                    controlVisibility(Visibility.Collapsed, Visibility.Visible, Visibility.Collapsed);
                }

                // Se verifica que no sean un nuevo MealTicket
                if (_rateType != null && txtAdults.Text != "" && txtMinors.Text != "" && _meQty >= 1)
                {
                    txtTAdults.Text = string.Format("{0:$0.00}", CalculateAdult(((_rateType == null) ? 0 : _rateType.raID), ((_meQty >= 0) ? _meQty : 0), ((txtAdults.Text != "") ? Convert.ToInt32(txtAdults.Text) : 0)));
                }
            }
        }
Пример #17
0
        public bool RatePost(int postId, int profileId, RateType vote)
        {
            var post = _postRepository.GetPostById(postId);

            if ((post == null) ||
                (!_memberService.IsMember(profileId, post.GroupId)))
            {
                return(false);
            }

            var rate = post.Rating.FirstOrDefault(x => x.ProfileId == profileId);

            if (rate != null && rate.Value != vote)
            {
                rate.Value = vote;
            }
            else if (rate == null)
            {
                PostRate r = new PostRate
                {
                    ProfileId = profileId,
                    Value     = vote
                };
                post.Rating.Add(r);
            }
            return(_postRepository.UpdatePost(post) != null);
        }
Пример #18
0
 public bool Compress(string dir, string output, MethodType method, RateType rate, FormatType format)
 {
     ArchiveName = output;
     DirPath     = dir;
     //base.compressDirectory(zip, path, name);
     return(true);
 }
Пример #19
0
 public HotelRate(int _nights, RateType _rateType, string _boardType, Decimal _value)
 {
     Nights    = _nights;
     RateType  = _rateType;
     BoardType = _boardType;
     Value     = _value;
 }
Пример #20
0
        public bool RateComment(int commentId, int profileId, RateType vote)
        {
            var comm = _commentRepository.GetCommentById(commentId, x => x.Post, x => x.Rating);

            if ((comm == null) ||
                (!_memberService.IsMember(profileId, comm.Post.GroupId)))
            {
                return(false);
            }

            var rate = comm.Rating.FirstOrDefault(x => x.ProfileId == profileId);

            if (rate != null && rate.Value != vote)
            {
                rate.Value = vote;
            }
            else if (rate == null)
            {
                CommentRate r = new CommentRate
                {
                    ProfileId = profileId,
                    Value     = vote
                };
                comm.Rating.Add(r);
            }
            return(_commentRepository.UpdateComment(comm) != null);
        }
Пример #21
0
        public static double RateFromDF(double t, double df, RateType rateType)
        {
            switch (rateType)
            {
            case RateType.Exponential:
                return(Log(df) / -t);

            case RateType.Linear:
                return((1.0 / df - 1.0) / t);

            case RateType.SemiAnnualCompounded:
                return((Pow(df, -1.0 / (2.0 * t)) - 1.0) * 2.0);

            case RateType.QuarterlyCompounded:
                return((Pow(df, -1.0 / (4.0 * t)) - 1.0) * 4.0);

            case RateType.MonthlyCompounded:
                return((Pow(df, -12.0 * t) - 1.0) * 12.0);

            case RateType.YearlyCompounded:
                return(Pow(df, -1.0 * t) - 1.0);

            case RateType.DiscountFactor:
                return(df);

            default:
                throw new NotImplementedException();
            }
        }
Пример #22
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + RateType.GetHashCode();
                hash = hash * 59 + Description.GetHashCode();
                hash = hash * 59 + Active.GetHashCode();
                hash = hash * 59 + PeriodType.GetHashCode();

                if (Rate != null)
                {
                    hash = hash * 59 + Rate.GetHashCode();
                }

                hash = hash * 59 + IsPercentRate.GetHashCode();
                hash = hash * 59 + IsRateEditable.GetHashCode();
                hash = hash * 59 + IsIncludedInTotal.GetHashCode();
                hash = hash * 59 + IsInTotalEditable.GetHashCode();

                return(hash);
            }
        }
Пример #23
0
        //UpdateByToomType
        public bool UpdateByRateType(NewRateTypeSaveDTO data)
        {
            bool succeed = false;

            RateType rateType = null;

            //RateTypeLog rateTypeLog = null;

            //If id is 0, it means add a new Rate type
            if (data.ID == 0)
            {
                rateType              = new RateType();
                rateType.ActiveYN     = true; //New item should be activate automatic
                rateType.HotelCode    = data.HotelCode;
                rateType.RateTypeCode = data.RateTypeCode;
                rateType.InsertDate   = DateTime.Now;
                rateType.UpdateDate   = DateTime.Now;
                // rate type log data
                //rateTypeLog = new RateTypeLog();
                //rateTypeLog.ConciergeID = data.UserName;
                //rateTypeLog.RateTypeCode = data.RateTypeCode;
                //rateTypeLog.InsertDate = DateTime.Now;
            }
            else
            {
                rateType            = ratetypeRepo.GetById(data.ID);
                rateType.UpdateDate = DateTime.Now;
            }

            #region insert to table RateType_Code

            //Set value from Ui
            rateType.RateTypeCodeDescription = data.RateTypeCodeDescription;
            try
            {
                if (data.ID == 0)
                {
                    //if id is 0, then add new
                    ratetypeRepo.Add(rateType);
                    //ratetypeLogRepo.Add(rateTypeLog);
                }
                else
                {
                    //else update
                    ratetypeRepo.Update(rateType);
                }
                unitOfWork.Commit();

                succeed = true;
            }
            catch (Exception e)
            {
                logger.Error("Exception: " + e.ToString());
                throw;
            }
            #endregion

            return(succeed);
        }
Пример #24
0
        public async Task <int> GetCountByVideoIdAndRateTypeAsync(string videoId, RateType type)
        {
            var likesCount = await repository.All()
                             .Where(c => c.VideoId == videoId && c.Rating == type)
                             .CountAsync();

            return(likesCount);
        }
Пример #25
0
        public RateType GetById(Guid id)
        {
            RateType rateType = this._iogContext.RateTypes
                                .FirstOrDefault(rateTypeIterator =>
                                                rateTypeIterator.Id == id && rateTypeIterator.Active);

            return(rateType);
        }
Пример #26
0
        public ActionResult DeleteConfirmed(int id)
        {
            RateType rateType = db.RateTypes.Find(id);

            db.RateTypes.Remove(rateType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #27
0
 public void RateTypeTest(string input, RateType expected)
 {
     JsonDoc.Assert <EarningsRate, RateType>(
         input: new JsonDoc.String(nameof(EarningsRate.RateType), input),
         toProperty: e => e.RateType,
         shouldBe: expected
         );
 }
Пример #28
0
        /// <summary>
        /// Valida los campos obligatorios segun sea requerido
        /// </summary>
        /// <returns> False - Algun Campo Vacio | True - Campos llenados correctamente </returns>
        /// <history>
        /// [vipacheco] 01/04/2016 Created
        /// [vipahceco] 15/Agosto/2016 Modified -> Se valida que el ticket tenga pax asociados.
        /// </history>
        private bool ValidateGeneral()
        {
            MealTicketType ticketCurrent = cboType.SelectedItem as MealTicketType;

            if (frmMealTickets._guestID == 0)
            {
                RateType       rateType  = cboRateType.SelectedItem as RateType;
                PersonnelShort personnel = cboCollaborator.SelectedItem as PersonnelShort;
                AgencyShort    agency    = cboAgency.SelectedItem as AgencyShort;

                if (rateType == null)
                {
                    UIHelper.ShowMessage("Select an option of rate type, please", MessageBoxImage.Information);
                    return(false);
                }
                else if (rateType.raID >= 2 && rateType.raID < 4 && personnel == null)
                {
                    UIHelper.ShowMessage("Select a collaborator, please", MessageBoxImage.Information);
                    return(false);
                }
                else if (rateType.raID == 4 && (agency == null || txtRepresentative.Text == ""))
                {
                    UIHelper.ShowMessage("Select an agency and write the representative name in the field for External option.", MessageBoxImage.Information);
                    return(false);
                }
                else if (ticketCurrent == null)
                {
                    UIHelper.ShowMessage("Select an option of meal type, please", MessageBoxImage.Information);
                    return(false);
                }
                // Verificamos el Pax
                int adults, minors = 0;
                if (string.IsNullOrEmpty(txtAdults.Text) && string.IsNullOrEmpty(txtMinors.Text))
                {
                    UIHelper.ShowMessage("Set the Pax information, adults or minors", MessageBoxImage.Information);
                    return(false);
                }
                else if (int.TryParse(txtAdults.Text, out adults) && int.TryParse(txtMinors.Text, out minors))
                {
                    // Verificamos que no sean ambos 0
                    if (adults == 0 && minors == 0)
                    {
                        UIHelper.ShowMessage("Set the Pax information, adults or minors", MessageBoxImage.Information);
                        return(false);
                    }
                }
            }
            else
            {
                if (ticketCurrent == null)
                {
                    UIHelper.ShowMessage("Select an option of meal type, please", MessageBoxImage.Information);
                    return(false);
                }
            }

            return(true);
        }
Пример #29
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));
        }
Пример #30
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);
        }
Пример #31
0
 public AnimationRate( TimeSpan duration )
 {
     if( duration < TimeSpan.Zero )
       {
     throw new ArgumentException( ErrorMessages.GetMessage( ErrorMessages.NegativeTimeSpanNotSupported ) );
       }
       _speed = 0d;
       _duration = duration.Ticks;
       _rateType = RateType.TimeSpan;
 }
Пример #32
0
 public AnimationRate( double speed )
 {
     if( DoubleHelper.IsNaN( speed ) || speed < 0d )
       {
     throw new ArgumentException( ErrorMessages.GetMessage( ErrorMessages.NegativeSpeedNotSupported ) );
       }
       _duration = 0;
       _speed = speed;
       _rateType = RateType.Speed;
 }
        public IHttpActionResult Post(RateType applyAt)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            _RateTypeService.Create (applyAt);
             

            return Created(applyAt);
        }
Пример #34
0
 public void AddRateEntryToSlot(RateType rateType, decimal effectiveRate, decimal amount)
 {
     this.rateSlots[rateType].AddRateEntry(effectiveRate, amount);
 }
 public ActionResult Rate(int id, RateType type)
 {
     var userID = User.Identity.GetUserId();
     var new_rate = new AchivementRate()
     {
         AchivementID = id,
         AchivementType = AchivementTypes.Text,
         Type = type,
         UserID = userID
     };
     db.AchivementRates.Add(new_rate);
     db.SaveChanges();
     var rates = db.AchivementRates.Where(x => x.AchivementID == id && x.AchivementType == AchivementTypes.Text);
     var rate = rates.Where(x => x.Type == RateType.Positive).Count() - rates.Where(x => x.Type == RateType.Negative).Count();
     ViewBag.Rate = rate;
     ViewBag.IsRated = true;
     return PartialView("Rate");
 }
Пример #36
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;
 }
Пример #37
0
 private AnimationRate( bool ignore )
 {
     _duration = 0;
       _speed = double.NaN;
       _rateType = RateType.Speed;
 }