Sei sulla pagina 1di 106

INVENTORY MANAGEMENT SYSTEM

For

LUCKNOW NAGAR NIGAM


In Partial fulfillment of DOEACC A Level Course From UPTEC Computer Consultancy Ltd. UPTEC Crossing 16, Rana pratap Marg Lucknow (U.P.) Period: 05/04/10 to 06/06/10

Submitted by: Project Guide: Rajesh Prasad Vivek Giri Reg.no-726891 Mr.

PREFACE
The project is designed to meet the requirements of todays organizations. Nowadays many professional and technical educational institutes are concerned with updating their employees with latest technologies and market scenario. To generate interest for updating and upgrading their knowledge and skill, organization provides some benefits in terms of increments and promotions. To meet this purpose every organization first decide a set of rules to do so because these rules are dependent upon policies so they should be stored in database and management should be able to change these things. The project is written in a very organized manner in the form of procedures so that one does not feel discomfort to understand the project. Special care has been taken in designing of terms. For the confirmation of entered data. For the validation of entered data certain checks have been used and appropriate error messages are displayed for wrong data is entered. The database of project is designed to not allow any redundant data within the table. An efficient use of primary key is made. The language of the project is very simple and can be understood by anyone. Effective use of Entity-Relationship Diagrams and Data Flow Diagrams has been

made to make the project understood in a graphical fashion because figure speaks better than words.

ACKNOWLEDGEMENT
During my project many helping hands came across my way and now when I have completed my project work, I would like to acknowledge my sincere and endless gratitude to them. First and foremost I express my deep sense of gratitude to Mr. Vivek Giri (Faculty of ASP.Net) for his increasing and able guidance, constructive criticism offered me during project work and whose enthusiastic collaboration with sustained interest made it possible to complete this project. I am deeply indebted to Ms. Mona Saxena (A Level coordinator) for her helping attitude and kind attention. I would like to thanks all the faculty members of my institute for their inspiration and moral support in making project. I would like to code my unforgettable and benevolent friends Mr. Ravi Singh (A Level Student) and Mr. Amit Singh (A Level Student). Their love in amazing expressed rarely in words but the sound of their loving hearts in their actions is clearly heard. Lastly it is untrue that those not mentioned here have gone without my heartfelt acknowledge.

CONTENTS
Sn TOPIC PAGE No

01. Introduction 01.1 01.2 01.3 01.4 02.1 02.2 02.3 02.4 03.1 03.2 03.3 03.4 03.5 03.6 About Organization Project Description Objective & Scope Hardware & Software Requirements Existing System Details Limitations of the Existing System Approaches to Problem Solving Software Engineering Methodology Proposed System Details New System Requirements E.R. Diagram (ERD) Data Flow Diagrams (DFD) Data Dictionary Input / Output Design 18 19 22 26 11 13 14 15 16 5 6 7 9 10

02. Existing System Description

03. Proposed System Description

03.7

Database Design

31 36 38 40 43 62 105 106

04. Testing and Validation 05. Implementation Plan 06. User Manual 07. Input / Output Screens 08. Source Code 09. Scope for Further Enhancement 10. Bibliography

ABOUT ORGANIZATION
A Municipal Corporation is a legal definition for local governing body, include cities, countries, towns, townships, charter townships, villages and boroughs. Municipal Corporation is a local government body that administers a city of dense population. Under the Panchayati Raj System, it interacts directly with the state government, though it is administratively art of the district it is located in. The largest Municipal Corporation in India currently is Mumbai, followed by Delhi, Kolkata and Chennai. Lucknow Municipal Corporation or Lucknow Nagar Nigam was introduced to cater to the civic problems of the citizens of the Lucknow city. The main functions of the Lucknow Nagar Nigam are upkeep and maintenance of city/ town base civic services including. Solid Waste Management Surface Drainage Sewerage and Sanitation Urban Slum Improvement House Tax Payment Electricity Supply etc.

PROJECT DESCRIPTION
In an attempt to facilitate the smooth inventory management operations of the organization, this Inventory Management System manages all the Inventory related works such as Purchasing, Distribution of Inventory & Stock Management. This would have a very optimum and effective measures for removing the cumbersome manual process. This project will automate the management of the inventory from their date of purchasing till the end of stock it tells that which should be ordered now.

PROJECT OBJECTIVES & SCOPE


The main objective of this software is about the Inventory Management System of the Nagar Nigam office, Lucknow. It defines how to lists the inventorys information in the detail form and provides various reports i.e. AvailableStockReport, EnteredItems, IssuedItems, UsersList, DepartmentList etc. Following are the objectives of the project : Automate the inventory management System. To develop the system which helps in management of Inventory for different departments. For added security, there is an account for the administrator who is provided a password for the login into the system and is responsible for the management of the software. Employees can also login into the system only after providing the valid password and employees code assigned to them. Automating the process involved on the allotment and distribution of the budget. Implementing the automatic handling of manual processing.

Information control. Automate the process regarding the investigation and production. Possible security measures to maintain the confidentiality. Report generation. Elimination of the duplicate entries of the transcript information. Scope of the Project:This system ensures that all the necessary functionality for a proper working of Inventory Management is identified and implemented. The scope of the project tends to provide the software in phases, so that further corrections and anomalies can be removed. Added security concerns and backups of the database shall be further implemented, in order to provide higher quality standard. There are several other features that are covered in this project which includes generation and printing of Reports for the users. Foremost and more importantly my project is highly reliable, efficient and accurate. With the aid of above-mentioned features my project reduces the consumed time considerably.

HARDWARE & SOFTWARE REQUIREMENTS


The installation of the software is very easy but it is to be ensured by the user that the following software and hardware requirements are met at the time of installation.

Hardware requirements:Processor Main Memory Monitor Hard Disk Printer : : : : : Intel Pentium 4 or Higher Ver. 256 MB 15 SVGA Colored 4 GB One High-Speed Printer

Software requirements:Operating System : Front End Back End : : Windows XP or Higher Ver. ASP.Net (Visual Studio 2005) M.S. SQL Server 2005

EXISTING SYSTEM DETAILS


Presently Lucknow Nagar Nigam has a manual system for managing inventory. When a department comes and places demands for items, it is noted down. It is checked whether there is sufficient items available and then order is fulfilled. When the current stock level of particular items falls below the reorder level a requisition is made for those items. When the suppliers supply the parts a entry of items is carried and then the payment is made to supplier and after that inventory stock is updated.

10

LIMITATIONS OF EXISTING SYSTEM


Before the system was developed the problem that were faced by the organization are: Low Functionality: The functionality was low because it needed lot of time to keep records in the register and a lot more where the previous data was thus leading to delays. Erroneous Output: As a data was stored separately for separate heads and there was no link of heads from one another, so some times the output of the records when required was erroneous. . More Manpower: To keep the records manually more manpower was required and also, to search the old information and making required reports. Security Problems: The data stored was not secured as can be accessed or changed or destroyed by any person easily who intend to do so.
11

Data Redundancy: As separate register were maintained for separate heads so, many fields were repeated as were common in those records and lead to data redundancy.

Processing Speed: The processing speed was also very slow as when, reports were required then registers containing records were searched and then reports were made, which took a long time and labor. Manual Errors: When a number of tough tasks are done by the humans like preparations of reports and preparations of company registers etc, then human errors are obvious due to number of factors like mental strain, tiredness etc. But as we all know that computer never gets tired irrespective of the amount of work it has to do so. So, this software can nullify the probability of manual errors that improves the organization purpose.

Complexity in work: In a manual system, whenever a record is to be updated or deleted, a lot of cutting and overwriting needs to be done on all the registers that are concerned with the deleted or updated records, which makes the work very complex. However in the

12

software, once a record is updated or deleted all the concerned changes are made in the database automatically. The above are the limitations of the existing system that forced the organization to request fro full proof software that would help organization get rid of all the above said problems.

APPROACH TO PROBLEM SOLVING


We begin a project with a preliminary analysis of project scope and feasibility. After this end user requirements are defined that comes under definition phase. The most popular approach to requirement definition is modeling. An alternative approach to requirement definition is prototyping. This project has also taken the help of prototyping. When users have difficulty in defining requirements, the analyst uses powerful new computer tools to build a prototype or small scale-working model of the final system. The end user can then react to the prototype to help the analyst establishing the requirements more easily. The entire requirement specification is organized into a document called requirement statement. Advantage of Prototyping: It encourages and requires active end user participation. End user morale and support, for project is enhanced because the system appears real to them. Iteration and change rate are in natural consequence of system development, that its end users tend to change their mind. Prototyping better fits this natural solution.

It is often being said that end user dont know fully their requirements until they see them implemented. If so, prototyping endorsed this philosophy.

13

SOFTWARE ENGINEERING METHODOLOGY


Modular approach is used for developing the proposed system. A system is considered modular if it is consist of discrete components so that each component can be implemented separately and a change to one component has minimal impact on other components. To design such hierarchies there are two approaches. Top Down Approach Bottom Up Approach A top down design methods often results in some form of stepwise refinements. Starting from an abstract design, in each step the design is refined to a more concrete level, until we reach a level where no more refinement is needed and the design can be implemented directly. A top down approach is suitable only if the specifications of the system are clearly known and the system development is from scratch. A bottom up approach starts with designing the most basic or primitive components and proceeds to higher level components that use these lower level components. Requirements of user are most important associated with any software for that purpose prototyping model is used. Both approaches have some merits and demerits. For this system top down approach has been used. It starts by identifying the major components of the system,

