Example #1
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);
        }
Example #2
0
        public void AddTransaction(Transaction_DB transc)
        {
            String        query = String.Format("insert into transactions(date_and_time,description, credit, debit,balance,userid) values('{0}','{1}','{2}','{3}','{4}',{5})", transc.date, transc.desc, transc.credit, transc.debit, transc.balance, transc.userid);
            BuisnessLogic bl    = new BuisnessLogic();

            bl.NonQuery(query);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
            }
        }
        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);
        }
Example #8
0
        public void fillGridTop5(DataGridView GV)
        {
            string        query = String.Format("SELECT top 5 date_and_time,description,credit,debit,balance FROM Transactions  where userid={0} order by date_and_time desc", Session.user.id);
            BuisnessLogic bl    = new BuisnessLogic();
            DataSet       ds    = bl.Adapter(query);

            GV.DataSource = ds.Tables[0];
        }
Example #9
0
        public void fillGrid(DataGridView GV)
        {
            string        query = String.Format("select transaction_id,date_and_time,description,credit,debit,balance from transactions where userid={0}", Session.user.id);
            BuisnessLogic bl    = new BuisnessLogic();
            DataSet       ds    = bl.Adapter(query);

            GV.DataSource = ds.Tables[0];
        }
        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);
        }
Example #11
0
        public void searchStatements(DataGridView GV, String search)
        {
            String query = String.Format("SELECT  transaction_id,date_and_time,description,credit,debit,balance from [Transactions] where ([description] like '%" + @search + "%' or [date_and_time] like '%" + @search + "%') and userid={0}", Session.user.id);

            Console.WriteLine(query);
            BuisnessLogic bl = new BuisnessLogic();
            DataSet       ds = bl.Adapter(query);

            GV.DataSource = ds.Tables[0];
        }
Example #12
0
        public String getID(string email)
        {
            string          query  = String.Format("select id from users where email='{0}'", email);
            BuisnessLogic   bl     = new BuisnessLogic();
            OleDbDataReader reader = bl.SelectQuery(query);

            if (reader.Read())
            {
                return(reader[0].ToString());
            }
            else
            {
                return("0");
            }
        }
 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);
     }
 }
        public String getBalance(string id)
        {
            string query = String.Format("select balance from Account where userid={0}", @id);

            Console.WriteLine(query);
            BuisnessLogic   bl     = new BuisnessLogic();
            OleDbDataReader reader = bl.SelectQuery(query);

            if (reader.Read())
            {
                return(reader[0].ToString());
            }
            else
            {
                Console.WriteLine("Error");
                return("0");
            }
        }