예제 #1
0
        public bool addBankAccountMoney(BankAccount obj,int addmoney)
        {
            string insertCommand = "update bankaccount set totalmoney= (select sum(totalmoney+'" + addmoney + "') from bankaccount where bankid= @BankId)  where bankid= @BankId";

            SqlCommand command = new SqlCommand(insertCommand);

            SqlParameter bankIdParameter = new SqlParameter("@BankId", SqlDbType.NVarChar, 50);
            bankIdParameter.Value = obj.bankId;

          command.Parameters.Add(bankIdParameter);
          
            if (da.Execution(command))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
예제 #2
0
        public bool deleteBankAccount(BankAccount obj)
        {
            string insertCommand = "delete from bankaccount  " +
                                   "where bankid= @bankid ";
            SqlCommand command = new SqlCommand(insertCommand);
            SqlParameter idParameter = new SqlParameter("@bankid", SqlDbType.NVarChar, 50);
            idParameter.Value = obj.bankId;


            command.Parameters.Add(idParameter);

            if (da.Execution(command))
            {
                return true;
            }
            else
            {
                return false;
            }

        }
예제 #3
0
        public bool insertBankAccount(BankAccount obj)
        {
            string insertCommand = "INSERT INTO bankaccount(BankId,TotalMoney) " +
                                   " VALUES (@BankId,@TotalMoney) ";

            SqlCommand command = new SqlCommand(insertCommand);

            SqlParameter bankIdParameter = new SqlParameter("@BankId", SqlDbType.NVarChar,50);
            bankIdParameter.Value = obj.bankId;

            SqlParameter TotalMoneyParameter = new SqlParameter("@TotalMoney", SqlDbType.Int);
            TotalMoneyParameter.Value = obj.totalmoney;







            command.Parameters.Add(bankIdParameter);
            command.Parameters.Add(TotalMoneyParameter);
          






            if (da.Execution(command))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
예제 #4
0
        public List<BankAccount> GetBankAccountInformation()
        {
            List<BankAccount> bList = new List<BankAccount>();

            string query = "select  BankId,TotalMoney,TotalPay from bankaccount";
            SqlCommand cmd = da.GetCommand(query);
            cmd.Connection.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                BankAccount ba = new BankAccount();
                ba.bankId = reader.GetString(0);
                ba.totalmoney = reader.GetInt32(1);
                ba.totalpay = reader.GetInt32(2);


                bList.Add(ba);
            }
            return bList;
        }