14

decomposing them into their lower level components and iterating until the desired level of detail is achieved.

PROPOSED SYSTEM DETAILS


The basic aim in the new proposed system was to provide all improved functionality of the existing system minus the entire drawbacks for shortcoming analyzed with front end ASP.Net and back end M.S. SQL Server most of the major irritants due to conventional file system, were removed without many efforts. All records in this system is stored in separate databases that are updated regularly, so whenever required these database are used to respond to user queries, basically inventor is bought under a budget category and issued to departments for the respective budget year. Several other aspects that the proposed system provides are easy updating, insertion and searching of records. Along with this it is capable of showing all items in stock, issued items and etc. One can easily know about the items available in the stock and can also avail the details of items such as quantity available, brands name, suppliers name and etc. The most important benefit of this proposed system is that one can easily access many types of reports like Available Stock, Supplier List, and Department List etc.

15

NEW SYSTEM REQUIREMENTS


As the proposed system is meant for some kind of improvement or up gradation that means it will certainly give rise to some great expectation at the end users which are as under: New computerized system should be user friendly and easy to operate. System must have some security and should avoid unauthorized access. System must generate an error message whenever possible. New system must provide all the outputs when required. System must generate reports of total orders received, generated, purchase order generated etc. Inconsistency should be removed to some extent. Performance Requirement: The following performance requirement was taken care of in developing the proposed system:

User Friendliness: The system is easy to learn and understand. A native user can use the system efficiently without any difficulty. Quick Response: The response time had been tried to keep minimum though there existed a bulk of data. Security: The program is able to apply some security checks.

16

Robustness: The system recovers from undesired existing system without human intervention. Benefits from the Proposed System:

This automated is less time consuming and quite efficient. This system is user friendly, since it is a menu driven software so it is easily understandable by the user. As the proposed system is computerized there wont be any errors in generating entry, moreover proper checks has been incorporated to detect any kind of errors. There is no data redundancy, since data in the computer is in normalized form there wont be any repetition of some data at different levels. There are proper constraints incorporated to check the repetition of data. This software will provide only authorized users to access. Thus it will provide integrity and security from unauthorized access. Computerization will increase throughput of the system as the retrieval of the information is fast depending on the user requirements. All the reports can be prepared without any delay.

17

ER Diagram

Dept. Code

Dept. Name

Department

Request for Items Item Code Supp. Code

Item Name

Item

Quantity

Supplies

Supp Code

Supp Name

Phone No

Supplier
18

Supp Address

Context Level DFD

Demand Items

Order for new inventory stock

Department

Inventory Management System


Items Supplied

Supplier

Items Issued

19

First Level DFD


Show List of available items, issued items etc. Check Avl. Qty Check Stock

Stock Report Generation Process


-----------------------------------

Stock Details Stock Details Entry Details

Stock Management Process


--------------------------------------

4.0

3.0

Item Entry
Return Avl. Qty Update Stock Issue Details Update table Update Stock Order for new Stock

Issue Item Process


-------------------------------------

Issue Item
Update table

2.0

Item Entry Process


-------------------------------------

1.0
Detail Check Allotted Budget Items Supplied

Demand for Items

Item Issued

Budget Departments
20

Suppliers

2nd Level DFD for Issue Items Process

Departments
Demand for Items Item Issued

Processing of Demands
------------------------------------

2.1
Required Qty.

Outgoing Qty.

Check inventory Status


------------------------------------

2.2

Check for Required Qty.

Available Qty.

Stock
21

DATA DICTIONARY
Data dictionary is an organized listing of all data elements that are pertinent to the system with prcised regressed definition so that both user and system analyst will have a common understanding of inputs, outputs and components of data stores. Data dictionary mainly consists of the following: Processes:
Process Name: it tells the name of process. Inflow: It tells what details are going to process. Outflow: It shows what output is coming. Process Logic: It tells the description of the process i.e. what process

is doing. Data Stores:


Name: It tells the name of the file. Inbound Flow: It tells what data are going to the process from the file. Outbound Flow: It tells what data are coming. Description: It tells the description of the table used.

22

Description of Process: 1. Process Name: Inbound Flow: Outbound Flow: Process Logic: 2. Process Name: Inbound Flow: Outbound Flow: Process Logic: 3. Process Name: Inbound Flow: Outbound Flow: Process Logic: Item Entry Request for item entry, details (Item Code, Item Name, Quantity, Supp Code, Budget Code). Item entry created for every item and items entered in stock. This process generates entry for new item received. Item Issue Request for issue items against department demand, details (Demand ID, Dept Code, Item Code, Qty). Item issued to department and update stock. This process issue items to department. Stock Management Stock details. Check stocks and generate order to supplier for required inventory. This process generates order to supplier for required inventory.

23

4.

Process Name: Inbound Flow: Outbound Flow: Process Logic:

Report Generation Request to show list of available items, Issued items, Item Entry. department list, supplier list etc. None This process generates various reports as per requirement.

5.

Process Name: Inbound Flow: Outbound Flow: Process Logic:

Processing of Demands Request from department to issue items. Item issued to department and update stock. This process issued items to department. Check Inventory Status Request to check stock for required items. Provide available quantity to process demand. This process checks available quantity in stock for the Required items.

6.

Process Name: Inbound Flow: Outbound Flow: Process Logic:

24

Description of Data Stores: 1. Name: Inbound Flow: Outbound Flow: Description: 2. Name: Inbound Flow: Outbound Flow: Description: 3. Name: Inbound Flow: Outbound Flow: Description: 4. Name: Inbound Flow: Outbound Flow: Stock Item Code Item Name, Item Code, Available Qty. It contains details of available stock. Item Entry Entry No, Entry Date, Item Code, Item Qty, Purchase Date, Bill date, Supplier Code etc. Item Entry Details It contains details of item entry. Issued Item Issue No, Issue Date, Item Code, Department Code, Demand Id, Demand Qty, Issued Qty, Remarks etc. Issued items details It contains details of issued items to department. Budget Budget Code Budget Category, Total Allotted Budget,
25

Balance Allotted Budget. Description: It contains details of Budget Allotment.

INPUT DESIGN
Here we will be discussing the design of various forms in the software, the fields that are involved in the form the type of the field and the purpose of each and every form. This will help user in understanding the software more closely and will be able to use it more efficiently. The fields are divided into following categories: Input Fields: The user has to enter the value in the field and these fields are not locked with respect to user. Self-Generated Fields: The values of these fields are displayed automatically based upon input. Description of Forms: 1. Login Form Purpose: Fields: It is the form displayed in the beginning asking for authorized user name & password. It contains two text boxes for user name & password.

2. Budget Allotment Form

26

Purpose: Fields:

It is the form displayed when budget is allotted initially or revised. It contains several text boxes to enter Serial No, Allotment Amt and drop down lists to select Budget Category, Budget Type etc.

3. Department Demand Form Purpose: Fields: It is the form displayed when department demand is created. It contains several text boxes to enter Department ID, Demand Date and drop down lists to select Department Name, Item Name etc. 4. Item Entry Form Purpose: Fields: It is the form displayed when items are purchased and entered in stock. It contains several text boxes to enter Entry No, Bill No and drop down lists to select Budget Code, Supplier Code etc. 5. Item Issue Form Purpose: Fields: It is the form displayed when items are issued and updated the stock. It contains several text boxes to enter Issue No, Issue Date and drop down lists to select Demand ID, Item Name etc. 6. Create User Form Purpose: Fields: It is the form displayed when new user is added. It contains several text boxes to enter User Name, Password and a drop down list to select User Type etc.
27

7. Change Password Form Purpose: Fields: It is the form displayed when users password is changed. It contains several text boxes to enter old password, new password and drop down lists to select User Name etc.

8. Budget Master Form Purpose: Fields: It is the form displayed when new Budget Code is created. It contains several text boxes to enter Budget Code, Budget Category etc. 9. Department Master Form Purpose: Fields: It is the form displayed when new Department Code is created. It contains several text boxes to enter Department Code, Department Name etc. 10. Item Master Form Purpose: Fields: It is the form displayed when new Item Code is created. It contains several text boxes to enter Item Code, Item Name, and Brands Name etc. 11. Supplier Master Form Purpose: Fields: It is the form displayed when new Supplier Code is created. It contains several text boxes to enter Supplier Code, Supplier Name, Supplier Address, Remarks etc.

28

OUTPUT DESIGN
In this section we will be discussing the design of various reports in the software, the fields that are involved in the report, the table from which the data is retrieved and the purpose of each and every report to help user in understanding the system more closely and will be able to use it more efficiently. Description of Reports: 1. Available Stock Report Purpose: Table Involved: Fields Used: 2. Entered Items Report Purpose: Table Involved: Fields Used: 3. Issued Items Report Purpose: Table Involved: It is a report showing details of the item issue. Item_Issue_Info, Item_Issue_Detail and Item_Master.
29

It is a report showing details of the available stock. Item_Master and Available_Stock. ItemCode, ItemName, BrandsName and Available Stock. It is a report showing details of the item entry. Item_Entry_Info and Item_Entry_Detail. EntryNo, EntryDate, BudgetCode, BillNo, SuppCode, TotalCost, ItemName, and Qty.

Fields Used:

IssueNo, IssueDate, DemandID, DemandDate, DeptCode, ItemName, and Qty.

