Journey of DLithe Bootcamp .NET Full Stack Developer | Week 7(March6-March10)
Last Week Bootcamp — SQL Database
The day started with talking with sharing thoughts about SUNDAY. Pallavi mam taken a special class. They started explaning the Triggers in SQL.
A trigger is a set of actions that are run automatically when a specified change operation (SQL INSERT, UPDATE, or DELETE statement) is performed on a specified table. Triggers are useful for tasks such as enforcing business rules, validating input data, and keeping an audit trail.
Uses for triggers:
- Enforce business rules
- Validate input data
- Generate a unique value for a newly-inserted row in a different file.
- Write to other files for audit trail purposes
- Query from other files for cross-referencing purposes
- Access system functions
- Replicate data to different files to achieve data consistency
Benefits of using triggers in business:
- Faster application development. Because the database stores triggers, you do not have to code the trigger actions into each database application.
- Global enforcement of business rules. Define a trigger once and then reuse it for any application that uses the database.
- Easier maintenance. If a business policy changes, you need to change only the corresponding trigger program instead of each application program.
- Improve performance in client/server environment. All rules run on the server before the result returns.
DML Triggers
DML triggers is a special type of stored procedure that automatically takes effect when a data manipulation language (DML) event takes place that affects the table or view defined in the trigger. DML events include INSERT, UPDATE, or DELETE statements. DML triggers can be used to enforce business rules and data integrity, query other tables, and include complex Transact-SQL statements. The trigger and the statement that fires it are treated as a single transaction, which can be rolled back from within the trigger. If a severe error is detected (for example, insufficient disk space), the entire transaction automatically rolls back.
Types of DML Triggers
AFTER trigger
AFTER triggers are executed after the action of the INSERT, UPDATE, MERGE, or DELETE statement is performed. AFTER triggers are never executed if a constraint violation occurs; therefore, these triggers cannot be used for any processing that might prevent constraint violations. For every INSERT, UPDATE, or DELETE action specified in a MERGE statement, the corresponding trigger is fired for each DML operation.
INSTEAD OF trigger
INSTEAD OF triggers override the standard actions of the triggering statement. Therefore, they can be used to perform error or value checking on one or more columns and perform additional actions before inserting, updating or deleting the row or rows. For example, when the value being updated in an hourly wage column in a payroll table exceeds a specified value, a trigger can be defined to either produce an error message and roll back the transaction, or insert a new record into an audit trail before inserting the record into the payroll table. The primary advantage of INSTEAD OF triggers is that they enable views that would not be updatable to support updates. For example, a view based on multiple base tables must use an INSTEAD OF trigger to support inserts, updates, and deletes that reference data in more than one table. Another advantage of INSTEAD OF triggers is that they enable you to code logic that can reject parts of a batch while letting other parts of a batch to succeed.
CLR Triggers
A CLR Trigger can be either an AFTER or INSTEAD OF trigger. A CLR trigger can also be a DDL trigger. Instead of executing a Transact-SQL stored procedure, a CLR trigger executes one or more methods written in managed code that are members of an assembly created in the .NET Framework and uploaded in SQL Server.
Use Case
The last week mainly focused on completion of use case the use case is developed on angular in the back end we are using Microsoft SQL Server.
The landing page consist of image caurosil, top offers and about us the company and also footer section. The whole project is built based on bootstrap classes in front end.
If user want to new policy he must register first. In registration form he must provide all the basic details like name, email, number and password.
After registration, the window will navigate to login page. In login p[age user can login to there profile throgh email id and password.
After successful signing, he will be landed too.Dashboard. In dashbord user able to see all policy details and amout of that policy.
If user alreday bought any policies, it will be displayed in the my policy details. And also the status of the policy will be displayed in the my policy window.
If user wants to buy new policy, user must click on the Create New Policy tab. Here user must provide proper information and required details.
Once user click on the pay now buttuon it will call the external payment window. There user has to provide the card details.
This is our team PANDA. All members in the taem are very energetic and resposive and polite. And they given tere 100% effort to complete the usecase.
This contact us page consists of simple google map iframe and simple required information fields.
Source code of the complete project: