private void Done(object sender, EventArgs e) { if (IsFieldsEmpty()) { this.ShowMessage(Resource.String.please_fill_all_fields); return; } var userMoneyModel = new MoneyModel() { Description = edtDescription.Text, Amount = long.Parse(edtAmount.Text), Group = feeGroup.Id, Time = deadLine }; var progressDialog = this.CreateDialog(GetString(Resource.String.adding_fee), GetString(Resource.String.wait)); progressDialog.Show(); this.DoRequest(MoneysController.Instance.Add(userMoneyModel), () => { progressDialog.Dismiss(); this.ShowMessage(Resource.String.create_fee_success); SetResult(Result.Ok); Finish(); }); }
public InsuredEmployment() { RevenuAnnuelSalarie = new MoneyModel() { Min = 0, Max = 9999999999, MaxLength = 10, AcceptDecimals = true }; RevenuAnnuelAutonome = new MoneyModel() { Min = 0, Max = 9999999999, MaxLength = 10, AcceptDecimals = true }; DateFinEmploi = DateModel.CreateLastFiveYearsDateModel(); DateFinTravailAutonome = DateModel.CreateLastFiveYearsDateModel(); AdresseEntreprise = new AddressModel(false); PourcentagePhysique = new SliderModel() { Name = nameof(PourcentagePhysique), StepValue = 1, MaxValue = 100, MinValue = 0, Value = "0" }; PourcentagePhysiqueAutonome = new SliderModel() { Name = nameof(PourcentagePhysiqueAutonome), StepValue = 1, MaxValue = 100, MinValue = 0, Value = "0" }; }
public MoneyController(Roulette r) { _Container = r; _moneyView = new MoneyView(this); _moneyModel = new MoneyModel(); }
public List <MoneyModel> ParseFileFromLocalStore() { lock (sync) { const string tableTag = "//table"; const string tableRowTag = ".//tr"; const string tableColTag = ".//td"; const string tableId = "DataGrid1"; string FileName = Resources.DestinationName; List <MoneyModel> courseList = new List <MoneyModel>(); HtmlDocument doc = new HtmlDocument(); doc.Load(FileName); if (doc != null) { // Get all tables in the document HtmlNodeCollection tables = doc.DocumentNode.SelectNodes(tableTag); HtmlNodeCollection tablerows = null; for (int i = 0; i < tables.Count; ++i) { if (tables[i].Id == tableId) { tablerows = tables[i].SelectNodes(tableRowTag); } } //start from 1 to ignore table headers for (int i = 1; i < tablerows.Count; ++i) { HtmlNodeCollection tablecolumns = tablerows[i].SelectNodes(tableColTag); string ISOID1 = tablecolumns[0].InnerText; string CharacterCode1 = tablecolumns[1].InnerText; string CurrencyCount1 = tablecolumns[2].InnerText; string CurrencyName1 = tablecolumns[3].InnerText; string CurrencyCource1 = tablecolumns[4].InnerText; MoneyModel tmp = new MoneyModel(); //UTF8Encoding utf8 = new UTF8Encoding(); tmp.ISOID = Convert.ToInt32(ISOID1); tmp.CharacterCode = CharacterCode1; tmp.CurrencyCount = Convert.ToDouble(CurrencyCount1); tmp.CurrencyName = CurrencyName1; tmp.CurrencyCource = Convert.ToDouble(CurrencyCource1.Replace('.', ',')); courseList.Add(tmp); } } return(courseList); } }
public IActionResult Delete(Guid id) { var model = new MoneyModel(); model.DeleteMove(id); return(RedirectToAction("Month", "Reports", new { id = model.ReportUrl })); }
public IActionResult Uncheck(Guid id, PrimalMoveNature nature) { var model = new MoneyModel(); var line = model.UncheckMove(id, nature); return(PartialView("../Reports/MoveLine", line)); }
public ActionResult MoneyAccount() { MoneyModel moneyModel = new MoneyModel { Money = 100, UserId = int.Parse(User.Identity.Name) }; return(View(moneyModel)); }
public PaymentModel( MoneyModel cost, DateTime date, string method) { this.Cost = cost; this.Date = date; this.Method = method; }
public void ExchangeMoney(int id, MoneyModel money, CurrencyModel to) { _balance.ExchangeMoney(money, to); foreach (var currency in _balance.GetCurrencies()) { _balanceDataManager.UpdateMoneyAmount(id, currency.Key.currencyId, currency.Value); } }
/// <summary> /// 读取工资设定 /// </summary> /// <param name="name"></param> /// <returns></returns> private static MoneyModel OpenSet() { FileStream fs = new FileStream(Directory.GetCurrentDirectory() + @"\Config\Model.XML", FileMode.OpenOrCreate, FileAccess.Read); BinaryFormatter bf = new BinaryFormatter(); MoneyModel mm = (MoneyModel)bf.Deserialize(fs); fs.Close(); return(mm); }
public IActionResult GetEventsByMoney([FromBody] MoneyModel moneyModel, int km) { var events = _eventService.GetEventsByMoney(moneyModel.UserId, km, moneyModel.MinMoney, moneyModel.MaxMoney); if (events == null) { return(Ok(0)); } return(Ok(events)); }
public VegasSolitaireMainViewModel(IEventAggregator aggregator, CommandContainer command, IGamePackageResolver resolver, MoneyModel money ) : base(aggregator, command, resolver) { _money1 = money; Money = money.Money; }
public ActionResult MoneyAccount(MoneyModel moneyModel) { if (ModelState.IsValid) { MoneyAccount moneyAccount = new MoneyAccount(unitOfWork); moneyAccount.AddMoney(moneyModel.UserId, moneyModel); return(RedirectToAction("Index", "Account")); } return(View()); }
public void AddMoney(int id, MoneyModel moneyModel) { var user = _unitOfWork.Users.GetItemById(id); _unitOfWork.Dispose(); _unitOfWork = new UnitOfWork(); user.Money += moneyModel.Money; _unitOfWork.Users.UpdateItem(user); _unitOfWork.Save(); }
public void AddMoney(MoneyModel money) { if (currencies.ContainsKey(money.currency)) { currencies[money.currency] = (currencies[money.currency] + money.amount); } else { currencies.Add(money.currency, money.amount); } }
public CreateBudgetModel( string description, MoneyModel limit, RecurrenceModel recurrence, CategoryModel category) { this.Description = description; this.Limit = limit; this.Recurrence = recurrence; this.Category = category; }
public void ChargeMoney(MoneyModel money) { if (currencies.ContainsKey(money.currency)) { currencies[money.currency] = (currencies[money.currency] - money.amount); } else { currencies.Add(money.currency, money.amount * -1); } }
public void ExchangeMoney(MoneyModel moneyFrom, CurrencyModel currencyTo) { double ratio = Math.Round(moneyFrom.currency.ratio / currencyTo.ratio, 2); AddMoney(new MoneyModel { currency = currencyTo, amount = (Math.Round(moneyFrom.amount * ratio * 100) / 100) }); ChargeMoney(moneyFrom); }
public IActionResult Register(UserModel model, string returnUrl) { if (model.Login == null || model.Password == null || Regex.Matches(model.Login, @"[a-zA-Z0-9]").Count == 0 || Regex.Matches(model.Password, @"[a-zA-Z0-9]").Count == 0 ) { ModelState.AddModelError("Login", "Invalid login or password"); return(View(model)); } if (db.Users.FirstOrDefault(u => u.Login == model.Login) != null) { ModelState.AddModelError("Login", "Login already claimed"); return(View(model)); } string salt = model.Login; UserModel user = new UserModel(); MoneyModel money = new MoneyModel(); user.Money = money; user.Login = model.Login; user.Password = getHash(salt + model.Password); _logger.LogInformation("Auth controller - Register method. Login: "******" Password hash: " + user.Password); db.Money.Add(money); db.SaveChanges(); user.Id = money.Id; _logger.LogInformation(db.SaveChanges().ToString()); user.GameStats = new GameStatsModel() { chips_earned = 0, Loses = 0, Wins = 0, Id = money.Id }; db.Users.Add(user); db.SaveChanges(); db.GameStats.Add(user.GameStats); db.SaveChanges(); TempData["login"] = user.Login; return(RedirectToAction("SuccessRegister")); }
private void CreateMoneyController() { MoneyModel = new MoneyModel(); MoneyController MCont = new MoneyController { View = MoneyView, Model = MoneyModel }; MCont.Init(); MoneyModel.Money = 40; }
public AboutBenefitModel() { RequestedAmount = new MoneyModel() { Min = 1, Max = 100000, MaxLength = 6, AcceptDecimals = false }; Diagnosis = ""; PhysicianInfo = new PhysicianModel(); }
public MoneyModel MakeChange(float amount) { MoneyModel moneyObj = new MoneyModel(); decimal amountDec = (decimal)amount; moneyObj.SilverDollars = GetDollars(ref amountDec); moneyObj.HalfDollars = GetHalfDollars(ref amountDec); moneyObj.Quarters = GetQuarters(ref amountDec); moneyObj.Dimes = GetDimes(ref amountDec); moneyObj.Nickels = GetNickels(ref amountDec); moneyObj.Pennies = GetPennies(ref amountDec); return(moneyObj); }
public async Task <JsonResult> GetChips() { UserModel user = await db.Users.FirstOrDefaultAsync(u => u.Login == User.Identity.Name); MoneyModel moneyModel = await db.Money.FirstOrDefaultAsync(m => m.Id == user.Id); decimal money = moneyModel.Chips; _logger.LogDebug(money.ToString()); return(Json(new { chips = money })); }
public void SetMoney(int id, MoneyModel money) { _balance.AddMoney(new MoneyModel { currency = money.currency, amount = money.amount }); _balanceDataManager.UpdateMoneyAmount( id, money.currency.currencyId, money.amount ); }
private BudgetModel( string id, string description, MoneyModel limit, RecurrenceModel recurrence, CategoryModel category, PeriodModel?period) { this.Id = id; this.Description = description; this.Limit = limit; this.Recurrence = recurrence; this.Category = category; this.Period = period; }
private void Init() { var content = Intent.GetStringExtra("MoneyDetail"); moneyModel = JsonConvert.DeserializeObject <MoneyModel>(content); feeGroup = AppConstantValues.FeeGrooups.Find(x => x.Id.Equals(moneyModel.Group)); deadLine = moneyModel.Time; tvTitle.Text = GetString(Resource.String.edit_fee); edtDescription.Text = moneyModel.Description; edtAmount.Text = moneyModel.Amount.ToString(); edtChooseFeeGroup.Text = GetString(feeGroup.TitleId); imgViewChooseFeeGroup.SetImageResource(feeGroup.ImageId); edtDeadline.Text = deadLine.ToDateString(); }
public List <Currency> GetAllCurrencies() { List <Currency> listCurrencies = new List <Currency>(); model = new MoneyModel(); foreach (MoneyEntities.Money dbCurrency in model.Money.ToList()) { Currency currency = new Currency(); currency.CurrencyId = dbCurrency.CurrencyId; currency.CurrencyValue = Convert.ToDecimal(dbCurrency.CurrencyValue); currency.CurrencyType = dbCurrency.CurrencyType; listCurrencies.Add(currency); } return(listCurrencies); }
//[ValidateAntiForgeryToken] public ActionResult Create(MoneyModel moneyModel) { if (ModelState.IsValid) { var account = new AccountBook(); account.Id = Guid.NewGuid(); account.Categoryyy = Convert.ToInt32(moneyModel.Type); account.Amounttt = Convert.ToInt32(moneyModel.Money); account.Remarkkk = moneyModel.Remark; _accountBookService.Add(account); _accountBookService.Save(); return(RedirectToAction("AccountingBook")); } return(View(moneyModel)); }
public bool TryConvert(MoneyModel o, out IMoney result) { result = null; if (o == null) { return(false); } result = new Money { Amount = o.Amount, CurrencyId = o.CurrencyId }; return(true); }
public List <MoneyModel> Get() { var getdata = db.AccountBook.Take(100).ToList(); List <MoneyModel> MoneyList = new List <MoneyModel>(); var i = 1; foreach (var data in getdata) { var result = new MoneyModel(); result.SN = i++; result.type = data.Categoryyy == 1 ? "支出" : "收入"; result.date = data.Dateee; result.price = data.Amounttt.ToString("#,0"); result.others = data.Remarkkk; MoneyList.Add(result); } return(MoneyList); }
public IActionResult BlackJack() { if (!User.Identity.IsAuthenticated) { ModelState.AddModelError("Login", "Please, login in"); return(RedirectToAction("Loginin", "Authentication")); } UserModel userModel = db.Users.FirstOrDefault(u => u.Login == User.Identity.Name); MoneyModel moneyModel = db.Money.FirstOrDefault(u => u.Id == userModel.Id); GameStatsModel gameStatsModel = db.GameStats.FirstOrDefault(u => u.Id == userModel.Id); userModel.Money = moneyModel; userModel.GameStats = gameStatsModel; return(View(userModel)); }