private void button2_Click(object sender, EventArgs e)
        {
            Users_DB user = new Users_DB();

            user.fname    = txt_fname.Text;
            user.lname    = txt_lname.Text;
            user.email    = txt_email.Text;
            user.phone    = txt_phone.Text;
            user.aadhar   = txt_aadhar.Text;
            user.username = txt_username.Text;
            if (txt_password.Text == txt_conf_password.Text)
            {
                user.password = txt_password.Text;
                user.AddAccount(user);
                MessageBox.Show("Account succesfullly created! you can log in now");
                MessageBox.Show("You ge]ot 500rs credit as your welcome gift.");
                Account_DB acc = new Account_DB();
                user.id = new Users_DB().getID(user.email);
                acc.insertBalanceForNew(user, 500);
                this.Close();
                new LoginForm().Show();
            }
            else
            {
                MessageBox.Show("password didnt match!!");
            }
        }
Exemple #2
0
        public void deleteTransactions(Users_DB user)
        {
            String        query = String.Format("delete from transactions where userid={0}", user.id);
            BuisnessLogic bl    = new BuisnessLogic();

            bl.NonQuery(query);
        }
Exemple #3
0
        public void DeleteUser(Users_DB user)
        {
            String        query = String.Format("delete from users where id={0}", user.id);
            BuisnessLogic bl    = new BuisnessLogic();

            bl.NonQuery(query);
        }
Exemple #4
0
        public void AddAccount(Users_DB user)
        {
            String        query = String.Format("insert into [users]([fname],[lname],[email],[phone],[aadhar],[username],[password]) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", user.fname, user.lname, user.email, user.phone, user.aadhar, user.username, user.password);
            BuisnessLogic bl    = new BuisnessLogic();

            bl.NonQuery(query);
        }
Exemple #5
0
        public void ChangePassword(Users_DB user)
        {
            String        queruy = String.Format("update [users] set [password]='{0}' where [id]={1}", user.password, user.id);
            BuisnessLogic bl     = new BuisnessLogic();

            bl.NonQuery(queruy);
        }
Exemple #6
0
        public bool Authenticate(Users_DB user)
        {
            string          query  = String.Format("select * from users where username='******' and 'password={1}'", user.username, user.password);
            BuisnessLogic   bl     = new BuisnessLogic();
            OleDbDataReader reader = bl.SelectQuery(query);

            if (reader.Read())
            {
                Users_DB ud = new Users_DB();
                ud.id       = reader[0].ToString();
                ud.fname    = reader[1].ToString();
                ud.lname    = reader[2].ToString();
                ud.email    = reader[3].ToString();
                ud.phone    = reader[4].ToString();
                ud.aadhar   = reader[5].ToString();
                ud.username = reader[6].ToString();
                ud.password = reader[7].ToString();
                Session.CreateSession(ud);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void btn_cng_pass_Click(object sender, EventArgs e)
        {
            Users_DB user     = new Users_DB();
            String   currpass = txt_curr_pass.Text;
            String   new_pass = txt_new_pass.Text;

            if (currpass == Session.user.password)
            {
                if (new_pass == txt_conf_newpass.Text)
                {
                    user.password = new_pass;
                    user.id       = Session.user.id;
                    user.ChangePassword(user);
                    MessageBox.Show("Password Succesfully Changed");
                }
                else
                {
                    MessageBox.Show("New Password and Confirm password didnt match");
                }
            }
            else
            {
                MessageBox.Show("Incorrect current password");
            }
        }
        public void insertBalanceForNew(Users_DB user, int bal)
        {
            String        query = String.Format("insert into account(userid,balance) values ({0},{1})", user.id, bal);
            BuisnessLogic bl    = new BuisnessLogic();

            bl.NonQuery(query);
        }
        public void transfer(Users_DB user, int beneficiary, int amt)
        {
            string        q1 = String.Format("update account set balance =balance - {0} where userid ={1}", amt, user.id);
            string        q2 = String.Format("update account set balance =balance + {0} where userid ={1}", amt, beneficiary);
            BuisnessLogic bl = new BuisnessLogic();

            bl.NonQuery(q1);
            bl.NonQuery(q2);
        }
Exemple #10
0
 public static void  CreateSession(Users_DB user1)
 {
     id       = user1.id;
     fname    = user1.fname;
     lname    = user1.lname;
     email    = user1.email;
     aadhar   = user1.aadhar;
     phone    = user1.phone;
     username = user1.username;
     password = user1.password;
     user     = user1;
 }
Exemple #11
0
        private void button2_Click(object sender, EventArgs e)
        {
            Users_DB user = new Users_DB();

            user.username = txt_uname.Text;
            user.password = txt_pass.Text;
            bool res = user.Authenticate(user);

            if (res)
            {
                MessageBox.Show("Login Successfull");

                new Home().Show();
                this.Close();
            }
        }
 public void updatebalance(Users_DB user, int amt, String mode)
 {
     if (mode == "add")
     {
         String query = String.Format("update account set balance=balance + {0} where userid={1}", amt, user.id);
         Console.Write(query);
         BuisnessLogic bl = new BuisnessLogic();
         bl.NonQuery(query);
     }
     if (mode == "withdraw")
     {
         String        query = String.Format("update account set balance=balance - {0} where userid={1}", amt, user.id);
         BuisnessLogic bl    = new BuisnessLogic();
         bl.NonQuery(query);
     }
 }