Exemplo n.º 1
0
 public void AddCard(CreditCard card)
 {
     if (!this.cards.Contains(card))
     {
         this.cards.Add(card);
     }
 }
Exemplo n.º 2
0
 private void LeftTapped(object sender, TappedRoutedEventArgs e)
 {
     var cce = this.DataContext as CreditCardEditor;
     if (this.tbNO.Text.Length == 4)
     {
         var symbol = (sender as SymbolIcon).Symbol;
         var card = new CreditCard((Bank)this.cbBank.SelectedItem, this.tbNickname.Text, this.tbNO.Text, (int)this.cbOrderDay.SelectedItem, (int)this.cbPayDay.SelectedItem);
         if (symbol == Symbol.Accept)
         {
             if (CreditCardManager.GetInstance().GetAllCards().Contains(card))
             {
                 var x = new MessageDialog("卡片已经存在!", "提示").ShowAsync();
             }
             else
             {
                 CreditCardManager.GetInstance().AddCard(card);
                 cce.Status = Status.OK;
             }
         }
         else if (symbol == Symbol.Edit)
         {
             if (CreditCardManager.GetInstance().GetAllCards().Contains(card) && !card.Equals(cce.OrignalCard))
             {
                 var x = new MessageDialog("卡片已经存在!", "提示").ShowAsync();
             }
             else
             {
                 MessageDialog md = new MessageDialog("确定要修改卡片信息吗?", "询问");
                 md.Commands.Add(new UICommand("确定", cmd =>
                 {
                     CreditCardManager.GetInstance().ReplaceCard(cce.OrignalCard, card);
                     cce.Status = Status.OK;
                 }, 0));
                 md.Commands.Add(new UICommand("放弃", cmd =>
                 {
                 }, 1));
                 md.DefaultCommandIndex = 0;
                 md.CancelCommandIndex = 1;
                 var x = md.ShowAsync();
             }
         }
     }
 }
Exemplo n.º 3
0
 private void TestCode()
 {
     var zhaoshangCard = new CreditCard(Bank.Zhaoshang, "Young", "8888", 20, 5);
     var jiansheCard = new CreditCard(Bank.Jianshe, "", "1234", 5, 20);
     var jiaotongCard = new CreditCard(Bank.Jiaotong, "中中中中中中中中中中", "2333", 25, 8);
     var zhongxinCard = new CreditCard(Bank.Zhongxin, "iBai", "6666", 10, 3);
     ccm.AddCard(zhaoshangCard);
     ccm.AddCard(jiansheCard);
     ccm.AddCard(jiaotongCard);
     ccm.AddCard(zhongxinCard);
 }
Exemplo n.º 4
0
 public void ReplaceCard(CreditCard oldCard, CreditCard newCard)
 {
     if (this.cards.Contains(oldCard))
     {
         var index = this.cards.IndexOf(oldCard);
         this.cards.Remove(oldCard);
         this.cards.Insert(index, newCard);
     }
 }
Exemplo n.º 5
0
 public void RemoveCard(CreditCard card)
 {
     this.cards.Remove(card);
 }
Exemplo n.º 6
0
 public void setEditor(Status status, CreditCard card)
 {
     this.OrignalCard = card;
     this.Status = status;
     this.Bank = card.Bank;
     this.NickName = card.NickName;
     this.NO = card.NO;
     this.OrderDay = card.OrderDay;
     this.PayDay = card.PayDay;
 }