Loading GST Billing Software
header image

Kushal Help : Why the New Save Delete Model?

Erachana Line

In our Software Form Models which are centered around Database Application Development, we use the New Save Delete Model.

This model consists of a form with 3 Buttons New, Save and Delete in addition to the Input controls that include TextBox, Dropdown, checkbox etc while the output is displayed on a DataGridView Control.

The buttons have the following roles based on the condition which they are in:

1) New: This button is responsible for clearing out the input controls on the form. Clearing Grid Row selected in the Form’s Grid if any. This button causes the input region to be depicted as if newly adding an entry to the DataGridView. The state of the form when it first loads must be in the same state as when the New button is pressed, so this state is referred to as New Mode.

2) Save: This button is responsible to check if all mandatory fields are entered by the user before saving the value into the data grid or database. It serves two specific purposes namely

a. When the user clicks on New and adds a new entry, this button ensures that upon clicking it, the entries are saved onto the grid, from where it might also be saved to the database.

b. When the user has selected a value on the grid, the values selected by the user are reflected on the input control region for any modification. Here the save button serves to Update an already existing entry.

Upon using the save feature, the model should also ensure that the most recently added or updated entry is highlighted and focused, ready for any additional modification to be saved using the save button again.

3) Delete: This button is responsible to delete an entry selected by the user on the DataGridView present on the form. After theDelete button is clicked, the form returns to the New Mode.

Internally the three buttons are associated with the following SQL’s in SQLite.

1) The new button is used to get the Max ID of a table to ensure that the next ID is placed immediately after the Max ID of a table.

2) The Save button is associated with Insert Query to store a new data onto the table. While it is also associated with Update Query to store any modifications done to a selected entry.

3) The Delete button is associated with removing an entry from the database based on what is to be removed as selected by the user.

The intention:

1) The mapping is made to ensure that a user can create a new entry from the form as and when required.

2) It ensures that a selected value can be modified and saved as soon as the need arises, but clicking on the data from the grid at runtime.

3) It also ensures that data to be deleted is deleted consistently and reflected back on the form.

The names ensure that the user is kept informed of what is going on:

1) New means the user wants to start something new.

2) Save means that the current set of values in input controls is to be Saved.

3) Delete means that the currently selected row in the grid is to be Deleted.

In the absence of any entries, the Save button check for all mandatory inputs before proceeding with adding a new entry.

In the special case of parent-child forms, we can additionally see the following buttons:

1) Add – that performs a new operation on the child Form.

2) Update – that performs save operation on the child Form.

3) Remove – that performs delete operation on the child Form.