Ejemplo n.º 1
0
 /// <summary>
 /// 注册完成关闭注册窗体,返回Login窗体,并传递注册后的卡号到login
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     //获取用户注册的账号和密码
     if (registRpwd.Text != registpwd.Text)
     {
         MessageBox.Show("两次密码输入不一致!请重新输入!");
         registpwd.Text  = "";
         registRpwd.Text = "";
     }
     else
     {
         BankBLL  bankbll   = new BankBLL();
         UserInfo userInfo1 = new UserInfo();
         userInfo1.Card_Number   = this.RegistName.Text.ToString();
         userInfo1.Card_Password = this.registpwd.Text.ToString();
         //返回true表示注册成功,false表示注册失败
         bool result = bankbll.UserRegist(userInfo1);
         if (result == true)
         {
             MessageBox.Show("开卡成功!");
             //1、把当前注册的账号传递给登录窗口并跳转
             Form1 login = new Form1(RegistName.Text);
             login.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("开卡失败,请重新输入");
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>
        private void BindBanks(bool addRow, bool deleteRow)
        {
            BankBLL objBankBLL = new BankBLL();

            grdBanks.DataSource = objBankBLL.GetAllBanks("");
            grdBanks.DataBind();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Update Database Make data as Obsoluted
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                CheckBox    chk        = (CheckBox)sender;
                GridViewRow gr         = (GridViewRow)chk.Parent.Parent;
                string      BANK_ID    = ((Literal)gr.FindControl("litBankID")).Text;
                BankBLL     objBankBLL = new BankBLL();
                message = objBankBLL.ObsoleteBank(Convert.ToInt32(BANK_ID), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }

                ClearDetails();
                BindBanks(false, true);
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Search banks data from the database and set filterd data to Grid Data source
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SearchGrid()
        {
            string  bankName   = txtSearchBankName.Text.Trim();
            BankBLL objBankBLL = new BankBLL();

            grdBanks.DataSource = objBankBLL.GetAllBanks(bankName);
            grdBanks.DataBind();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Search banks data from the database and set filterd data to Grid Data source
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string  bankName   = txtSearchBankName.Text.Trim();
            BankBLL objBankBLL = new BankBLL();

            grdBanks.DataSource = objBankBLL.GetAllBanks(bankName);
            grdBanks.DataBind();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// to fill the banks from the batabase
        /// </summary>
        private void FillBanks()
        {
            BankBLL objBankBLL = new BankBLL();

            ddlBank.DataSource     = objBankBLL.GetBanks();
            ddlBank.DataValueField = "BankID";
            ddlBank.DataTextField  = "BankName";
            ddlBank.DataBind();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdBanks_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            try
            {
                if (e.CommandName == "EditRow")
                {
                    ShowHideSections(true, false);
                    ViewState["BANK_ID"] = e.CommandArgument;
                    BankBLL objBankBLL = new BankBLL();
                    BankBO  objBank    = objBankBLL.GetBankByBankID(Convert.ToInt32(ViewState["BANK_ID"]));

                    txtBankName.Text = objBank.BankName;
                    btnSave.Text     = "Update";
                    btnClear.Text    = "Cancel";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
                }

                else if (e.CommandName == "DeleteRow")
                {
                    BankBLL objBankBLL = new BankBLL();

                    message = objBankBLL.DeleteBank(Convert.ToInt32(e.CommandArgument));
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data deleted successfully";
                    }
                    ClearDetails();
                    BindBanks(false, true);
                }
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 窗体加载时产生随机数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Registered_Load(object sender, EventArgs e)
        {
            //调用生成卡号
            string account = CreateAccountNum();

            RegistName.Text = account;
            //RegistName.Text = "621288100105810458";
            //1、验证数据库是否存在当前生成的卡号
            UserInfo userInfo = new UserInfo();

            userInfo.Card_Number = this.RegistName.Text.ToString();
            //2、调用BLL
            BankBLL bankbll = new BankBLL();
            bool    result  = bankbll.RegistNumber(userInfo.Card_Number);

            //3、如果result返回true的结果,则重新调用生成卡号
            while (result != false)
            {
                //2、重新验证卡号是否存在
                MessageBox.Show("已经存在卡号");
                account = CreateAccountNum();
                result  = bankbll.RegistNumber(userInfo.Card_Number);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Save and Update Data into Database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BankBO objBank = new BankBO();

            objBank.BankID   = Convert.ToInt32(ViewState["BANK_ID"]);
            objBank.BankName = txtBankName.Text.Trim();

            BankBLL objBankBLL   = new BankBLL();
            string  AlertMessage = string.Empty;
            string  message      = string.Empty;

            if (objBank.BankID == 0)
            {
                objBank.CreatedBy = Convert.ToInt32(Session["USER_ID"]);
                message           = objBankBLL.AddBank(objBank);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                    ClearDetails();
                }
            }
            else
            {
                objBank.UpdatedBy = Convert.ToInt32(Session["USER_ID"]);
                message           = objBankBLL.UpdateBank(objBank);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                    ClearDetails();
                }
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);

            BindBanks(true, false);
        }
Ejemplo n.º 10
0
 private void readCard()
 {
     try
     {
         Thread.Sleep(1500);
         //等待用户插卡
         MachCardBLL.waitCard();
     }
     catch (ThreadAbortException ae) { log.Write("error:" + ae.Message); }
     catch (Exception ex)
     {
         log.Write("error:插卡页readCard():" + ex.Message);
     }
     while (true)
     {
         try
         {
             Thread.Sleep(700);
             //卡机内是否有卡
             if (!MachCardBLL.CardUsable())
             {
                 continue;
             }
             PrintInfo("正在读卡,请稍后...");
             Thread.Sleep(1500);
         }
         catch (ThreadAbortException ae) { log.Write("error:" + ae.Message); }
         catch (Exception ex)
         {
             log.Write("error:插卡页readCard():" + ex.Message);
         }
         try
         {
             //签到
             PayAccess.ReadSign();
             string wtNo = wt.GetCardNo();
             if (wtNo != null)
             {
                 if (wtNo.Length == 16)
                 {
                     if (SysBLL.payCostType == 3)
                     {
                         //退卡
                         MachCardBLL.backCard();
                         //等待用户插卡
                         MachCardBLL.waitCard();
                         PrintInfo("暂不支持此卡,请取卡");
                         return;
                     }
                     else
                     {
                         SysBLL.payCardType = 1;
                         SysBLL.payCardNo   = wtNo;
                         if (!pwdBLL.SetCryptMode(1))
                         {
                             throw new Exception("系统异常,请稍后再试...");                        //万通卡加密方式
                         }
                         pwdBLL.closeKey();
                         //pwdBLL.OpenKeyboard(SysConfigHelper.readerNode("ZT598Port"), "9600", wtNo);
                         if (!setPayParam(wtNo, null, wtNo))
                         {
                             //PrintInfo("业务异常,请稍后再试...");
                             //退卡
                             MachCardBLL.backCard();
                             //等待用户插卡
                             MachCardBLL.waitCard();
                             return;
                         }
                         ;
                         SysBLL.payTypeName = "甘肃一卡通";
                         WintopStatusInfo statusInfo = new WintopAccess().queryCardStatus(wtNo);
                         if ((statusInfo.msgrsp.WTSTATE == null) || (statusInfo.msgrsp.WTSTATE.Equals("")))
                         {
                             PrintInfo("业务正忙,请稍后再试");
                             //退卡
                             MachCardBLL.backCard();
                             //等待用户插卡
                             MachCardBLL.waitCard();
                             return;
                         }
                         if ("01".Equals(statusInfo.msgrsp.WTSTATE))
                         {
                             //执行下一步操作
                             this.Dispatcher.Invoke(new Action(() => { Util.JumpUtil.jumpCommonPage("FormInputPassword"); }));
                             return;
                         }
                         else
                         {
                             PrintInfo("该卡已挂失,无法正常使用");
                             //退卡
                             MachCardBLL.backCard();
                             //等待用户插卡
                             MachCardBLL.waitCard();
                             return;
                         }
                     }
                 }
             }
             dictionary = null;
             //银行卡
             dictionary = BankBLL.ReadBankCard();
             SysBLL.IcBankDictionary = dictionary;
             //if (SysBLL.payCostType == 3)
             //{
             SysBLL.payCardType = 0;
             SysBLL.payCardNo   = dictionary["cardNo"];
             if (!pwdBLL.SetCryptMode(0))
             {
                 throw new Exception("系统异常,请稍后再试...");                         //拉卡拉加密方式
             }
             pwdBLL.closeKey();
             //pwdBLL.OpenKeyboard(SysConfigHelper.readerNode("ZT598Port"), "9600", dictionary["cardNo"]);
             //if (!setPayParam("", dictionary, dictionary["cardNo"])) throw new Exception("查询失败");
             if (!setPayParam("", dictionary, dictionary["cardNo"]))
             {
                 return;
             }
             ;
             SysBLL.payTypeName = "银行卡";
             this.Dispatcher.Invoke(new Action(() => { Util.JumpUtil.jumpCommonPage("FormInputPassword"); }));
             return;
             //}
             //else
             //{
             //    //退卡
             //    MachCardBLL.backCard();
             //    //等待用户插卡
             //    MachCardBLL.waitCard();
             //    PrintInfo("暂不支持此卡,请取卡");
             //}
         }
         catch (ThreadAbortException ae)
         {
             log.Write("error:读卡失败:" + ae.Message);
             return;
         }catch (WtException we)
         {
             log.Write("error:读卡异常");
             PrintInfo("读取失败");
             //退卡
             MachCardBLL.backCard();
             //等待用户插卡
             MachCardBLL.waitCard();
         }
         catch (Exception ex)
         {
             log.Write("error:读卡异常:" + ex.Message);
             PrintInfo("读取失败");
             //退卡
             MachCardBLL.backCard();
             //等待用户插卡
             MachCardBLL.waitCard();
         }
         finally
         {
             //btnOkBg.Enabled = true;
         }
     }
 }