public ChargesViewModel() { NewCharge = new Charge(); Charges = new ObservableCollection<Charge>(); //Persons.Add(new Person { Amount = 15, Name = "asd", Description = "sad" }); }
void Start() { jump = GetComponent<Jump> (); charge = GetComponent<Charge> (); anim = gameObject.GetComponent<Animator> (); score = GetComponent<PlayerScore>(); }
// true is rapid fire // false is charge // Use this for initialization void Start() { master = MasterPlayer.mainPlayer; rapid = GetComponentInChildren<Rapid> (); charge = GetComponentInChildren<Charge> (); reset (); }
public void RemoveChargeFromCharges(Charge c) { foreach (var person in ((App)Application.Current).personsViewModel.Persons) { person.Charges.Remove(c); } Charges.Remove(c); }
/// <summary> /// �`���[�W���[�^�[��쐬 /// </summary> public void CreateChargeParameterWindow(Charge targetCharge) { var chargeW = (Instantiate(chargeMeter) as GameObject).GetComponent<ChargeGaugeCreator>(); chargeW.parent = character; chargeW.transform.parent = transform.parent; chargeW.transform.localPosition = character.transform.localPosition; chargeW.transform.localScale = Vector3.one; chargeW.charge = targetCharge; }
public UserState(UserState other) { mValence = other.mValence; mArousal = other.mArousal; mTaskEngagement = other.mTaskEngagement; mSocialEngagement = other.mSocialEngagement; mAttentionFocus = other.mAttentionFocus; mAttention = other.mAttention; }
public UserState() { mValence = Charge.Neutral; mArousal = Charge.Neutral; mTaskEngagement = Charge.Neutral; mSocialEngagement = Charge.Neutral; mAttentionFocus = PointofFocus.NonApplicable; mAttention = Charge.Neutral; }
public IHttpActionResult Post(Charge Charge) { if (!ModelState.IsValid) { return BadRequest(ModelState); } _ChargeService.Create (Charge); return Created(Charge); }
public ChargeViewModel(Charge charge, IServiceFactory serviceFactory) { this._repositoryService = serviceFactory.RepositoryService; this._navigationService = serviceFactory.NavigationService; this._viewService = serviceFactory.ViewService; this._billedAmount = charge.BilledAmount; this._chargeId = charge.ChargeId; this._description = charge.Description; this._employeeId = charge.EmployeeId; this._expenseDate = charge.ExpenseDate; this._expenseReportId = charge.ExpenseReportId; this._location = charge.Location; this._merchant = charge.Merchant; this._notes = charge.Notes; this._transactionAmount = charge.TransactionAmount; this._modified = false; }
public void initCharge(Vector2 start, Vector2 target, bool grounded) { m_airChargeDestination = target; m_marker.mark(target); if(grounded) { AudioSource chargeSound = m_boostEffect.GetComponent<AudioSource>(); if (chargeSound && !chargeSound.isPlaying) chargeSound.Play(); m_currentCharge = new Charge(m_playerBody, m_groundStartChargeSpeed, m_groundEndChargeSpeed, target); } else { m_currentCharge = new Charge(m_playerBody, m_startChargeSpeed, m_endChargeSpeed, target); AudioSource chargeSound = GetComponent<AudioSource>(); if (chargeSound) chargeSound.Play(); } //changeFireColor(m_chargeColor); boostEffect(!grounded); }
public void ParseStringTest() { double value = 10F; string s = value.ToString(); Charge expected = new Charge(10F); Charge actual; actual = Charge.Parse(s); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void ParseProviderTest() { double value = 10F; string s = value.ToString(); IFormatProvider provider = null; // TODO: Initialize to an appropriate value Charge expected = new Charge(10F); Charge actual; actual = Charge.Parse(s, provider); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public async Task<IActionResult> SummaryPost(string stripeToken) //It`s not necessery to use parametr of OrderDetailsCart becouse of BindProperty { var claimsIdentity = (ClaimsIdentity)User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); detailCart.listCart = await _db.ShoppingCart.Where(c => c.ApplicationUserId == claim.Value).ToListAsync(); detailCart.OrderHeader.PaymentStatus = SD.PaymentStatusPending; detailCart.OrderHeader.OrderDate = DateTime.Now; detailCart.OrderHeader.UserId = claim.Value; detailCart.OrderHeader.Status = SD.PaymentStatusPending; detailCart.OrderHeader.PickUpTime = Convert.ToDateTime(detailCart.OrderHeader.PickUpDate.ToShortDateString() + " " + detailCart.OrderHeader.PickUpTime.ToShortTimeString()); List<OrderDetails> orderDetailsList = new List<OrderDetails>(); _db.OrderHeader.Add(detailCart.OrderHeader); await _db.SaveChangesAsync(); detailCart.OrderHeader.OrderTotalOriginal = 0; foreach (var item in detailCart.listCart) { item.MenuItem = await _db.MenuItem.FirstOrDefaultAsync(m => m.Id == item.MenuItemId); OrderDetails orderDetails = new OrderDetails { MenuItemId = item.MenuItemId, OrderId = detailCart.OrderHeader.Id, Description = item.MenuItem.Description, Name = item.MenuItem.Name, Price = item.MenuItem.Price, Count = item.Count }; detailCart.OrderHeader.OrderTotalOriginal += orderDetails.Count * orderDetails.Price; _db.OrderDetails.Add(orderDetails); } if (HttpContext.Session.GetString(SD.ssCouponCode) != null) { detailCart.OrderHeader.CouponCode = HttpContext.Session.GetString(SD.ssCouponCode); var couponFromDb = await _db.Coupon.Where(c => c.Name.ToLower() == detailCart.OrderHeader.CouponCode.ToLower()).FirstOrDefaultAsync(); detailCart.OrderHeader.OrderTotal = SD.DiscountedPrice(couponFromDb, detailCart.OrderHeader.OrderTotalOriginal); } else { detailCart.OrderHeader.OrderTotal = detailCart.OrderHeader.OrderTotalOriginal; } detailCart.OrderHeader.CouponCodeDiscount = detailCart.OrderHeader.OrderTotalOriginal - detailCart.OrderHeader.OrderTotal; _db.ShoppingCart.RemoveRange(detailCart.listCart); HttpContext.Session.SetInt32(SD.ssShoppingCartCount, 0); await _db.SaveChangesAsync(); var options = new ChargeCreateOptions { Amount = Convert.ToInt32(detailCart.OrderHeader.OrderTotal * 100), Currency = "USD", Description = "Order ID :" + detailCart.OrderHeader.Id, Source = stripeToken }; var service = new ChargeService(); Charge charge = service.Create(options); if (charge.BalanceTransactionId == null) { detailCart.OrderHeader.PaymentStatus = SD.PaymentStatusRejected; } else { detailCart.OrderHeader.TransactionId = charge.BalanceTransactionId; } if (charge.Status.ToLower() == "succeeded") { await _emailSender.SendEmailAsync(_db.Users.Where(u => u.Id == claim.Value).FirstOrDefault().Email, "Spice - Order Created " + detailCart.OrderHeader.Id.ToString(), "Order has been submitted successfully"); detailCart.OrderHeader.PaymentStatus = SD.PaymentStatusApproved; detailCart.OrderHeader.Status = SD.StatusSubmitted; } else { detailCart.OrderHeader.PaymentStatus = SD.PaymentStatusRejected; } await _db.SaveChangesAsync(); //return RedirectToAction("Index", "Home"); return RedirectToAction("Confirm", "Order", new { id = detailCart.OrderHeader.Id }); }
public void ToUInt64Test() { IConvertible target = new Charge(10F); IFormatProvider provider = null; ulong expected = 10; ulong actual; actual = target.ToUInt64(provider); Assert.AreEqual(expected, actual); }
public void ToSingleTest() { IConvertible target = new Charge(10F); IFormatProvider provider = null; float expected = 10F; float actual; actual = target.ToSingle(provider); Assert.AreEqual(expected, actual); }
public void ToInt32Test() { IConvertible target = new Charge(10.2324F); IFormatProvider provider = null; int expected = 10; int actual; actual = target.ToInt32(provider); Assert.AreEqual(expected, actual); }
public void ToDecimalTest() { IConvertible target = new Charge(10F); IFormatProvider provider = null; Decimal expected = new Decimal(10F); Decimal actual; actual = target.ToDecimal(provider); Assert.AreEqual(expected, actual); }
public FieldPoint(Charge charge) { InitializeComponent(); mcharge = charge; }
public async Task <IActionResult> OnPostAsync() { //values of the card to be used for payment var cardValues = new Dictionary <string, string> { { "card[number]", PaymentInfo.CardNumber }, { "card[exp_month]", PaymentInfo.ExpMonth }, { "card[exp_year]", PaymentInfo.ExpYear }, { "card[cvc]", PaymentInfo.CVC } }; //assign post request authorization headers client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "sk_test_1ZLIjXbcdEj6uuj8EzrIcFwH00527VvVTq"); //create the encoded url content from the post data var cardContent = new FormUrlEncodedContent(cardValues); //send the post request to get the purchase care todken var cardResponse = await client.PostAsync("https://api.stripe.com/v1/tokens", cardContent); //store the card token response object var cardResponseString = await cardResponse.Content.ReadAsStringAsync(); //convert the card token response back into JSON JObject cardToken = JObject.Parse(cardResponseString); //values of the charged payment with the charge token id var chargeValues = new Dictionary <string, string> { { "amount", (PaymentInfo.Amount * 100).ToString() }, { "currency", "usd" }, { "description", "Test Charge Through LMS" }, { "source", (string)cardToken.SelectToken("id") }//the token id from the charge }; //create the encoded url content from the post data var chargeContent = new FormUrlEncodedContent(chargeValues); //send the post request with the payment info to be charged var chargeResponse = await client.PostAsync("https://api.stripe.com/v1/charges", chargeContent); if (chargeResponse.IsSuccessStatusCode) { Charge charge = new Charge { Amount = -1 * (PaymentInfo.Amount), Date = DateTime.Now, Reason = "Student Account Payment", StudentId = _userManager.GetUserId(User) }; _context.Charge.Add(charge); _context.SaveChanges(); return(RedirectToPage("PaymentConfirmation", new { success = true })); } else { return(RedirectToPage("PaymentConfirmation", new { success = false })); } }
public async Task <ActionResult> contratLocationClient(String stripeToken, decimal idLocation) { Location currentLocation = db.Location.FirstOrDefault(p => p.id == idLocation); if (currentLocation == null) { TempData["result_code"] = -1; TempData["message"] = "Temps fourni pour le payment est expiré veuillez réessayer."; TempData.Keep(); //TODO rediriger a la liste des candidatures return(RedirectToAction("mesDemandeLocation")); } Inscrire candidat = db.Inscrire.Where(p => p.id == currentLocation.Ins_id).First(); if (candidat == null) { return(HttpNotFound()); } Inscrire client = db.Inscrire.Where(p => p.id == currentLocation.Ins_id2).First(); if (client == null) { return(HttpNotFound()); } if (String.IsNullOrEmpty(stripeToken)) { return(HttpNotFound()); } StripeConfiguration.SetApiKey("sk_test_51Gx6jgIK0UhIWHGbs9dcTW7tyGLkl39s6waxls9Z5D8E0arsL4bjy9N0g563Tlzo5JNvbeFOkAl5fMEY85eerPIx00mYJFiqLY"); var stripeOptions = new ChargeCreateOptions { Amount = (long)Math.Ceiling(currentLocation.remuneration.Value) * 35 / 100, // 1 dollar is equal to 100 cent. Currency = "USD", Description = "Charge for payment of 35% of Location", Source = stripeToken, //Customer = customer.Id }; var service = new ChargeService(); if (Session["id"] == null) { return(HttpNotFound()); } int idUserSession = Convert.ToInt32(Session["id"]); currentLocation.dateSgnClt = DateTime.Now; currentLocation.avisClient = 2; currentLocation.signClient = 2; db.Entry(currentLocation).State = EntityState.Modified; double amount = (long)Math.Ceiling(currentLocation.remuneration.Value) * 35 / 100; FraisLocation fraisLocation = new FraisLocation(); fraisLocation.archived = 1; fraisLocation.avance = amount; fraisLocation.created = DateTime.Now; fraisLocation.etat = 0; //TODO mettre le bon etat fraisLocation.Ins_id = candidat.id; fraisLocation.Ins_id2 = client.id; fraisLocation.Loc_id = currentLocation.id; fraisLocation.libelle = "Paiement de 35% pour la location"; fraisLocation.montant = Convert.ToDouble(currentLocation.remuneration); fraisLocation.userId = idUserSession; fraisLocation.reste = Convert.ToDouble(currentLocation.remuneration) - amount; fraisLocation.status = 0; //TODO mettre le bon status je suppose o veut dire non achevé db.FraisLocation.Add(fraisLocation); try { Charge charge = service.Create(stripeOptions); var map = new Dictionary <String, String>(); map.Add("@ViewBag.titre", "Paiement de 35% du salaire pour la location de l'employé " + candidat.login); map.Add("@ViewBag.login", client.login); map.Add("@ViewBag.content", "Votre paiement a bien été pris en compte. Le montant à été prélever de votre compte avec succès. Bénéficiez du meilleur de nos service."); string body = MsMail.BuldBodyTemplate("~/EmailTemplate/CustomEmail.cshtml", map); var map1 = new Dictionary <String, String>(); map1.Add("@ViewBag.titre", "Vous êtes sollicité pour un travail "); map1.Add("@ViewBag.login", candidat.login); map1.Add("@ViewBag.content", "Votre demande de location a été confimer. Vous êtes conviez a prendre service le plutôt possible."); string body2 = MsMail.BuldBodyTemplate("~/EmailTemplate/CustomEmail.cshtml", map1); MsMail mail = new MsMail(); MsMail mail2 = new MsMail(); db.SaveChanges(); //TODO retraviller le mail avec du HTML await mail.Send(client.email, "Paiement location", body); await mail2.Send(candidat.email, "NiovarJobs, Demande location accepté ", body2); //TODO rediriger a la liste des candidatures return(RedirectToAction("mesDemandeLocation")); } catch (StripeException e) { // throw; return(RedirectToAction("contratLocationClient", new { id = currentLocation.id })); } return(RedirectToAction("contratLocationClient", new { id = currentLocation.id })); }
public void ToBooleanTest() { IConvertible target = new Charge(20F); IFormatProvider provider = null; bool expected = true; bool actual = target.ToBoolean(provider); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); }
public void ToByteTest() { IConvertible target = new Charge(10F); IFormatProvider provider = null; byte expected = 0; byte actual; actual = target.ToByte(provider); Assert.AreEqual(expected, actual); Assert.Inconclusive("Convertion to byte from Charge is limited use with caution"); }
public void ToAmpereHoursTest() { Charge target = new Charge(10F); double expected = 0.0027777777777777779; double actual; actual = target.ToAmpereHours(); Assert.AreEqual(expected, actual); }
public void ToInt16Test() { IConvertible target = new Charge(10.16568F); IFormatProvider provider = null; short expected = 10; short actual; actual = target.ToInt16(provider); Assert.AreEqual(expected, actual); }
public void ToFaradayTest() { Charge target = new Charge(10F); double expected = 0.00010364268992774003; double actual; actual = target.ToFaraday(); Assert.AreEqual(expected, actual); }
public void ToSByteTest() { IConvertible target = new Charge(10F); IFormatProvider provider = null; sbyte expected = 10; sbyte actual; actual = target.ToSByte(provider); Assert.AreEqual(expected, actual); }
public void ToStringProviderTest() { double value = 10F; Charge target = new Charge(10F); IFormatProvider provider = null; string expected = value.ToString(); string actual; actual = target.ToString(provider); Assert.AreEqual(expected, actual); }
public void ToTypeTest() { IConvertible target = new Charge(10F); Type conversionType = typeof(Double); IFormatProvider provider = null; object expected = (double)10; object actual; actual = target.ToType(conversionType, provider); Assert.AreEqual(expected, actual); }
public FieldPoint() { InitializeComponent(); mcharge = new Charge(); }
public void ToAbcoulombsTest() { Charge target = new Charge(10F); double expected = 1F; double actual; actual = target.ToAbcoulombs(); Assert.AreEqual(expected, actual); }
public void CreateCharge(Charge charge) { chargeRepository.Add(charge); }
public void ToAtomicUnitsOfChargeTest() { Charge target = new Charge(1F); double expected = 6.2415097445115249E+18; double actual; actual = target.ToAtomicUnitsOfCharge(); Assert.AreEqual(expected, actual); }
public void GetTypeCodeTest() { Charge target = new Charge(10F); TypeCode expected = new TypeCode(); expected = TypeCode.Double; TypeCode actual = target.GetTypeCode(); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); }
public void ToStatcoulombsTest() { Charge target = new Charge(10F); double expected = 29979245368.431435; double actual; actual = target.ToStatcoulombs(); Assert.AreEqual(expected, actual); }
public void ParseStyleTest() { double value = 10F; string s = value.ToString(); NumberStyles style = new NumberStyles(); style = NumberStyles.Any; Charge expected = new Charge(); Charge actual = Charge.Parse(s, style); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); }
public void ToStringFormatTest() { double value = 10F; Charge target = new Charge(10F); string format = string.Empty; string expected = value.ToString(); string actual; actual = target.ToString(format); Assert.AreEqual(expected, actual); }
public IActionResult SummaryPost(string stripeToken) { var claimsIdentity = (ClaimsIdentity)User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); ShoppingCartVM.OrderHeader.ApplicationUser = _unitOfWork.ApplicationUser.GetFirstOrDefault(c => c.Id == claim.Value, includeProperties: "Company"); ShoppingCartVM.ListCart = _unitOfWork.ShoppingCart .GetAll(c => c.ApplicationUserId == claim.Value, includeProperties: "Product"); ShoppingCartVM.OrderHeader.PaymentStatus = SD.PaymentStatusPending; ShoppingCartVM.OrderHeader.OrderStatus = SD.StatusPending; ShoppingCartVM.OrderHeader.ApplicarionUserId = claim.Value; ShoppingCartVM.OrderHeader.OrderDate = DateTime.Now; _unitOfWork.OrderHeader.Add(ShoppingCartVM.OrderHeader); _unitOfWork.Save(); foreach (var item in ShoppingCartVM.ListCart) { item.Price = SD.GetPriceBasedOnQuantity(item.Count, item.Product.Price, item.Product.Price50, item.Product.Price100); OrderDetail orderDetails = new OrderDetail() { ProductId = item.ProductId, OrderId = ShoppingCartVM.OrderHeader.Id, Price = item.Price, Count = item.Count }; ShoppingCartVM.OrderHeader.OrderTotal += orderDetails.Count * orderDetails.Price; _unitOfWork.OrderDetail.Add(orderDetails); } _unitOfWork.ShoppingCart.RemoveRange(ShoppingCartVM.ListCart); _unitOfWork.Save(); HttpContext.Session.SetInt32(SD.ssShopingCart, 0); if (stripeToken == null) { //order will be created for delayed payment for authorized company ShoppingCartVM.OrderHeader.PaymentDueDate = DateTime.Now.AddDays(30); ShoppingCartVM.OrderHeader.PaymentStatus = SD.PaymentStatusDelayedPayment; ShoppingCartVM.OrderHeader.OrderStatus = SD.StatusApproved; } else { //process payment var options = new ChargeCreateOptions { Amount = Convert.ToInt32(ShoppingCartVM.OrderHeader.OrderTotal * 100), Currency = "usd", Description = "Order ID: " + ShoppingCartVM.OrderHeader.Id, Source = stripeToken }; var service = new ChargeService(); Charge charge = service.Create(options); if (charge.BalanceTransactionId == null) { ShoppingCartVM.OrderHeader.PaymentStatus = SD.PaymentStatusRejected; } else { ShoppingCartVM.OrderHeader.TransactionId = charge.BalanceTransactionId; } if (charge.Status.ToLower() == "succeeded") { ShoppingCartVM.OrderHeader.PaymentStatus = SD.PaymentStatusApproved; ShoppingCartVM.OrderHeader.OrderStatus = SD.StatusApproved; ShoppingCartVM.OrderHeader.PaymentDate = DateTime.Now; } } _unitOfWork.Save(); return(RedirectToAction("OrderConfirmation", "Cart", new { id = ShoppingCartVM.OrderHeader.Id })); }