Hospital Management System Projectmm

194
Page | 1 1. ORGANISATIONAL OVERVIEW SP FORT HOSPITAL SP FORT hospital is owned by a large business family. It was established on 26 th January, 1998.in the first years of its development there were only average facilities. After this it was the way of gradual development. The reasons for its growth are: Very effective doctor service is available here. The doctors are well qualified and are always ready to provide as good service as possible The tools and facilities provide here are of the best quality. The machines used are just like those available in any other super specialty hospital. If any machine becomes out of order it will be repaired as early as possible by the service men available here so that the machine can be used at any time of its need. Above all three is an excellent management group in the hospital. They are always willing to provide any facility required by the customer. And ,they are always willing to listen to problems and rectify them The patients are highly impressed because of the excellent service provide in the hospital. The service cost is not very high. Thus most excellent service is available here at low expense.

Transcript of Hospital Management System Projectmm

Page 1: Hospital Management System Projectmm

P a g e | 1

1. ORGANISATIONAL OVERVIEW

SP FORT HOSPITAL

SP FORT hospital is owned by a large business family. It was established on 26thJanuary, 1998.in the first years of its development there were only average facilities. After this it was the way of gradual development. The reasons for its growth are:

• Very effective doctor service is available here. The doctors are well qualified and are always ready to provide as good service as possible

• The tools and facilities provide here are of the best quality. The machines used are just like those available in any other super specialty hospital. If any machine becomes out of order it will be repaired as early as possible by the service men available here so that the machine can be used at any time of its need.

• Above all three is an excellent management group in the hospital. They are always willing to provide any facility required by the customer. And ,they are always willing to listen to problems and rectify them

• The patients are highly impressed because of the excellent service provide in the hospital. The service cost is not very high. Thus most excellent service is available here at low expense.

Page 2: Hospital Management System Projectmm

P a g e | 2

2. SYSTEM ANALYSIS

Analysis is a detailed study of various operations performed by a system and their relationships within and outside the system. During analysis, data are collected on the available files, decision points and transactions handled by the present system. Interviews, on-site observation and questionnaire are the tools used for system analysis. Using the following steps it becomes easy to draw the exact boundary of the new system under consideration:

All procedures, requirements must be analyzed and documented in the form of detailed data flow diagrams (DFD), data dictionary, logical data structures and miniature specifications. System analysis also includes sub-dividing of complex process involving the entire system, identification of data store and manual processes.

The main purpose of analysis activity is to clearly understand the exact requirements of the system and eliminates the entire problem: inconsistency and its completeness of the existing system

2.1. STUDY OF EXISTING SYSTEM

• Patient reception

In case of an emergency the receptionist will collect patient information like name, age and address and whether they want to consult a doctor to their wish. If that doctor is not available, receptionistwill suggest a doctor’s name. If the case is serious, he is directly sent to the casualty and after the initial checkup he will be referred to the appropriate department doctors.

• Outpatient registration

After the patient reception OP card issued. The patient funds the op registration fees at the registration. The consulting fee is different for different doctors. The OP card is valid for a particular duration. If the patient comes after this duration, the card will be renewed. Then the details collected from the patient are recorded.

• Inpatient admission

.The patient will be admitted in hospital if needed, by the doctor .

• Room/ward

There are 2 sections. General ward and room.

Page 3: Hospital Management System Projectmm

P a g e | 3

• Billing

Only when a patient is discharge from a hospital a bill is prepared. It includes room rent, doctor‘s charge and soon.

• Discharge

A patient is discharged only when the doctor suggests. The dues will be cleared.

• Lab test

Depending on the disease and symptoms, the doctor will suggest for the required test for patient.

2.1.1 LIMITATION OF EXISTING SYSTEM

1. Lack of immediate retrievals: -The information is very difficult to retrieve and to find particular information like- E.g. - To find out about the patient’s history, the user has to go through various registers. This results in inconvenience and wastage of time.

2. Lack of immediate information storage: - The information generated by various transactions takes time and efforts to be stored at right place.

3. Lack of prompt updating: - Various changes to information like patient details or immunization details of child are difficult to make as paper work is involved.

4. Error prone manual calculation: - Manual calculations are error prone and take a lot of time this may result in incorrect information. For example calculation of patient billing based on various treatments.

5. Preparation of accurate and prompt reports: - This becomes a difficulttask as information is difficult to collect from various registers.

2.2. PROPOSED SYSTEM

The main objective of the proposed system is to overcome the drawbacks in the manual system. Also some modifications have to make it a simple and user friendly. Redundancy, inconsistency and storage of large amount of data extraction for generating a variety of reports

Page 4: Hospital Management System Projectmm

P a g e | 4

are the factors in the manual system. This form is the basic for the development of proposed system. High speed and accuracy are the main features of the proposed system over the manual system.

2.2.1. ADVANTAGES OF PROPOSED SYSTEM

• Planned approach towards working: - The working in the organization will be well planned and organized. The data will be stored properly in data stores, which will help in retrieval of information as well as its storage.

• Accuracy: - The level of accuracy in the proposed system will be higher. All operation would be done correctly and it ensures that whatever information is coming from the center is accurate.

• Reliability: - The reliability of the proposed system will be high due to the above stated reasons. The reason for the increased reliability of the system is that now there would be proper storage of information.

• No Redundancy: - In the proposed system utmost care would be that no information is repeated anywhere, in storage or otherwise. This would assure economic use of storage space and consistency in the data stored.

• Immediate retrieval of information: - The main objective of proposed system is to provide for a quick and efficient retrieval of information. Any typeof information would be available whenever the user requires.

• Immediate storage of information: - In manual system there are manyproblems to store the largest amount of information.

• Easy to Operate: - The system should be easy to operate and should be such that it can be developed within a short period of time and fit in the limited budget of the user.

2.3. REQUIREMENT ANALYSIS

Requirements Analysis is the process of understanding the customer needs and expectations from a proposed system or application and is a well-defined stage in the Software Development Life Cycle model.

Page 5: Hospital Management System Projectmm

P a g e | 5

Requirements are a description of how a system should behave or a description of system properties or attributes. It can alternatively be a statement of ‘what’ an application is expected to do.

Given the multiple levels of interaction between users, business processes and devices in global corporations today, there are simultaneous and complex requirements from a single application, from various levels within an organization and outside it as well.

The Software Requirements Analysis Process covers the complex task of eliciting and documenting the requirements of all these users, modeling and analyzing these requirements and documenting them as a basis for system design.

A dedicated and specialized Requirements Analyst is best equipped to handle the job. The Requirements Analysis function may also fall under the scope of Project Manager, Program Manager or Business Analyst, depending on the organizational hierarchy.

2.3.1. HARDWARE REQUIREMENTS

Processor : Dual coreHard disk : 20 GBRam : 1GBCd drive : 52xInput device: keyboard, mouse & web camera

2.3.2. SOFTWARE REQUIREMENTS

Operating system : windows7Backend : MicrosoftSQL server 2005Front end : c#.netDesign tool : Microsoft visual studio

2.4. FEASIBILITY STUDY

Preliminary investigations examine project feasibility, the likelihood the system organization. All projects are feasible-given unlimited resources and infinite time. Unfortunately,

Page 6: Hospital Management System Projectmm

P a g e | 6

the development of a computer-based system or product is more likely plagued by a scarcity of resource and difficult delivery dates. It is boat necessary and prudent to evaluate the feasibility of the project at the earliest possible time. Feasibility and risk analysis are related in many ways. Three important tests of feasibility are studied and described below

2.4.1. ECONOMIC FEASIBILITY

Economics feasibility is an important task of system analysis. A system that can be developed technically and that can be developed technically and that will be used if installed must still be profitable for the organization. Financial benefits must be equal or exceed the cost. The analysis raises financial and economic questions during the preliminary investigation to estimates the following to estimates the following.

1. The cost of conduct a full system investigation

2. The error benefit in the form of reduced cost or fewer costly errors.

3. The cost if nothing changes to be, judged feasible, a proposal for the specific project must pass all these tests, otherwise it is not considered as feasible project.

2.4.2. OPERATIONAL FEASIBILITY

Proposed project are beneficial only if they can be turned into information systems that will. Meet the operating requirements of the organization. This test of feasibility asks if the system will work when it is developed and installed. This project satisfies all the operational conditions.

2.4.3. TECHNICAL FEASIBILITY

There are a number of technical issued when are generally raised during the feasibility stage of the investigation. A study of function, performance and constraints may affect the ability to achieve an acceptable system. The considerations that are normally that are normally associated to technical feasibility include:

1. Development risk

2. Resource availability

3. Technology

2.5 RELEVANT ENTITIES

Entities are the objects of significance for the organization about which information needs to be known. The main entities of our project are

Page 7: Hospital Management System Projectmm

P a g e | 7

1. User 2. Administrator.

1. User:

The hospital staffs are the users in this software

Login

With user name and password, users can login to the software

OP

Details regarding outpatients are stored.

IP

Details of admitted persons are stored.

INFO

User can recollect all stored details.

TEST

User can add the test amount into patient bills.

Pharmacy

User can add the medicine charges into patient bills.

Video conferencing

User can communicate with another person through internet.

2. Administrator

Administrator Login is used only for the administrative purpose of the system. This login can be used only by the administrator, who accepts or deny access to the user.

Settings

Administrator can only set& reset the setting of the software

Id card creation

Id card for hospital staffs are created by the administrator.

Page 8: Hospital Management System Projectmm

P a g e | 8

3. SYSTEM DESIGN

The most creative and challenge phase of the system life cycle is system design . System design is a solution a ‘how’ to approach to the creation of a new system. This important phase is composed of several steps. They provide the understanding and procedural details necessary for implementing the system recommended in the feasibility study. Emphasis is translating the performance requirements into design specification. The design phase is a transition from a user oriented document to a documented oriented to the programmers or database personal. This phase is including input and output design and basics of form design.

There are two different categories in design phase. They are physical design of the system and logical design of the system. Define the system in terms of the user system specification is called logical system definition. First the system objectives are achieved logically, and then only design portions will convert into physical terms.

In logical system definition a number of factors have been considered

• The analyst must clarify the specific objectives of the design process • The result of the analysis must be converted into an outline of the outfits for and input

the system• It is necessary to structure the data , which will need to be stored in order to

procedure the outputs

• It is necessary to consider the nature of the processing need to met the user requirements

3.1 DESIGN OF SUBSYSTEM

1. OP MODULE

The op module deals with functions of out patients. They are

• Op registration• Op consultation

Page 9: Hospital Management System Projectmm

P a g e | 9

Op registration sub modules The function of this module of registration of new patient in the op .The registration form with patient’s data. The patients can select the desired doctors for consultation. And also OP card issued.

Op consultation sub module

This is designed to update op renewal and consultations. The op number is used to search for patient data.

2. IP MODULE

Admission of patient maintenance of the IP register, discharge of patient and IP billing are handled by this module. The sub modules are

IP admission IP bills

* IP admission sub module

There are two primary options in addition. That is to admit a patient already having an IP registration or to admit a new patient as IP .in the first case function is to search with op number and show all available patient data. Additional information needed is then entered in IP register. For a new patient new IP number is generated and will relevant data are accepted.

In this module will inpatients are listed. The user can select patient for discharge. While proceeding with discharge summary is entered

* IP bills sub module

The IP number is used to search for patients data. Then validity for current registration is verified by checking data of last renewal in IP registration. And calculate the total fee and balance fee of the patient.

3. INFO MODULE

This module has the following sub modules

• Room / ward information • Doctors information • Test information • Op information• IP information

Page 10: Hospital Management System Projectmm

P a g e | 10

• Room / ward information To display which room / bed is free and which occupied.

• Doctors information List the name of all doctors and there name ,id ,section and consultation free are displayed .

• Test informationTo display the test details. Test name and cost of the test are included.

• Op informationTo display op information

• Ip informationTo display ip information

4. SETTINGS

This module relates to the generation of reports needed for system setting.

5. TEST

This module relates to the testing.

6. ID CARD CREATION

This module related to creating ID card for hospital staff.

7. VIDEO CONFERENCING

This module offer video communication through internet.

8. PHARMACY

This module deals medicine cost of a patient from the hospital

Page 11: Hospital Management System Projectmm

P a g e | 11

3.2 USER INTERFACE DESIGN

The user interface portion of a software product is responsible for all interactions with the user. Almost every software product has a user interface. Most users often judge a software product based on its user interface. An interface that is difficult to use leads to higher levels of user errors and ultimately leads to user dissatisfaction. Therefore, sufficient care attention should be paid to the design of the user, interface of any software product.

Systematic development of the user interface is also important. Development of a good interface usually takes significant portion of the total system development effort. Unless the user interface is designed and developed in a systematic manner, the total effort required to develop the interface will increase tremendously. Therefore, it is necessary to carefully study various concepts associated with user interface design and understand the various systematic techniques available for the development of user interface.

Page 12: Hospital Management System Projectmm

P a g e | 12

3.3 DATA BASE DESIGN After the input and output and various from are designed files and the data they store most be organized according to user requirements and constrains of the hard ware and the operating system. In a data environment, common data are available and used by several users .instead of each program managing its own data, data across application are shared by authorized users with data base software managing the data as an entity.

A data base is a collection of interrelated data stored with minimum redundancy to serve many users quickly and efficiently .the generally objective is to make in formation access easy, quick, in expensive, flexible for the user. In data base designing several specific objectives are considered they are

• Control redundancy • Easy of learning • Data independence • More information on low cost• Accuracy and integrity • Recovery form failure • Privacy and security performance.

Heart of the data base is the data base management .it control and manage the data base file and manages the data base files and handle s request from application program in a data manipulation language .

Data base structuring is refined through a process called normalization .data are grouped in the simplest way possible so that later changes can be made be with a minimum of impact on the structure. When too many application are formed together to make entities, some are found to be entitled themselves into attributes liked by common data elements to form relationship improved by effective data base management system.

3.4 TABLE DESIGN

users

column name data type constraintsuser name nvarchar(50) primary keypassword nvarchar(30)IsAdmin nvarchar(10)

Page 13: Hospital Management System Projectmm

P a g e | 13

IPpayment

column name data type constraintsIpno Char(10) Foreign keyBilldate datetimeDue Decimal(10,2)paid Decimal(10,2)closed Varchar(10)

RoomWard

column name data type constraintsRoom name varchar(50) Primary keyNoOfBeds varchar(50)Rent decimal(10,2)BedsFree intRoomType varchar(10)

Test

column name data type constraintsTest varchar(50)charge float

DEPARTMENT

column name data type constraintsDEPARTMENT Varchar(200)

op

Column name Data type constraints

Op no varchar(10) Primary key

Name varchar(300)

Age int

Sex varchar(2)

Address varchar(500)

Phone varchar(300)

Page 14: Hospital Management System Projectmm

P a g e | 14

Refdr varchar(300)

Date varchar(50)

Last date varchar(50)

comments varchar(max)DEPARTMENT varchar(200)

DrDetails

Column name Data type constraintsId no Int primary keyName varchar(300)Phone_no varchar(50)Details varchar(max)Consultation_fee Floatdepartment varchar(200)

Pharmacy

column name data type constraintsID int primary keyItem varchar(50)Quantity intRate Decimal(10,2)

OTHER

column name data type constraintsHOSPITALNAME varchar(200)OpExpiryDays int

IP

Column name Data type constraintsIP no Char(10) Primary keyCons_date varchar(50)Name varchar(50)Age IntSex char(2)

Page 15: Hospital Management System Projectmm

P a g e | 15

Address varchar(300)Phone varchar(30)Refdr varchar(300)Complaint varchar(500)Wardtype varchar(50)Roomorwardno char(10)Department varchar(100)Date of last paid date

3.5 RELATIONSHIP BETWEEN TABLES

Page 16: Hospital Management System Projectmm

P a g e | 16

3.6 DATA FLOW DIAGRAM

The DFD is a simple graphical formalize that can be used to represent a system. A DFD graphically depicts the transformation of the data input to the system to the final result through a hierarchy of levels. The main reason why the DFD technique is so popular is probably because of the fact that DFD is a very simple formalism – it is simple to understand and use. A DFD model uses a very limited number of functions performed by a system and the data flow among these functions. Starting with a set of high-level functions that a system performs, a DFD model hierarchically represents various sub functions. To develop a higher-level DFD model, processes are decomposed into their sub-processes and the data flows among these sub-processes are identified.

Primitive Symbols Used for Constructing DFD

Function Symbol

A function is represented using a circle. This symbol is called a process or a bubble. Bubbles are annotated with the names of the corresponding functions.

- Process

External Entity Symbol

An external entity such as a librarian, a library member, etc is represented by a rectangle. The external entities are essentially those physical entities external to the software system which interact with the system by inputting data to the system or by consuming the data produced by the system. In addition to the human users, the external entity symbol can be used to represent external hardware and software such as external application software.

- External Entity

Data Flow Symbol

A directed arc or an arrow is used as flow symbol. A data flow symbol represents the data flow occurring between two processes, or between an external entity and a process, in the direction of the data flow arrow. Data flow symbols are usually annotated with the corresponding data names

Page 17: Hospital Management System Projectmm

P a g e | 17

- Data Flow Symbol

Data Store Symbol

A data store represents a logical file. It is represented using two parallel lines. A logical file can represent either a data store symbol which can represent either a data structure or physical file on disk. Each data store is connected to a process by means of a data flow symbol. The direction of the data flow arrow shows whether data is being read from or written in to a data store. An arrow flowing in or out of a data store implicitly represents the entire data store and hence arrows connecting to a data store need not be annotated with the name of the corresponding data items.

- Data Store Symbol

Output Symbol

The Output symbol is used to represent the output

- Output Symbol

3.7 CONTEXT DIAGRAM

Context diagram is also called Level-0 DFD. It represents the entire system in a single bubble. The various external entities with which the system interacts and the data flows occurring between the systems and external entities are also represented. A System Context Diagram (SCD) is the highest level of a system, showing the system as a whole and its inputs and outputs from/to external actors. SCDs are a type of Data Flow Diagram, and they should always be produced as DFDs. Context Diagrams show the interactions between a system and other factors with which the system is designed to face. SCD is very helpful in understanding the context in which the system will be part of Software engineering.

Context diagrams are used early in a project to get agreement on the scope under investigation. Context diagrams are typically included in a requirements document. These diagrams must be read by all project stakeholders and thus should be written in plain language so the stakeholders can understand items within the document. An alternative would be a use case diagram since it also represents the scope of the project at a similar level of abstraction.

Page 18: Hospital Management System Projectmm

P a g e | 18

The best System Context Diagrams are used to display how system interoperates at a very high level or how systems operate and interact logically. The system context diagram is a necessary tool in developing a baseline interaction between systems and actors; actors and system or systems and system.

LEVEL 1 DFD

Page 19: Hospital Management System Projectmm

P a g e | 19

Page 20: Hospital Management System Projectmm

P a g e | 20

Page 21: Hospital Management System Projectmm

P a g e | 21

Page 22: Hospital Management System Projectmm

P a g e | 22

Page 23: Hospital Management System Projectmm

P a g e | 23

3.8 STRUCTURE CHART

Page 24: Hospital Management System Projectmm

P a g e | 24

3.9 MENU TREE

Page 25: Hospital Management System Projectmm

P a g e | 25

4. PROCESSING ENVIORNMENT

4.1 Hardware Specification

Processor Intel Dual Core

RAM 1GB

Hard disk 40 GB

Input Keyboard, mouse&web camera

4.2 Software Specification

Operating system windows 7

Language used English

Front end C#.net

Back end MS SQL

OPERATING SYSTEM

Windows 7 is the latest release of Microsoft Windows, a series of operating systems produced by Microsoft for use on personal computers, including home and business desktops, laptops, netbooks, tablet PCs, and media center PCs. Windows 7 was released to manufacturing on July 22, 2009, and reached general retail availability on October 22, 2009, less than three years after the release of its predecessor, Windows Vista. Windows 7's server counterpart, Windows Server 2008 R2, was released at the same time.

Unlike its predecessor, Windows Vista, which introduced a large number of new features, Windows 7 was intended to be a more focused, incremental upgrade to the Windows line, with the goal of being compatible with applications and hardware with which Windows Vista was not at the time. Presentations given by Microsoft in 2008 focused on multi-touch support, a redesigned Windows shell with a new taskbar, referred to as the Super bar, a home networking system called Home Group, and performance improvements. Some standard applications that

Page 26: Hospital Management System Projectmm

P a g e | 26

have been included with prior releases of Microsoft Windows, including Windows Calendar, Windows Mail, Windows Movie Maker, and Windows Photo Gallery, are not included in Windows 7; most are instead offered separately at no charge as part of the Windows Live Essentials suite.

FRONT END

Introduction to Microsoft - Net

• Microsoft .net is a set of software technologies for collecting information, people, system and devices.

• An absolutely new programming module totally object oriented; grammar / functionally independent of each other.

• Simplified and consistent architecture same development methodology may be applied across plethora of languages without performance loss.

• Microsoft.net is a set of software technologies for connecting information, people, system and devices.

• An absolutely new programming model- totally object oriented; grammar functionally independent of each other.

• Simplified and consist architecture- same development methodology may be applied without performance loss.

• Net frame work• The net framework is a development and execution environment that allows

different programming languages and libraries to work together seamlessly to create applications that are easier to build, manage, deploy and integrated with other networked systems.

The.net frame work is responsible for providing a basic platform for application.

Main parts of .net frame work

