예제 #1
0
 public void AddCard(CreditCard card)
 {
     if (!this.cards.Contains(card))
     {
         this.cards.Add(card);
     }
 }
예제 #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();
             }
         }
     }
 }
예제 #3
0
파일: CardsPage.xaml.cs 프로젝트: feong/CC
 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);
 }
예제 #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);
     }
 }
예제 #5
0
 public void RemoveCard(CreditCard card)
 {
     this.cards.Remove(card);
 }
예제 #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;
 }