Exemplo n.º 1
0
 /// <summary>
 /// 添加卡功能
 /// </summary>
 private void add_card()
 {
     ThirdData.mark = 2;
     if (cardid.Text == "" || password_card.Text == "" || bankName.Text == "")
     {
         MessageBox.Show("银行卡,密码,银行名称不能为空!!!");
         cardid.Focus();
     }
     else
     {
         CardOpera cardOpera = new CardOpera();
         CardInfo cardInfo = ThirdData.cardInfo;
         cardInfo.UserId = ThirdData.user.Id;
         cardInfo.Cardid = cardid.Text;
         cardInfo.Password = password_card.Text;
         cardInfo.BankName = bankName.Text;
         cardInfo.Balance = 0;
         ThirdData.cardInfo = cardInfo;
         int num = cardOpera.addCard(cardInfo);
         if (num == 1)
         {
             MessageBox.Show("添加成功");
             ShowCard(ThirdData.cardInfo);
             okMain.Text = "交易";
             ThirdData.cardInfo = cardInfo;
         }
         else
         {
             MessageBox.Show("添加失败");
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 查找卡的功能
 /// </summary>
 private void searchCard()
 {
     string id = cardid.Text;
     string pwd = password_card.Text;
     if (id == "" || pwd == "")
     {
         MessageBox.Show("银行卡号或密码不能为空");
         if (id == "")
             cardid.Focus();
         else if (pwd == "")
             password_card.Focus();
     }
     else
     {
         CardOpera cardOpera = new CardOpera();
         CardInfo cardInfo = new CardInfo();
         cardInfo.Cardid = id;
         cardInfo.Password = pwd;
         cardInfo.UserId = ThirdData.user.Id;
         cardInfo = cardOpera.ViewCard(cardInfo);
         if (cardInfo == null)
         {
             MessageBox.Show("银行卡或者密码不正确!!!");
             cardid.Text = "";
             password_card.Text = "";
             cardid.Focus();
         }
         else
         {
             ShowCard(cardInfo);
         }
         okMain.Text = "交易";
         ThirdData.mark = 2;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 修改卡功能
        /// </summary>
        private void modify_card()
        {
            if (password_card.Text == "" && bankName.Text == "")
            {
                MessageBox.Show("密码和银行名称不能同时为空..");
                password_card.Focus();
            }
            else
            {
                CardInfo cardInfo = ThirdData.cardInfo;
                CardOpera cardOpera = new CardOpera();
                if (password_card.Text != "" && bankName.Text == "")
                    cardInfo.Password = password_card.Text;
                else if (password_card.Text == "" && bankName.Text != "")
                    cardInfo.BankName = bankName.Text;
                else
                {
                    cardInfo.BankName = bankName.Text;
                    cardInfo.Password = password_card.Text;
                }
                int num = cardOpera.ModifyCard(cardInfo);
                if (num == 1)
                {
                    MessageBox.Show("修改成功");
                    ThirdData.cardInfo = cardInfo;
                    ShowCard(ThirdData.cardInfo);
                    okMain.Text = "交易";

                }
                else
                    MessageBox.Show("修改失败");
                ThirdData.mark = 2;
            }
        }