4. Pending Demand Report Purpose: Table Involved: It is a report showing details of the pending demand. Department_Demand_Info, Department_Demand_Detail, Pending_Demand, Item_Master, Department_Master. Fields Used: DepartmentName, DemandID, DemandDate, ItemName, DemandQty, and PendingQty. 5. Department List Report Purpose: Table Involved: Fields Used: 6. Supplier List Report Purpose: Table Involved: Fields Used: 7. User List Report Purpose: Table Involved: Fields Used: It is a report showing details of the users. Login. UserName and Type. It is a report showing details of the suppliers. Supplier_Master. SuppName, SuppAdd, PhoneNo, IncomdeTaxNo, PanNo, SecurityNum, and ContactPerson. It is a report showing details of the departments. Department_Master. DeptCode and DeptName.

30

DATABASE DESIGN
Table Name: Available Stock

Table Name: Budget Master

Table Name: Budget Allotment

31

Table Name: Department Master

Table Name: Department Demand Info

Table Name: Department Demand Detail

Table Name: Item Master

32

Table Name: Item Entry Info

Table Name: Item Entry Detail

Table Name: Item Issue Info

33

Table Name: Item Issue Detail

Table Name: Login

Table Name: Pending Demand

Table Name: Supplier Master

34

TESTING AND VALIDATION


Our main objective is to design tests that systematically uncover different classes of errors and to do so with a minimum amount of time and effort. As a secondary benefit, testing demonstrates that software functions appear to be working according to specifications, that to be working according to specifications, that performance requirements appear to have been met. Glen Myers states a number of rules that can serve well as testing objectives: errors. error. A successful test is one that uncovers undiscovered errors. Therefore keeping is mind the objectives, the software can be tested in two ways. Knowing the specified function that the software has been designed to perform, tests can be conducted that demonstrates each function is fully operational. Knowing the internal working of a product, tests can be conducted to ensure the smooth operation of the software. A good test case is one that has a high probability of finding an undiscovered Testing is the process of executing a program with the intent of finding

35

Keeping in mind the mentioned objectives the following testing strategies will be used to test the software. White Box Testing: It focuses on the control structure of the software. Using white box testing the programmer can: Guarantee that all independent paths within a module have been exercised at least once. Exercise all logical decisions on their true and false sides. Execute all loops at their boundaries and within their operational bounds. Exercise internal data structures to ensure their validity. Black Box Testing: It focuses on the functional requirements of the software. It finds errors in the following categories: Incorrect or missing functions. Interface errors. Errors in data structures. Performance errors. Initialization and termination errors. This test will be done at the later stage since it focuses on information domain. Further more unit testing and Integration testing will also be done to provide complete verification and validation of the software. Unit Testing:

36

This test focuses on verification effort on the software. Using the detail design description as a guide, important control paths will be tested to uncover errors within the boundary of each module present in the software. Integration Testing: Unit testing raises a question. If all the modules work individually, then why will the not work together? The problem is of interfacing. Data can get lost across an interface. Therefore Integration testing will be done to ensure that all the modules work as it is expected by them. Besides these Validation Testing will also be done to check unauthorized access. These entire tests will ensure that the software works smoothly.

IMPLEMENTATION PLAN
In conversion from one system to another the objective is to put the tested system into operation while handling costs, risks and personnel irritation to minimum. It involves creating: Computer Compatible Files Training Operation Staff Installation Software for System Description The implementation plan should be such that it should not disrupt the present functioning of the organization. But result of change from manual to computerized system can be chaotic sometime. There are many problems to except a new system there a\can be errors, files are damaged etc. While functioning of the new system. To avoid such a problem in starting we will be using a parallel run approach.

37

Steps involved in implementation are as follows: Conversion of system begins with a review of the project plan, the system documentation and implementation plan. The parties involved are the user, the project team. The conversion portion of implementation is finalized and approved. Files are created in the system after creating the database of system consisting of tables required for storing the records. The records, which are stored in registers, previously in manual system are entered into the table of the database. Software made is installed in the system by running a setup program, which adds an icon in the program list of windows after the setup is run, containing the name of the system. The software when run connects itself to the database previously made in system. Parallel processing between the existing and new system is initiated. Results of computer runs and operations for the new system are logged on a special form. Assuming no problems after some days, parallel processing is discontinued implementation results are documented for reference. Conversion is complete, plan for post implementation review are prepare. Following the review, the new system is officially operational. The reason behind the use of this approach is that the software has been prepared on and tested on a stand-alone machine.

38

USERS MANUAL
This manual has been prepared to assist the user in a user-friendly manner, the program of Inventory Management System. This program is designed in a way that Dropdown list popup and the user finds him self in a most convenient situation to deal with the different modules performing different tasks. Below are given the content and then the description of each menu is given. For Entering into the Main Menu:On double clicking the icon, after few seconds the login form appears as under

39

The System prompts the user to enter his/her name followed by password. At this stage the program is designed in such a way that it distinguishes between the password of the general user and the administrator. If the administrator enters his password the system shows the Home page with all options enabled to him.

Menu Options:
Master:

This dropdown list contains all the options related to the master entry i.e. creating a new code such as Budget Master, Item Master etc.

40

Transactions:

This dropdown list contains all the options related to the transactions such as Item Entry, Item Issue, and Budget Allotment etc.

Reports:

This dropdown list contains all the options related to the reports such as Supplier List, Department List, and Stock etc.

Available

Security:

This dropdown list contains all the options related to the security such as Alter User and Alter Password.

41

INPUT / OUTPUT SCREENS

LOGIN FORM

42

HOME PAGE

43

ITEM ENTRY FORM

44

ITEM ISSUE FORM

45

BUDGET ALLOTMENT FORM

46

DEPARTMENT DEMAND FORM

47

CREATE / DELETE USER FORM

48

ALTER PASSWORD FORM

49

ITEM MASTER FORM

50

DEPARTMENT MASTER FORM

51

SUPPLIER MASTER FORM

52

BUDGET MASTER FORM

53

ENTERED ITEMS REPORT

54

ISSUED ITEMS REPORT

55

PENDING DEMAND REPORT

56

AVAILABLE STOCK REPORT

57

SUPPLIER LIST REPORT

58

DEPARTMENT LIST REPORT

59

USER LIST REPORT

60

SOURCE CODE
61

There are given the source code that are used in this software. Form wise description are given below.

Item_Entry.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings["TempConnectionString"] .ConnectionString); static int sn = 0, flag=0; protected void Page_Load(object sender, EventArgs e) { if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } if (!Page.IsPostBack) { TextBox9.Focus(); } try { con2.Open(); SqlCommand cmd; cmd = new SqlCommand("select * from Temp_ItemEntry", con2); SqlDataReader dr2 = cmd.ExecuteReader(); dr2.Read(); flag = 1; Button6.Enabled = true; Button2.Enabled = true; Panel1.Visible = true; dr2.Close(); con2.Close(); } catch (Exception ex) { Response.Write(ex.Message); flag = 0; Panel1.Visible = false;

62

} }

con.Close();

protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) { try { TextBox6.Text = ""; TextBox7.Text = ""; con.Open(); SqlCommand cmd; cmd = new SqlCommand("select * from temp_ItemEntry where ItemName='" + DropDownList3.SelectedItem.Text + "'", con); SqlDataReader dr5 = cmd.ExecuteReader(); dr5.Read(); if (DropDownList3.SelectedItem.Text == dr5["ItemName"].ToString()) { Label2.Text = "Already exist"; } dr5.Close(); con.Close(); } catch (Exception ex) { Label2.Text = ""; con.Close(); } if (Label2.Text == "") { if (DropDownList3.SelectedItem.Text != "Select") { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from item_master where ItemName='" + DropDownList3.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); TextBox6.Text = dr["ItemCode"].ToString(); TextBox7.Text = dr["BrandsName"].ToString(); dr.Close(); Button1.Enabled = true; con.Close(); } catch (Exception ex) { } } } } protected void Button1_Click(object sender, EventArgs e) { if (Label2.Text == "") { try { Button2.Enabled = true; Button6.Enabled = true; sn++; flag = 1;

63

con2.Open(); SqlCommand cmd = new SqlCommand("insert into temp_itementry values('" + sn + "','" + TextBox6.Text + "', '" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox8.Text + "')", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); DropDownList3.Text = "Select"; TextBox6.Text = ""; TextBox7.Text = ""; TextBox1.Text = ""; TextBox2.Text = ""; TextBox8.Text = ""; Panel1.Visible = true; con2.Close(); } catch (Exception ex) { } } } protected void Button2_Click(object sender, EventArgs e) { int x; if (Label6.Text == "" && Label2.Text == "") { if (flag == 1) { if (Button2.Text == "Submit") { Button2.Text = "Confirm"; Button6.Enabled = false; Button1.Enabled = false; } else { string b, c, d, g; int j; try { con.Open(); con2.Open(); x = Convert.ToInt32(Label4.Text) Convert.ToInt32(TextBox5.Text); SqlCommand cmd = new SqlCommand(); cmd = new SqlCommand("update budget_master set BalanceAllotedAmt='" + x + "' where BudgetCode='" + DropDownList1.SelectedItem.Text + "' ", con); cmd.ExecuteNonQuery(); cmd = new SqlCommand("insert into item_entry values('" + TextBox9.Text + "','" + TextBox3.Text + "','" + DropDownList1.SelectedItem.Text + "', '" + TextBox4.Text + "', '" + DropDownList2.SelectedItem.Text + "', '" + Convert.ToInt32(TextBox5.Text) + "')", con); cmd.ExecuteNonQuery(); SqlCommand cmd1 = new SqlCommand("select Sn from temp_itementry", con2); SqlDataReader dr3 = cmd1.ExecuteReader(); ListBox1.DataSource = dr3; ListBox1.DataTextField = "Sn"; ListBox1.DataBind(); dr3.Close(); foreach (ListItem li in ListBox1.Items)

64

cmd = new SqlCommand("select * from temp_itementry where Sn='" + li + "'", con2); SqlDataReader dr2 = cmd.ExecuteReader(); dr2.Read(); b = dr2["ItemCode"].ToString(); d = dr2["Remarks"].ToString(); j = Convert.ToInt32(dr2["Quantity"].ToString()); g = dr2["PurDate"].ToString(); dr2.Close(); cmd = new SqlCommand("insert into item_entry_detail values('" + TextBox9.Text + "','" + b + "','" + j + "','" + g + "', '" + d + "')", con); cmd.ExecuteNonQuery(); cmd = new SqlCommand("select * from available_stock where ItemCode='" + b + "'", con); SqlDataReader dr4 = cmd.ExecuteReader(); dr4.Read(); int y Convert.ToInt32(dr4["Available_Stock"] .ToString()) + j; dr4.Close(); cmd = new SqlCommand("update available_stock set available_stock='" + y + "' where ItemCode='" + b + "'", con); cmd.ExecuteNonQuery();

} }

} catch (Exception ex) { }

} cmd = new SqlCommand("delete from temp_itementry", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); Response.Write("<script>alert('New entry has been created')</script>"); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; DropDownList3.Text = "Select"; Label4.Text = ""; Label6.Text = ""; Button2.Text = "Submit"; Button2.Enabled = false; Panel1.Visible = false; flag = 0; sn = 0; con.Close(); con2.Close();

} } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedItem.Text != "Select") { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from budget_master

65

} else {

} catch (Exception ex) { }

