Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maarceloluiz/bank-system
Bank System - OOP Programing - Database Management
https://github.com/maarceloluiz/bank-system
Last synced: 6 days ago
JSON representation
Bank System - OOP Programing - Database Management
- Host: GitHub
- URL: https://github.com/maarceloluiz/bank-system
- Owner: MaarceloLuiz
- Created: 2023-11-08T19:24:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-15T13:19:00.000Z (about 1 year ago)
- Last Synced: 2023-11-15T14:28:37.780Z (about 1 year ago)
- Language: C#
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bank-System
## Database Table
CREATE TABLE [dbo].[NewAccount] (
[AccNum] INT IDENTITY (100000, 1) NOT NULL,
[FirstName] NVARCHAR (50) NOT NULL,
[Surname] NVARCHAR (50) NOT NULL,
[DOB] NVARCHAR (150) NOT NULL,
[County] NVARCHAR (50) NOT NULL,
[Gender] NVARCHAR (50) NOT NULL,
[Balance] MONEY NOT NULL,
[AccType] NVARCHAR (50) NOT NULL,
PRIMARY KEY CLUSTERED ([AccNum] ASC)
);--------------------------------------------------------------------------------------------------------------------------------------------
CREATE TABLE [dbo].[Transactions] (
[TransactionsID] INT IDENTITY (1, 1) NOT NULL,
[Firstname] NVARCHAR (50) NULL,
[Surname] NVARCHAR (50) NULL,
[DOB] NVARCHAR (150) NULL,
[County] NVARCHAR (50) NULL,
[Gender] NVARCHAR (50) NULL,
[Balance] MONEY NULL,
[AccType] NVARCHAR (50) NULL,
[Amount] MONEY NULL,
PRIMARY KEY CLUSTERED ([TransactionsID] ASC)
);## Triggers
CREATE TRIGGER [Trig]
ON [dbo].[NewAccount]
FOR DELETE, INSERT, UPDATE
AS
BEGIN
DECLARE @fn nvarchar(50)
SELECT @fn = Firstname From inserted
DECLARE @sn nvarchar(50)
SELECT @sn = Surname From inserted
DECLARE @dob nvarchar(150)
SELECT @dob = DOB From inserted
DECLARE @cy nvarchar(50)
SELECT @cy = County FROM inserted
DECLARE @ge nvarchar(50)
SELECT @ge = Gender FROM inserted
DECLARE @bal money
SELECT @bal = Balance From inserted
DECLARE @act nvarchar(50)
SELECT @act = AccType From insertedINSERT INTO Transactions(Firstname, Surname, DOB, County, Gender, Balance, AccType) VALUES(@fn, @sn, @dob, @cy, @ge, @bal, @act)
END
## Stored Procedures
CREATE PROCEDURE [dbo].[uspAddAcc]
@fn nvarchar(50),
@sn nvarchar(50),
@dob nvarchar(150),
@cy nvarchar(50),
@ge nvarchar(50),
@bal money,
@acty nvarchar(50)
ASINSERT INTO NewAccount(FirstName, Surname, DOB, County, Gender, Balance, AccType) VALUES(@fn, @sn, @dob, @cy, @ge, @bal, @acty)
RETURN 0--------------------------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[uspAllAbove]
@amt decimal
ASSELECT * FROM NewAccount WHERE Balance > @amt
RETURN 0--------------------------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[uspGen]
@gen nvarchar(50)
ASSELECT * FROM NewAccount WHERE Gender = @gen
RETURN 0--------------------------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[uspGetAll]
AS
SELECT * FROM NewAccount
RETURN 0--------------------------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[uspGetBalance]
@acNo int
ASSELECT * FROM NewAccount WHERE AccNum = @acNo
RETURN 0--------------------------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[uspPopCombo]
ASSELECT * FROM NewAccount
RETURN 0--------------------------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[uspTransfer]
@acNoFrom int,
@nbFrom decimal,
@acNoTo int,
@nbTo decimal
ASUPDATE NewAccount SET Balance = @nbFrom WHERE AccNum = @acNoFrom
UPDATE NewAccount SET Balance = @nbTo WHERE AccNum = @acNoTo
RETURN 0--------------------------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[uspUpdateBalance]
@acNo int,
@nb decimal
ASUPDATE NewAccount SET Balance = @nb WHERE AccNum = @acNo
RETURN 0--------------------------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[uspAllTransactions]
ASSELECT * from Transactions
RETURN 0