• The common language runtime (CLR)• The frame work class libraries (FCL)• The programming language (C#,VB)• Asp.net (web application)

Common language runtime

• CLR is a virtual machine component of micro soft’s.net.• It’s an implementation for common language infra-structure(CLI)• CLR runs a form of byte code.

Page 27: Hospital Management System Projectmm

P a g e | 27

The common language run time is responsible for run time services such as language integration, security enforcement memory, process and thread management. in addition it has a role at development time when feature such as life cycle management ,storage type naming across language exception .handling, dynamic binding and soon .reduce the amount of the code that a developer must write to turn business logic into re-usable component.

Frame work class libraries (FCL)

• FCL is a library of classes available to all languages using.net fiber work.• The BCL provides classes which encapsulated a number of common function

including file reading and writing, graphic rendering, data base interaction and XML document manipulation.

The class library is an object oriented, providing types form which our own managed code can derive functionally. This not only make the .net frame work type easy to use ,but also reduces the time associated with learning new features of the .net frame work. in addition third party components can integrate seamlessly with classes in the .net frame work.

C-SHARP(C#)

• C# = VB + java (best of both).• C# is an OOP language.• Developed by Microsoft.• Simple operator loading.• Basic statement identical to c++, java.

C# is simple ,powerful ,type –safe object oriented rapid application development while retraining expressiveness and elegance of c-style language visual studio support visual c# with a featured code editor project templates ,designers ,code wizard , a power full and easy-to-to use debugger and other tool. The .net frame work class library provides access to a wide range of operating system services and other use full, well-designed class that sped up the development cycle significantly.

The c# language is clearly the star of whole .net range-production with visual basic .net and it is side click. C # is a ’java-like’ qualities such as garbage. Collection and hierarchical namespaces—have received lot of attention.

WPF

Windows Presentation Foundation (WPF) is the code-name of the presentation (user-interfaces) sub system in Windows programming model and is used to create user interfaces. If you have been programming .NET, you must be familiar with Windows Forms and ASP.NET. Windows Forms are used to build Windows client application and ASP.NET is

Page 28: Hospital Management System Projectmm

P a g e | 28

used to build Web applications. Well, WPF is a new technology that may be used instead of both Windows Forms and ASP.NET.

BACKEND

MS SQL

SQL server is the native data store of C#.net. Every business enterprises maintain large volume of data for its operation with more and more people accessing data for their work, the need to maintain its integrity and relevance increases. Normally with the traditional method of storing data and information in file, the changes that the data loses its integrity and validity are very high SQL server 2005 offers capacity of both relational and object-oriented data base system. In general objects can be defined as reusable software calls which can be located independently and perform specific

Tasks on my application environment with little or no change to the code.

FEATURES OF SQL

• Scalability and availability • Enterprise level database features• Ease of interaction deployment and use

Page 29: Hospital Management System Projectmm

P a g e | 29

5. CODING AND TESTING

The input to the coding phase is the design document. During the coding phase, different modules identify in the design document are coded according to the respective module specifications. Recall that at the end of the design phase, we not only have the module structure of the system but also the module specifications where the data structures and algorithms for each module are specified. Therefore, we can say that the objective of the coding phase is transform the design of a system as given by its module specifications, into a high level language code and to unit test this code.

A crucial phase in the system development life cycle is the successful implementation of new system design. Implementation simply means converting a new system design into operation. An important aspect of the system analyst’s job is to make sure that the design is implemented to establish the standard. A critical phase in the system development is the implementation of the new system. Implementation is the process of converting a new system design into an operational one. Implementation includes all the activities that take place to convert from the old system into a new one. The new system may be totally new. Replacing an existing system on it may be a major modification to a system currently put into use.

Implementation is the stage of the project when this theoretical design is turned into a working system. At this stage the main work load shifts to user department. It can’t be considered to be a crucial stage in achieving a successful new stage and in giving the user confidence that the system will work and be effective.

TESTING

Testing is probably the most important phase for long-term support as well as for the reputation of the company. If you don’t control the quality of the software, it will not be able to compete with other products on the market. If software crashes at the customer site, your customer loses productivity as well money and you lose credibility. Sometimes these losses are huge. Unhappy customers will not buy your other products and will not refer other customers to you. You can avoid this situation by doing extensive testing. This testing is referred to as Quality Assurance, or QA, in most of the software world.

Usually, testing starts as soon as the initial parts of the software are available. There are multiple types of testing and these are explained in this section. Each of these has its own importance.

Page 30: Hospital Management System Projectmm

P a g e | 30

• Unit testing

• User Acceptance testing

• Validation testing

• Integration testing

1. Unit testing

Unit testing is testing one part or one component of the product. The developer usually does this when he/she has completed writing code for that part of the product. This makes sure that the component is doing what it is intended to do. This also saves a lot of time for software testers as well as developers by eliminating many cycles of software being passed back and forth between the developer and the tester.

When a developer is confident that a particular part of the software is ready, he/she can write test cases to test functionality of this part of the software. The component is then forwarded to the software testing people who run test cases to make sure that the unit is working properly.

2 User Acceptance testing

User acceptance of a system is a key factor for the success of any system. The system under consideration is tested for the user acceptance by constantly, keeping in touch with the prospective system user at the time of developing and making changes whenever required.

3 Validation testing

Validation test can be defines in many ways, but a simple definition is that the validation succeeds when the software functions in a manner that is expected by the customer.

4 Integration testing

It is the systematic approach for constructing the program structure, while at the same time conducting test to uncover errors associated with in the interface.

Page 31: Hospital Management System Projectmm

P a g e | 31

6. SECURITY, BACKUP AND RECOVERY

Security is the condition of being protected against danger or data loss. In the general sense, security is a concept similar to safety. The nuance between the two is an added emphasis on being protected from dangers that originate for outside. Individuals or actions that encroach upon the condition of protection are responsible for the breach of security.

In the field of information technology, backup refers to the copying of data so that these additional copies may be restored after a data loss event. Backups are useful primarily for two purposes: to restore a computer to an operational state following a disaster and to restore small numbers of files after they have been accidentally deleted or corrupted. Backups differ from archives in the sense that archives are the primary copy of data and backups are a secondary copy of data. Backup systems differ from fault tolerant systems in the sense that backup systems assume that a fault will cause a data loss event and fault-tolerant systems assume a fault will not. Backups are typically that last line of defense against data loss, and consequently the least granular and least convenient to use.

Page 32: Hospital Management System Projectmm

P a g e | 32

7. UPGRADEABILITY POSSIBILITIES

It refers to the up gradation possibilities of the current project. This program can upgraded to have many more features such as hospital inventory management, staff details, payroll management etc. Also it can give network capabilities for connecting and synchronizing various section or departments of a hospital.

1. Even though casualty not included even if it could be added2. Pharmacy is described simply we could add specific details about pharmacy and

test3. Different types of rooms and ward are available in the hospital. That are not

specified in the software 4. Staff details except doctorsare not stored 5. Users are only hospital staff.Even though should be explicit publically.

Page 33: Hospital Management System Projectmm

P a g e | 33

8. SOFTWARE MAINTENANCE

Software maintenance refers to any changes made to a software product after it has been delivered to the customer. Maintenance is needed to correct errors, enhance features, port to new platforms, etc. When the hardware platform changes, and a software product performs some low level functions, maintenance becomes necessary. The requirement of software maintenance arises on account of the three main reasons:

CorrectiveCorrective maintenance of a software product becomes necessary to rectify the bugs

observed while the system is in use.

Adaptive A software product might need maintenance when the customers need the product to run

on new platforms, on new operating systems, on new operating systems, or when they need the product to be interfaced with new hardware or software.

PerfectiveA software product needs maintenance to support the new features that users want it to

support to change different functionalities of the system according to customer demands, or to enhance the performance of the system.

Page 34: Hospital Management System Projectmm

P a g e | 34

9. APPENDIX

9.1Conclusion

Hospital management system is an application that can be used for manipulating and maintaining the internal processes of a hospital in a simple and user friendly way. This software works on a simple work station. If we use this software we can perform most of the function in a hospital within seconds.

9.2Bibliography

BOOKS

Fundamentals of Software Engineering

ByRajib Mall

Software Engineering

By K.L James

WEBSITE

http://www.en/wikipedia.org.

9.3. Gantt chartGantt charts are mainly used to allocate resources to activities. The resources allocated to

activities include staff, hardware and software. A Gantt chart is a special type of bar chart where each bar represents an activity. The bars are drawn along a timeline. The length of each bar is proportional to the duration of the time planned for the corresponding activity.

Gantt charts used for the software project management are actually an enhanced version of the standard Gantt charts. In the charts used for software project management, each bar consists of a white part and shaded part. The shaded part of the bar shows the length of the time estimated to take. The white part shows the slack time is the time by which a task must be finished.

Page 35: Hospital Management System Projectmm

Design database part

Design database part

NOV 15 DEC 1 DEC 25 JAN 11 JAN 31 March 10

Specifications

Design database part

Design GUI part

Code database part

Code GUI part

Integration and test

Write user manualpart Designatabs

P a g e | 35

9.4Meeting Minutes

Date : November 15 to November 30

Time : 10:00 am

Location :neyyattin kara

Present :AKHIL S.V

AKHIL GOPAL

DEEPU

Page 36: Hospital Management System Projectmm

P a g e | 36

SACHIN vijeesh

Progress Report

We took a weekly meeting. This period the specification of requirement was conducted. A detailed study of the existing system was done. Reports were written about the analysis. The drawbacks of the existing system were noted. Thus a new system was proposed. The requirements and the specifications for the proposed system were recorded. The server, which has a major role, was also specified. The software was broken into the modules. Specific tasks were assigned to each member.

Scheduled meeting

Date : December 1 to December 25

Time : 11:00 am

Location :neyyattin kara

Present :AKHIL S.V

AKHIL GOPAL

DEEPU

SACHIN vijeesh

Progress Report

The design of the graphical user interface part has been started. User friendly interface were created in concerned to the customer. The table design is completed. Date base work is also finished. Necessary values are inserted. Various validation processes are studied. The database design discussed with our project guide at college.

Scheduled meeting

Date : January 11 to January 31

Page 37: Hospital Management System Projectmm

P a g e | 37

Time : 10:00 am

Location :neyyattin kara

Present :AKHIL S.V

AKHIL GOPAL

DEEPU

SACHIN VIJEESH

Progress Report

The code of GUI part has been completed. The database part code will take a few more days to be finished. The report work has been completed.

Scheduled meeting

Date : February 1 to March 10

Time : 10:00 am

Location :neyyattin kara

Present :AKHIL S.V

AKHIL GOPAL

DEEPU

SACHIN VIJEESH

Page 38: Hospital Management System Projectmm

P a g e | 38

Progress Report

The design and coding of the system have completed. Now the integration and testing part to evaluate the systems complaints with specified requirements the data input and output has been checked. System testing has done using verification and validation. Thus this proposed system has finished its design coding and testing phase.

Page 39: Hospital Management System Projectmm

P a g e | 39

10. SOURCE CODE

using System.Collections.Generic;using System.Text;using System.Windows.Controls;namespace WpfApplication2{classClassAgeValidation:ValidationRule {int _MinAge = 0;int _MaxAge = 200;public ClassAgeValidation() { }

publicint MinAge {get {return _MinAge; }set {_MinAge = value;} }

publicint MaxAge {get { return _MaxAge; }set { _MaxAge = value; } }

publicoverride ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) {int age = 0;try {if (((string)value).Length > 0) age = Int32.Parse((string)value); }catch(Exception w) {returnnew ValidationResult(false, "Illegal Charecters or " + w.Message); }if ((age < MinAge) || age > MaxAge) {returnnew ValidationResult(false, "Please Enter an age Between " + MinAge + " and " + MaxAge); }else {returnnew ValidationResult(true, null); }

}

Page 40: Hospital Management System Projectmm

P a g e | 40

}} using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Windows;

namespace WpfApplication2{publicclassDoctor {publicstring _doctor;public Doctor(string doctor) { _doctor = doctor; }

publicstring Name {get { return _doctor; } }

publicoverridestring ToString() {return _doctor.ToString(); } }

publicclassDoctorList : ObservableCollection<Doctor> {public DoctorList() : base() { } }

publicclassDepartment {string _Department; DoctorList _depts;

public Department(string department) { _Department = department; _depts = new DoctorList(); }

publicstring Name {get { return _Department; } }

publicoverridestring ToString() {return _Department.ToString(); }public DoctorList Doctors {

Page 41: Hospital Management System Projectmm

P a g e | 41

get { return _depts; } } }

publicclassDepartmentList : ObservableCollection<Department> {

ClassLogging log = new ClassLogging(); public DepartmentList() : base() {try { ClassDbManager db = new ClassDbManager(global::WpfApplication2.Properties.Settings.Default.ConnectionString); db.OpenDB(); Department department;

DataTable dtDepartments = new DataTable(); DataTable dtDoctors = new DataTable();

SqlCommand com = new SqlCommand(); com.CommandType = CommandType.StoredProcedure;

//select departments com.CommandText = "SelectDepartments"; com.Connection = ClassDbManager.con; com.Connection = ClassDbManager.con;

SqlDataAdapter ad = new SqlDataAdapter(); ad.SelectCommand = com; ad.Fill(dtDepartments);

//select doctors og correspondin departmnes com.Parameters.Clear(); com.CommandText = "SelectDoctor"; com.Parameters.Add("@DepartmentName", SqlDbType.VarChar);

DataTableReader dtrDepartments = new DataTableReader(dtDepartments);while (dtrDepartments.Read()) { Add(department = new Department(dtrDepartments["Departments"].ToString()));

com.Parameters["@DepartmentName"].Value = dtrDepartments["Departments"].ToString();//com.CommandText = "SELECT name AS DoctorName FROM DOCTORS WHERE DEPARTMENT='" + dtrDepartments["DEPARTMENTS"].ToString() + "'"; ad.SelectCommand = com;

ad.Fill(dtDoctors);for (int i = 0; i < dtDoctors.Rows.Count; i++) { department.Doctors.Add(new Doctor(dtDoctors.Rows[i]["DoctorName"].ToString())); }

Page 42: Hospital Management System Projectmm

P a g e | 42

dtDoctors.Clear(); } }catch (Exception w) { log.LogException(w); } } }

publicclassPatient : INotifyPropertyChanged {string OpNumber="",name = "", address = "", phoneNumber = "", comment = "", department, doctor = "",sex;int age = 0;

publicevent PropertyChangedEventHandler PropertyChanged;

public Patient() { }

public Patient(string OpNumber,string name, int age, string address, string phoneNumber, string comment, string department, string doctor,string sex) {this.OpNumber=OpNumber;this.name = name;this.age = age;this.address = address;this.phoneNumber = phoneNumber;this.comment = comment;this.department = department;this.doctor = doctor;this.sex = sex; }

publicoverridestring ToString() {return OPNumber.ToString(); }

publicstring OPNumber {get{return OpNumber;}set { OpNumber = value; OnPropertyChanged(OpNumber); } }

publicstring Name {get { return name; }set { name = value;

Page 43: Hospital Management System Projectmm

P a g e | 43

OnPropertyChanged(name); } }

publicint Age {get { return age; }set { age = value; OnPropertyChanged(age.ToString()); } }

publicstring Address {get { return address; }set { address = value; OnPropertyChanged(address); } }

publicstring PhoneNumber {get { return phoneNumber; }set { phoneNumber = value; OnPropertyChanged(phoneNumber); } }

publicstring Comment {get { return comment; }set { comment = value; OnPropertyChanged(comment); } }

publicstring Department {get { return department; }set { department = value; OnPropertyChanged(department); } }

publicstring Doctor {get { return doctor; }set

Page 44: Hospital Management System Projectmm

P a g e | 44

{ doctor = value; OnPropertyChanged(doctor); } }

publicstring Sex {get { return sex; }set { sex = value; OnPropertyChanged(sex); } }

protectedvoid OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged;if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); } } }

publicclassPatients : ObservableCollection<Patient> { public Patients() : base() { ClassDbManager db = new ClassDbManager(global::WpfApplication2.Properties.Settings.Default.ConnectionString); db.OpenDB();//add patient details/* *OP Number *Name *Age *Address *PhoneNumber *Comment *Departmnet *Doctor */ SqlCommand com = new SqlCommand(); com.Connection = ClassDbManager.con; com.CommandType = CommandType.StoredProcedure; com.CommandText="SelectOP";

SqlDataReader rdOP = com.ExecuteReader();

while (rdOP.Read()) { Add(new Patient(rdOP["ID"].ToString(), rdOP["name"].ToString(), Convert.ToInt32(rdOP["Age"].ToString()), rdOP["Address"].ToString(), rdOP["Phone"].ToString(), rdOP["Comment"].ToString(), rdOP["department"].ToString(), rdOP["doctor"].ToString(),rdOP["sex"].ToString())); }

Page 45: Hospital Management System Projectmm

P a g e | 45

} }

}

sing System;using System.Collections.Generic;using System.Data.SqlClient;using System.Text;using System.Windows.Forms;using System.Data;

namespace WpfApplication2{classClassDbManager {string ConString = ""; ClassLogging log = new ClassLogging();

public ClassDbManager() {

}public ClassDbManager(string connString) { ConString = connString; }publicstatic SqlConnection con ;//function for opening connectionpublicbool OpenDB() {if (ConString != "") {try { con = new SqlConnection(ConString); con.Open();returntrue;

}catch { MessageBox.Show("Cannot open DB\nSource:Class DBManger.openDB(string)");returnfalse; } }elsereturnfalse; }//function for checking if entry exitspublicbool EntryExists(string query) { DataSet ds = new DataSet(); SqlDataAdapter ad = new SqlDataAdapter(); SqlCommand com = new SqlCommand(); com.Connection = ClassDbManager.con;

Page 46: Hospital Management System Projectmm

P a g e | 46

com.CommandText = query; ad.SelectCommand = com;if (query != null) {try {if (ad.Fill(ds) > 0) {return (true); }else {return (false); } }catch {

return (false); } }elsereturnfalse; }//function for inserting valuespublicint Insert(string[] fields, string table, string[] values) {string query = "", tempQuery = "";int affectedRows = 0; DataSet ds = new DataSet();

SqlCommand com = new SqlCommand(); com.Connection = con;try {if (fields != null) {

tempQuery = "insert into " + table + "(";for (int i = 0; i < fields.Length; i++) { tempQuery += fields[i] + ","; } query = tempQuery.Remove(tempQuery.Length - 1); query += ") values("; tempQuery = "";

}else { tempQuery = "insert into " + table; query += tempQuery + " values("; tempQuery = ""; }

for (int i = 0; i < values.Length; i++) { tempQuery += "'" + values[i] + "',";

Page 47: Hospital Management System Projectmm

P a g e | 47

} query += tempQuery.Remove(tempQuery.Length - 1) + ")"; com.CommandText = query; }catch(Exception w) {

//return negative if cannot build query

log.LogException(w);return -1; }try { Clipboard.SetText(com.CommandText); affectedRows = com.ExecuteNonQuery();return affectedRows; }catch(Exception w) { log.LogException(w);return 0; } }//function for selecting MAX IDpublicstring MAXID(string TableName) { SqlCommand com = new SqlCommand("SELECT MAX(ID) FROM "+TableName); com.Connection = con; DataTable DT = new DataTable(); SqlDataAdapter AD = new SqlDataAdapter(); AD.SelectCommand = com; AD.Fill(DT);if (DT.Rows.Count > 0) {return (DT.Rows[0][0].ToString()); }else {return"1"; } }

}}sing System;using System.Collections.Generic;using System.Linq;using System.Text;

namespace WpfApplication2{publicclassResultEventArgs : EventArgs {privatereadonlybool errorOccured;privatereadonlystring message;

Page 48: Hospital Management System Projectmm

P a g e | 48

public ResultEventArgs(bool ErrorOccured, string Error) {this.errorOccured = ErrorOccured;this.message = Error; }

publicstring Message {get { return message; } }

publicbool ErrorOccured {get { return errorOccured; } }

}}

using System;using System.Collections.Generic;using System.IO;using System.Text;