where BudgetCode='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); Label4.Text = dr["BalanceAllotedAmt"].ToString(); dr.Close(); con.Close();

Label4.Text=""; } } protected void Button6_Click(object sender, EventArgs e) { if (Button6.Text == "Delete All Items") { Button6.Text = "Confirm"; Button1.Enabled = false; Button2.Enabled = false; } else { try { con2.Open(); SqlCommand cmd = new SqlCommand("delete from temp_itementry", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); Button6.Text = "Delete All Items"; Button6.Enabled = true; Button1.Enabled = false; Button2.Enabled = false; Panel1.Visible = false; flag = 0; sn = 0; con2.Close(); } catch (Exception ex) { } } } protected void Button3_Click(object sender, EventArgs e) { Server.Transfer("Home.aspx"); } protected void Button7_Click(object sender, EventArgs e) { if (Button7.Text == "Clear") { Button7.Text = "Confirm"; } else { Button6.Text = "Delete All Items"; TextBox6.Text = ""; TextBox7.Text = ""; Label4.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; DropDownList3.Text = "Select"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = "";

66

TextBox4.Text = ""; TextBox5.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; Button7.Text = "Clear"; try { con2.Open(); SqlCommand cmd = new SqlCommand("delete from temp_itementry", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); Button6.Text = "Delete All Items"; Button1.Enabled = true; Button2.Enabled = true; Button6.Enabled = true; Panel1.Visible = false; flag = 0; sn = 0; con2.Close(); } catch (Exception ex) { } } } protected void TextBox5_TextChanged(object sender, EventArgs e) { if(DropDownList1.SelectedItem.Text != "Select") { if (TextBox5.Text != null) { if (Convert.ToInt32(Label4.Text) < Convert.ToInt32(TextBox5.Text)) { Label6.Text = "Exceeds alloted budget"; } else { Label6.Text = ""; } } } } protected void TextBox9_TextChanged(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd; cmd = new SqlCommand("select EntryNo from item_entry where EntryNo='" + TextBox9.Text + "'", con); SqlDataReader dr2 = cmd.ExecuteReader(); dr2.Read(); if (TextBox9.Text == dr2["EntryNo"].ToString()) { Label1.Text = "Already Exist"; } else { Label1.Text = ""; }

67

dr2.Close(); con.Close(); } catch (Exception ex) { Label1.Text = ""; }

} }

Item_Issue.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings["TempConnectionString"] .ConnectionString); static int sn=0, flag=0; protected void Page_Load(object sender, EventArgs e) { if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } if (!Page.IsPostBack) { TextBox6.Focus(); } try { con2.Open(); SqlCommand cmd; cmd = new SqlCommand("select * from Temp_ItemIssue", con2);

68

SqlDataReader dr2 = cmd.ExecuteReader(); dr2.Read(); flag = 1; Button5.Enabled = true; Button2.Enabled = true; Panel3.Visible = true; dr2.Close(); con2.Close(); } catch (Exception ex) { flag = 0; con.Close(); } } protected void TextBox6_TextChanged(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd; cmd = new SqlCommand("select IssueNo from item_issue_info where IssueNo='" + TextBox6.Text + "'", con); SqlDataReader dr2 = cmd.ExecuteReader(); dr2.Read(); if (TextBox6.Text == dr2["IssueNo"].ToString()) { Label1.Text = "Already Exist"; } else { Label1.Text = ""; } dr2.Close(); con.Close(); } catch (Exception ex) { Label1.Text = ""; } } protected void Button2_Click(object sender, EventArgs e) { if (flag == 1) { if (Button2.Text == "Issue") { Button2.Text = "Confirm"; Button5.Enabled = false; Button1.Enabled = false; } else { try { con.Open(); con2.Open(); SqlCommand cmd = new SqlCommand("insert into item_issue_info values('" + TextBox6.Text + "','" + TextBox4.Text + "','" + DropDownList2.SelectedItem.Text + "','" + TextBox1.Text + "','" + TextBox9.Text + "','" + TextBox2.Text + "')", con);

69

cmd.ExecuteNonQuery(); cmd = new SqlCommand("select Sn from temp_itemissue", con2); SqlDataReader dr3 = cmd.ExecuteReader(); ListBox2.DataSource = dr3; ListBox2.DataTextField = "Sn"; ListBox2.DataBind(); dr3.Close(); foreach (ListItem li in ListBox2.Items) { cmd = new SqlCommand("select * from temp_itemissue where Sn='" + li + "'", con2); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); string a = dr["ItemCode"].ToString(); int b = Convert.ToInt32(dr["IssueQty"].ToString()); int d = Convert.ToInt32(dr["RemainQty"].ToString()); dr.Close(); cmd = new SqlCommand("insert into item_issue_detail values('" + TextBox6.Text + "','" + a + "','" + b + "')", con); cmd.ExecuteNonQuery(); cmd = new SqlCommand("select * from available_stock where ItemCode='" + a + "'", con); SqlDataReader dr2 = cmd.ExecuteReader(); dr2.Read(); int c = Convert.ToInt32(dr2["Available_Stock"].ToString()) - b; dr2.Close(); cmd = new SqlCommand("update available_stock set available_stock='" + c + "' where ItemCode='" + a + "'", con); cmd.ExecuteNonQuery(); cmd = new SqlCommand("update department_demand_detail set PendingQty='" + d +"' where ItemCode='" + a + "' and DemandID='"+DropDownList2.SelectedItem.Text+"'", con); cmd.ExecuteNonQuery(); } cmd = new SqlCommand("delete from temp_itemissue", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); Response.Write("<script>alert('Issue entry has been created')</script>"); TextBox1.Text = ""; TextBox2.Text = ""; TextBox4.Text = ""; TextBox9.Text = ""; TextBox6.Text = ""; Label2.Text = ""; Label3.Text = ""; TextBox3.Text = ""; TextBox7.Text = ""; TextBox8.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; Button2.Text = "Issue"; Button2.Enabled = false; sn = 0; flag = 0; con.Close(); con2.Close(); } catch (Exception ex) { } } } }

70

protected void Button5_Click(object sender, EventArgs e) { if (flag == 1) { if (Button5.Text == "Delete All Items") { Button5.Text = "Confirm"; Button1.Enabled = false; Button2.Enabled = false; } else { try { con2.Open(); SqlCommand cmd = new SqlCommand("delete from temp_itemissue", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); Button5.Text = "Delete All Items"; Button5.Enabled = false; Button2.Enabled = false; Panel3.Visible = false; Label2.Text = ""; Label3.Text = ""; flag = 0; sn = 0; con2.Close(); } catch (Exception ex) { } } } } protected void Button3_Click(object sender, EventArgs e) { if (Button3.Text == "Clear") { Button3.Text = "Confirm"; } else { try { con2.Open(); SqlCommand cmd = new SqlCommand("delete from temp_itemissue", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); Panel3.Visible = false; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; Label1.Text = ""; Label2.Text = ""; Label3.Text = ""; Button2.Text = "Issue"; Button3.Text = "Clear"; Button5.Text = "Delete All Items"; Button1.Enabled = false; Button2.Enabled = false; Button5.Enabled = false; DropDownList1.Enabled = false; sn = 0; flag = 0; con2.Close(); } catch (Exception ex) { }

71

} TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; } protected void Button4_Click(object sender, EventArgs e) { Server.Transfer("Home.aspx"); } protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { try { DropDownList1.Items.Clear(); DropDownList1.Enabled = true; con.Open(); SqlCommand cmd; cmd = new SqlCommand("select * from Department_Demand_info where DemandID='" + DropDownList2.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); TextBox9.Text = dr["DeptCode"].ToString(); TextBox1.Text = dr["DemandDate"].ToString(); TextBox2.Text = dr["Remarks"].ToString(); dr.Close(); cmd = new SqlCommand("select * from department_demand_detail where DemandID='" + DropDownList2.SelectedItem.Text +"'", con); SqlDataReader dr3 = cmd.ExecuteReader(); ListBox1.DataSource = dr3; ListBox1.DataTextField = "Sn"; ListBox1.DataBind(); dr3.Close(); foreach (ListItem li in ListBox1.Items) { cmd = new SqlCommand("select * from department_demand_detail where Sn='" + li + "'", con); SqlDataReader dr4 = cmd.ExecuteReader(); dr4.Read(); string p=dr4["ItemCode"].ToString(); dr4.Close(); cmd = new SqlCommand("select * from Item_Master where ItemCode='" + p + "'", con); SqlDataReader dr5 = cmd.ExecuteReader(); dr5.Read(); DropDownList1.Items.Add(dr5["ItemName"].ToString()); dr5.Close(); } DropDownList1.Items.Add("Select"); DropDownList1.Text = "Select"; con.Close(); } catch (Exception ex) { } }

