public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is Card other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((CardBrand == null && other.CardBrand == null) || (CardBrand?.Equals(other.CardBrand) == true)) && ((Last4 == null && other.Last4 == null) || (Last4?.Equals(other.Last4) == true)) && ((ExpMonth == null && other.ExpMonth == null) || (ExpMonth?.Equals(other.ExpMonth) == true)) && ((ExpYear == null && other.ExpYear == null) || (ExpYear?.Equals(other.ExpYear) == true)) && ((CardholderName == null && other.CardholderName == null) || (CardholderName?.Equals(other.CardholderName) == true)) && ((BillingAddress == null && other.BillingAddress == null) || (BillingAddress?.Equals(other.BillingAddress) == true)) && ((Fingerprint == null && other.Fingerprint == null) || (Fingerprint?.Equals(other.Fingerprint) == true)) && ((CardType == null && other.CardType == null) || (CardType?.Equals(other.CardType) == true)) && ((PrepaidType == null && other.PrepaidType == null) || (PrepaidType?.Equals(other.PrepaidType) == true)) && ((Bin == null && other.Bin == null) || (Bin?.Equals(other.Bin) == true))); }
void ValidateVictoryCard() { CardType playerCard = selected; CardType computerCard = computer.type; computer.FadeOut(); switch (selected) { case CardType.PAPER: paper.GetComponent <SpriteRenderer>().enabled = false; break; case CardType.ROCK: rock.GetComponent <SpriteRenderer>().enabled = false; break; case CardType.SCISSOR: scissor.GetComponent <SpriteRenderer>().enabled = false; break; } if (playerCard.Equals(computerCard)) { texts.DefineResult(GameResult.DRAW); } else if ((playerCard.Equals(CardType.ROCK) && computerCard.Equals(CardType.SCISSOR)) || (playerCard.Equals(CardType.PAPER) && computerCard.Equals(CardType.ROCK)) || (playerCard.Equals(CardType.SCISSOR) && computerCard.Equals(CardType.PAPER))) { texts.DefineResult(GameResult.PLAYER1_VICTORY); texts.PlayerVictory(); } else { texts.DefineResult(GameResult.PLAYER2_VICTORY); texts.ComputerVictory(); } }
private bool IsValidType(string cardNumber, CardType cardType) { // jcp //test card number 0123456782 if (cardType.Equals(CardType.jpcReward)) { return(cardNumber.Length >= 10 && cardNumber.Length <= 11); } // Visa if (Regex.IsMatch(cardNumber, "^(4)") && cardType.Equals(CardType.Visa)) { return(cardNumber.Length == 13 || cardNumber.Length == 16); } // MasterCard if (Regex.IsMatch(cardNumber, "^(51|52|53|54|55)") && cardType.Equals(CardType.MasterCard)) { return(cardNumber.Length == 16); } // Amex if (Regex.IsMatch(cardNumber, "^(34|37)") && cardType.Equals(CardType.Amex)) { return(cardNumber.Length == 15); } // Diners if (Regex.IsMatch(cardNumber, "^(300|301|302|303|304|305|36|38)") && cardType.Equals(CardType.Diners)) { return(cardNumber.Length == 14); } // Discover if (Regex.IsMatch(cardNumber, "^(6011)") && cardType.Equals(CardType.Discover)) { return(cardNumber.Length == 16); } //Unknown if (cardType.Equals(CardType.Unknown)) { return(true); } return(false); }
/// <summary> /// Item /// </summary> /// <returns></returns> async Task <IEnumerable <Item> > RefrishItems() { short defaultSale = 0; short defaultPurchase = 0; int branchId = MainWindow.branchID.Value; selectedItems = new List <int>(); if (CardType.Equals("sales")) { defaultSale = 1; defaultPurchase = 0; } else if (CardType.Equals("purchase")) { defaultPurchase = 1; defaultSale = 0; } else if (CardType.Equals("order")) { defaultPurchase = 0; defaultSale = 0; } else if (CardType.Equals("movement")) { defaultPurchase = -1; defaultSale = -1; } items = await itemModel.GetSaleOrPurItems(category.categoryId, defaultSale, defaultPurchase, branchId); MainWindow.InvoiceGlobalItemsList = items.ToList(); if (CardType == "order" || CardType == "sales") { MainWindow.InvoiceGlobalSaleUnitsList = await itemUnitModel.GetForSale(); } else { MainWindow.InvoiceGlobalItemUnitsList = await itemUnitModel.Getall(); } return(items); }
public void ObjectEqualsWrongTypeFalse() { object ct = new CardType("V"); Assert.IsFalse(ct.Equals(1)); }
public void ObjectEqualsNullFalse() { object ct = new CardType("V"); Assert.IsFalse(ct.Equals(null)); }
public void ObjectEqualsTrue() { object ct = new CardType("V"); Assert.IsTrue(ct.Equals(new CardType("V"))); }
public void EquitableEqualsFalse() { IEquatable <CardType> ct = new CardType("V"); Assert.IsFalse(ct.Equals(new CardType("M"))); }
private async void Btn_getAllCategory_Click(object sender, RoutedEventArgs e) { try { if (sender != null) { SectionData.StartAwait(grid_ucItems); } categoryParentId = 0; await RefrishCategoriesCard(); grid_categoryControlPath.Children.Clear(); //category.categoryId = 0; //await RefrishItems(); #region short defaultSale = 0; short defaultPurchase = 0; int branchId = MainWindow.branchID.Value; selectedItems = new List <int>(); if (CardType.Equals("sales")) { defaultSale = 1; defaultPurchase = 0; } else if (CardType.Equals("purchase")) { defaultPurchase = 1; defaultSale = 0; } else if (CardType.Equals("order")) { defaultPurchase = 0; defaultSale = 0; } else if (CardType.Equals("movement")) { defaultPurchase = -1; defaultSale = -1; } items = await itemModel.GetSaleOrPurItems(0, defaultSale, defaultPurchase, branchId); MainWindow.InvoiceGlobalItemsList = items.ToList(); if (CardType == "order" || CardType == "sales") { MainWindow.InvoiceGlobalSaleUnitsList = await itemUnitModel.GetForSale(); } else { MainWindow.InvoiceGlobalItemUnitsList = await itemUnitModel.Getall(); } #endregion Txb_searchitems_TextChanged(null, null); if (sender != null) { SectionData.EndAwait(grid_ucItems); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_ucItems); } SectionData.ExceptionMessage(ex, this); } }