namespace WpfApplication2{classClassLogging {string _path = Environment.CurrentDirectory + "\\Logs\\ErrorLog.log";StreamWriter sw;

publicstring Path {get { return _path; }set { _path = value; } }

publicvoid LogException(Exception w) {try {if (!Directory.Exists(Directory.GetDirectoryRoot(_path))) {Directory.CreateDirectory(Environment.CurrentDirectory + "\\Logs"); }if (!File.Exists(_path)) {using (sw = File.CreateText(_path)) { sw.WriteLine("---Hospital Management System error Log---\n"); } sw.Close(); }

Page 49: Hospital Management System Projectmm

P a g e | 49

sw = File.AppendText(_path);//Time sw.WriteLine(""); sw.WriteLine("[" + DateTime.Now.ToString() + "]\n");

//Message sw.WriteLine("[" + w.Message + "]");

//Stack trce sw.WriteLine("[" + w.StackTrace + "]");

//Source sw.WriteLine("[" + w.Source + "]");

sw.Close(); }catch (Exception Ex) {// throw Ex; } }

sing System;using System.Collections.Generic;using System.Text;using System.Data;using System.Data.SqlClient;

namespace WpfApplication2{/* * Load OP bill items and return as data table * insert into OP Bill -at frnt * Print OP Bill */classClassOPBillMangement {public DataTable LoadBillItems() {try { DataTable items = new DataTable(); SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM OPBILLMASTER", ClassDbManager.con); ad.Fill(items);return items; }catch(Exception w) { ClassLogging log = new ClassLogging(); log.LogException(w);returnnull; } }

Page 50: Hospital Management System Projectmm

P a g e | 50

}}

using System;using System.Collections.Generic;using System.Data;using System.Data.SqlClient;using System.Text;

namespace WpfApplication2{classClassPharmacyManger {public DataView GetItemList() { SqlDataAdapter ad = new SqlDataAdapter("SELECT Item FROM pharmacy",ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt);return dt.AsDataView(); }

publicbool AddNewItem(string item,decimal rate) {try {string[] fields = { "Item", "rate" };string table = "pharmacy";string[] values = { item, rate.ToString() }; ClassDbManager db = new ClassDbManager();if (db.Insert(fields, table, values) > 0) {returntrue; }else {returnfalse; } }catch {returnfalse; } }

publicbool RemoveItem(string item) { SqlCommand com = new SqlCommand("DELETE FROM PHARMACY WHERE ITEM='" + item + "'", ClassDbManager.con);if (com.ExecuteNonQuery() > 0) {returntrue; }else {returnfalse; }

Page 51: Hospital Management System Projectmm

P a g e | 51

}

publicint GetSelectedQuantity(string item) { SqlDataAdapter ad = new SqlDataAdapter("SELECT quantity FROM pharmacy WHERE item='" + item + "'", ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt);if (dt.Rows.Count > 0) {try {int qty=Convert.ToInt32(dt.Rows[0]["quantity"]);return qty; }catch {return 0; } }else {return 0; } }

publicbool UpdateQuantity(string item,int qty) { SqlCommand com = new SqlCommand("UPDATE Pharmacy SET quantity=" + qty + " WHERE item='" + item + "'", ClassDbManager.con);if (com.ExecuteNonQuery() > 0) {returntrue; }else {returnfalse; } }

publicbool SubstractQuantity(int qty) { SqlCommand com=new SqlCommand("UPDATE pharmacy SET quantity=quantity-"+qty,ClassDbManager.con);if (com.ExecuteNonQuery() > 0) {returntrue; }else {returnfalse; } }

}}ing System;

Page 52: Hospital Management System Projectmm

P a g e | 52

using System.Collections.Generic;using System.Linq;using System.Text;

namespace WpfApplication2{classClassOPDataClass {publicstring OPNumber {get { returnstring.Empty; } }

publicstring Name {get { returnstring.Empty; } }

publicstring Age {get { returnstring.Empty; } }

publicstring Sex {get { returnstring.Empty; } }

publicstring Date {get { returnstring.Empty; } }

publicstring HospitalName {get { returnstring.Empty; } }

}

classClassOPBillDataClass {publicstring OPNumber {get { returnstring.Empty; } }

publicstring BillItem {get { returnstring.Empty; } }

publicstring Amount {get { returnstring.Empty; } }

publicstring Date

Page 53: Hospital Management System Projectmm

P a g e | 53

{get { returnstring.Empty; } } }

} using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Windows;

namespace WpfApplication2{classClassRoomWardManagement {/* * Add new room or ward * remove room/ward * allocate room * deallocate room * */

SqlDataAdapter ad = new SqlDataAdapter(); SqlCommand com = new SqlCommand(); DataTable dt = new DataTable(); ClassDbManager db = new ClassDbManager();publicbool AddNewRoom(string name,int noOfBeds,decimal rent,bool isRoom) {string _name = "";int _noOfBeds = 1;decimal _rent=0;string _room_ward="ward";try {if (name != "") { _name = name;if (noOfBeds >= 0)//if less than/equal to zero,take default value(1) {_noOfBeds = noOfBeds;}

if (rent >= 0){_rent = rent;}

if(isRoom){_room_ward = "room";}

//insert datastring[] field = { "RoomName", "NoOfBeds", "Rent", "RoomType", "BedsFree" };string table = "ROOMWARD";string[] values = { _name,_noOfBeds.ToString(),_rent.ToString(),_room_ward,_noOfBeds.ToString()};if (!db.EntryExists("select RoomName from ROOMWARD where RoomName='" + _name + "'")) {if (db.Insert(field, table, values) > 0)returntrue;else

Page 54: Hospital Management System Projectmm

P a g e | 54

returnfalse; }else {returnfalse; } }else {thrownewException("Name cannot be empty"); } }catch { }returntrue; }publicbool RemoveRoom(string name) {if (name != "") {try {string query = "DELETE FROM ROOMWARD WHERE RoomName='" + name + "'"; com.Connection = ClassDbManager.con; com.CommandType = CommandType.Text; com.CommandText = query;if (com.ExecuteNonQuery() > 0)returntrue;elsereturnfalse; }catch(Exception w) { ClassLogging log = new ClassLogging(); log.LogException(w);returnfalse; }using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;

namespace WpfApplication2{publicpartialclassForm1 : Form {public Form1() { InitializeComponent(); }

privatevoid button1_Click(object sender, EventArgs e) {

Page 55: Hospital Management System Projectmm

P a g e | 55

ClassRoomWardManagement ward = new ClassRoomWardManagement();//for (int i = 0; i < 30; i++)//{// if (ward.AddNewRoom("ward" + i.ToString(), 10, 50, false)) ;// // MessageBox.Show("added");//}

if (ward.Deallocate("ward1")) { MessageBox.Show("allocated"); }else { MessageBox.Show("Not allocated"); } } }}namespace WpfApplication2{partialclassForm1 {///<summary>/// Required designer variable.///</summary>private System.ComponentModel.IContainer components = null;

///<summary>/// Clean up any resources being used.///</summary>///<param name="disposing">true if managed resources should be disposed; otherwise, false.</param>protectedoverridevoid Dispose(bool disposing) {if (disposing && (components != null)) { components.Dispose(); }base.Dispose(disposing); }

#region Windows Form Designer generated code

///<summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor.///</summary>privatevoid InitializeComponent() {this.button1 = new System.Windows.Forms.Button();this.SuspendLayout();// // button1// this.button1.Location = new System.Drawing.Point(269, 101);this.button1.Name = "button1";this.button1.Size = new System.Drawing.Size(75, 23);this.button1.TabIndex = 0;

Page 56: Hospital Management System Projectmm

P a g e | 56

this.button1.Text = "button1";this.button1.UseVisualStyleBackColor = true;this.button1.Click += new System.EventHandler(this.button1_Click);// // Form1// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.ClientSize = new System.Drawing.Size(851, 414);this.Controls.Add(this.button1);this.Name = "Form1";this.Text = "Form1";this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Button button1; }}using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;

namespace WpfApplication2{publicpartialclassFormID : Form {public FormID() { InitializeComponent(); }string imgSource = "";privatevoid button1_Click(object sender, EventArgs e) {if (openFileDialog1.ShowDialog() == DialogResult.OK) {try { pictureBox1.Image = Image.FromFile(openFileDialog1.FileName); }catch { MessageBox.Show("Image Load failed"); } } }

privatevoid label2_Click(object sender, EventArgs e) {

}

Page 57: Hospital Management System Projectmm

P a g e | 57

privatevoid buttonOK_Click(object sender, EventArgs e) {// Bitmap bmp;// if(imgSource!="")// {// bmp = new Bitmap(imgSource);// }// WindowIDShow id = new WindowIDShow(textBoxCName.Text, textBoxName.Text, textBoxID.Text,comboBoxBGroup.Text,bmp);// id.Show();//}

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;

namespace WpfApplication2{publicpartialclassFormOPBill : Form { DataTable dt = new DataTable();public FormOPBill( DataTable _dt) { dt = _dt; InitializeComponent(); }

privatevoid FormOPBill_Load(object sender, EventArgs e) { reportViewer1.LocalReport.DataSources[0].Value = dt;

this.reportViewer1.RefreshReport(); } }}

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Data.SqlClient;using System.Text;using System.Windows.Forms;

namespace WpfApplication2{publicpartialclassFormOPCard : Form {int ID = 0;public FormOPCard(int ID) {

Page 58: Hospital Management System Projectmm

P a g e | 58

this.ID = ID; InitializeComponent(); }

privatevoid FormOPCard_Load(object sender, EventArgs e) {//populate table DataTable dtOPCardDetails = new DataTable(); SqlDataAdapter ad = new SqlDataAdapter(); SqlCommand com = new SqlCommand(); com.CommandType = CommandType.StoredProcedure; com.Connection = ClassDbManager.con; com.CommandText = "OPCardDetails"; com.Parameters.Add("@ID",SqlDbType.Int); com.Parameters["@ID"].Value=ID; ad.SelectCommand=com; ad.Fill(dtOPCardDetails);

reportViewer1.LocalReport.DataSources[0].Value=dtOPCardDetails;

this.reportViewer1.RefreshReport();

} }}

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using System.Data.SqlClient;using System.Data;

namespace WpfApplication2{///<summary>/// Interaction logic for UserControlIP.xaml///</summary>publicpartialclassUserControlIP : UserControl {public UserControlIP() { InitializeComponent(); }

publicevent ResultEventHandler Result;protectedvirtualvoid OnResult(ResultEventArgs e) {

Page 59: Hospital Management System Projectmm

P a g e | 59

ResultEventHandler handler = Result;if (handler != null) { handler(this, e); } }

publicbool SubmitValues() {if (textBoxName.Text != "")//name cannot be empty {if (textBoxComment.Text != "") //Comment Cannot be emty {if (textBoxAge.Text != "")//Age cannot be empty { SqlCommand com = new SqlCommand(@"Insert into ip (consdate,name,age,sex,address,phone,refdr,complaint,department,RoomorWardno,DateLastPaid) values('" + DateTime.Now.Date + "','" + textBoxName.Text + "'," + textBoxAge.Text + ",'" + ((bool)(radioButtonFemale.IsChecked) ? "Female" : "Male") + "','" + textBoxAddress.Text + "','" + textBoxPhoneNumber.Text + "','" + comboBoxReferenceDoctor.Text + "','" + textBoxComment.Text + "','" + comboBoxDepartments.Text + "','"+comboBoxRoom.Text+"','"+DateTime.Now.Date+"')", ClassDbManager.con);if (com.ExecuteNonQuery() > 0) { ResultEventArgs e = new ResultEventArgs(false, "New Entry added"); OnResult(e);//clear all values #region clear fields textBoxName.Text = ""; textBoxAge.Text = ""; textBoxAddress.Text = "Not Specified"; textBoxPhoneNumber.Text = ""; textBoxComment.Text = ""; #endregionreturntrue; }else { ResultEventArgs e = new ResultEventArgs(true, "Please Check your data"); OnResult(e);returnfalse; } }else { ResultEventArgs e = new ResultEventArgs(true, "New entry not added! Age not valid"); OnResult(e);returnfalse; }

Page 60: Hospital Management System Projectmm

P a g e | 60

}else { textBoxComment_LostFocus(newobject(), new RoutedEventArgs()); ResultEventArgs e = new ResultEventArgs(true, "New entry not added! Comment Cannot be empty"); OnResult(e);returnfalse; } }else {

textBoxName_LostFocus(newobject(), new RoutedEventArgs()); ResultEventArgs e = new ResultEventArgs(true, "New entry not added! Name Cannot be empty"); OnResult(e);returnfalse; }

}privatevoid comboBoxOP_SelectionChanged(object sender, SelectionChangedEventArgs e) {/* * name * age * sex * address * phone no * comment * department * doctor */

SqlDataAdapter ad = new SqlDataAdapter("SELECT NAME,AGE,SEX,ADDRESS,PHONE,COMMENT,DEPARTMENT,DOCTOR FROM OP WHERE ID=" + ((System.Data.DataRowView)(comboBoxOP.SelectedValue)).Row[0].ToString(), ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt);

textBoxName.Text = dt.Rows[0]["NAME"].ToString(); textBoxAge.Text = dt.Rows[0]["AGE"].ToString(); radioButtonMale.IsChecked = (dt.Rows[0]["SEX"].ToString().Trim().ToLower() == "male" ? true : false); radioButtonFemale.IsChecked = (dt.Rows[0]["SEX"].ToString().Trim().ToLower() == "male" ? false : true); textBoxAddress.Text = dt.Rows[0]["ADDRESS"].ToString(); textBoxPhoneNumber.Text = dt.Rows[0]["PHONE"].ToString(); textBoxComment.Text = dt.Rows[0]["COMMENT"].ToString(); comboBoxDepartments.SelectedItem = dt.Rows[0]["DEPARTMENT"].ToString(); comboBoxReferenceDoctor.SelectedItem = dt.Rows[0]["DOCTOR"].ToString(); }

privatevoid UserControl_Loaded(object sender, RoutedEventArgs e)

Page 61: Hospital Management System Projectmm

P a g e | 61

{//select op No. into combobox SqlDataAdapter ad = new SqlDataAdapter("SELECT ID FROM OP", ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt); comboBoxOP.ItemsSource = dt.AsDataView(); comboBoxOP.DisplayMemberPath = "ID";

ad = new SqlDataAdapter("SELECT roomname FROM ROOMWARD",ClassDbManager.con); DataTable dt1 = new DataTable(); ad.Fill(dt1); comboBoxRoom.ItemsSource = dt1.AsDataView(); comboBoxRoom.DisplayMemberPath = "roomname";try { comboBoxRoom.SelectedIndex = 0; }catch { } }

privatevoid textBoxAge_TextChanged(object sender, TextChangedEventArgs e) {//Text Box Validation ClassAgeValidation val = new ClassAgeValidation(); ValidationResult res = val.Validate(textBoxAge.Text, null);if (!res.IsValid) { textBoxAge.Style = (Style)this.Resources["textBoxInError"]; textBoxAge.ToolTip = "Age is not valid"; }else { textBoxAge.Style = (Style)TextBox.StyleProperty.DefaultMetadata.DefaultValue; textBoxAge.ToolTip = null; } }

privatevoid textBoxName_LostFocus(object sender, RoutedEventArgs e) {if (textBoxName.Text.Length == 0) { textBoxName.Style = (Style)this.Resources["textBoxInError"]; textBoxName.ToolTip = "Name Cannot be empty"; }else { textBoxName.Style = (Style)TextBox.StyleProperty.DefaultMetadata.DefaultValue; textBoxName.ToolTip = null; } }

privatevoid textBoxComment_LostFocus(object sender, RoutedEventArgs e) {if (textBoxComment.Text.Length == 0)

Page 62: Hospital Management System Projectmm

P a g e | 62

{ textBoxComment.Style = (Style)this.Resources["textBoxInError"]; textBoxComment.ToolTip = "Comment Cannot be empty"; }else { textBoxComment.Style = (Style)TextBox.StyleProperty.DefaultMetadata.DefaultValue; textBoxComment.ToolTip = null; } }

}}

sing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;

namespace WpfApplication2{///<summary>/// Interaction logic for UserControlOPConsultation.xaml///</summary>publicpartialclassUserControlOPConsultation : UserControl {public UserControlOPConsultation() { InitializeComponent(); }

publicevent ResultEventHandler Result;protectedvirtualvoid OnResult(ResultEventArgs e) { ResultEventHandler handler = Result;if (handler != null) { handler(this, e); } }

int _OpNo=0;publicint SelectedOP {get {return _OpNo;} }privatevoid Search_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)

Page 63: Hospital Management System Projectmm

P a g e | 63

{foreach (Patient item in listBoxOPNumber.Items) {if (textBoxSearch.Text.ToUpper() == item.ToString().ToUpper()) { listBoxOPNumber.SelectedItem = item;break; } } }

privatevoid textBoxSearch_KeyDown(object sender, KeyEventArgs e) {if (e.Key == Key.Enter) { Search_MouseLeftButtonUp(null, null); } }

privatevoid listBoxOPNumber_SelectionChanged_1(object sender, SelectionChangedEventArgs e) { _OpNo=Convert.ToInt32( listBoxOPNumber.SelectedItem.ToString()); ResultEventArgs ev = new ResultEventArgs(false, _OpNo.ToString()); OnResult(ev); } }}

sing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;

namespace WpfApplication2{///<summary>/// Interaction logic for UserControlOpRegCons.xaml///</summary>publicpartialclassUserControlOpRegCons : UserControl {public UserControlOpRegCons() { InitializeComponent(); } }sing System.Collections.Generic;using System.Text;using System.Windows;

Page 64: Hospital Management System Projectmm

P a g e | 64

using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using System.Data;using System.Data.SqlClient;

namespace WpfApplication2{///<summary>/// Interaction logic for Window1.xaml ///</summary>///publicpartialclassWindow1 : Window { Thickness thick = new Thickness(2, 40, 2, 2);

public Window1() { InitializeComponent(); }enumSelectedButton{OP,Consultation,IP,Tools,Test,Master}; SelectedButton selectedButton = SelectedButton.OP;

#region appearence...protectedoverridevoid OnMouseMove(MouseEventArgs e) {//Code for window movment Point origin = new Point(0, 0); Point pos= Mouse.GetPosition(this); Point upperRight = new Point(origin.X + this.Width, 0);base.OnMouseMove(e);if (e.LeftButton == MouseButtonState.Pressed && pos.X > 0 && pos.X <this.Width && pos.Y > 0 && pos.Y < 20) {this.WindowState = WindowState.Normal;this.DragMove(); }

}

protectedoverridevoid OnSourceInitialized(EventArgs e) {base.OnSourceInitialized(e); GlassHelper.ExtendGlass(this, thick);

} #endregion

privatevoid Window_Loaded(object sender, RoutedEventArgs e) { ClassDbManager db = new ClassDbManager(global::WpfApplication2.Properties.Settings.Default.ConnectionString);

Page 65: Hospital Management System Projectmm

P a g e | 65

if (!db.OpenDB()) MessageBox.Show("Cannot Connect to Database", "Error", MessageBoxButton.OK, MessageBoxImage.Error);// Form1 frm = new Form1();// frm.Show();

ClassOPBillMangement OPBill = new ClassOPBillMangement(); DataTable dt = OPBill.LoadBillItems(); dataGrid1.ItemsSource = dt.DefaultView; Microsoft.Windows.Controls.DataGridLength CWidth = new Microsoft.Windows.Controls.DataGridLength(100, Microsoft.Windows.Controls.DataGridLengthUnitType.Star); dataGrid1.ColumnWidth = CWidth;

}

privatevoid buttonSave_Click(object sender, RoutedEventArgs e) {if (selectedButton == SelectedButton.OP) { OPReg.SubmitValues(); }elseif (selectedButton == SelectedButton.Consultation) {//do code for date updationif (OPCons.SelectedOP > 0) { SqlCommand com = new SqlCommand("UPDATE OP SET LAST_DATE='" + DateTime.Now.Date + "' WHERE id=" + OPCons.SelectedOP, ClassDbManager.con);if (com.ExecuteNonQuery() > 0) { Brush b = new SolidColorBrush(Colors.Black); StatusLabel.Foreground = b; StatusLabel.Content = "OP Status updated"; }else { Brush b = new SolidColorBrush(Colors.Red); StatusLabel.Foreground = b; StatusLabel.Content = "OP Status cannot be updated"; } }else { Brush b = new SolidColorBrush(Colors.Red); StatusLabel.Foreground = b; StatusLabel.Content = "No OP Selected!"; }

}elseif (selectedButton == SelectedButton.IP) { userControlIP1.SubmitValues(); } }

privatevoid OPReg_Error(object sender, ResultEventArgs e) {

Page 66: Hospital Management System Projectmm

P a g e | 66

if (e.ErrorOccured) { Brush b = new SolidColorBrush(Colors.Red); StatusLabel.Foreground = b; StatusLabel.Content = e.Message; }else { Brush b = new SolidColorBrush(Colors.White); StatusLabel.Foreground = b; StatusLabel.Content = e.Message; }

}

privatevoid label1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { WindowNewOPAdded wind = new WindowNewOPAdded(); wind.ShowDialog(); }

#region tabButton click...privatevoid tabButtonOP_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { selectedButton = SelectedButton.OP;

expander1.Visibility = Visibility.Hidden;

tabButtonOP.IsSelected = true; tabButtonOPCons.IsSelected = false; tabButtonIP.IsSelected=false;

buttonIPBill.Visibility = Visibility.Hidden; expander1.Visibility = Visibility.Visible;

OPReg.Visibility = Visibility.Visible; OPCons.Visibility = Visibility.Hidden; userControlIP1.Visibility = Visibility.Hidden; }

privatevoid tabButtonIP_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { selectedButton = SelectedButton.IP;

expander1.Visibility = Visibility.Hidden;

tabButtonOP.IsSelected = false; tabButtonOPCons.IsSelected = false; tabButtonIP.IsSelected = true;

buttonIPBill.Visibility = Visibility.Visible; expander1.Visibility = Visibility.Hidden;

OPReg.Visibility = Visibility.Hidden; OPCons.Visibility = Visibility.Hidden; userControlIP1.Visibility = Visibility.Visible; }

Page 67: Hospital Management System Projectmm

P a g e | 67

privatevoid tabButtonOPCons_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { selectedButton = SelectedButton.Consultation;

tabButtonOPCons.IsSelected = true; tabButtonOP.IsSelected = false; tabButtonIP.IsSelected = false;

buttonIPBill.Visibility = Visibility.Hidden;// expander1.Visibility = Visibility.Hidden;

OPCons.Visibility = Visibility.Visible; OPReg.Visibility = Visibility.Hidden; userControlIP1.Visibility = Visibility.Hidden;

expander1.Visibility = Visibility.Visible; }

#endregionprivatevoid buttonBill_Click(object sender, RoutedEventArgs e) {try {if (selectedButton == SelectedButton.Consultation) { ClassDbManager db = new ClassDbManager();string[] fields = { "ITEM", "AMOUNT", "OPNUMBER", "DATE" };string table = "OPBILL";for (int i = 0; i < dataGrid1.Items.Count; i++) {string[] values = { dataGrid1.Items[0].ToString(), dataGrid1.Items[1].ToString(), OPCons.listBoxOPNumber.SelectedItem.ToString(), DateTime.Today.ToString() }; db.Insert(fields, table, values); } } }catch { } }

privatevoid buttonBill_Click_1(object sender, RoutedEventArgs e) {//pass it to report viewer DataTable dt = ((DataView)dataGrid1.ItemsSource).Table; FormOPBill opBill = new FormOPBill(dt); opBill.Show(); }

privatevoid userControlIP1_Result(object sender, ResultEventArgs e) {if (e.ErrorOccured) { Brush b = new SolidColorBrush(Colors.Red); StatusLabel.Foreground = b; StatusLabel.Content = e.Message; }else {

Page 68: Hospital Management System Projectmm

P a g e | 68

Brush b = new SolidColorBrush(Colors.White); StatusLabel.Foreground = b; StatusLabel.Content = e.Message; } }

privatevoid buttonIPBill_Click(object sender, RoutedEventArgs e) { WindowBill bill = new WindowBill(); bill.ShowDialog(); }

privatevoid label2_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { WindowMaster master = new WindowMaster(); master.ShowDialog(); }

privatevoid OPCons_Result(object sender, ResultEventArgs e) {//upadte bill datagrid with new cons fee SqlDataAdapter ad = new SqlDataAdapter("SELECT OPExpiryDays FROM Other", ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt);int maxDays = Convert.ToInt32(dt.Rows[0][0]);

int daysAfterLastVisit = 0;DateTime LastDate = newDateTime();

ad = new SqlDataAdapter("SELECT last_date FROM OP WHERE ID=" + e.Message, ClassDbManager.con); dt.Clear(); ad.Fill(dt);try { LastDate=Convert.ToDateTime(dt.Rows[0]["last_date"]); }catch{} daysAfterLastVisit = LastDate.Subtract(DateTime.Now.Date).Days;

if (daysAfterLastVisit <= maxDays) { ClassOPBillMangement OPBill = new ClassOPBillMangement(); DataTable dt1 = OPBill.LoadBillItems(); dt1.Rows.RemoveAt(0); DataRow dr = dt1.NewRow(); dr[0] = "Consultation Fee"; dr[1] = 0; dt1.Rows.InsertAt(dr, 0); dataGrid1.ItemsSource = dt1.AsDataView(); Microsoft.Windows.Controls.DataGridLength CWidth = new Microsoft.Windows.Controls.DataGridLength(100, Microsoft.Windows.Controls.DataGridLengthUnitType.Star); dataGrid1.ColumnWidth = CWidth; }else {

Page 69: Hospital Management System Projectmm

P a g e | 69

ClassOPBillMangement OPBill = new ClassOPBillMangement(); DataTable dt1 = OPBill.LoadBillItems(); dataGrid1.ItemsSource = dt1.DefaultView; Microsoft.Windows.Controls.DataGridLength CWidth = new Microsoft.Windows.Controls.DataGridLength(100, Microsoft.Windows.Controls.DataGridLengthUnitType.Star); dataGrid1.ColumnWidth = CWidth; }

}

privatevoid labelTest_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { WindowTest test = new WindowTest(); test.ShowDialog(); }

privatevoid label3_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { WindowPharmacy ph = new WindowPharmacy(); ph.ShowDialog(); }

}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;

namespace WpfApplication2{///<summary>/// Interaction logic for WindowAddRoom.xaml///</summary>publicpartialclassWindowAddRoom : Window {public WindowAddRoom() { InitializeComponent(); }publicstructretVal {

Page 70: Hospital Management System Projectmm

P a g e | 70

publicstring name;publicint NoOfWards;publicdecimal Rent; }public retVal val = new retVal();privatevoid buttonAdd_Click(object sender, RoutedEventArgs e) {try {if (textBoxName.Text != "") val.name = textBoxName.Text;

if (textBoxRent.Text != "") val.Rent = Convert.ToDecimal(textBoxRent.Text);this.Close(); }catch(Exception w) { ClassLogging log = new ClassLogging(); log.LogException(w); } }

privatevoid buttonCancel_Click(object sender, RoutedEventArgs e) {this.Close(); }

privatevoid Window_Loaded(object sender, RoutedEventArgs e) { val.name = ""; val.NoOfWards = 1; val.Rent = 0; } }}

sing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;

namespace WpfApplication2{///<summary>/// Interaction logic for WindowAddWard.xaml///</summary>publicpartialclassWindowAddWard : Window {public WindowAddWard()

Page 71: Hospital Management System Projectmm

P a g e | 71

{ InitializeComponent(); }

privatevoid buttonCancel_Click(object sender, RoutedEventArgs e) {this.Close(); }

publicstructretVal {publicstring name ;publicint NoOfWards ;publicdecimal Rent ; }

public retVal val = new retVal();privatevoid buttonAdd_Click(object sender, RoutedEventArgs e) {if (textBoxName.Text != "") val.name = textBoxName.Teusing System;using System.Collections.Generic;using System.Data.SqlClient;using System.Data;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;

namespace WpfApplication2{///<summary>/// Interaction logic for WindowBill.xaml///</summary>publicpartialclassWindowBill : Window {public WindowBill() { InitializeComponent(); }

void SetRoomRentDue(int ipno) { SqlDataAdapter ad=new SqlDataAdapter("SELECT DateLastPaid FROM IP where ipno="+ipno,ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt);DateTime date1=newDateTime();if (DateTime.TryParse(dt.Rows[0]["DateLastPaid"].ToString(),out date1)) { int days = 0;

Page 72: Hospital Management System Projectmm

P a g e | 72

days= date1.Subtract(DateTime.Now).Days; dt.Clear(); ad = new SqlDataAdapter("SELECT RoomorWardNo FROM ip WHERE ipno=" + ipno, ClassDbManager.con); ad.Fill(dt);

string ward_room = dt.Rows[0][0].ToString(); dt.Clear(); ad = new SqlDataAdapter("SELECT Rent FROM ROOMWARD where roomname='" + ward_room + "'", ClassDbManager.con); ad.Fill(dt);

decimal rent = Convert.ToDecimal(dt.Rows[0][0]);decimal due = rent * days;

ad = new SqlDataAdapter("UPDATE IPBILLITEM SET due=" + due, ClassDbManager.con); ad.Fill(dt); } }privatevoid Window_Loaded(object sender, RoutedEventArgs e) { SqlDataAdapter ad = new SqlDataAdapter("select ipno from ip", ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt); comboBox1.ItemsSource=dt.AsDataView(); comboBox1.DisplayMemberPath = "ipno"; }

privatevoid buttonClose_Click(object sender, RoutedEventArgs e) {this.Close(); }

privatevoid buttonAdd_Click(object sender, RoutedEventArgs e) { SetRoomRentDue(Convert.ToInt32(comboBox1.Text)); GridView1.Enabled = true;try { System.Windows.Forms.DataGridView grid = (System.Windows.Forms.DataGridView)this.FindName("GridView1"); SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM BillItems", ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt);

GridView1.DataSource = dt; }catch { }

}

privatevoid buttonCancel_Click(object sender, RoutedEventArgs e) { GridView1.Enabled = false; GridView1.DataSource = null;

Page 73: Hospital Management System Projectmm

P a g e | 73

GridView1.Refresh(); }

privatevoid buttonSave_Click(object sender, RoutedEventArgs e) {

if (textBoxPaid.Text != null&& textBoxPaid.Text != "") {if (comboBox1.SelectedIndex != -1) { ClassDbManager db = new ClassDbManager();decimal total = 0;for (int i = 0; i < GridView1.Rows.Count - 1; i++) {decimal tmpTotal = 0;if (!decimal.TryParse(GridView1.Rows[i].Cells[1].Value.ToString(), out tmpTotal)) { MessageBox.Show("Invalid charactor!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);return; } total += tmpTotal; }if (total != 0) {if (db.EntryExists("select 1 from ipbillitem where ipno=" + comboBox1.Text)) { SqlCommand com = new SqlCommand("update ipbillitem set billdate='" + DateTime.Now.Date +"',due=" + (total - Convert.ToDecimal(textBoxPaid.Text)).ToString() +",paid=" + textBoxPaid.Text + " where ipno=" + comboBox1.Text, ClassDbManager.con);if (com.ExecuteNonQuery() > 0) {

com.CommandText = "UPDATE IP SET DateLastPaid='" + DateTime.Now.Date + "' WHERE IPno=" + comboBox1.Text; com.ExecuteNonQuery(); MessageBox.Show("Data Saved Successfully", "Updated", MessageBoxButton.OK, MessageBoxImage.Information); GridView1.DataSource = null; GridView1.Refresh(); }else { MessageBox.Show("Cannot Update data", "Error", MessageBoxButton.OK, MessageBoxImage.Error);return; } }else { SqlCommand com = new SqlCommand(@"Insert into ipbillitem(ipno,billdate,due,paid,closed) values(" + comboBox1.Text + ",'" + DateTime.Now.Date + "'," + (total - Convert.ToDecimal(textBoxPaid.Text)).ToString()

Page 74: Hospital Management System Projectmm

P a g e | 74

+ "," + textBoxPaid.Text + ",'false')", ClassDbManager.con);if (com.ExecuteNonQuery() > 0) { com.CommandText = "UPDATE IP SET DateLastPaid='" + DateTime.Now.Date + "' WHERE IPno=" + comboBox1.Text; com.ExecuteNonQuery(); MessageBox.Show("Data Saved Successfully", "Updated", MessageBoxButton.OK, MessageBoxImage.Information); GridView1.DataSource = null; GridView1.Refresh(); }else { MessageBox.Show("Cannot Update data", "Error", MessageBoxButton.OK, MessageBoxImage.Error);return; } } }else { MessageBox.Show("Nothing to save", "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation);return; } } MessageBox.Show("Please enter IP No.", "IP no. not selected", MessageBoxButton.OK, MessageBoxImage.Exclamation);return; } MessageBox.Show("Please enter Amount paid", "No amount", MessageBoxButton.OK, MessageBoxImage.Exclamation);return; }

privatevoid buttonAdd_Click_1(object sender, RoutedEventArgs e) {try { System.Windows.Forms.DataGridView grid = (System.Windows.Forms.DataGridView)this.FindName("GridView1"); SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM BillItems", ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt); ad = new SqlDataAdapter("SELECT due FROM IPBillItem WHERE closed='false' AND IPNo=" + comboBox1.Text.Trim() + " AND due>0", ClassDbManager.con); DataTable dt1 = new DataTable(); ad.Fill(dt1);if (dt1.Rows.Count > 0) { DataRow dr = dt.NewRow(); dr[0] = "Due"; dr[1] = dt1.Rows[0]["due"].ToString(); dt.Rows.Add(dr); }

Page 75: Hospital Management System Projectmm

P a g e | 75

GridView1.DataSource = dt; }catch { } } }}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;

namespace WpfApplication2{///<summary>/// Interaction logic for WindowID.xaml///</summary>publicpartialclassWindowID : Window {public WindowID() { InitializeComponent(); }

privatevoid button1_Click(object sender, RoutedEventArgs e) {

} }}

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;

namespace WpfApplication2{///<summary>/// Interaction logic for WindowIDShow.xaml///</summary>publicpartialclassWindowIDShow : Window

Page 76: Hospital Management System Projectmm

P a g e | 76

{ Image _img = new Image();string _CName = "";string _Name = "";string _ID = "";string _BGroup = "";

public WindowIDShow(string CName,string Name,string ID,string BGroup,Image img) { _img = img; _CName = CName; _Name = Name; _ID = ID; _BGroup = BGroup; InitializeComponent(); }

privatevoid Window_Loaded(object sender, RoutedEventArgs e) { labelCName.Content = _CName; labelName.Content = _Name; labelID.Content = _ID; labelBGroup.Content = _BGroup; image1 = _img; } }}using System;using System.Collections.Generic;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;using System.Data;using System.Data.SqlClient;

namespace WpfApplication2{///<summary>/// Interaction logic for WindowMaster.xaml///</summary>publicpartialclassWindowMaster : Window {public WindowMaster() { InitializeComponent(); } ClassRoomWardManagement wr = new ClassRoomWardManagement();void RefreshWardList() { DataTable dtWard = wr.GetWardList(); listBoxWard.ItemsSource = dtWard.AsDataView(); listBoxWard.DisplayMemberPath = "RoomName";

Page 77: Hospital Management System Projectmm

P a g e | 77

}

void RefreshRoomList() { DataTable dtRoom = wr.GetRoomList(); listBoxRoom.ItemsSource = dtRoom.AsDataView(); listBoxRoom.DisplayMemberPath = "RoomName"; }void RefreshTestList() { SqlDataAdapter ad = new SqlDataAdapter("SELECT test FROM test",ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt); listBoxTest.ItemsSource = dt.AsDataView(); listBoxTest.DisplayMemberPath = "test"; }void RefreshPharmacyItems() { ClassPharmacyManger ph=new ClassPharmacyManger(); listBoxPharmItems.ItemsSource = ph.GetItemList(); listBoxPharmItems.DisplayMemberPath = "Item";

}privatevoid Window_Loaded(object sender, RoutedEventArgs e) {//load wards RefreshRoomList(); RefreshWardList(); RefreshTestList(); RefreshPharmacyItems(); }

privatevoid buttonWardAdd_Click(object sender, RoutedEventArgs e) {

WindowAddWard add = new WindowAddWard(); add.ShowDialog();if (!string.IsNullOrEmpty(add.val.name)) {if (!wr.AddNewRoom(add.val.name, add.val.NoOfWards, add.val.Rent, false)) { MessageBox.Show("Cannot add ward", "Error", MessageBoxButton.OK, MessageBoxImage.Error); }else { RefreshWardList(); } } }

privatevoid buttonRoomAdd_Click(object sender, RoutedEventArgs e) { WindowAddRoom add = new WindowAddRoom(); add.ShowDialog();if (!string.IsNullOrEmpty(add.val.name)) {

Page 78: Hospital Management System Projectmm

P a g e | 78

if (!wr.AddNewRoom(add.val.name, add.val.NoOfWards, add.val.Rent, true)) { MessageBox.Show("Cannot add Room", "Error", MessageBoxButton.OK, MessageBoxImage.Error); }else { RefreshRoomList(); } } }

privatevoid buttonWardRemove_Click(object sender, RoutedEventArgs e) { wr.RemoveRoom(((DataRowView)listBoxWard.SelectedItem)[0].ToString()); RefreshWardList(); }

privatevoid buttonRoomRemove_Click(object sender, RoutedEventArgs e) { wr.RemoveRoom(((DataRowView)listBoxRoom.SelectedItem)[0].ToString()); RefreshRoomList(); }

privatevoid buttonTestAdd_Click(object sender, RoutedEventArgs e) {if(!string.IsNullOrEmpty(textBoxTestName.Text)&&!string.IsNullOrEmpty(textBoxTestCharge.Text)) {decimal dec=0;if(decimal.TryParse(textBoxTestCharge.Text,out dec)) {string[] fields={"test","charge"};string table="test";string[] values={textBoxTestName.Text,textBoxTestCharge.Text}; ClassDbManager db=new ClassDbManager();if(!db.EntryExists("SELECT 1 FROM test WHERE test='"+textBoxTestName.Text+"'")) {if(db.Insert(fields,table,values)>0) { MessageBox.Show("New entry Added","Success",MessageBoxButton.OK,MessageBoxImage.Information); RefreshTestList(); }else { MessageBox.Show("Cannot add new entry","Cannot add new entry",MessageBoxButton.OK,MessageBoxImage.Error); } }else { MessageBox.Show("Entry already exists","Cannot add entry",MessageBoxButton.OK,MessageBoxImage.Exclamation); } } }else

Page 79: Hospital Management System Projectmm

P a g e | 79

{ MessageBox.Show("Some fiedls aree empty","Value missing",MessageBoxButton.OK,MessageBoxImage.Exclamation); } }

privatevoid buttonTestRemove_Click(object sender, RoutedEventArgs e) {if (!string.IsNullOrEmpty(listBoxTest.SelectedItem.ToString())) { SqlCommand com = new SqlCommand("DELETE FROM test WHERE test='" + ((DataRowView)(listBoxTest.SelectedItem)).Row.ItemArray[0].ToString() + "'", ClassDbManager.con);if(com.ExecuteNonQuery()>0) { RefreshTestList(); }else { MessageBox.Show("Cannot remove entry","Error",MessageBoxButton.OK,MessageBoxImage.Error); } } }

privatevoid buttonPharmAdd_Click(object sender, RoutedEventArgs e) { ClassPharmacyManger ph=new ClassPharmacyManger(); ClassDbManager db=new ClassDbManager();if(!string.IsNullOrEmpty(textBoxPharmItem.Text)) {decimal rate=0;if(decimal.TryParse(textBoxPharmRate.Text,out rate)||!string.IsNullOrEmpty(textBoxPharmRate.Text)) {if(!db.EntryExists("SELECT 1 FROM pharmacy WHERE item='"+textBoxPharmItem.Text+"'")) {if(ph.AddNewItem(textBoxPharmItem.Text,rate)) { MessageBox.Show("New Item added","Success",MessageBoxButton.OK,MessageBoxImage.Information); RefreshPharmacyItems(); }else { MessageBox.Show("Cannot add new entry","Error",MessageBoxButton.OK,MessageBoxImage.Error); } }else { MessageBox.Show("Entry already exists","Cannot add entry",MessageBoxButton.OK,MessageBoxImage.Stop); } }else {

Page 80: Hospital Management System Projectmm

P a g e | 80

MessageBox.Show("Invalid Rate","Cannot add entry",MessageBoxButton.OK,MessageBoxImage.Stop); } } }

privatevoid buttonPharmUpdate_Click(object sender, RoutedEventArgs e) {int Qty=0;if(!string.IsNullOrEmpty(textBoxQty.Text)||int.TryParse(textBoxQty.Text,out Qty)) {int.TryParse(textBoxQty.Text, out Qty); ClassPharmacyManger ph=new ClassPharmacyManger();if (ph.UpdateQuantity(((DataRowView)(listBoxPharmItems.SelectedItem)).Row.ItemArray[0].ToString(), Qty)) { MessageBox.Show("Item updated","Success",MessageBoxButton.OK,MessageBoxImage.Information); }else { MessageBox.Show("Cannot add new entry","Error",MessageBoxButton.OK,MessageBoxImage.Error); } }else { MessageBox.Show("Invalid quantity","Cannot add entry",MessageBoxButton.OK,MessageBoxImage.Stop); } }

privatevoid buttonPharmRemove_Click(object sender, RoutedEventArgs e) { ClassPharmacyManger ph = new ClassPharmacyManger();if (ph.RemoveItem(((DataRowView)(listBoxPharmItems.SelectedItem)).Row.ItemArray[0].ToString())) { MessageBox.Show("Item Removed", "Success", MessageBoxButton.OK, MessageBoxImage.Information); RefreshPharmacyItems(); }else { MessageBox.Show("Cannot remove entry", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }

privatevoid listBoxPharmItems_SelectionChanged(object sender, SelectionChangedEventArgs e) { ClassPharmacyManger ph = new ClassPharmacyManger();try { textBoxQty.Text = (ph.GetSelectedQuantity(((DataRowView)(e.AddedItems[0])).Row.ItemArray[0].ToString())).ToString(); }

Page 81: Hospital Management System Projectmm

P a g e | 81

catch { } }

}}

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;

namespace WpfApplication2{///<summary>/// Interaction logic for WindowNewOPAdded.xaml///</summary>publicpartialclassWindowNewOPAdded : Window { public WindowNewOPAdded() { InitializeComponent(); }

privatevoid Window_Loaded(object sender, RoutedEventArgs e) { listBoxOPNumber.SelectedIndex = listBoxOPNumber.Items.Count - 1;//set selected index to last entry }

privatevoid buttonPrint_Click(object sender, RoutedEventArgs e) { FormOPCard op = new FormOPCard(Convert.ToInt32(listBoxOPNumber.SelectedItem.ToString())); op.Show(); } }}

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;

Page 82: Hospital Management System Projectmm

P a g e | 82

using System.Windows.Shapes;using System.Data;using System.Data.SqlClient;

namespace WpfApplication2{///<summary>/// Interaction logic for WindowPharmacy.xaml///</summary>publicpartialclassWindowPharmacy : Window {public WindowPharmacy() { InitializeComponent(); } DataTable dt = new DataTable();

void MakeDataTable(DataTable DT) { DT.Columns.Add("Item"); DT.Columns.Add("Quantity"); }privatevoid Window_Loaded(object sender, RoutedEventArgs e) {

WpfApplication2._D__DB_HOSPITAL_MDFDataSet1 _D__DB_HOSPITAL_MDFDataSet1 = ((WpfApplication2._D__DB_HOSPITAL_MDFDataSet1)(this.FindResource("_D__DB_HOSPITAL_MDFDataSet1")));// Load data into the table Ip. You can modify this code as needed. WpfApplication2._D__DB_HOSPITAL_MDFDataSet1TableAdapters.IpTableAdapter _D__DB_HOSPITAL_MDFDataSet1IpTableAdapter = new WpfApplication2._D__DB_HOSPITAL_MDFDataSet1TableAdapters.IpTableAdapter(); _D__DB_HOSPITAL_MDFDataSet1IpTableAdapter.Fill(_D__DB_HOSPITAL_MDFDataSet1.Ip); System.Windows.Data.CollectionViewSource ipViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("ipViewSource"))); ipViewSource.View.MoveCurrentToFirst(); WpfApplication2._D__DB_HOSPITAL_MDFDataSet2 _D__DB_HOSPITAL_MDFDataSet2 = ((WpfApplication2._D__DB_HOSPITAL_MDFDataSet2)(this.FindResource("_D__DB_HOSPITAL_MDFDataSet2")));// Load data into the table Pharmacy. You can modify this code as needed. WpfApplication2._D__DB_HOSPITAL_MDFDataSet2TableAdapters.PharmacyTableAdapter _D__DB_HOSPITAL_MDFDataSet2PharmacyTableAdapter = new WpfApplication2._D__DB_HOSPITAL_MDFDataSet2TableAdapters.PharmacyTableAdapter(); _D__DB_HOSPITAL_MDFDataSet2PharmacyTableAdapter.Fill(_D__DB_HOSPITAL_MDFDataSet2.Pharmacy); System.Windows.Data.CollectionViewSource pharmacyViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("pharmacyViewSource"))); pharmacyViewSource.View.MoveCurrentToFirst();

MakeDataTable(dt); GridView1.DataSource = dt; GridView1.Refresh(); }

Page 83: Hospital Management System Projectmm

P a g e | 83

privatevoid buttonAddToIP_Click(object sender, RoutedEventArgs e) {

}

privatevoid buttonAdd_Click_1(object sender, RoutedEventArgs e) {if(comboBoxItems.SelectedIndex!=-1) { DataRow dr = dt.NewRow(); dr[0] = comboBoxItems.Text; dr[1] = 0.00; dt.Rows.Add(dr); } GridView1.DataSource = dt; GridView1.Refresh(); }

privatevoid buttonAddToIP_Click_1(object sender, RoutedEventArgs e) { ClassPharmacyManger ph = new ClassPharmacyManger(); SqlDataAdapter ad; DataTable tmpDt=new DataTable();int qty = 0;decimal rate=0;decimal amount=0;if (comboBox1.SelectedIndex != -1) {if (GridView1.Rows.Count > 0) {for (int i = 0; i < GridView1.Rows.Count-1; i++) {if (ph.GetSelectedQuantity(GridView1[0, i].Value.ToString()) >Convert.ToInt32(GridView1[1, i].Value)) { qty = Convert.ToInt32(GridView1[1, i].Value); ad = new SqlDataAdapter("SELECT rate FROM pharmacy WHERE item='" + GridView1[0, i].Value.ToString() + "'", ClassDbManager.con); tmpDt.Clear(); ad.Fill(tmpDt); amount = Convert.ToDecimal(tmpDt.Rows[0]["rate"]) * qty; } } }//update dto dueif (amount > 0) { SqlCommand com = new SqlCommand("UPDATE IPBILLITEM SET DUE=due+" + amount + " WHERE IPNO=" + comboBox1.Text, ClassDbManager.con);if (com.ExecuteNonQuery() > 0) { MessageBox.Show("Amount added to due", "Success"); }else { MessageBox.Show("Cannot update entry");

Page 84: Hospital Management System Projectmm

P a g e | 84

} }else { MessageBox.Show("Nothing to save"); }

} }

}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;using System.Data;using System.Data.SqlClient;

namespace WpfApplication2{///<summary>/// Interaction logic for WindowTest.xaml///</summary>publicpartialclassWindowTest : Window {public WindowTest() { InitializeComponent(); }

privatevoid Window_Loaded(object sender, RoutedEventArgs e) {

WpfApplication2._D__DB_HOSPITAL_MDFDataSet _D__DB_HOSPITAL_MDFDataSet = ((WpfApplication2._D__DB_HOSPITAL_MDFDataSet)(this.FindResource("_D__DB_HOSPITAL_MDFDataSet")));// Load data into the table Test. You can modify this code as needed. WpfApplication2._D__DB_HOSPITAL_MDFDataSetTableAdapters.TestTableAdapter _D__DB_HOSPITAL_MDFDataSetTestTableAdapter = new WpfApplication2._D__DB_HOSPITAL_MDFDataSetTableAdapters.TestTableAdapter(); _D__DB_HOSPITAL_MDFDataSetTestTableAdapter.Fill(_D__DB_HOSPITAL_MDFDataSet.Test); System.Windows.Data.CollectionViewSource testViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("testViewSource"))); testViewSource.View.MoveCurrentToFirst();

Page 85: Hospital Management System Projectmm

P a g e | 85

System.Windows.Data.CollectionViewSource classOPBillDataClassViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("classOPBillDataClassViewSource")));// Load data by setting the CollectionViewSource.Source property:// classOPBillDataClassViewSource.Source = [generic data source] WpfApplication2._D__DB_HOSPITAL_MDFDataSet1 _D__DB_HOSPITAL_MDFDataSet1 = ((WpfApplication2._D__DB_HOSPITAL_MDFDataSet1)(this.FindResource("_D__DB_HOSPITAL_MDFDataSet1")));// Load data into the table Ip. You can modify this code as needed. WpfApplication2._D__DB_HOSPITAL_MDFDataSet1TableAdapters.IpTableAdapter _D__DB_HOSPITAL_MDFDataSet1IpTableAdapter = new WpfApplication2._D__DB_HOSPITAL_MDFDataSet1TableAdapters.IpTableAdapter(); _D__DB_HOSPITAL_MDFDataSet1IpTableAdapter.Fill(_D__DB_HOSPITAL_MDFDataSet1.Ip); System.Windows.Data.CollectionViewSource ipViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("ipViewSource"))); ipViewSource.View.MoveCurrentToFirst(); }

privatevoid buttonAdd_Click(object sender, RoutedEventArgs e) {//add to dueif(comboBox1.SelectedIndex!=-1) {if(comboBoxIP.SelectedIndex!=-1) { SqlCommand com = new SqlCommand("UPDATE IPBILLITEM SET due=due+" + textBoxPrice.Text + " WHERE IPNO=" + comboBoxIP.Text, ClassDbManager.con);if (com.ExecuteNonQuery() > 0) { MessageBox.Show("Added to IP due", "Success", MessageBoxButton.OK, MessageBoxImage.Information); }else { MessageBox.Show("Cannot add to IP","Error",MessageBoxButton.OK,MessageBoxImage.Error); } } } }

privatevoid comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { SqlDataAdapter ad = new SqlDataAdapter("SELECT charge FROM test WHERE test='" + (((System.Data.DataRowView)((comboBox1.SelectedItem))).Row).ItemArray[0].ToString() + "'", ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt); textBoxPrice.Text = dt.Rows[0]["charge"].ToString(); }

DataTable dtGrid = new DataTable();

Page 86: Hospital Management System Projectmm

P a g e | 86

}}

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Data.SqlClient;using System.Text;using System.Windows.Forms;using System.IO;

namespace WpfApplication2{ public partial class FormID : Form { public FormID() { InitializeComponent(); } string imgSource = ""; private void button1_Click(object sender, EventArgs e) { }

private void label2_Click(object sender, EventArgs e) {

}

private void buttonOK_Click(object sender, EventArgs e) { try { SqlCommand com1 = new SqlCommand("delete from tempid", ClassDbManager.con); com1.ExecuteNonQuery(); Bitmap bmp = new Bitmap(imgSource); MemoryStream ms = new MemoryStream(); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); byte[] bytes=ms.ToArray();

SqlCommand com = new SqlCommand("Insert into tempId(id,name,bloodgroup,company,image,Department) values(@id,@name,@bloodgroup,@company,@image,@Department)", ClassDbManager.con); com.Parameters.AddWithValue("@id", textBoxID.Text); com.Parameters.AddWithValue("@name", textBoxName.Text); com.Parameters.AddWithValue("@bloodgroup", comboBoxBGroup.Text); com.Parameters.AddWithValue("@company", textBoxCName.Text); com.Parameters.AddWithValue("@image", bytes); com.Parameters.AddWithValue("@Department", textBoxDepartment.Text); com.ExecuteNonQuery();

FormIDShow a = new FormIDShow();

Page 87: Hospital Management System Projectmm

P a g e | 87

a.Show(); } catch(Exception w) { MessageBox.Show(w.Message); } }

private void button1_Click_1(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { pictureBox1.Image = Image.FromFile(openFileDialog1.FileName); imgSource = openFileDialog1.FileName; } catch { MessageBox.Show("Image Load failed"); } } }

private void FormID_Load(object sender, EventArgs e) { comboBoxBGroup.SelectedIndex = 0; } }}

using System;using System.Collections.Generic;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using System.Data;using System.Data.SqlClient;

namespace WpfApplication2{ /// <summary> /// Interaction logic for Window1.xaml /// </summary> /// public partial class Window1 : Window { Thickness thick = new Thickness(2, 40, 2, 2);

Page 88: Hospital Management System Projectmm

P a g e | 88

bool IsAdmin = false; public Window1(bool isadmin) { IsAdmin = isadmin; InitializeComponent(); } enum SelectedButton{OP,Consultation,IP,Tools,Test,Master}; SelectedButton selectedButton = SelectedButton.OP;

#region appearence... protected override void OnMouseMove(MouseEventArgs e) { //Code for window movment Point origin = new Point(0, 0); Point pos= Mouse.GetPosition(this); Point upperRight = new Point(origin.X + this.Width, 0); base.OnMouseMove(e); if (e.LeftButton == MouseButtonState.Pressed && pos.X > 0 && pos.X < this.Width && pos.Y > 0 && pos.Y < 20) { this.WindowState = WindowState.Normal; this.DragMove(); } }

protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); GlassHelper.ExtendGlass(this, thick); } #endregion

private void Window_Loaded(object sender, RoutedEventArgs e) { // Form1 frm = new Form1(); // frm.Show();

ClassOPBillMangement OPBill = new ClassOPBillMangement(); DataTable dt = OPBill.LoadBillItems(); dataGrid1.ItemsSource = dt.DefaultView; Microsoft.Windows.Controls.DataGridLength CWidth = new Microsoft.Windows.Controls.DataGridLength(100, Microsoft.Windows.Controls.DataGridLengthUnitType.Star); dataGrid1.ColumnWidth = CWidth;

}

private void buttonSave_Click(object sender, RoutedEventArgs e) { if (selectedButton == SelectedButton.OP) { OPReg.SubmitValues(); } else if (selectedButton == SelectedButton.Consultation) {

Page 89: Hospital Management System Projectmm

P a g e | 89

//do code for date updation if (OPCons.SelectedOP > 0) { SqlCommand com = new SqlCommand("UPDATE OP SET LAST_DATE='" + DateTime.Now.Date + "' WHERE id=" + OPCons.SelectedOP, ClassDbManager.con); if (com.ExecuteNonQuery() > 0) { Brush b = new SolidColorBrush(Colors.Black); StatusLabel.Foreground = b; StatusLabel.Content = "OP Status updated"; } else { Brush b = new SolidColorBrush(Colors.Red); StatusLabel.Foreground = b; StatusLabel.Content = "OP Status cannot be updated"; } } else { Brush b = new SolidColorBrush(Colors.Red); StatusLabel.Foreground = b; StatusLabel.Content = "No OP Selected!"; } } else if (selectedButton == SelectedButton.IP) { userControlIP1.SubmitValues(); } }

private void OPReg_Error(object sender, ResultEventArgs e) { if (e.ErrorOccured) { Brush b = new SolidColorBrush(Colors.Red); StatusLabel.Foreground = b; StatusLabel.Content = e.Message; } else { Brush b = new SolidColorBrush(Colors.White); StatusLabel.Foreground = b; StatusLabel.Content = e.Message; }

}

private void label1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { WindowNewOPAdded wind = new WindowNewOPAdded(); wind.ShowDialog(); }

#region tabButton click...

Page 90: Hospital Management System Projectmm

P a g e | 90

private void tabButtonOP_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { selectedButton = SelectedButton.OP;

expander1.Visibility = Visibility.Hidden;

tabButtonOP.IsSelected = true; tabButtonOPCons.IsSelected = false; tabButtonIP.IsSelected=false;

buttonIPBill.Visibility = Visibility.Hidden; expander1.Visibility = Visibility.Visible;

OPReg.Visibility = Visibility.Visible; OPCons.Visibility = Visibility.Hidden; userControlIP1.Visibility = Visibility.Hidden; }

private void tabButtonIP_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { selectedButton = SelectedButton.IP;

expander1.Visibility = Visibility.Hidden;

tabButtonOP.IsSelected = false; tabButtonOPCons.IsSelected = false; tabButtonIP.IsSelected = true;

buttonIPBill.Visibility = Visibility.Visible; expander1.Visibility = Visibility.Hidden;

OPReg.Visibility = Visibility.Hidden; OPCons.Visibility = Visibility.Hidden; userControlIP1.Visibility = Visibility.Visible; }

private void tabButtonOPCons_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { selectedButton = SelectedButton.Consultation;

tabButtonOPCons.IsSelected = true; tabButtonOP.IsSelected = false; tabButtonIP.IsSelected = false;

buttonIPBill.Visibility = Visibility.Hidden; // expander1.Visibility = Visibility.Hidden;

OPCons.Visibility = Visibility.Visible; OPReg.Visibility = Visibility.Hidden; userControlIP1.Visibility = Visibility.Hidden;

expander1.Visibility = Visibility.Visible; }

#endregion

Page 91: Hospital Management System Projectmm

P a g e | 91

private void buttonBill_Click(object sender, RoutedEventArgs e) { try { if (selectedButton == SelectedButton.Consultation) { ClassDbManager db = new ClassDbManager(); string[] fields = { "ITEM", "AMOUNT", "OPNUMBER", "DATE" }; string table = "OPBILL"; for (int i = 0; i < dataGrid1.Items.Count; i++) { string[] values = { dataGrid1.Items[0].ToString(), dataGrid1.Items[1].ToString(), OPCons.listBoxOPNumber.SelectedItem.ToString(), DateTime.Today.ToString() }; db.Insert(fields, table, values); } } } catch { } }

private void buttonBill_Click_1(object sender, RoutedEventArgs e) { //pass it to report viewer DataTable dt = ((DataView)dataGrid1.ItemsSource).Table; FormOPBill opBill = new FormOPBill(dt); opBill.Show(); }

private void userControlIP1_Result(object sender, ResultEventArgs e) { if (e.ErrorOccured) { Brush b = new SolidColorBrush(Colors.Red); StatusLabel.Foreground = b; StatusLabel.Content = e.Message; } else { Brush b = new SolidColorBrush(Colors.White); StatusLabel.Foreground = b; StatusLabel.Content = e.Message; } }

private void buttonIPBill_Click(object sender, RoutedEventArgs e) { WindowBill bill = new WindowBill(); bill.ShowDialog(); }

private void label2_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (IsAdmin) { WindowMaster master = new WindowMaster(); master.ShowDialog();

Page 92: Hospital Management System Projectmm

P a g e | 92

} else { MessageBox.Show("Yo dont have privilage to perform this action!", "Access denied", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }

private void OPCons_Result(object sender, ResultEventArgs e) { //upadte bill datagrid with new cons fee SqlDataAdapter ad = new SqlDataAdapter("SELECT OPExpiryDays FROM Other", ClassDbManager.con); DataTable dt = new DataTable(); ad.Fill(dt); int maxDays = Convert.ToInt32(dt.Rows[0][0]);

int daysAfterLastVisit = 0; DateTime LastDate = new DateTime(); ad = new SqlDataAdapter("SELECT last_date FROM OP WHERE ID=" + e.Message, ClassDbManager.con); dt.Clear(); ad.Fill(dt); try { LastDate=Convert.ToDateTime(dt.Rows[0]["last_date"]); } catch{} daysAfterLastVisit = LastDate.Subtract(DateTime.Now.Date).Days;

if (daysAfterLastVisit <= maxDays) { ClassOPBillMangement OPBill = new ClassOPBillMangement(); DataTable dt1 = OPBill.LoadBillItems(); dt1.Rows.RemoveAt(0); DataRow dr = dt1.NewRow(); dr[0] = "Consultation Fee"; dr[1] = 0; dt1.Rows.InsertAt(dr, 0); dataGrid1.ItemsSource = dt1.AsDataView(); Microsoft.Windows.Controls.DataGridLength CWidth = new Microsoft.Windows.Controls.DataGridLength(100, Microsoft.Windows.Controls.DataGridLengthUnitType.Star); dataGrid1.ColumnWidth = CWidth; } else { ClassOPBillMangement OPBill = new ClassOPBillMangement(); DataTable dt1 = OPBill.LoadBillItems(); dataGrid1.ItemsSource = dt1.DefaultView; Microsoft.Windows.Controls.DataGridLength CWidth = new Microsoft.Windows.Controls.DataGridLength(100, Microsoft.Windows.Controls.DataGridLengthUnitType.Star); dataGrid1.ColumnWidth = CWidth; }

}

Page 93: Hospital Management System Projectmm

P a g e | 93

private void labelTest_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { WindowTest test = new WindowTest(); test.ShowDialog(); }

private void label3_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { WindowPharmacy ph = new WindowPharmacy(); ph.ShowDialog(); }

private void labelIDCard_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { FormID id = new FormID(); id.ShowDialog(); }

private void i(object sender, MouseButtonEventArgs e) { Form2 ns = new Form2(); ns.Show(); }

private void label5_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { VdoWindow cs = new VdoWindow(); cs.Show(); }

}}

using System;using System.Collections.Generic;using System.Data.SqlClient;using System.Data;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;

Page 94: Hospital Management System Projectmm

P a g e | 94

using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;

namespace WpfApplication2{ public delegate void ResultEventHandler(object sender, ResultEventArgs e); public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } public event ResultEventHandler Result; protected virtual void OnResult(ResultEventArgs e) { ResultEventHandler handler = Result; if (handler != null) { handler(this, e); } }

SqlDataAdapter ad = new SqlDataAdapter(); SqlCommand com = new SqlCommand(); DataTable dt = new DataTable();

public bool SubmitValues() { /* *Validate all columns\ * *Name NOT NULL √ *Age NOT NULL,INTEGER √ *Address Anything...√ *Phone Number Anything...√ *Comment NOT NULL.√ *Department Fixed√ *Doctor Fixed√ *Last Consultastion Date Fixed√ * *Save √ * *Name, Age, Sex(convert to varchar),Address,Phone Number,Comment,Department,Doctor√ * * *Display Op √ *Print OP Card * */ ClassDbManager db = new ClassDbManager(); if (textBoxName.Text != "")//name cannot be empty { if (textBoxComment.Text != "") //Comment Cannot be emty {

Page 95: Hospital Management System Projectmm

P a g e | 95

if (textBoxAge.Text != "")//Age cannot be empty { //insert values string sex = ""; if ((bool)radioButtonFemale.IsChecked) sex = "Female"; else sex = "Male";

string[] fields = { "NAME", "AGE", "SEX", "ADDRESS", "COMMENT", "PHONE", "DEPARTMENT", "DOCTOR", "DATE" }; string table = "OP"; string[] values = { textBoxName.Text, textBoxAge.Text, sex, textBoxAddress.Text ,textBoxComment.Text, textBoxPhoneNumber.Text, comboBoxDepartments.Text, comboBoxReferenceDoctor.Text, DateTime.Today.ToShortDateString() };

if (db.Insert(fields, table, values) > 0)//add successful { ResultEventArgs e = new ResultEventArgs(false, "New Entry added"); OnResult(e); WindowNewOPAdded wnd = new WindowNewOPAdded();//show quick info wnd.ShowDialog(); //clear all values #region clear fields textBoxName.Text = ""; textBoxAge.Text = ""; textBoxAddress.Text = "Not Specified"; textBoxPhoneNumber.Text = ""; textBoxComment.Text = ""; #endregion return true; } else// Cannot add entry { ResultEventArgs e = new ResultEventArgs(true, "Please Check your data"); OnResult(e); return false; } } else //Age empty { ResultEventArgs e = new ResultEventArgs(true, "New entry not added! Age not valid"); OnResult(e); return false; } } else //Comment Empty { textBoxComment_LostFocus(new object(), new RoutedEventArgs()); ResultEventArgs e = new ResultEventArgs(true, "New entry not added! Comment Cannot be empty"); OnResult(e);

Page 96: Hospital Management System Projectmm

P a g e | 96

return false; } } else //Name empty { textBoxName_LostFocus(new object(), new RoutedEventArgs()); ResultEventArgs e = new ResultEventArgs(true, "New entry not added! Name Cannot be empty"); OnResult(e); return false; } }

private void Usr1_Loaded(object sender, RoutedEventArgs e) { com.Connection = ClassDbManager.con; }

#region validation... private void textBoxAge_TextChanged(object sender, TextChangedEventArgs e) { //Text Box Validation ClassAgeValidation val = new ClassAgeValidation(); ValidationResult res = val.Validate(textBoxAge.Text, null); if (!res.IsValid) { textBoxAge.Style = (Style)this.Resources["textBoxInError"]; textBoxAge.ToolTip = "Age is not valid"; } else { textBoxAge.Style = (Style)TextBox.StyleProperty.DefaultMetadata.DefaultValue; textBoxAge.ToolTip = null; } }

private void textBoxName_LostFocus(object sender, RoutedEventArgs e) { if (textBoxName.Text.Length==0) { textBoxName.Style = (Style)this.Resources["textBoxInError"]; textBoxName.ToolTip = "Name Cannot be empty"; } else { textBoxName.Style = (Style)TextBox.StyleProperty.DefaultMetadata.DefaultValue; textBoxName.ToolTip = null; } }

private void textBoxComment_LostFocus(object sender, RoutedEventArgs e) { if (textBoxComment.Text.Length==0) {

Page 97: Hospital Management System Projectmm

P a g e | 97

textBoxComment.Style = (Style)this.Resources["textBoxInError"]; textBoxComment.ToolTip = "Comment Cannot be empty"; } else { textBoxComment.Style = (Style)TextBox.StyleProperty.DefaultMetadata.DefaultValue; textBoxComment.ToolTip = null; } }

#endregion

}}

/------------------------------------------------------------------------------// <auto-generated>// This code was generated by a tool.// Runtime Version:4.0.30319.1//// Changes to this file may cause incorrect behavior and will be lost if// the code is regenerated.// </auto-generated>//------------------------------------------------------------------------------

#pragma warning disable 1591

namespace WpfApplication2 { /// <summary> ///Represents a strongly typed in-memory cache of data. ///</summary> [global::System.Serializable()] [global::System.ComponentModel.DesignerCategoryAttribute("code")] [global::System.ComponentModel.ToolboxItem(true)] [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")] [global::System.Xml.Serialization.XmlRootAttribute("HospitalDataSet1")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")] public partial class HospitalDataSet1 : global::System.Data.DataSet { private OPBILLMASTERDataTable tableOPBILLMASTER; private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]

Page 98: Hospital Management System Projectmm

P a g e | 98

public HospitalDataSet1() { this.BeginInit(); this.InitClass(); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); base.Tables.CollectionChanged += schemaChangedHandler; base.Relations.CollectionChanged += schemaChangedHandler; this.EndInit(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected HospitalDataSet1(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context, false) { if ((this.IsBinarySerialized(info, context) == true)) { this.InitVars(false); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += schemaChangedHandler1; this.Relations.CollectionChanged += schemaChangedHandler1; return; } string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string)))); if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { global::System.Data.DataSet ds = new global::System.Data.DataSet(); ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); if ((ds.Tables["OPBILLMASTER"] != null)) { base.Tables.Add(new OPBILLMASTERDataTable(ds.Tables["OPBILLMASTER"])); } this.DataSetName = ds.DataSetName; this.Prefix = ds.Prefix; this.Namespace = ds.Namespace; this.Locale = ds.Locale; this.CaseSensitive = ds.CaseSensitive; this.EnforceConstraints = ds.EnforceConstraints; this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); this.InitVars(); } else { this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); } this.GetSerializationData(info, context);

Page 99: Hospital Management System Projectmm

P a g e | 99

global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); base.Tables.CollectionChanged += schemaChangedHandler; this.Relations.CollectionChanged += schemaChangedHandler; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] public OPBILLMASTERDataTable OPBILLMASTER { get { return this.tableOPBILLMASTER; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.BrowsableAttribute(true)] [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)] public override global::System.Data.SchemaSerializationMode SchemaSerializationMode { get { return this._schemaSerializationMode; } set { this._schemaSerializationMode = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] public new global::System.Data.DataTableCollection Tables { get { return base.Tables; } }

Page 100: Hospital Management System Projectmm

P a g e | 100

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] public new global::System.Data.DataRelationCollection Relations { get { return base.Relations; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void InitializeDerivedDataSet() { this.BeginInit(); this.InitClass(); this.EndInit(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public override global::System.Data.DataSet Clone() { HospitalDataSet1 cln = ((HospitalDataSet1)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return cln; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override bool ShouldSerializeTables() { return false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override bool ShouldSerializeRelations() { return false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

Page 101: Hospital Management System Projectmm

P a g e | 101

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) { if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { this.Reset(); global::System.Data.DataSet ds = new global::System.Data.DataSet(); ds.ReadXml(reader); if ((ds.Tables["OPBILLMASTER"] != null)) { base.Tables.Add(new OPBILLMASTERDataTable(ds.Tables["OPBILLMASTER"])); } this.DataSetName = ds.DataSetName; this.Prefix = ds.Prefix; this.Namespace = ds.Namespace; this.Locale = ds.Locale; this.CaseSensitive = ds.CaseSensitive; this.EnforceConstraints = ds.EnforceConstraints; this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); this.InitVars(); } else { this.ReadXml(reader); this.InitVars(); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() { global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream(); this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null)); stream.Position = 0; return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars() { this.InitVars(true); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

Page 102: Hospital Management System Projectmm

P a g e | 102

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars(bool initTable) { this.tableOPBILLMASTER = ((OPBILLMASTERDataTable)(base.Tables["OPBILLMASTER"])); if ((initTable == true)) { if ((this.tableOPBILLMASTER != null)) { this.tableOPBILLMASTER.InitVars(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitClass() { this.DataSetName = "HospitalDataSet1"; this.Prefix = ""; this.Namespace = "http://tempuri.org/HospitalDataSet1.xsd"; this.EnforceConstraints = true; this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; this.tableOPBILLMASTER = new OPBILLMASTERDataTable(); base.Tables.Add(this.tableOPBILLMASTER); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private bool ShouldSerializeOPBILLMASTER() { return false; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) { if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) { this.InitVars(); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]

Page 103: Hospital Management System Projectmm

P a g e | 103

public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { HospitalDataSet1 ds = new HospitalDataSet1(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]

Page 104: Hospital Management System Projectmm

P a g e | 104

public delegate void OPBILLMASTERRowChangeEventHandler(object sender, OPBILLMASTERRowChangeEvent e); /// <summary> ///Represents the strongly named DataTable class. ///</summary> [global::System.Serializable()] [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] public partial class OPBILLMASTERDataTable : global::System.Data.TypedTableBase<OPBILLMASTERRow> { private global::System.Data.DataColumn columnBillItem; private global::System.Data.DataColumn columnAmount; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public OPBILLMASTERDataTable() { this.TableName = "OPBILLMASTER"; this.BeginInit(); this.InitClass(); this.EndInit(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal OPBILLMASTERDataTable(global::System.Data.DataTable table) { this.TableName = table.TableName; if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { this.CaseSensitive = table.CaseSensitive; } if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { this.Locale = table.Locale; } if ((table.Namespace != table.DataSet.Namespace)) { this.Namespace = table.Namespace; } this.Prefix = table.Prefix; this.MinimumCapacity = table.MinimumCapacity; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]

Page 105: Hospital Management System Projectmm

P a g e | 105

protected OPBILLMASTERDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : base(info, context) { this.InitVars(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn BillItemColumn { get { return this.columnBillItem; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataColumn AmountColumn { get { return this.columnAmount; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] public int Count { get { return this.Rows.Count; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public OPBILLMASTERRow this[int index] { get { return ((OPBILLMASTERRow)(this.Rows[index])); } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event OPBILLMASTERRowChangeEventHandler OPBILLMASTERRowChanging;

Page 106: Hospital Management System Projectmm

P a g e | 106

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event OPBILLMASTERRowChangeEventHandler OPBILLMASTERRowChanged; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event OPBILLMASTERRowChangeEventHandler OPBILLMASTERRowDeleting; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public event OPBILLMASTERRowChangeEventHandler OPBILLMASTERRowDeleted; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void AddOPBILLMASTERRow(OPBILLMASTERRow row) { this.Rows.Add(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public OPBILLMASTERRow AddOPBILLMASTERRow(string BillItem, decimal Amount) { OPBILLMASTERRow rowOPBILLMASTERRow = ((OPBILLMASTERRow)(this.NewRow())); object[] columnValuesArray = new object[] { BillItem, Amount}; rowOPBILLMASTERRow.ItemArray = columnValuesArray; this.Rows.Add(rowOPBILLMASTERRow); return rowOPBILLMASTERRow; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public OPBILLMASTERRow FindByBillItem(string BillItem) { return ((OPBILLMASTERRow)(this.Rows.Find(new object[] { BillItem}))); }

Page 107: Hospital Management System Projectmm

P a g e | 107

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public override global::System.Data.DataTable Clone() { OPBILLMASTERDataTable cln = ((OPBILLMASTERDataTable)(base.Clone())); cln.InitVars(); return cln; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Data.DataTable CreateInstance() { return new OPBILLMASTERDataTable(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal void InitVars() { this.columnBillItem = base.Columns["BillItem"]; this.columnAmount = base.Columns["Amount"]; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitClass() { this.columnBillItem = new global::System.Data.DataColumn("BillItem", typeof(string), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnBillItem); this.columnAmount = new global::System.Data.DataColumn("Amount", typeof(decimal), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnAmount); this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { this.columnBillItem}, true)); this.columnBillItem.AllowDBNull = false; this.columnBillItem.Unique = true; this.columnBillItem.MaxLength = 100; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]

Page 108: Hospital Management System Projectmm

P a g e | 108

public OPBILLMASTERRow NewOPBILLMASTERRow() { return ((OPBILLMASTERRow)(this.NewRow())); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { return new OPBILLMASTERRow(builder); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override global::System.Type GetRowType() { return typeof(OPBILLMASTERRow); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { base.OnRowChanged(e); if ((this.OPBILLMASTERRowChanged != null)) { this.OPBILLMASTERRowChanged(this, new OPBILLMASTERRowChangeEvent(((OPBILLMASTERRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { base.OnRowChanging(e); if ((this.OPBILLMASTERRowChanging != null)) { this.OPBILLMASTERRowChanging(this, new OPBILLMASTERRowChangeEvent(((OPBILLMASTERRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {

Page 109: Hospital Management System Projectmm

P a g e | 109

base.OnRowDeleted(e); if ((this.OPBILLMASTERRowDeleted != null)) { this.OPBILLMASTERRowDeleted(this, new OPBILLMASTERRowChangeEvent(((OPBILLMASTERRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { base.OnRowDeleting(e); if ((this.OPBILLMASTERRowDeleting != null)) { this.OPBILLMASTERRowDeleting(this, new OPBILLMASTERRowChangeEvent(((OPBILLMASTERRow)(e.Row)), e.Action)); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void RemoveOPBILLMASTERRow(OPBILLMASTERRow row) { this.Rows.Remove(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); HospitalDataSet1 ds = new HospitalDataSet1(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2);

Page 110: Hospital Management System Projectmm

P a g e | 110

global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "OPBILLMASTERDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; } } /// <summary> ///Represents strongly named DataRow class. ///</summary>

Page 111: Hospital Management System Projectmm

P a g e | 111

public partial class OPBILLMASTERRow : global::System.Data.DataRow { private OPBILLMASTERDataTable tableOPBILLMASTER; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal OPBILLMASTERRow(global::System.Data.DataRowBuilder rb) : base(rb) { this.tableOPBILLMASTER = ((OPBILLMASTERDataTable)(this.Table)); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public string BillItem { get { return ((string)(this[this.tableOPBILLMASTER.BillItemColumn])); } set { this[this.tableOPBILLMASTER.BillItemColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public decimal Amount { get { try { return ((decimal)(this[this.tableOPBILLMASTER.AmountColumn])); } catch (global::System.InvalidCastException e) { throw new global::System.Data.StrongTypingException("The value for column \'Amount\' in table \'OPBILLMASTER\' is DBNull.", e); } } set { this[this.tableOPBILLMASTER.AmountColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool IsAmountNull() { return this.IsNull(this.tableOPBILLMASTER.AmountColumn); }

Page 112: Hospital Management System Projectmm

P a g e | 112

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public void SetAmountNull() { this[this.tableOPBILLMASTER.AmountColumn] = global::System.Convert.DBNull; } } /// <summary> ///Row event argument class ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public class OPBILLMASTERRowChangeEvent : global::System.EventArgs { private OPBILLMASTERRow eventRow; private global::System.Data.DataRowAction eventAction; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public OPBILLMASTERRowChangeEvent(OPBILLMASTERRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public OPBILLMASTERRow Row { get { return this.eventRow; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public global::System.Data.DataRowAction Action { get { return this.eventAction; } } }

Page 113: Hospital Management System Projectmm

P a g e | 113

}}namespace WpfApplication2.HospitalDataSet1TableAdapters { /// <summary> ///Represents the connection and commands used to retrieve and save data. ///</summary> [global::System.ComponentModel.DesignerCategoryAttribute("code")] [global::System.ComponentModel.ToolboxItem(true)] [global::System.ComponentModel.DataObjectAttribute(true)] [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public partial class OPBILLMASTERTableAdapter : global::System.ComponentModel.Component { private global::System.Data.SqlClient.SqlDataAdapter _adapter; private global::System.Data.SqlClient.SqlConnection _connection; private global::System.Data.SqlClient.SqlTransaction _transaction; private global::System.Data.SqlClient.SqlCommand[] _commandCollection; private bool _clearBeforeFill; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public OPBILLMASTERTableAdapter() { this.ClearBeforeFill = true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter { get { if ((this._adapter == null)) { this.InitAdapter(); } return this._adapter; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

Page 114: Hospital Management System Projectmm

P a g e | 114

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal global::System.Data.SqlClient.SqlConnection Connection { get { if ((this._connection == null)) { this.InitConnection(); } return this._connection; } set { this._connection = value; if ((this.Adapter.InsertCommand != null)) { this.Adapter.InsertCommand.Connection = value; } if ((this.Adapter.DeleteCommand != null)) { this.Adapter.DeleteCommand.Connection = value; } if ((this.Adapter.UpdateCommand != null)) { this.Adapter.UpdateCommand.Connection = value; } for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { if ((this.CommandCollection[i] != null)) { ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value; } } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal global::System.Data.SqlClient.SqlTransaction Transaction { get { return this._transaction; } set { this._transaction = value; for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { this.CommandCollection[i].Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.DeleteCommand != null))) { this.Adapter.DeleteCommand.Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.InsertCommand != null))) { this.Adapter.InsertCommand.Transaction = this._transaction; } if (((this.Adapter != null) && (this.Adapter.UpdateCommand != null))) { this.Adapter.UpdateCommand.Transaction = this._transaction;

Page 115: Hospital Management System Projectmm

P a g e | 115

} } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected global::System.Data.SqlClient.SqlCommand[] CommandCollection { get { if ((this._commandCollection == null)) { this.InitCommandCollection(); } return this._commandCollection; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool ClearBeforeFill { get { return this._clearBeforeFill; } set { this._clearBeforeFill = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitAdapter() { this._adapter = new global::System.Data.SqlClient.SqlDataAdapter(); global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); tableMapping.SourceTable = "Table"; tableMapping.DataSetTable = "OPBILLMASTER"; tableMapping.ColumnMappings.Add("BillItem", "BillItem"); tableMapping.ColumnMappings.Add("Amount", "Amount"); this._adapter.TableMappings.Add(tableMapping); this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand(); this._adapter.DeleteCommand.Connection = this.Connection; this._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[OPBILLMASTER] WHERE (([BillItem] = @Original_BillItem) AND ((@" + "IsNull_Amount = 1 AND [Amount] IS NULL) OR ([Amount] = @Original_Amount)))"; this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text; this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_BillItem", global::System.Data.SqlDbType.VarChar, 0,

Page 116: Hospital Management System Projectmm

P a g e | 116

global::System.Data.ParameterDirection.Input, 0, 0, "BillItem", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Amount", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Amount", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Amount", global::System.Data.SqlDbType.Decimal, 0, global::System.Data.ParameterDirection.Input, 10, 2, "Amount", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand(); this._adapter.InsertCommand.Connection = this.Connection; this._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[OPBILLMASTER] ([BillItem], [Amount]) VALUES (@BillItem, @Amoun" + "t);\r\nSELECT BillItem, Amount FROM OPBILLMASTER WHERE (BillItem = @BillItem)"; this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text; this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@BillItem", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "BillItem", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Amount", global::System.Data.SqlDbType.Decimal, 0, global::System.Data.ParameterDirection.Input, 10, 2, "Amount", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand(); this._adapter.UpdateCommand.Connection = this.Connection; this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[OPBILLMASTER] SET [BillItem] = @BillItem, [Amount] = @Amount WHERE (([BillItem] = @Original_BillItem) AND ((@IsNull_Amount = 1 AND [Amount] IS NULL) OR ([Amount] = @Original_Amount)));SELECT BillItem, Amount FROM OPBILLMASTER WHERE (BillItem = @BillItem)"; this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text; this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@BillItem", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "BillItem", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Amount", global::System.Data.SqlDbType.Decimal, 0, global::System.Data.ParameterDirection.Input, 10, 2, "Amount", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_BillItem", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "BillItem", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Amount",

Page 117: Hospital Management System Projectmm

P a g e | 117

global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Amount", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Amount", global::System.Data.SqlDbType.Decimal, 0, global::System.Data.ParameterDirection.Input, 10, 2, "Amount", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitConnection() { this._connection = new global::System.Data.SqlClient.SqlConnection(); this._connection.ConnectionString = global::WpfApplication2.Properties.Settings.Default.D__DB_HOSPITAL_MDFConnectionString; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private void InitCommandCollection() { this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "SELECT BillItem, Amount FROM dbo.OPBILLMASTER"; this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] public virtual int Fill(HospitalDataSet1.OPBILLMASTERDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; if ((this.ClearBeforeFill == true)) { dataTable.Clear();

Page 118: Hospital Management System Projectmm

P a g e | 118

} int returnValue = this.Adapter.Fill(dataTable); return returnValue; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] public virtual HospitalDataSet1.OPBILLMASTERDataTable GetData() { this.Adapter.SelectCommand = this.CommandCollection[0]; HospitalDataSet1.OPBILLMASTERDataTable dataTable = new HospitalDataSet1.OPBILLMASTERDataTable(); this.Adapter.Fill(dataTable); return dataTable; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(HospitalDataSet1.OPBILLMASTERDataTable dataTable) { return this.Adapter.Update(dataTable); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(HospitalDataSet1 dataSet) { return this.Adapter.Update(dataSet, "OPBILLMASTER"); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]

Page 119: Hospital Management System Projectmm

P a g e | 119

[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(global::System.Data.DataRow dataRow) { return this.Adapter.Update(new global::System.Data.DataRow[] { dataRow}); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int Update(global::System.Data.DataRow[] dataRows) { return this.Adapter.Update(dataRows); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)] public virtual int Delete(string Original_BillItem, global::System.Nullable<decimal> Original_Amount) { if ((Original_BillItem == null)) { throw new global::System.ArgumentNullException("Original_BillItem"); } else { this.Adapter.DeleteCommand.Parameters[0].Value = ((string)(Original_BillItem)); } if ((Original_Amount.HasValue == true)) { this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(0)); this.Adapter.DeleteCommand.Parameters[2].Value = ((decimal)(Original_Amount.Value)); } else { this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(1)); this.Adapter.DeleteCommand.Parameters[2].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;

Page 120: Hospital Management System Projectmm

P a g e | 120

if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.DeleteCommand.Connection.Open(); } try { int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.DeleteCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)] public virtual int Insert(string BillItem, global::System.Nullable<decimal> Amount) { if ((BillItem == null)) { throw new global::System.ArgumentNullException("BillItem"); } else { this.Adapter.InsertCommand.Parameters[0].Value = ((string)(BillItem)); } if ((Amount.HasValue == true)) { this.Adapter.InsertCommand.Parameters[1].Value = ((decimal)(Amount.Value)); } else { this.Adapter.InsertCommand.Parameters[1].Value = global::System.DBNull.Value; } global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State; if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.InsertCommand.Connection.Open(); } try { int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery(); return returnValue; }

Page 121: Hospital Management System Projectmm

P a g e | 121

finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.InsertCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)] public virtual int Update(string BillItem, global::System.Nullable<decimal> Amount, string Original_BillItem, global::System.Nullable<decimal> Original_Amount) { if ((BillItem == null)) { throw new global::System.ArgumentNullException("BillItem"); } else { this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(BillItem)); } if ((Amount.HasValue == true)) { this.Adapter.UpdateCommand.Parameters[1].Value = ((decimal)(Amount.Value)); } else { this.Adapter.UpdateCommand.Parameters[1].Value = global::System.DBNull.Value; } if ((Original_BillItem == null)) { throw new global::System.ArgumentNullException("Original_BillItem"); } else { this.Adapter.UpdateCommand.Parameters[2].Value = ((string)(Original_BillItem)); } if ((Original_Amount.HasValue == true)) { this.Adapter.UpdateCommand.Parameters[3].Value = ((object)(0)); this.Adapter.UpdateCommand.Parameters[4].Value = ((decimal)(Original_Amount.Value)); } else { this.Adapter.UpdateCommand.Parameters[3].Value = ((object)(1)); this.Adapter.UpdateCommand.Parameters[4].Value = global::System.DBNull.Value; }

Page 122: Hospital Management System Projectmm

P a g e | 122

global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State; if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open) != global::System.Data.ConnectionState.Open)) { this.Adapter.UpdateCommand.Connection.Open(); } try { int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery(); return returnValue; } finally { if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.UpdateCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)] public virtual int Update(global::System.Nullable<decimal> Amount, string Original_BillItem, global::System.Nullable<decimal> Original_Amount) { return this.Update(Original_BillItem, Amount, Original_BillItem, Original_Amount); } } /// <summary> ///TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios ///</summary> [global::System.ComponentModel.DesignerCategoryAttribute("code")] [global::System.ComponentModel.ToolboxItem(true)] [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerDesigner, Microsoft.VSD" + "esigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapterManager")] public partial class TableAdapterManager : global::System.ComponentModel.Component {

Page 123: Hospital Management System Projectmm

P a g e | 123

private UpdateOrderOption _updateOrder; private OPBILLMASTERTableAdapter _oPBILLMASTERTableAdapter; private bool _backupDataSetBeforeUpdate; private global::System.Data.IDbConnection _connection; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public UpdateOrderOption UpdateOrder { get { return this._updateOrder; } set { this._updateOrder = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" + "ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + "a", "System.Drawing.Design.UITypeEditor")] public OPBILLMASTERTableAdapter OPBILLMASTERTableAdapter { get { return this._oPBILLMASTERTableAdapter; } set { this._oPBILLMASTERTableAdapter = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public bool BackupDataSetBeforeUpdate { get { return this._backupDataSetBeforeUpdate; } set { this._backupDataSetBeforeUpdate = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

Page 124: Hospital Management System Projectmm

P a g e | 124

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] public global::System.Data.IDbConnection Connection { get { if ((this._connection != null)) { return this._connection; } if (((this._oPBILLMASTERTableAdapter != null) && (this._oPBILLMASTERTableAdapter.Connection != null))) { return this._oPBILLMASTERTableAdapter.Connection; } return null; } set { this._connection = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] public int TableAdapterInstanceCount { get { int count = 0; if ((this._oPBILLMASTERTableAdapter != null)) { count = (count + 1); } return count; } } /// <summary> ///Update rows in top-down order. ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private int UpdateUpdatedRows(HospitalDataSet1 dataSet, global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows, global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows) { int result = 0; if ((this._oPBILLMASTERTableAdapter != null)) { global::System.Data.DataRow[] updatedRows = dataSet.OPBILLMASTER.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent); updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows); if (((updatedRows != null)

Page 125: Hospital Management System Projectmm

P a g e | 125

&& (0 < updatedRows.Length))) { result = (result + this._oPBILLMASTERTableAdapter.Update(updatedRows)); allChangedRows.AddRange(updatedRows); } } return result; } /// <summary> ///Insert rows in top-down order. ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private int UpdateInsertedRows(HospitalDataSet1 dataSet, global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows) { int result = 0; if ((this._oPBILLMASTERTableAdapter != null)) { global::System.Data.DataRow[] addedRows = dataSet.OPBILLMASTER.Select(null, null, global::System.Data.DataViewRowState.Added); if (((addedRows != null) && (0 < addedRows.Length))) { result = (result + this._oPBILLMASTERTableAdapter.Update(addedRows)); allAddedRows.AddRange(addedRows); } } return result; } /// <summary> ///Delete rows in bottom-up order. ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private int UpdateDeletedRows(HospitalDataSet1 dataSet, global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows) { int result = 0; if ((this._oPBILLMASTERTableAdapter != null)) { global::System.Data.DataRow[] deletedRows = dataSet.OPBILLMASTER.Select(null, null, global::System.Data.DataViewRowState.Deleted); if (((deletedRows != null) && (0 < deletedRows.Length))) { result = (result + this._oPBILLMASTERTableAdapter.Update(deletedRows)); allChangedRows.AddRange(deletedRows); } }

Page 126: Hospital Management System Projectmm

P a g e | 126

return result; } /// <summary> ///Remove inserted rows that become updated rows after calling TableAdapter.Update(inserted rows) first ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private global::System.Data.DataRow[] GetRealUpdatedRows(global::System.Data.DataRow[] updatedRows, global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows) { if (((updatedRows == null) || (updatedRows.Length < 1))) { return updatedRows; } if (((allAddedRows == null) || (allAddedRows.Count < 1))) { return updatedRows; } global::System.Collections.Generic.List<global::System.Data.DataRow> realUpdatedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>(); for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { global::System.Data.DataRow row = updatedRows[i]; if ((allAddedRows.Contains(row) == false)) { realUpdatedRows.Add(row); } } return realUpdatedRows.ToArray(); } /// <summary> ///Update all changes to the dataset. ///</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public virtual int UpdateAll(HospitalDataSet1 dataSet) { if ((dataSet == null)) { throw new global::System.ArgumentNullException("dataSet"); } if ((dataSet.HasChanges() == false)) { return 0; } if (((this._oPBILLMASTERTableAdapter != null) && (this.MatchTableAdapterConnection(this._oPBILLMASTERTableAdapter.Connection) == false))) { throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring.");

Page 127: Hospital Management System Projectmm

P a g e | 127

} global::System.Data.IDbConnection workConnection = this.Connection; if ((workConnection == null)) { throw new global::System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" + "ger TableAdapter property to a valid TableAdapter instance."); } bool workConnOpened = false; if (((workConnection.State & global::System.Data.ConnectionState.Broken) == global::System.Data.ConnectionState.Broken)) { workConnection.Close(); } if ((workConnection.State == global::System.Data.ConnectionState.Closed)) { workConnection.Open(); workConnOpened = true; } global::System.Data.IDbTransaction workTransaction = workConnection.BeginTransaction(); if ((workTransaction == null)) { throw new global::System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" + "ctions or the current state is not allowing the transaction to begin."); } global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>(); global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>(); global::System.Collections.Generic.List<global::System.Data.Common.DataAdapter> adaptersWithAcceptChangesDuringUpdate = new global::System.Collections.Generic.List<global::System.Data.Common.DataAdapter>(); global::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection> revertConnections = new global::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection>(); int result = 0; global::System.Data.DataSet backupDataSet = null; if (this.BackupDataSetBeforeUpdate) { backupDataSet = new global::System.Data.DataSet(); backupDataSet.Merge(dataSet); } try { // ---- Prepare for update ----------- // if ((this._oPBILLMASTERTableAdapter != null)) { revertConnections.Add(this._oPBILLMASTERTableAdapter, this._oPBILLMASTERTableAdapter.Connection); this._oPBILLMASTERTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(workConnection));

Page 128: Hospital Management System Projectmm

P a g e | 128

this._oPBILLMASTERTableAdapter.Transaction = ((global::System.Data.SqlClient.SqlTransaction)(workTransaction)); if (this._oPBILLMASTERTableAdapter.Adapter.AcceptChangesDuringUpdate) { this._oPBILLMASTERTableAdapter.Adapter.AcceptChangesDuringUpdate = false; adaptersWithAcceptChangesDuringUpdate.Add(this._oPBILLMASTERTableAdapter.Adapter); } } // //---- Perform updates ----------- // if ((this.UpdateOrder == UpdateOrderOption.UpdateInsertDelete)) { result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); } else { result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); } result = (result + this.UpdateDeletedRows(dataSet, allChangedRows)); // //---- Commit updates ----------- // workTransaction.Commit(); if ((0 < allAddedRows.Count)) { global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; allAddedRows.CopyTo(rows); for (int i = 0; (i < rows.Length); i = (i + 1)) { global::System.Data.DataRow row = rows[i]; row.AcceptChanges(); } } if ((0 < allChangedRows.Count)) { global::System.Data.DataRow[] rows = new System.Data.DataRow[allChangedRows.Count]; allChangedRows.CopyTo(rows); for (int i = 0; (i < rows.Length); i = (i + 1)) { global::System.Data.DataRow row = rows[i]; row.AcceptChanges(); } } } catch (global::System.Exception ex) { workTransaction.Rollback(); // ---- Restore the dataset ----------- if (this.BackupDataSetBeforeUpdate) { global::System.Diagnostics.Debug.Assert((backupDataSet != null)); dataSet.Clear();

Page 129: Hospital Management System Projectmm

P a g e | 129

dataSet.Merge(backupDataSet); } else { if ((0 < allAddedRows.Count)) { global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; allAddedRows.CopyTo(rows); for (int i = 0; (i < rows.Length); i = (i + 1)) { global::System.Data.DataRow row = rows[i]; row.AcceptChanges(); row.SetAdded(); } } } throw ex; } finally { if (workConnOpened) { workConnection.Close(); } if ((this._oPBILLMASTERTableAdapter != null)) { this._oPBILLMASTERTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._oPBILLMASTERTableAdapter])); this._oPBILLMASTERTableAdapter.Transaction = null; } if ((0 < adaptersWithAcceptChangesDuringUpdate.Count)) { global::System.Data.Common.DataAdapter[] adapters = new System.Data.Common.DataAdapter[adaptersWithAcceptChangesDuringUpdate.Count]; adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters); for (int i = 0; (i < adapters.Length); i = (i + 1)) { global::System.Data.Common.DataAdapter adapter = adapters[i]; adapter.AcceptChangesDuringUpdate = true; } } } return result; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] protected virtual void SortSelfReferenceRows(global::System.Data.DataRow[] rows, global::System.Data.DataRelation relation, bool childFirst) { global::System.Array.Sort<global::System.Data.DataRow>(rows, new SelfReferenceComparer(relation, childFirst)); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]

Page 130: Hospital Management System Projectmm

P a g e | 130

protected virtual bool MatchTableAdapterConnection(global::System.Data.IDbConnection inputConnection) { if ((this._connection != null)) { return true; } if (((this.Connection == null) || (inputConnection == null))) { return true; } if (string.Equals(this.Connection.ConnectionString, inputConnection.ConnectionString, global::System.StringComparison.Ordinal)) { return true; } return false; } /// <summary> ///Update Order Option ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] public enum UpdateOrderOption { InsertUpdateDelete = 0, UpdateInsertDelete = 1, } /// <summary> ///Used to sort self-referenced table's rows ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private class SelfReferenceComparer : object, global::System.Collections.Generic.IComparer<global::System.Data.DataRow> { private global::System.Data.DataRelation _relation; private int _childFirst; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] internal SelfReferenceComparer(global::System.Data.DataRelation relation, bool childFirst) { this._relation = relation; if (childFirst) { this._childFirst = -1; } else { this._childFirst = 1; }

Page 131: Hospital Management System Projectmm

P a g e | 131

} [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] private global::System.Data.DataRow GetRoot(global::System.Data.DataRow row, out int distance) { global::System.Diagnostics.Debug.Assert((row != null)); global::System.Data.DataRow root = row; distance = 0;

global::System.Collections.Generic.IDictionary<global::System.Data.DataRow, global::System.Data.DataRow> traversedRows = new global::System.Collections.Generic.Dictionary<global::System.Data.DataRow, global::System.Data.DataRow>(); traversedRows[row] = row;

global::System.Data.DataRow parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); for ( ; ((parent != null) && (traversedRows.ContainsKey(parent) == false)); ) { distance = (distance + 1); root = parent; traversedRows[parent] = parent; parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); }

if ((distance == 0)) { traversedRows.Clear(); traversedRows[row] = row; parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); for ( ; ((parent != null) && (traversedRows.ContainsKey(parent) == false)); ) { distance = (distance + 1); root = parent; traversedRows[parent] = parent; parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); } }

return root; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]

Page 132: Hospital Management System Projectmm

P a g e | 132

public int Compare(global::System.Data.DataRow row1, global::System.Data.DataRow row2) { if (object.ReferenceEquals(row1, row2)) { return 0; } if ((row1 == null)) { return -1; } if ((row2 == null)) { return 1; }

int distance1 = 0; global::System.Data.DataRow root1 = this.GetRoot(row1, out distance1);

int distance2 = 0; global::System.Data.DataRow root2 = this.GetRoot(row2, out distance2);

if (object.ReferenceEquals(root1, root2)) { return (this._childFirst * distance1.CompareTo(distance2)); } else { global::System.Diagnostics.Debug.Assert(((root1.Table != null) && (root2.Table != null))); if ((root1.Table.Rows.IndexOf(root1) < root2.Table.Rows.IndexOf(root2))) { return -1; } else { return 1; } } } } }}

#pragma warning restore 1591

namespace WpfApplication2{ partial class Form2 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null;

/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing)

Page 133: Hospital Management System Projectmm

P a g e | 133

{ if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }

#region Windows Form Designer generated code

/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.OP = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.iDDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.nAMEDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.aGEDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.sEXDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.aDDRESSDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.cOMMENTDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pHONEDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dATEDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.lASTDATEDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dOCTORDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dEPARTMENTDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.oPBindingSource = new System.Windows.Forms.BindingSource(this.components); this.hospitalDataSet = new WpfApplication2.HospitalDataSet(); this.oPBILLMASTERBindingSource = new System.Windows.Forms.BindingSource(this.components); this.hospitalDataSet1 = new WpfApplication2.HospitalDataSet1(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.dataGridView3 = new System.Windows.Forms.DataGridView(); this.ipnoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.consDateDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.nameDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ageDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();

Page 134: Hospital Management System Projectmm

P a g e | 134

this.sexDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.addressDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.phoneDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.refdrDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.complaintDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.roomOrWardnoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.departmentDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dateLastPaidDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ipBindingSource = new System.Windows.Forms.BindingSource(this.components); this.hospitalDataSet2 = new WpfApplication2.HospitalDataSet2(); this.tabPage4 = new System.Windows.Forms.TabPage(); this.dataGridView4 = new System.Windows.Forms.DataGridView(); this.testDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.chargeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.testBindingSource = new System.Windows.Forms.BindingSource(this.components); this.hospitalDataSet3 = new WpfApplication2.HospitalDataSet3(); this.tabPage5 = new System.Windows.Forms.TabPage(); this.dataGridView5 = new System.Windows.Forms.DataGridView(); this.iDDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.itemDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.quantityDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.rateDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pharmacyBindingSource = new System.Windows.Forms.BindingSource(this.components); this.hospitalDataSet4 = new WpfApplication2.HospitalDataSet4(); this.oPTableAdapter = new WpfApplication2.HospitalDataSetTableAdapters.OPTableAdapter(); this.oPBILLMASTERTableAdapter = new WpfApplication2.HospitalDataSet1TableAdapters.OPBILLMASTERTableAdapter(); this.ipTableAdapter = new WpfApplication2.HospitalDataSet2TableAdapters.IpTableAdapter(); this.testTableAdapter = new WpfApplication2.HospitalDataSet3TableAdapters.TestTableAdapter(); this.pharmacyTableAdapter = new WpfApplication2.HospitalDataSet4TableAdapters.PharmacyTableAdapter(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage6 = new System.Windows.Forms.TabPage(); this.dataGridView2 = new System.Windows.Forms.DataGridView(); this.hospitalDataSet5 = new WpfApplication2.HospitalDataSet5(); this.rOOMWARDBindingSource = new System.Windows.Forms.BindingSource(this.components);

Page 135: Hospital Management System Projectmm

P a g e | 135

this.rOOMWARDTableAdapter = new WpfApplication2.HospitalDataSet5TableAdapters.ROOMWARDTableAdapter(); this.roomNameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.noOfBedsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.rentDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.bedsFreeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.roomTypeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridView6 = new System.Windows.Forms.DataGridView(); this.hospitalDataSet6 = new WpfApplication2.HospitalDataSet6(); this.dOCTORSBindingSource = new System.Windows.Forms.BindingSource(this.components); this.dOCTORSTableAdapter = new WpfApplication2.HospitalDataSet6TableAdapters.DOCTORSTableAdapter(); this.iDNODataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.nAMEDataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pHONENUMBERDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dETAILSDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.cONSULTATIONFEEDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dEPARTMENTDataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.OP.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.oPBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.oPBILLMASTERBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet1)).BeginInit(); this.tabPage3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ipBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet2)).BeginInit(); this.tabPage4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.testBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet3)).BeginInit(); this.tabPage5.SuspendLayout();

Page 136: Hospital Management System Projectmm

P a g e | 136

((System.ComponentModel.ISupportInitialize)(this.dataGridView5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pharmacyBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet4)).BeginInit(); this.tabPage2.SuspendLayout(); this.tabPage6.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rOOMWARDBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dOCTORSBindingSource)).BeginInit(); this.SuspendLayout(); // // OP // this.OP.Controls.Add(this.tabPage1); this.OP.Controls.Add(this.tabPage3); this.OP.Controls.Add(this.tabPage4); this.OP.Controls.Add(this.tabPage5); this.OP.Controls.Add(this.tabPage2); this.OP.Controls.Add(this.tabPage6); this.OP.Location = new System.Drawing.Point(1, 0); this.OP.Name = "OP"; this.OP.SelectedIndex = 0; this.OP.Size = new System.Drawing.Size(1174, 526); this.OP.TabIndex = 0; // // tabPage1 // this.tabPage1.Controls.Add(this.dataGridView1); this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Size = new System.Drawing.Size(1166, 500); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "OP "; this.tabPage1.UseVisualStyleBackColor = true; // // dataGridView1 // this.dataGridView1.AutoGenerateColumns = false; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.iDDataGridViewTextBoxColumn, this.nAMEDataGridViewTextBoxColumn, this.aGEDataGridViewTextBoxColumn, this.sEXDataGridViewTextBoxColumn,

Page 137: Hospital Management System Projectmm

P a g e | 137

this.aDDRESSDataGridViewTextBoxColumn, this.cOMMENTDataGridViewTextBoxColumn, this.pHONEDataGridViewTextBoxColumn, this.dATEDataGridViewTextBoxColumn, this.lASTDATEDataGridViewTextBoxColumn, this.dOCTORDataGridViewTextBoxColumn, this.dEPARTMENTDataGridViewTextBoxColumn}); this.dataGridView1.DataSource = this.oPBindingSource; this.dataGridView1.Location = new System.Drawing.Point(7, 0); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Size = new System.Drawing.Size(1159, 491); this.dataGridView1.TabIndex = 0; // // iDDataGridViewTextBoxColumn // this.iDDataGridViewTextBoxColumn.DataPropertyName = "ID"; this.iDDataGridViewTextBoxColumn.HeaderText = "ID"; this.iDDataGridViewTextBoxColumn.Name = "iDDataGridViewTextBoxColumn"; this.iDDataGridViewTextBoxColumn.ReadOnly = true; // // nAMEDataGridViewTextBoxColumn // this.nAMEDataGridViewTextBoxColumn.DataPropertyName = "NAME"; this.nAMEDataGridViewTextBoxColumn.HeaderText = "NAME"; this.nAMEDataGridViewTextBoxColumn.Name = "nAMEDataGridViewTextBoxColumn"; // // aGEDataGridViewTextBoxColumn // this.aGEDataGridViewTextBoxColumn.DataPropertyName = "AGE"; this.aGEDataGridViewTextBoxColumn.HeaderText = "AGE"; this.aGEDataGridViewTextBoxColumn.Name = "aGEDataGridViewTextBoxColumn"; // // sEXDataGridViewTextBoxColumn // this.sEXDataGridViewTextBoxColumn.DataPropertyName = "SEX"; this.sEXDataGridViewTextBoxColumn.HeaderText = "SEX"; this.sEXDataGridViewTextBoxColumn.Name = "sEXDataGridViewTextBoxColumn"; // // aDDRESSDataGridViewTextBoxColumn // this.aDDRESSDataGridViewTextBoxColumn.DataPropertyName = "ADDRESS"; this.aDDRESSDataGridViewTextBoxColumn.HeaderText = "ADDRESS"; this.aDDRESSDataGridViewTextBoxColumn.Name = "aDDRESSDataGridViewTextBoxColumn"; // // cOMMENTDataGridViewTextBoxColumn // this.cOMMENTDataGridViewTextBoxColumn.DataPropertyName = "COMMENT"; this.cOMMENTDataGridViewTextBoxColumn.HeaderText = "COMMENT"; this.cOMMENTDataGridViewTextBoxColumn.Name = "cOMMENTDataGridViewTextBoxColumn"; // // pHONEDataGridViewTextBoxColumn //

Page 138: Hospital Management System Projectmm

P a g e | 138

this.pHONEDataGridViewTextBoxColumn.DataPropertyName = "PHONE"; this.pHONEDataGridViewTextBoxColumn.HeaderText = "PHONE"; this.pHONEDataGridViewTextBoxColumn.Name = "pHONEDataGridViewTextBoxColumn"; // // dATEDataGridViewTextBoxColumn // this.dATEDataGridViewTextBoxColumn.DataPropertyName = "DATE"; this.dATEDataGridViewTextBoxColumn.HeaderText = "DATE"; this.dATEDataGridViewTextBoxColumn.Name = "dATEDataGridViewTextBoxColumn"; // // lASTDATEDataGridViewTextBoxColumn // this.lASTDATEDataGridViewTextBoxColumn.DataPropertyName = "LAST_DATE"; this.lASTDATEDataGridViewTextBoxColumn.HeaderText = "LAST_DATE"; this.lASTDATEDataGridViewTextBoxColumn.Name = "lASTDATEDataGridViewTextBoxColumn"; // // dOCTORDataGridViewTextBoxColumn // this.dOCTORDataGridViewTextBoxColumn.DataPropertyName = "DOCTOR"; this.dOCTORDataGridViewTextBoxColumn.HeaderText = "DOCTOR"; this.dOCTORDataGridViewTextBoxColumn.Name = "dOCTORDataGridViewTextBoxColumn"; // // dEPARTMENTDataGridViewTextBoxColumn // this.dEPARTMENTDataGridViewTextBoxColumn.DataPropertyName = "DEPARTMENT"; this.dEPARTMENTDataGridViewTextBoxColumn.HeaderText = "DEPARTMENT"; this.dEPARTMENTDataGridViewTextBoxColumn.Name = "dEPARTMENTDataGridViewTextBoxColumn"; // // oPBindingSource // this.oPBindingSource.DataMember = "OP"; this.oPBindingSource.DataSource = this.hospitalDataSet; // // hospitalDataSet // this.hospitalDataSet.DataSetName = "HospitalDataSet"; this.hospitalDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // oPBILLMASTERBindingSource // this.oPBILLMASTERBindingSource.DataMember = "OPBILLMASTER"; this.oPBILLMASTERBindingSource.DataSource = this.hospitalDataSet1; // // hospitalDataSet1 // this.hospitalDataSet1.DataSetName = "HospitalDataSet1"; this.hospitalDataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // tabPage3

Page 139: Hospital Management System Projectmm

P a g e | 139

// this.tabPage3.Controls.Add(this.dataGridView3); this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Name = "tabPage3"; this.tabPage3.Padding = new System.Windows.Forms.Padding(3); this.tabPage3.Size = new System.Drawing.Size(1166, 500); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "IP"; this.tabPage3.UseVisualStyleBackColor = true; // // dataGridView3 // this.dataGridView3.AutoGenerateColumns = false; this.dataGridView3.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView3.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.ipnoDataGridViewTextBoxColumn, this.consDateDataGridViewTextBoxColumn, this.nameDataGridViewTextBoxColumn1, this.ageDataGridViewTextBoxColumn1, this.sexDataGridViewTextBoxColumn1, this.addressDataGridViewTextBoxColumn1, this.phoneDataGridViewTextBoxColumn1, this.refdrDataGridViewTextBoxColumn, this.complaintDataGridViewTextBoxColumn, this.roomOrWardnoDataGridViewTextBoxColumn, this.departmentDataGridViewTextBoxColumn1, this.dateLastPaidDataGridViewTextBoxColumn}); this.dataGridView3.DataSource = this.ipBindingSource; this.dataGridView3.Location = new System.Drawing.Point(3, 0); this.dataGridView3.Name = "dataGridView3"; this.dataGridView3.Size = new System.Drawing.Size(1119, 461); this.dataGridView3.TabIndex = 0; // // ipnoDataGridViewTextBoxColumn // this.ipnoDataGridViewTextBoxColumn.DataPropertyName = "Ipno"; this.ipnoDataGridViewTextBoxColumn.HeaderText = "Ipno"; this.ipnoDataGridViewTextBoxColumn.Name = "ipnoDataGridViewTextBoxColumn"; this.ipnoDataGridViewTextBoxColumn.ReadOnly = true; // // consDateDataGridViewTextBoxColumn // this.consDateDataGridViewTextBoxColumn.DataPropertyName = "ConsDate"; this.consDateDataGridViewTextBoxColumn.HeaderText = "ConsDate"; this.consDateDataGridViewTextBoxColumn.Name = "consDateDataGridViewTextBoxColumn"; // // nameDataGridViewTextBoxColumn1 // this.nameDataGridViewTextBoxColumn1.DataPropertyName = "Name"; this.nameDataGridViewTextBoxColumn1.HeaderText = "Name"; this.nameDataGridViewTextBoxColumn1.Name = "nameDataGridViewTextBoxColumn1"; // // ageDataGridViewTextBoxColumn1

Page 140: Hospital Management System Projectmm

P a g e | 140

// this.ageDataGridViewTextBoxColumn1.DataPropertyName = "Age"; this.ageDataGridViewTextBoxColumn1.HeaderText = "Age"; this.ageDataGridViewTextBoxColumn1.Name = "ageDataGridViewTextBoxColumn1"; // // sexDataGridViewTextBoxColumn1 // this.sexDataGridViewTextBoxColumn1.DataPropertyName = "Sex"; this.sexDataGridViewTextBoxColumn1.HeaderText = "Sex"; this.sexDataGridViewTextBoxColumn1.Name = "sexDataGridViewTextBoxColumn1"; // // addressDataGridViewTextBoxColumn1 // this.addressDataGridViewTextBoxColumn1.DataPropertyName = "Address"; this.addressDataGridViewTextBoxColumn1.HeaderText = "Address"; this.addressDataGridViewTextBoxColumn1.Name = "addressDataGridViewTextBoxColumn1"; // // phoneDataGridViewTextBoxColumn1 // this.phoneDataGridViewTextBoxColumn1.DataPropertyName = "Phone"; this.phoneDataGridViewTextBoxColumn1.HeaderText = "Phone"; this.phoneDataGridViewTextBoxColumn1.Name = "phoneDataGridViewTextBoxColumn1"; // // refdrDataGridViewTextBoxColumn // this.refdrDataGridViewTextBoxColumn.DataPropertyName = "Refdr"; this.refdrDataGridViewTextBoxColumn.HeaderText = "Refdr"; this.refdrDataGridViewTextBoxColumn.Name = "refdrDataGridViewTextBoxColumn"; // // complaintDataGridViewTextBoxColumn // this.complaintDataGridViewTextBoxColumn.DataPropertyName = "Complaint"; this.complaintDataGridViewTextBoxColumn.HeaderText = "Complaint"; this.complaintDataGridViewTextBoxColumn.Name = "complaintDataGridViewTextBoxColumn"; // // roomOrWardnoDataGridViewTextBoxColumn // this.roomOrWardnoDataGridViewTextBoxColumn.DataPropertyName = "RoomOrWardno"; this.roomOrWardnoDataGridViewTextBoxColumn.HeaderText = "RoomOrWardno"; this.roomOrWardnoDataGridViewTextBoxColumn.Name = "roomOrWardnoDataGridViewTextBoxColumn"; // // departmentDataGridViewTextBoxColumn1 // this.departmentDataGridViewTextBoxColumn1.DataPropertyName = "Department"; this.departmentDataGridViewTextBoxColumn1.HeaderText = "Department"; this.departmentDataGridViewTextBoxColumn1.Name = "departmentDataGridViewTextBoxColumn1";

Page 141: Hospital Management System Projectmm

P a g e | 141

// // dateLastPaidDataGridViewTextBoxColumn // this.dateLastPaidDataGridViewTextBoxColumn.DataPropertyName = "DateLastPaid"; this.dateLastPaidDataGridViewTextBoxColumn.HeaderText = "DateLastPaid"; this.dateLastPaidDataGridViewTextBoxColumn.Name = "dateLastPaidDataGridViewTextBoxColumn"; // // ipBindingSource // this.ipBindingSource.DataMember = "Ip"; this.ipBindingSource.DataSource = this.hospitalDataSet2; // // hospitalDataSet2 // this.hospitalDataSet2.DataSetName = "HospitalDataSet2"; this.hospitalDataSet2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // tabPage4 // this.tabPage4.Controls.Add(this.dataGridView4); this.tabPage4.Location = new System.Drawing.Point(4, 22); this.tabPage4.Name = "tabPage4"; this.tabPage4.Size = new System.Drawing.Size(1166, 500); this.tabPage4.TabIndex = 3; this.tabPage4.Text = "TEST"; this.tabPage4.UseVisualStyleBackColor = true; // // dataGridView4 // this.dataGridView4.AutoGenerateColumns = false; this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.testDataGridViewTextBoxColumn, this.chargeDataGridViewTextBoxColumn}); this.dataGridView4.DataSource = this.testBindingSource; this.dataGridView4.Location = new System.Drawing.Point(3, 3); this.dataGridView4.Name = "dataGridView4"; this.dataGridView4.Size = new System.Drawing.Size(247, 203); this.dataGridView4.TabIndex = 0; // // testDataGridViewTextBoxColumn // this.testDataGridViewTextBoxColumn.DataPropertyName = "Test"; this.testDataGridViewTextBoxColumn.HeaderText = "Test"; this.testDataGridViewTextBoxColumn.Name = "testDataGridViewTextBoxColumn"; // // chargeDataGridViewTextBoxColumn // this.chargeDataGridViewTextBoxColumn.DataPropertyName = "Charge"; this.chargeDataGridViewTextBoxColumn.HeaderText = "Charge";

Page 142: Hospital Management System Projectmm

P a g e | 142

this.chargeDataGridViewTextBoxColumn.Name = "chargeDataGridViewTextBoxColumn"; // // testBindingSource // this.testBindingSource.DataMember = "Test"; this.testBindingSource.DataSource = this.hospitalDataSet3; // // hospitalDataSet3 // this.hospitalDataSet3.DataSetName = "HospitalDataSet3"; this.hospitalDataSet3.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // tabPage5 // this.tabPage5.Controls.Add(this.dataGridView5); this.tabPage5.Location = new System.Drawing.Point(4, 22); this.tabPage5.Name = "tabPage5"; this.tabPage5.Padding = new System.Windows.Forms.Padding(3); this.tabPage5.Size = new System.Drawing.Size(1166, 500); this.tabPage5.TabIndex = 4; this.tabPage5.Text = "PHARMACY"; this.tabPage5.UseVisualStyleBackColor = true; // // dataGridView5 // this.dataGridView5.AutoGenerateColumns = false; this.dataGridView5.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView5.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.iDDataGridViewTextBoxColumn1, this.itemDataGridViewTextBoxColumn, this.quantityDataGridViewTextBoxColumn, this.rateDataGridViewTextBoxColumn}); this.dataGridView5.DataSource = this.pharmacyBindingSource; this.dataGridView5.Location = new System.Drawing.Point(-4, 0); this.dataGridView5.Name = "dataGridView5"; this.dataGridView5.Size = new System.Drawing.Size(444, 157); this.dataGridView5.TabIndex = 0; // // iDDataGridViewTextBoxColumn1 // this.iDDataGridViewTextBoxColumn1.DataPropertyName = "ID"; this.iDDataGridViewTextBoxColumn1.HeaderText = "ID"; this.iDDataGridViewTextBoxColumn1.Name = "iDDataGridViewTextBoxColumn1"; this.iDDataGridViewTextBoxColumn1.ReadOnly = true; // // itemDataGridViewTextBoxColumn // this.itemDataGridViewTextBoxColumn.DataPropertyName = "Item"; this.itemDataGridViewTextBoxColumn.HeaderText = "Item"; this.itemDataGridViewTextBoxColumn.Name = "itemDataGridViewTextBoxColumn"; // // quantityDataGridViewTextBoxColumn

Page 143: Hospital Management System Projectmm

P a g e | 143

// this.quantityDataGridViewTextBoxColumn.DataPropertyName = "Quantity"; this.quantityDataGridViewTextBoxColumn.HeaderText = "Quantity"; this.quantityDataGridViewTextBoxColumn.Name = "quantityDataGridViewTextBoxColumn"; // // rateDataGridViewTextBoxColumn // this.rateDataGridViewTextBoxColumn.DataPropertyName = "Rate"; this.rateDataGridViewTextBoxColumn.HeaderText = "Rate"; this.rateDataGridViewTextBoxColumn.Name = "rateDataGridViewTextBoxColumn"; // // pharmacyBindingSource // this.pharmacyBindingSource.DataMember = "Pharmacy"; this.pharmacyBindingSource.DataSource = this.hospitalDataSet4; // // hospitalDataSet4 // this.hospitalDataSet4.DataSetName = "HospitalDataSet4"; this.hospitalDataSet4.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // oPTableAdapter // this.oPTableAdapter.ClearBeforeFill = true; // // oPBILLMASTERTableAdapter // this.oPBILLMASTERTableAdapter.ClearBeforeFill = true; // // ipTableAdapter // this.ipTableAdapter.ClearBeforeFill = true; // // testTableAdapter // this.testTableAdapter.ClearBeforeFill = true; // // pharmacyTableAdapter // this.pharmacyTableAdapter.ClearBeforeFill = true; // // tabPage2 // this.tabPage2.Controls.Add(this.dataGridView2); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Size = new System.Drawing.Size(1166, 500); this.tabPage2.TabIndex = 5; this.tabPage2.Text = "ROOMWARD"; this.tabPage2.UseVisualStyleBackColor = true; // // tabPage6 // this.tabPage6.Controls.Add(this.dataGridView6);

Page 144: Hospital Management System Projectmm

P a g e | 144

this.tabPage6.Location = new System.Drawing.Point(4, 22); this.tabPage6.Name = "tabPage6"; this.tabPage6.Padding = new System.Windows.Forms.Padding(3); this.tabPage6.Size = new System.Drawing.Size(1166, 500); this.tabPage6.TabIndex = 6; this.tabPage6.Text = "DOCTORS"; this.tabPage6.UseVisualStyleBackColor = true; // // dataGridView2 // this.dataGridView2.AutoGenerateColumns = false; this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.roomNameDataGridViewTextBoxColumn, this.noOfBedsDataGridViewTextBoxColumn, this.rentDataGridViewTextBoxColumn, this.bedsFreeDataGridViewTextBoxColumn, this.roomTypeDataGridViewTextBoxColumn}); this.dataGridView2.DataSource = this.rOOMWARDBindingSource; this.dataGridView2.Location = new System.Drawing.Point(7, 3); this.dataGridView2.Name = "dataGridView2"; this.dataGridView2.Size = new System.Drawing.Size(551, 156); this.dataGridView2.TabIndex = 0; // // hospitalDataSet5 // this.hospitalDataSet5.DataSetName = "HospitalDataSet5"; this.hospitalDataSet5.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // rOOMWARDBindingSource // this.rOOMWARDBindingSource.DataMember = "ROOMWARD"; this.rOOMWARDBindingSource.DataSource = this.hospitalDataSet5; // // rOOMWARDTableAdapter // this.rOOMWARDTableAdapter.ClearBeforeFill = true; // // roomNameDataGridViewTextBoxColumn // this.roomNameDataGridViewTextBoxColumn.DataPropertyName = "RoomName"; this.roomNameDataGridViewTextBoxColumn.HeaderText = "RoomName"; this.roomNameDataGridViewTextBoxColumn.Name = "roomNameDataGridViewTextBoxColumn"; // // noOfBedsDataGridViewTextBoxColumn // this.noOfBedsDataGridViewTextBoxColumn.DataPropertyName = "NoOfBeds"; this.noOfBedsDataGridViewTextBoxColumn.HeaderText = "NoOfBeds"; this.noOfBedsDataGridViewTextBoxColumn.Name = "noOfBedsDataGridViewTextBoxColumn"; // // rentDataGridViewTextBoxColumn // this.rentDataGridViewTextBoxColumn.DataPropertyName = "Rent";

Page 145: Hospital Management System Projectmm

P a g e | 145

this.rentDataGridViewTextBoxColumn.HeaderText = "Rent"; this.rentDataGridViewTextBoxColumn.Name = "rentDataGridViewTextBoxColumn"; // // bedsFreeDataGridViewTextBoxColumn // this.bedsFreeDataGridViewTextBoxColumn.DataPropertyName = "BedsFree"; this.bedsFreeDataGridViewTextBoxColumn.HeaderText = "BedsFree"; this.bedsFreeDataGridViewTextBoxColumn.Name = "bedsFreeDataGridViewTextBoxColumn"; // // roomTypeDataGridViewTextBoxColumn // this.roomTypeDataGridViewTextBoxColumn.DataPropertyName = "RoomType"; this.roomTypeDataGridViewTextBoxColumn.HeaderText = "RoomType"; this.roomTypeDataGridViewTextBoxColumn.Name = "roomTypeDataGridViewTextBoxColumn"; // // dataGridView6 // this.dataGridView6.AutoGenerateColumns = false; this.dataGridView6.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView6.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.iDNODataGridViewTextBoxColumn, this.nAMEDataGridViewTextBoxColumn2, this.pHONENUMBERDataGridViewTextBoxColumn, this.dETAILSDataGridViewTextBoxColumn, this.cONSULTATIONFEEDataGridViewTextBoxColumn, this.dEPARTMENTDataGridViewTextBoxColumn2}); this.dataGridView6.DataSource = this.dOCTORSBindingSource; this.dataGridView6.Location = new System.Drawing.Point(7, 3); this.dataGridView6.Name = "dataGridView6"; this.dataGridView6.Size = new System.Drawing.Size(642, 150); this.dataGridView6.TabIndex = 0; // // hospitalDataSet6 // this.hospitalDataSet6.DataSetName = "HospitalDataSet6"; this.hospitalDataSet6.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // dOCTORSBindingSource // this.dOCTORSBindingSource.DataMember = "DOCTORS"; this.dOCTORSBindingSource.DataSource = this.hospitalDataSet6; // // dOCTORSTableAdapter // this.dOCTORSTableAdapter.ClearBeforeFill = true; // // iDNODataGridViewTextBoxColumn // this.iDNODataGridViewTextBoxColumn.DataPropertyName = "IDNO"; this.iDNODataGridViewTextBoxColumn.HeaderText = "IDNO"; this.iDNODataGridViewTextBoxColumn.Name = "iDNODataGridViewTextBoxColumn";

Page 146: Hospital Management System Projectmm

P a g e | 146

this.iDNODataGridViewTextBoxColumn.ReadOnly = true; // // nAMEDataGridViewTextBoxColumn2 // this.nAMEDataGridViewTextBoxColumn2.DataPropertyName = "NAME"; this.nAMEDataGridViewTextBoxColumn2.HeaderText = "NAME"; this.nAMEDataGridViewTextBoxColumn2.Name = "nAMEDataGridViewTextBoxColumn2"; // // pHONENUMBERDataGridViewTextBoxColumn // this.pHONENUMBERDataGridViewTextBoxColumn.DataPropertyName = "PHONE_NUMBER"; this.pHONENUMBERDataGridViewTextBoxColumn.HeaderText = "PHONE_NUMBER"; this.pHONENUMBERDataGridViewTextBoxColumn.Name = "pHONENUMBERDataGridViewTextBoxColumn"; // // dETAILSDataGridViewTextBoxColumn // this.dETAILSDataGridViewTextBoxColumn.DataPropertyName = "DETAILS"; this.dETAILSDataGridViewTextBoxColumn.HeaderText = "DETAILS"; this.dETAILSDataGridViewTextBoxColumn.Name = "dETAILSDataGridViewTextBoxColumn"; // // cONSULTATIONFEEDataGridViewTextBoxColumn // this.cONSULTATIONFEEDataGridViewTextBoxColumn.DataPropertyName = "CONSULTATION_FEE"; this.cONSULTATIONFEEDataGridViewTextBoxColumn.HeaderText = "CONSULTATION_FEE"; this.cONSULTATIONFEEDataGridViewTextBoxColumn.Name = "cONSULTATIONFEEDataGridViewTextBoxColumn"; // // dEPARTMENTDataGridViewTextBoxColumn2 // this.dEPARTMENTDataGridViewTextBoxColumn2.DataPropertyName = "DEPARTMENT"; this.dEPARTMENTDataGridViewTextBoxColumn2.HeaderText = "DEPARTMENT"; this.dEPARTMENTDataGridViewTextBoxColumn2.Name = "dEPARTMENTDataGridViewTextBoxColumn2"; // // Form2 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1175, 525); this.Controls.Add(this.OP); this.Name = "Form2"; this.Text = "Form2"; this.Load += new System.EventHandler(this.Form2_Load); this.OP.ResumeLayout(false); this.tabPage1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.oPBindingSource)).EndInit();

Page 147: Hospital Management System Projectmm

P a g e | 147

((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.oPBILLMASTERBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet1)).EndInit(); this.tabPage3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ipBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet2)).EndInit(); this.tabPage4.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.testBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet3)).EndInit(); this.tabPage5.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pharmacyBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet4)).EndInit(); this.tabPage2.ResumeLayout(false); this.tabPage6.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rOOMWARDBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.hospitalDataSet6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dOCTORSBindingSource)).EndInit(); this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.TabControl OP; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage3; private System.Windows.Forms.DataGridView dataGridView1; private System.Windows.Forms.TabPage tabPage4; private System.Windows.Forms.TabPage tabPage5; private HospitalDataSet hospitalDataSet; private System.Windows.Forms.BindingSource oPBindingSource; private HospitalDataSetTableAdapters.OPTableAdapter oPTableAdapter; private System.Windows.Forms.DataGridViewTextBoxColumn iDDataGridViewTextBoxColumn;

Page 148: Hospital Management System Projectmm

P a g e | 148

private System.Windows.Forms.DataGridViewTextBoxColumn nAMEDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn aGEDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn sEXDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn aDDRESSDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn cOMMENTDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn pHONEDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn dATEDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn lASTDATEDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn dOCTORDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn dEPARTMENTDataGridViewTextBoxColumn; private HospitalDataSet1 hospitalDataSet1; private System.Windows.Forms.BindingSource oPBILLMASTERBindingSource; private HospitalDataSet1TableAdapters.OPBILLMASTERTableAdapter oPBILLMASTERTableAdapter; private System.Windows.Forms.DataGridView dataGridView3; private HospitalDataSet2 hospitalDataSet2; private System.Windows.Forms.BindingSource ipBindingSource; private HospitalDataSet2TableAdapters.IpTableAdapter ipTableAdapter; private System.Windows.Forms.DataGridViewTextBoxColumn ipnoDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn consDateDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn ageDataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn sexDataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn addressDataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn phoneDataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn refdrDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn complaintDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn roomOrWardnoDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn departmentDataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn dateLastPaidDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridView dataGridView4; private HospitalDataSet3 hospitalDataSet3; private System.Windows.Forms.BindingSource testBindingSource; private HospitalDataSet3TableAdapters.TestTableAdapter testTableAdapter; private System.Windows.Forms.DataGridViewTextBoxColumn testDataGridViewTextBoxColumn;

Page 149: Hospital Management System Projectmm

P a g e | 149

private System.Windows.Forms.DataGridViewTextBoxColumn chargeDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridView dataGridView5; private HospitalDataSet4 hospitalDataSet4; private System.Windows.Forms.BindingSource pharmacyBindingSource; private HospitalDataSet4TableAdapters.PharmacyTableAdapter pharmacyTableAdapter; private System.Windows.Forms.DataGridViewTextBoxColumn iDDataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn itemDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn quantityDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn rateDataGridViewTextBoxColumn; private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.TabPage tabPage6; private System.Windows.Forms.DataGridView dataGridView2; private HospitalDataSet5 hospitalDataSet5; private System.Windows.Forms.BindingSource rOOMWARDBindingSource; private HospitalDataSet5TableAdapters.ROOMWARDTableAdapter rOOMWARDTableAdapter; private System.Windows.Forms.DataGridViewTextBoxColumn roomNameDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn noOfBedsDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn rentDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn bedsFreeDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn roomTypeDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridView dataGridView6; private HospitalDataSet6 hospitalDataSet6; private System.Windows.Forms.BindingSource dOCTORSBindingSource; private HospitalDataSet6TableAdapters.DOCTORSTableAdapter dOCTORSTableAdapter; private System.Windows.Forms.DataGridViewTextBoxColumn iDNODataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn nAMEDataGridViewTextBoxColumn2; private System.Windows.Forms.DataGridViewTextBoxColumn pHONENUMBERDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn dETAILSDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn cONSULTATIONFEEDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn dEPARTMENTDataGridViewTextBoxColumn2; }}

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;

Page 150: Hospital Management System Projectmm

P a g e | 150

using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;using System.Data;using System.Data.SqlClient;

namespace WpfApplication2{ /// <summary> /// Interaction logic for WindowPharmacy.xaml /// </summary> public partial class WindowPharmacy : Window { public WindowPharmacy() { InitializeComponent(); } DataTable dt = new DataTable();

void MakeDataTable(DataTable DT) { DT.Columns.Add("Item"); DT.Columns.Add("Quantity"); } private void Window_Loaded(object sender, RoutedEventArgs e) { WpfApplication2._D__DB_HOSPITAL_MDFDataSet1 _D__DB_HOSPITAL_MDFDataSet1 = ((WpfApplication2._D__DB_HOSPITAL_MDFDataSet1)(this.FindResource("_D__DB_HOSPITAL_MDFDataSet1"))); // Load data into the table Ip. You can modify this code as needed. WpfApplication2._D__DB_HOSPITAL_MDFDataSet1TableAdapters.IpTableAdapter _D__DB_HOSPITAL_MDFDataSet1IpTableAdapter = new WpfApplication2._D__DB_HOSPITAL_MDFDataSet1TableAdapters.IpTableAdapter(); _D__DB_HOSPITAL_MDFDataSet1IpTableAdapter.Fill(_D__DB_HOSPITAL_MDFDataSet1.Ip); System.Windows.Data.CollectionViewSource ipViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("ipViewSource"))); ipViewSource.View.MoveCurrentToFirst(); WpfApplication2._D__DB_HOSPITAL_MDFDataSet2 _D__DB_HOSPITAL_MDFDataSet2 = ((WpfApplication2._D__DB_HOSPITAL_MDFDataSet2)(this.FindResource("_D__DB_HOSPITAL_MDFDataSet2"))); // Load data into the table Pharmacy. You can modify this code as needed. WpfApplication2._D__DB_HOSPITAL_MDFDataSet2TableAdapters.PharmacyTableAdapter _D__DB_HOSPITAL_MDFDataSet2PharmacyTableAdapter = new WpfApplication2._D__DB_HOSPITAL_MDFDataSet2TableAdapters.PharmacyTableAdapter(); _D__DB_HOSPITAL_MDFDataSet2PharmacyTableAdapter.Fill(_D__DB_HOSPITAL_MDFDataSet2.Pharmacy);

Page 151: Hospital Management System Projectmm

P a g e | 151

System.Windows.Data.CollectionViewSource pharmacyViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("pharmacyViewSource"))); pharmacyViewSource.View.MoveCurrentToFirst(); MakeDataTable(dt); GridView1.DataSource = dt; GridView1.Refresh(); }

private void buttonAddToIP_Click(object sender, RoutedEventArgs e) {

}

private void buttonAdd_Click_1(object sender, RoutedEventArgs e) { if(comboBoxItems.SelectedIndex!=-1) { DataRow dr = dt.NewRow(); dr[0] = comboBoxItems.Text; dr[1] = 0.00; dt.Rows.Add(dr); } GridView1.DataSource = dt; GridView1.Refresh(); }

private void buttonAddToIP_Click_1(object sender, RoutedEventArgs e) { ClassPharmacyManger ph = new ClassPharmacyManger(); SqlDataAdapter ad; DataTable tmpDt=new DataTable(); int qty = 0; decimal rate=0; decimal amount=0; if (comboBox1.SelectedIndex != -1) { if (GridView1.Rows.Count > 0) { for (int i = 0; i < GridView1.Rows.Count-1; i++) { if (ph.GetSelectedQuantity(GridView1[0, i].Value.ToString()) > Convert.ToInt32(GridView1[1, i].Value)) { qty = Convert.ToInt32(GridView1[1, i].Value); ad = new SqlDataAdapter("SELECT rate FROM pharmacy WHERE item='" + GridView1[0, i].Value.ToString() + "'", ClassDbManager.con); tmpDt.Clear(); ad.Fill(tmpDt); amount = Convert.ToDecimal(tmpDt.Rows[0]["rate"]) * qty; } } } //update dto due if (amount > 0) {

Page 152: Hospital Management System Projectmm

P a g e | 152

SqlCommand com = new SqlCommand("UPDATE IPBILLITEM SET DUE=due+" + amount + " WHERE IPNO=" + comboBox1.Text, ClassDbManager.con); if (com.ExecuteNonQuery() > 0) { MessageBox.Show("Amount added to due", "Success"); } else { MessageBox.Show("Cannot update entry"); } } else { MessageBox.Show("Nothing to save"); }

} }

}}

using System;using System.Collections.Generic;using System.Data.SqlClient;using System.Data;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;

namespace WpfApplication2{ /// <summary> /// Interaction logic for WindowLogin.xaml /// </summary> public partial class WindowLogin : Window { public WindowLogin() { InitializeComponent(); }

bool DetectedUser = false;

private void buttonLogin_Click(object sender, RoutedEventArgs e) { ClassDbManager db = new ClassDbManager(global::WpfApplication2.Properties.Settings.Default.ConnectionString);

Page 153: Hospital Management System Projectmm

P a g e | 153

if (!db.OpenDB()) MessageBox.Show("Cannot Connect to Database", "Error", MessageBoxButton.OK, MessageBoxImage.Error); SqlCommand com = new SqlCommand(); com.Connection = ClassDbManager.con; com.CommandText = "SELECT isadmin FROM users WHERE username='" + textBox1.Text + "' AND password='" + passwordBox1.Password + "'"; SqlDataAdapter ad = new SqlDataAdapter(); DataTable dt = new DataTable(); ad.SelectCommand = com; ad.Fill(dt);

if (dt.Rows.Count > 0) { DetectedUser = true; if (dt.Rows[0][0].ToString().Trim().ToLower() == "false") { Window1 wnd = new Window1(Convert.ToBoolean(dt.Rows[0][0].ToString().Trim().ToLower())); label2.IsEnabled = false; wnd.Show(); this.Close(); } else { Window1 wnd = new Window1(Convert.ToBoolean(dt.Rows[0][0].ToString().Trim().ToLower())); label2.IsEnabled = false; wnd.Show(); this.Close(); } } else { MessageBox.Show("Invalid user name or password","Login failed",MessageBoxButton.OK,MessageBoxImage.Exclamation); } }

private void buttonCancel_Click(object sender, RoutedEventArgs e) { Environment.Exit(0); }

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (!DetectedUser) Environment.Exit(0); }

private void Window_Loaded(object sender, RoutedEventArgs e) {

} }}

Page 154: Hospital Management System Projectmm

P a g e | 154

11. SCREEN SHOTS

Page 155: Hospital Management System Projectmm

P a g e | 155

Page 156: Hospital Management System Projectmm

P a g e | 156

Page 157: Hospital Management System Projectmm

P a g e | 157

Page 158: Hospital Management System Projectmm

P a g e | 158

Page 159: Hospital Management System Projectmm

P a g e | 159

Page 160: Hospital Management System Projectmm

P a g e | 160

Page 161: Hospital Management System Projectmm

P a g e | 161

Page 162: Hospital Management System Projectmm

P a g e | 162

Page 163: Hospital Management System Projectmm

P a g e | 163

Page 164: Hospital Management System Projectmm

P a g e | 164

Page 165: Hospital Management System Projectmm

P a g e | 165

Page 166: Hospital Management System Projectmm

P a g e | 166