72

protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e) { Label2.Text = ""; try { con2.Open(); SqlCommand cmd; cmd = new SqlCommand("select * from temp_ItemIssue where ItemName='" + DropDownList1.SelectedItem.Text + "'", con2); SqlDataReader dr5 = cmd.ExecuteReader(); dr5.Read(); if (DropDownList1.SelectedItem.Text == dr5["ItemName"].ToString()) { Label3.Text = "Already exist"; } dr5.Close(); con2.Close(); } catch (Exception ex) { Label3.Text = ""; con.Close(); } if (Label3.Text == "") { if (DropDownList1.SelectedItem.Text != "Select") { try { con.Open(); SqlCommand cmd; cmd = new SqlCommand("select * from Item_Master where ItemName= '" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); string a = dr["ItemCode"].ToString(); dr.Close(); cmd = new SqlCommand("select * from Available_Stock where ItemCode= '" + a + "'", con); SqlDataReader dr2 = cmd.ExecuteReader(); dr2.Read(); TextBox3.Text = dr2["Available_Stock"].ToString(); dr2.Close(); cmd = new SqlCommand("select * from department_demand_detail where DemandID= '" + DropDownList2.SelectedItem.Text + "' and ItemCode='" + a + "'", con); SqlDataReader dr4 = cmd.ExecuteReader(); dr4.Read(); TextBox7.Text = dr4["PendingQty"].ToString(); Button1.Enabled = true; dr4.Close(); con.Close(); } catch (Exception ex) { } }

73

} } protected void TextBox8_TextChanged(object sender, EventArgs e) { int m,n,o; if (TextBox3.Text != "" && TextBox7.Text != "" && TextBox8.Text != "") { m = Convert.ToInt32(TextBox3.Text); n = Convert.ToInt32(TextBox7.Text); o = Convert.ToInt32(TextBox8.Text); if (o > n ^ o > m) { Label2.Text = "Exceeds Limit"; } else { Label2.Text = ""; } } else { Label2.Text = "Exceeds Limit"; } } protected void Button1_Click(object sender, EventArgs e) { if (Label2.Text == "") { flag = 1; string a, b; int c, d, f; try { Panel3.Visible = true; sn++; con.Open(); con2.Open(); SqlCommand cmd = new SqlCommand("select * from Item_Master where ItemName='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); a = dr["ItemCode"].ToString(); b = dr["ItemName"].ToString(); dr.Close(); c = Convert.ToInt32(TextBox7.Text); d = Convert.ToInt32(TextBox8.Text); f = c - d; cmd = new SqlCommand("insert into Temp_ItemIssue values('" + sn + "','" + a + "','" + b + "','" + c + "','" + d + "','" + f + "')", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); DropDownList1.Text = "Select"; TextBox3.Text = ""; TextBox7.Text = ""; TextBox8.Text = ""; Button2.Enabled = true; Button5.Enabled = true; con2.Close(); }

74

} } }

catch (Exception ex) { }

Department_Demand.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class Default2 : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings["TempConnectionString"] .ConnectionString); static int sn = 0, flag = 0; protected void Page_Load(object sender, EventArgs e) { Label2.Text = ""; if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } if (!Page.IsPostBack) { TextBox2.Focus(); } } protected void Button5_Click(object sender, EventArgs e) { Server.Transfer("Home.aspx"); } protected void Button2_Click(object sender, EventArgs e) { if (flag == 1) { if (Label1.Text == "")

75

if (Button2.Text == "Submit") { Button2.Text = "Confirm"; Button1.Enabled = false; Button3.Enabled = false; } else { try { con.Open(); con2.Open(); SqlCommand cmd; cmd = new SqlCommand("select * from department_master where DeptName='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr1 = cmd.ExecuteReader(); dr1.Read(); string d = dr1["DeptCode"].ToString(); dr1.Close(); cmd = new SqlCommand("insert into department_demand_info values('" + TextBox2.Text + "','" + TextBox4.Text + "','" + d + "','" + TextBox3.Text + "')", con); cmd.ExecuteNonQuery(); SqlCommand cmd1 = new SqlCommand("select Sn from temp_demand", con2); SqlDataReader dr3 = cmd1.ExecuteReader(); ListBox1.DataSource = dr3; ListBox1.DataTextField = "sn"; ListBox1.DataBind(); dr3.Close(); int c, f; foreach (ListItem li in ListBox1.Items) { cmd = new SqlCommand("select * from temp_demand where Sn='" + li + "'", con2); SqlDataReader dr2 = cmd.ExecuteReader(); dr2.Read(); string b = dr2["ItemCode"].ToString(); c = Convert.ToInt32(dr2["DemandQty"].ToString()); f = Convert.ToInt32(dr2["PendingQty"].ToString()); dr2.Close(); cmd = new SqlCommand("insert into department_demand_detail values('" + TextBox2.Text + "','" + b + "','" + c + "','" + f + "')", con); cmd.ExecuteNonQuery(); } cmd = new SqlCommand("delete from temp_demand", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); Label2.Text = "New demand has been created"; TextBox2.Text = ""; TextBox4.Text = ""; TextBox3.Text = ""; TextBox1.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select";

76

Button1.Enabled = true; Button3.Enabled = true; Panel1.Visible = false; Button2.Text = "Submit"; flag = 0; sn = 0; con.Close(); con2.Close(); } catch (Exception ex) { } } } } } protected void Button3_Click(object sender, EventArgs e) { if (flag == 1) { if (Button3.Text == "Delete All Items") { Button3.Text = "Confirm"; Button1.Enabled = false; Button2.Enabled = false; } else { try { con2.Open(); SqlCommand cmd; cmd = new SqlCommand("delete from temp_demand", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); Button3.Text = "Delete All Items"; Button1.Enabled = true; Button2.Enabled = true; Panel1.Visible = false; flag = 0; sn = 0; Label3.Text = ""; DropDownList2.Text = "Select"; con2.Close(); } catch (Exception ex) { } } } protected void Button4_Click(object sender, EventArgs e) { try { con2.Open(); SqlCommand cmd; cmd = new SqlCommand("delete from temp_demand", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); TextBox2.Text = ""; TextBox4.Text = ""; TextBox3.Text = ""; TextBox1.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; Button1.Enabled = true; Button3.Enabled=true; Button2.Text = "Submit"; Button3.Text = "Delete All Items"; flag = 0; sn = 0; Label3.Text = ""; Panel1.Visible = false; con2.Close(); }

77

} catch (Exception ex) { } } protected void Button1_Click(object sender, EventArgs e) { string str = ""; if (Label3.Text == "") { try { con.Open(); con2.Open(); sn++; flag = 1; SqlCommand cmd = new SqlCommand("select * from item_master where ItemName='" + DropDownList2.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); str = dr["ItemCode"].ToString(); dr.Close(); cmd = new SqlCommand("insert into temp_demand values('" + sn + "','" + str + "','" + DropDownList2.SelectedItem.Text + "','" + TextBox1.Text + "','" + TextBox1.Text + "')", con2); cmd.ExecuteNonQuery(); GridView1.DataBind(); DropDownList2.Text = "Select"; TextBox1.Text = ""; Panel1.Visible = true; con.Close(); con2.Close(); } catch (Exception ex) { } } } protected void TextBox2_TextChanged(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd; cmd = new SqlCommand("select demandid from department_demand_info where demandid='" + TextBox2.Text + "'", con); SqlDataReader dr2 = cmd.ExecuteReader(); dr2.Read(); if (TextBox2.Text == dr2["DemandID"].ToString()) { Label1.Text = "Already Exist"; } else { Label1.Text = ""; } dr2.Close(); con.Close(); } catch (Exception ex) {

78

Label1.Text = "";

} protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd; cmd = new SqlCommand("select * from temp_demand where ItemName='" + DropDownList2.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (DropDownList2.SelectedItem.Text == dr["ItemName"].ToString()) { Label3.Text = "Already exist"; } dr.Close(); con.Close(); } catch (Exception ex) { Label3.Text = ""; } }

Budget_Allotment.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class Default2 : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[ "IMS2ConnectionString"].ConnectionString);

79

