Example #1
0
        public void WithdrawAmt()
        {
            WithdrawMoney withdrmnyscrn = new WithdrawMoney();

            withdrmnyscrn.Show();
            childvmm1.CardNo1 = CardNo;
            childvmm1.Pin1    = Pin;
        }
Example #2
0
        public void CheckPin()
        {
            try
            {
                using (OracleConnection con = new OracleConnection(ConString))
                {
                    con.Open();
                    OracleCommand     cmd = new OracleCommand("SELECT count(*) FROM customer1 where card_no=" + CardNo + " and card_pin=" + Pin + " ", con);
                    OracleDataAdapter oda = new OracleDataAdapter(cmd);
                    DataTable         dt  = new DataTable(); //this is creating a virtual table
                    oda.Fill(dt);

                    if (dt.Rows[0][0].ToString() == "1")
                    {
                        /* I have made a new page called home page. If the user is successfully authenticated then the form will be moved to the next form */
                        OracleCommand cmd1 = new OracleCommand("SELECT c_name FROM Customer1 where card_no='" + CardNo + "' and card_pin='" + Pin + "' ", con);
                        // OracleDataAdapter oda = new OracleDataAdapter(cmd);
                        OracleDataReader odr = cmd1.ExecuteReader();
                        if (odr.Read())
                        {
                            MessageBox.Show("Welcome " + Convert.ToString(odr.GetValue(0)));
                            cust_card_no = CardNo;
                            cust_pin     = Pin;
                            ministatementViewModel mns = new ministatementViewModel();
                            mns.cust_card_no = cust_card_no;
                            cust_name        = Convert.ToString(odr.GetValue(0));
                        }
                        // MessageBox.Show("SUCCESS");
                        Menuscreen    menuscrn      = new Menuscreen();
                        WithdrawMoney withdrmnyscrn = new WithdrawMoney();

                        /* MainWindow mainw =new MainWindow();
                         * mainw.Close();
                         * mainw.Hide(); */
                        menuscrn.Show();

                        //withdrmnyscrn.Show();
                        menuscrn.DataContext = childvm;
                        /// withdrmnyscrn.DataContext = childvmm;
                        // childvmm.CardNo1 = CardNo;
                        childvm.CardNo = CardNo;
                        childvm.Pin    = Pin;
                        /// childvmm.cust_card_no = CardNo;
                        ///childvmm.Pin1 = Pin;
                        childvm.Custlbl = "Hi, " + Convert.ToString(odr.GetValue(0));
                        ///childvmm.cust_name = Convert.ToString(odr.GetValue(0));
                    }
                    else
                    {
                        MessageBox.Show("Invalid username or password");
                    }

                    //  datagridview1.ItemsSource=dt.DefaultView;
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }