Beispiel #1
0
        public void loadCourses()
        {
            DBConnect objDB = new DBConnect();
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "ShowAllCourses";
            DataSet myDS = objDB.GetDataSetUsingCmdObj(objCommand);
            gvCourses.DataSource = myDS;
            gvCourses.DataBind();
        }
Beispiel #2
0
 public DataSet GetAccounts()
 {
     DBConnect objdb = new DBConnect();
     SqlCommand sqlCommand = new SqlCommand();
     sqlCommand.CommandType = CommandType.StoredProcedure;
     sqlCommand.CommandText = "GetAllAccounts";
     DataSet dataset = objdb.GetDataSetUsingCmdObj(sqlCommand);
     return dataset;
 }
Beispiel #3
0
        public decimal getAccountBalance(string name, float cardNumber)
        {
            DBConnect objdb = new DBConnect();
            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.CommandText = "GetAccountBalance";
            sqlCommand.Parameters.AddWithValue("@Name", name);
            sqlCommand.Parameters.AddWithValue("@CardNumber", cardNumber);

            SqlParameter returnParameter = new SqlParameter("@Balance", DbType.Decimal);
            returnParameter.Direction = ParameterDirection.ReturnValue;
            sqlCommand.Parameters.Add(returnParameter);

            // Execute stored procedure using DBConnect object and the SQLCommand object
            objdb.GetDataSetUsingCmdObj(sqlCommand);

            decimal balance;
            balance = decimal.Parse(sqlCommand.Parameters["@Balance"].Value.ToString());
            return balance;
        }
Beispiel #4
0
        public int getCreditCardCount()
        {
            DBConnect objdb = new DBConnect();
            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.CommandText = "GetCreditCardCount";

            //stores the value in the variable @theCount
            SqlParameter returnParameter = new SqlParameter("@theCount", DbType.Int32);
            returnParameter.Direction = ParameterDirection.ReturnValue;
            sqlCommand.Parameters.Add(returnParameter);

            // Execute stored procedure using DBConnect object and the SQLCommand object
            objdb.GetDataSetUsingCmdObj(sqlCommand);

            int count;
            count = int.Parse(sqlCommand.Parameters["@theCount"].Value.ToString());
            return count;
        }
Beispiel #5
0
 public DataSet getAllTransactions()
 {
     //Update Account balance using stored procedure
     DBConnect objdb = new DBConnect();
     SqlCommand sqlCommand = new SqlCommand();
     sqlCommand.CommandType = CommandType.StoredProcedure;
     sqlCommand.CommandText = "GetAllTransactions";
     DataSet dataset = objdb.GetDataSetUsingCmdObj(sqlCommand);
     return dataset;
 }
Beispiel #6
0
        protected void gvCourses_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int rowIndex = e.RowIndex;
            int selectedCRN = int.Parse(gvCourses.Rows[rowIndex].Cells[1].Text);
            DBConnect objDB = new DBConnect();
            SqlCommand objCommand = new SqlCommand();
            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "DeleteCourse";
            objCommand.Parameters.AddWithValue("@CRN", selectedCRN);
            objDB.GetDataSetUsingCmdObj(objCommand);
            objDB.DoUpdateUsingCmdObj(objCommand);

            loadCourses();
        }