static int temp1 = 0, temp2 = 0, temp5 = 0, temp6 = 0, temp7 = 0, temp8 = 0, temp9 = 0, temp10 = 0; protected void Page_Load(object sender, EventArgs e) { TextBox2.Focus(); if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } } protected void Button5_Click(object sender, EventArgs e) { if (Button5.Text == "Delete") { Button5.Text = "Confirm"; Button1.Enabled = false; Button2.Enabled = false; try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Budget_Allotment where SerialNo='" + DropDownList4.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); TextBox2.Text = dr["SerialNo"].ToString(); Label4.Text = dr["BudgetCode"].ToString(); DropDownList2.Text = dr["BudgetYear"].ToString(); DropDownList3.Text = dr["BudgetType"].ToString(); TextBox1.Text = dr["AmmountAlloted"].ToString(); temp5 = Convert.ToInt32(dr["AmmountAlloted"].ToString()); dr.Close(); cmd = new SqlCommand("select * from Budget_Master where BudgetCode='" + Label4.Text + "'", con); SqlDataReader dr1 = cmd.ExecuteReader(); dr1.Read(); DropDownList1.Text = dr1["BudgetCategory"].ToString(); temp6 = Convert.ToInt32(dr1["TotalAllotedAmt"].ToString()); temp7 = Convert.ToInt32(dr1["BalanceAllotedAmt"].ToString()); Label2.Text = temp6.ToString(); con.Close(); } catch (Exception ex) { } } else { try { con.Open(); SqlCommand cmd = new SqlCommand("delete from Budget_Allotment where SerialNo='" + TextBox2.Text + "'", con); cmd.ExecuteNonQuery(); Button5.Text = "Delete"; temp9 = Convert.ToInt32(TextBox1.Text); temp6 = temp6 - temp9; temp7 = temp7 - temp9; cmd = new SqlCommand("update Budget_Master set

80

} } protected void Button2_Click(object sender, EventArgs e) { if (Button2.Text == "Edit") { Button2.Text = "Update"; Button1.Enabled = false; Button5.Enabled = false; try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Budget_Allotment where SerialNo='" + DropDownList4.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); TextBox2.Text = dr["SerialNo"].ToString(); Label4.Text = dr["BudgetCode"].ToString(); DropDownList2.Text = dr["BudgetYear"].ToString(); DropDownList3.Text = dr["BudgetType"].ToString(); TextBox1.Text = dr["AmmountAlloted"].ToString(); temp5 = Convert.ToInt32(dr["AmmountAlloted"].ToString()); dr.Close(); cmd = new SqlCommand("select * from Budget_Master where BudgetCode='" + Label4.Text + "'", con); SqlDataReader dr1 = cmd.ExecuteReader(); dr1.Read(); DropDownList1.Text = dr1["BudgetCategory"].ToString(); temp6 = Convert.ToInt32(dr1["TotalAllotedAmt"].ToString()); temp7 = Convert.ToInt32(dr1["BalanceAllotedAmt"].ToString()); Label2.Text = temp6.ToString(); con.Close(); } catch (Exception ex) { } } else

} catch (Exception ex) { }

TotalAllotedAmt='"+ temp6 + "', BalanceAllotedAmt='" + temp7 + "' where BudgetCode='" + Label4.Text + "'", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('Selected alloted budget has been deleted')</script>"); DropDownList4.Items.Clear(); DropDownList4.DataBind(); DropDownList4.Items.Add("Select SrNo"); DropDownList4.Text = "Select SrNo"; TextBox1.Text = ""; TextBox2.Text = ""; Label2.Text = ""; Label4.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; DropDownList3.Text = "Select"; Button2.Text = "Edit"; Button5.Text = "Delete"; Button1.Enabled = true; Button2.Enabled = true; temp5 = 0; temp6 = 0; temp7 = 0; temp9 = 0; con.Close();

81

try {

} } protected void Button3_Click1(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Text = ""; Label2.Text = ""; Label4.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; DropDownList3.Text = "Select"; DropDownList4.Text = "Select SrNo"; Button2.Text = "Edit"; Button5.Text = "Delete"; temp1 = 0; temp2 = 0; temp5 = 0; temp6 = 0; temp7 = 0; temp8 = 0; temp9 = 0; temp10 = 0; Button1.Enabled = true; Button2.Enabled = true; Button5.Enabled = true; } protected void Button4_Click1(object sender, EventArgs e) { Server.Transfer("Home.aspx"); }

} catch (Exception ex) { }

Button2.Text = "Edit"; con.Open(); SqlCommand cmd = new SqlCommand("update Budget_Allotment set BudgetCode='" + Label4.Text + "', BudgetYear='" + DropDownList2.SelectedItem.Text + "', BudgetType='" + DropDownList3.SelectedItem.Text + "', AmmountAlloted='" + Convert.ToInt32(TextBox1.Text) + "' where SerialNo='" + TextBox2.Text + "'", con); cmd.ExecuteNonQuery(); temp10 = Convert.ToInt32(TextBox1.Text); temp6 = temp6 - temp5; temp7 = temp7 - temp5; temp6 = temp6 + temp10; temp7 = temp7 + temp10; cmd = new SqlCommand("update Budget_Master set TotalAllotedAmt='" + temp6 + "', BalanceAllotedAmt='" + temp7 + "' where BudgetCode='" + Label4.Text + "'", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('Selected alloted budget has been updated')</script>"); DropDownList4.Items.Clear(); DropDownList4.DataBind(); DropDownList4.Items.Add("Select SrNo"); DropDownList4.Text = "Select SrNo"; TextBox1.Text = ""; TextBox2.Text = ""; Label2.Text = ""; Label4.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; DropDownList3.Text = "Select"; Button2.Text = "Edit"; Button5.Text = "Delete"; Button1.Enabled = true; Button5.Enabled = true; temp5 = 0; temp6 = 0; temp7 = 0; temp10 = 0; Button1.Enabled = true; Button4.Enabled = true; TextBox2.Enabled = true; con.Close();

82

protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Budget_Master where BudgetCategory='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); Label4.Text = dr["BudgetCode"].ToString(); Label2.Text = dr["TotalAllotedAmt"].ToString(); temp1 = Convert.ToInt32(dr["TotalAllotedAmt"].ToString()); temp2 = Convert.ToInt32(dr["BalanceAllotedAmt"].ToString()); con.Close(); } catch (Exception ex) { } } protected void TextBox2_TextChanged(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Budget_Allotment where SerialNo='" + TextBox2.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (TextBox2.Text == dr["SerialNo"].ToString()) { Label1.Text = "Already exist"; } dr.Close(); con.Close(); } catch (Exception ex) { Label1.Text = ""; } } protected void Button1_Click(object sender, EventArgs e) { if (Label1.Text == "") { if (Button1.Text == "Add") { Button1.Text = "Confirm"; Button2.Enabled = false; Button5.Enabled = false; } else { try { con.Open(); SqlCommand cmd = new SqlCommand("insert into Budget_Allotment values('"

83

+ TextBox2.Text + "','" + Label4.Text + "','" + DropDownList2.SelectedItem.Text + "','" + DropDownList3.SelectedItem.Text + "','" + TextBox1.Text + "')", con); cmd.ExecuteNonQuery(); temp8 = Convert.ToInt32(TextBox1.Text); temp1 = temp1 + temp8; temp2 = temp2 + temp8; cmd = new SqlCommand("update Budget_Master set TotalAllotedAmt='" + temp1 + "', BalanceAllotedAmt='" + temp2 + "' where BudgetCode='" + Label4.Text + "' ", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('New budget allotment has been created')</script>"); DropDownList4.Items.Clear(); DropDownList4.DataBind(); DropDownList4.Items.Add("Select SrNo"); DropDownList4.Text = "Select SrNo"; TextBox1.Text = ""; TextBox2.Text = ""; Label2.Text = ""; Label4.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select"; DropDownList3.Text = "Select"; Button1.Text = "Add"; Button2.Enabled = true; Button5.Enabled = true; temp1 = 0; temp2 = 0; temp8 = 0; con.Close(); } catch (Exception ex) { } } } } }

Create_User.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page {

84

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); protected void Page_Load(object sender, EventArgs e) { TextBox1.Focus(); if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } else { try { if (Request.QueryString["id"].ToString() != "'Administrator'") { Panel2.Enabled = false; } } catch (Exception ex) { } } } protected void Button8_Click(object sender, EventArgs e) { if (Label1.Text == "") { try { con.Open(); SqlCommand cmd = new SqlCommand("insert into Login values('" + TextBox1.Text + "','" + TextBox3.Text + "','" + DropDownList1.SelectedItem.Text + "')", con); cmd.ExecuteNonQuery(); DropDownList2.Items.Clear(); DropDownList2.DataBind(); DropDownList2.Items.Add("Select to Delete"); DropDownList2.Text = "Select to Delete"; Response.Write("<script>alert('New user has been created')</script>"); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; DropDownList1.Text = "Select"; con.Close(); } catch (Exception ex) { } } } protected void Button3_Click1(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; DropDownList1.Text = "Select"; DropDownList2.Text = "Select to Delete"; Button2.Text = "Delete"; Button1.Enabled = true; } protected void Button4_Click1(object sender, EventArgs e) { Server.Transfer("Home.aspx"); } protected void Button2_Click1(object sender, EventArgs e)

85

} protected void DropDownList2_SelectedIndexChanged1(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Login where UserName='" + DropDownList2.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); TextBox1.Text = dr["UserName"].ToString(); TextBox2.Text = ""; TextBox3.Text = ""; DropDownList1.Text = dr["Type"].ToString(); dr.Close(); con.Close(); } catch (Exception ex) { } } protected void TextBox1_TextChanged(object sender, EventArgs e) { try { con.Open();

if (DropDownList2.SelectedItem.Text != "Select to Delete") { if (Button2.Text == "Delete") { Button2.Text = "Confirm"; Button1.Enabled = false; } else { try { con.Open(); SqlCommand cmd = new SqlCommand("delete from Login where UserName='" + DropDownList2.SelectedItem.Text + "'", con); cmd.ExecuteNonQuery(); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; Button2.Text = "Delete"; Button1.Enabled = true; DropDownList1.Text = "Select"; DropDownList2.Items.Clear(); DropDownList2.DataBind(); DropDownList2.Items.Add("Select to Delete"); DropDownList2.Text = "Select Delete"; Response.Write("<script>alert('Selected user has been deleted')</script>"); con.Close(); } catch (Exception ex) { } } }

86

SqlCommand cmd = new SqlCommand("select * from Login where UserName='" + TextBox1.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (TextBox1.Text == dr["UserName"].ToString()) { Label1.Text = "Already exist"; } dr.Close(); con.Close(); } catch (Exception ex) { Label1.Text = ""; } } }

Change_Password.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); protected void Page_Load(object sender, EventArgs e) { DropDownList1.Focus(); if (Session["User_Name"] == null) {

87

Server.Transfer("Login.aspx");

} protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Login where UserName='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); Label1.Text = dr["Type"].ToString(); con.Close(); } catch (Exception ex) { } } protected void Button1_Click1(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Login where UserName='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (TextBox1.Text == dr["Password"].ToString()) { cmd = new SqlCommand("update Login set Password='" + TextBox3.Text + "' where UserName='" + DropDownList1.SelectedItem.Text + "'", con); dr.Close(); cmd.ExecuteNonQuery(); Response.Write("<script>alert('Password has been changed')</script>"); DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select"); DropDownList1.Text = "Select"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; Label1.Text = ""; } else { Response.Write("<script>alert('Old password does not match')</script>"); } con.Close(); } catch (Exception ex) { } } protected void Button2_Click1(object sender, EventArgs e) { DropDownList1.Text = "Select"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; Label1.Text = ""; }

88

protected void Button3_Click1(object sender, EventArgs e) { Server.Transfer("Home.aspx"); } }

Item_Master.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); protected void Page_Load(object sender, EventArgs e) { TextBox1.Focus(); if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } } protected void Button1_Click1(object sender, EventArgs e) { if (Label1.Text == "") { if (Button1.Text == "Add") { Button1.Text = "Confirm"; Button5.Enabled = false; } else { try { con.Open(); SqlCommand cmd = new SqlCommand("insert into Item_Master values('" + TextBox1.Text + "','" +

89

TextBox2.Text + "','" + TextBox3.Text + "')", con); cmd.ExecuteNonQuery(); cmd = new SqlCommand("insert into available_stock values('" + TextBox1.Text + "', 0)", con); cmd.ExecuteNonQuery(); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; Response.Write("<script>alert('New item code has been created')</script>"); DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select to Delete"); DropDownList1.Text = "Select to Delete"; Button5.Enabled = true; Button1.Text = "Add"; con.Close(); } catch (Exception ex) { } } } } protected void Button3_Click1(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; DropDownList1.Text = "Select to Delete"; Button5.Text = "Delete"; Button5.Enabled = true; Button1.Text = "Add"; Button1.Enabled = true; } protected void Button4_Click1(object sender, EventArgs e) { Server.Transfer("Home.aspx"); } protected void Button5_Click1(object sender, EventArgs e) { if (Button5.Text == "Delete") { Button5.Text = "Confirm"; Button1.Enabled = false; try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Item_Master where ItemName='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); TextBox1.Text = dr["ItemCode"].ToString(); TextBox2.Text = dr["ItemName"].ToString(); TextBox3.Text = dr["BrandsName"].ToString(); con.Close(); } catch (Exception ex) { } } else { try {

90

} } protected void TextBox1_TextChanged(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Item_Master where ItemCode='" + TextBox1.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (TextBox1.Text == dr["ItemCode"].ToString()) { Label1.Text = "Already exist"; } dr.Close(); con.Close(); } catch (Exception ex) { Label1.Text = ""; } } }

} catch (Exception ex) { }

con.Open(); SqlCommand cmd = new SqlCommand("delete from available_stock where ItemCode='" + TextBox1.Text + "'", con); cmd.ExecuteNonQuery(); cmd = new SqlCommand("delete from Item_Master where ItemCode='" + TextBox1.Text + "'", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('Selected item has been deleted')</script>"); DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select to Delete"); DropDownList1.Text = "Select to Delete"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; Button5.Text = "Delete"; Button1.Enabled = true; con.Close();

Department_Master.aspx.cs
using using using using using System; System.Data; System.Configuration; System.Collections; System.Web;

91

using using using using using using

System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); protected void Page_Load(object sender, EventArgs e) { TextBox1.Focus(); if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } } protected void Button5_Click1(object sender, EventArgs e) { if (Button5.Text == "Delete") { Button5.Text = "Confirm"; Button1.Enabled = false; try { con.Open(); SqlCommand cmd = new SqlCommand("select * from department_master where DeptName='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); TextBox1.Text = dr["DeptCode"].ToString(); TextBox2.Text = dr["DeptName"].ToString(); con.Close(); } catch (Exception ex) { } } else { try { con.Open(); SqlCommand cmd = new SqlCommand("delete from Department_Master where DeptCode='" + TextBox1.Text + "'", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('Selected department code has been deleted')</script>"); DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select to Delete"); DropDownList1.Text = "Select to Delete"; TextBox1.Text = ""; TextBox2.Text = "";

92

} } protected void Button1_Click1(object sender, EventArgs e) { if (Label1.Text == "") { if (Button1.Text == "Add") { Button1.Text = "Confirm"; Button5.Enabled = false; } else { try { con.Open(); SqlCommand cmd = new SqlCommand("insert into Department_Master values('" + TextBox1.Text + "','" + TextBox2.Text + "')", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('New department code has been created')</script>"); DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select to Delete"); DropDownList1.Text = "Select to Delete"; TextBox1.Text = ""; TextBox2.Text = ""; Button1.Text = "Add"; Button5.Enabled = true; con.Close(); } catch (Exception ex) { } } } } protected void Button4_Click1(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Text = ""; DropDownList1.Text = "Select to Delete"; Button5.Text = "Delete"; Button1.Text = "Add"; Button1.Enabled = true; Button5.Enabled = true; } protected void Button3_Click1(object sender, EventArgs e) { Server.Transfer("Home.aspx"); } protected void TextBox1_TextChanged(object sender, EventArgs e) { try {

} catch (Exception ex) { }

Button5.Text = "Delete"; Button1.Enabled = true; con.Close();

93

con.Open(); SqlCommand cmd = new SqlCommand("select * from Department_Master where DeptCode='" + TextBox1.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (TextBox1.Text == dr["DeptCode"].ToString()) { Label1.Text = "Already exist"; } dr.Close(); con.Close(); } catch (Exception ex) { Label1.Text = ""; }

} }

Supplier_Master.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); protected void Page_Load(object sender, EventArgs e) { if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } if (!Page.IsPostBack) { TextBox11.Focus(); } }

94

protected void Button1_Click1(object sender, EventArgs e) { if (Label1.Text == "") { if (Button1.Text == "Add") { Button1.Text = "Confirm"; Button2.Enabled = false; Button5.Enabled = false; DropDownList1.Enabled = false; } else { try { con.Open(); SqlCommand cmd = new SqlCommand("insert into Supplier_Master values('" + TextBox11.Text + "','" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox8.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox10.Text + "')", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('New supplier has been created')</script>"); DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select Supplier"); DropDownList1.Text = "Select Supplier"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox8.Text = ""; TextBox10.Text = ""; TextBox11.Text = ""; Button1.Text = "Add"; Button2.Enabled = true; Button5.Enabled = true; DropDownList1.Enabled = true; con.Close(); } catch (Exception ex) { } } } } protected void Button3_Click1(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox8.Text = ""; TextBox10.Text = ""; TextBox11.Text = ""; DropDownList1.Text = "Select Supplier"; Button2.Text = "Delete"; Button5.Text = "Edit"; Button1.Text = "Add"; Button1.Enabled = true; Button2.Enabled = true; Button5.Enabled = true; DropDownList1.Enabled = true; } protected void Button4_Click1(object sender, EventArgs e) { Server.Transfer("Home.aspx"); }

95

protected void Button2_Click1(object sender, EventArgs e) if (DropDownList1.Text != "Select Supplier") { if (Button2.Text == "Delete") { Button2.Text = "Confirm"; Button1.Enabled = false; Button5.Enabled = false; DropDownList1.Enabled = false; try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Supplier_Master where SuppCode='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); Button1.Enabled = false; TextBox11.Text = dr["SuppCode"].ToString(); TextBox1.Text = dr["SuppName"].ToString(); TextBox2.Text = dr["SuppAdd"].ToString(); TextBox3.Text = dr["SecurityNum"].ToString(); TextBox4.Text = dr["IncomeTaxNo"].ToString(); TextBox5.Text = dr["PanNo"].ToString(); TextBox6.Text = dr["ContactPerson"].ToString(); TextBox8.Text = dr["PhoneNo"].ToString(); TextBox10.Text = dr["Reamrks"].ToString(); con.Close(); } catch (Exception ex) { } } else { try { con.Open(); SqlCommand cmd = new SqlCommand("delete from Supplier_Master where SuppCode='"+ TextBox11.Text + "'", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('Selected supplier has been deleted')</script>"); DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select Supplier"); DropDownList1.Text = "Select Supplier"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox8.Text = ""; TextBox10.Text = ""; TextBox11.Text = ""; Button2.Text = "Delete"; Button1.Enabled = true; Button5.Enabled = true; DropDownList1.Enabled = true; con.Close(); } catch (Exception ex) { } } }

96

} protected void Button5_Click1(object sender, EventArgs e) { if (DropDownList1.Text != "Select Supplier") { if (Button5.Text == "Edit") { Button5.Text = "Update"; Button1.Enabled = false; Button2.Enabled = false; DropDownList1.Enabled = false; try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Supplier_Master where SuppCode='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); Button1.Enabled = false; TextBox11.Text = dr["SuppCode"].ToString(); TextBox1.Text = dr["SuppName"].ToString(); TextBox2.Text = dr["SuppAdd"].ToString(); TextBox3.Text = dr["SecurityNum"].ToString(); TextBox4.Text = dr["IncomeTaxNo"].ToString(); TextBox5.Text = dr["PanNo"].ToString(); TextBox6.Text = dr["ContactPerson"].ToString(); TextBox8.Text = dr["PhoneNo"].ToString(); TextBox10.Text = dr["Reamrks"].ToString(); con.Close(); } catch (Exception ex) { } } else { try { con.Open(); SqlCommand cmd = new SqlCommand("update Supplier_Master set SuppCode='" + TextBox11.Text + "', SuppName='" + TextBox1.Text + "', SuppAdd='"+ TextBox2.Text + "', SecurityNum='" + TextBox3.Text + "', IncomeTaxNo='" + TextBox4.Text + "', PanNo='" + TextBox5.Text + "', ContactPerson='" + TextBox6.Text + "', PhoneNo='" + TextBox8.Text + "', Remarks='" + TextBox10.Text + "' where SuppCode='" + TextBox11.Text + "'", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('Selected supplier has been updated')</script>"); DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select Supplier"); DropDownList1.Text = "Select Supplier"; TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox8.Text = ""; TextBox10.Text = ""; TextBox11.Text = ""; Button5.Text = "Edit";

97

} }

} catch (Exception ex) { }

Button1.Enabled = true; Button2.Enabled = true; DropDownList1.Enabled = true; con.Close();

} protected void TextBox11_TextChanged(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Supplier_Master where SuppCode='" + TextBox11.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (TextBox11.Text == dr["SuppCode"].ToString()) { Label1.Text = "Already exist"; } dr.Close(); con.Close(); } catch (Exception ex) { Label1.Text = ""; } }

Budget_Master.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class Default2 : System.Web.UI.Page {

98

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); protected void Page_Load(object sender, EventArgs e) { TextBox1.Focus(); if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } } protected void Button2_Click(object sender, EventArgs e) { if (Label1.Text == "") { if (Button2.Text == "Add") { Button2.Text = "Confirm"; Button3.Enabled = false; } else { try { con.Open(); SqlCommand cmd = new SqlCommand("insert into Budget_Master values('" + TextBox1.Text + "','" + TextBox2.Text + "',0,0)", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('New budget code has been created')</script>"); TextBox1.Text = ""; TextBox2.Text = ""; Button2.Text = "Add"; Button3.Enabled = true; DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select to Delete"); DropDownList1.Text = "Select to Delete"; con.Close(); } catch (Exception ex) { } } } } protected void Button4_Click(object sender, EventArgs e) { Server.Transfer("Home.aspx"); } protected void Button1_Click(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Text = ""; DropDownList1.Text = "Select to Delete"; Button2.Text = "Add"; Button2.Enabled = true; Button3.Text = "Delete"; Button3.Enabled = true; } protected void Button3_Click(object sender, EventArgs e) { if (Button3.Text == "Delete")

99

Button3.Text = "Confirm"; Button2.Enabled = false; try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Budget_Master where BudgetCategory='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); TextBox1.Text = dr["BudgetCode"].ToString(); TextBox2.Text = dr["BudgetCategory"].ToString(); con.Close(); } catch (Exception ex) { }

} else {

try {

} } protected void TextBox1_TextChanged(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Budget_Master where BudgetCode='" + TextBox1.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (TextBox1.Text == dr["BudgetCode"].ToString()) { Label1.Text = "Already exist"; } dr.Close(); con.Close(); } catch (Exception ex)

} catch (Exception ex) { }

con.Open(); SqlCommand cmd = new SqlCommand("delete from Budget_Master where BudgetCode='" + TextBox1.Text + "'", con); cmd.ExecuteNonQuery(); Response.Write("<script>alert('Selected budget has been deleted')</script>"); DropDownList1.Items.Clear(); DropDownList1.DataBind(); DropDownList1.Items.Add("Select to Delete"); DropDownList1.Text = "Select to Delete"; TextBox1.Text = ""; TextBox2.Text = ""; Button3.Text = "Delete"; Button2.Enabled = true; con.Close();

100

{ } } }

Label1.Text = "";

Login.aspx.cs
using using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls; System.Data.SqlClient;

public partial class Login2 : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS2ConnectionString"] .ConnectionString); protected void Page_Load(object sender, EventArgs e) { TextBox1.Focus(); } protected void Button1_Click(object sender, EventArgs e) { try { con.Open(); SqlCommand cmd = new SqlCommand("select * from Login where UserName='" + TextBox1.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (TextBox2.Text == dr["Password"].ToString()) { Session["User_Name"] = TextBox1.Text; Response.Redirect("Home.aspx?id='" + dr["Type"].ToString() + "'"); } else { TextBox1.Text = ""; TextBox2.Text = ""; Response.Write("<script>alert('Invalid User')</script>"); }

101

dr.Close(); con.Close(); } catch (Exception ex) { } } protected void Button2_Click(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Text = ""; }

MasterPage_Master.aspx.cs
using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls;

public partial class MasterPage : System.Web.UI.MasterPage { static int flag = 0; static string b = ""; protected void Page_Load(object sender, EventArgs e) { if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } try { b = Request.QueryString["id"].ToString(); if (b != "'Administrator'") { DropDownList1.Enabled = false; } } catch(Exception ex) { DropDownList1.Enabled = false; } } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedIndex == 1) { Server.Transfer("Budget_Master.aspx"); } if (DropDownList1.SelectedIndex == 2)

102

Server.Transfer("Item_Master.aspx"); } if (DropDownList1.SelectedIndex == 3) { Server.Transfer("Supplier_Master.aspx"); } if (DropDownList1.SelectedIndex == 4) { Server.Transfer("Department_Master.aspx"); } DropDownList1.Text = "Master"; } protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList2.SelectedIndex == 1) { Server.Transfer("Item_Entry.aspx"); } if (DropDownList2.SelectedIndex == 2) { Server.Transfer("Item_Issue.aspx"); } if (DropDownList2.SelectedIndex == 3) { Server.Transfer("Department_Demand.aspx"); } if (DropDownList2.SelectedIndex == 4) { Server.Transfer("Budget_Allotment.aspx"); } DropDownList1.Text = "Transactions"; } protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList4.SelectedIndex == 1) { Server.Transfer("Create_User.aspx"); } if (DropDownList4.SelectedIndex == 2) { Server.Transfer("Change_Password.aspx"); } DropDownList1.Text = "Security"; } protected void Button1_Click(object sender, EventArgs e) { Server.Transfer("Login.aspx"); } protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList3.SelectedIndex == 1) { Response.Redirect("Report_SupplierList.aspx"); }

103

} protected void LinkButton1_Click(object sender, EventArgs e) { Session.Clear(); Server.Transfer("Login.aspx"); flag = 0; } }

if (DropDownList3.SelectedIndex == 2) { Response.Redirect("Report_DepartmentList.aspx"); } if (DropDownList3.SelectedIndex == 3) { Response.Redirect("Report_UserList.aspx"); } if (DropDownList3.SelectedIndex == 4) { Response.Redirect("Report_Entered_Items.aspx"); } if (DropDownList3.SelectedIndex == 5) { Response.Redirect("Report_Issued_Items.aspx"); } if (DropDownList3.SelectedIndex == 6) { Response.Redirect("Report_Available_Stock.aspx"); } if (DropDownList3.SelectedIndex == 7) { Response.Redirect("Report_Pending_Demand.aspx"); } DropDownList3.Text = "Reports";

Home.aspx.cs
using using using using using using using using using using System; System.Data; System.Configuration; System.Collections; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Session["User_Name"] == null) { Server.Transfer("Login.aspx"); } } }

104

SCOPE FOR FURTHER ENHANCEMENT


The developed system is made feasible such that further enhancements can be made easily to the project without making many changes in the existing design and coding of the software. First of all the system is made for as standalone PC but it has been provided with a facility of creating as many users as required so, the system can be easily made to run on a network environments without much changes. Secondly the system can be made to get connected to Internet and can receive information from Internet and can send the reports or others for the finished products could be done through Internet from within the system itself if required by the user in future. So there is a lot of scope for further enhancement, which depends on users requirements while working on the system.

105

BIBLIOGRAPHY
Here I would like to present the name of books, used for references while designing, coding, testing and implementation of system. Designing and Coding Phase a. Black Book of ASP.Net by Steven Holzner Testing, Implementation Phase a. System Analysis and Design by Elias M. Ewad. b. An Integrated Approach to Software Engineering by Pankaj Jalote.

106

Potrebbero piacerti anche