Вы находитесь на странице: 1из 158

P age |1

1. ORGANISATIONAL OVERVIEW
SP FORT HOSPITAL SP FORT hospital is owned by a large business family. It was established on 26 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:
th

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.

P age |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 doctors 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.

P age |3

Billing

Only when a patient is discharge from a hospital a bill is prepared. It includes room rent, doctors 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 patients 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

P age |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.

P age |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 core Hard disk : 20 GB Ram : 1GB Cd drive : 52x Input device: keyboard, mouse & web camera

2.3.2. SOFTWARE REQUIREMENTS Operating system : windows7 Backend : MicrosoftSQL server 2005 Front end : c#.net Design 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,

P age |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

P age |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.

P age |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

P age |9

 Op registration sub modules The function of this module of registration of new patient in the op .The registration form with patients 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 y y 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

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 information To display the test details. Test name and cost of the test are included. Op information To display op information Ip information To 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

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.

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 user name password IsAdmin data type nvarchar(50) nvarchar(30) nvarchar(10) constraints primary key

P a g e | 13

IPpayment column name


Ipno Billdate Due paid closed

data type
Char(10) datetime Decimal(10,2) Decimal(10,2) Varchar(10)

constraints Foreign key

RoomWard column name Room name NoOfBeds Rent BedsFree RoomType data type varchar(50) varchar(50) decimal(10,2) int varchar(10)
constraints

Primary key

Test column name Test charge DEPARTMENT column name


DEPARTMENT

data type varchar(50) float

constraints

data type
Varchar(200)

constraints

op Column name Op no Name Age Sex Address Phone Data type varchar(10) varchar(300) int varchar(2) varchar(500) varchar(300)
constraints

Primary key

P a g e | 14

Refdr Date Last date comments DEPARTMENT

varchar(300) varchar(50) varchar(50) varchar(max) varchar(200)

DrDetails
Column name Id no Name Phone_no Details Consultation_fee department Data type Int varchar(300) varchar(50) varchar(max) Float varchar(200) constraints primary key

Pharmacy column name


ID Item Quantity Rate

data type
int varchar(50) int Decimal(10,2)

constraints primary key

OTHER column name


HOSPITALNAME OpExpiryDays

data type
varchar(200) int

constraints

IP Column name IP no Cons_date Name Age Sex Data type Char(10) varchar(50) varchar(50) Int char(2)
constraints

Primary key

P a g e | 15

Address Phone Refdr Complaint Wardtype Roomorwardno Department Date of last paid

varchar(300) varchar(30) varchar(300) varchar(500) varchar(50) char(10) varchar(100) date

3.5 RELATIONSHIP BETWEEN TABLES


opco sultatio

op

no

op

op n o

IP

ip o
ip o IP

I Ppayme t

Test

P armacy

ip o

P a g e | 16

3.6DATA 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 Constr cting DFD F nction 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

P a g e | 17

Data Store Symbol

Data Flow 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

O t

t 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.

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.

administrator

us er

Hos pital Management system 2.0 0.0

LEVEL 1 DFD

user administrator

login 0.1

user

display

P a g e | 19

admi is trat r

setti s . ar ac

admi is trat r

i car .

is la

   

est

r etails

P a g e | 20

P a g e | 21

s ltati

e t

est ser i f . ar ac

r etails

e rt

 
ar

$ & % $#" ! 

' 

is la

P a g e | 22

i p no
user test 0.7

.
I

harmacy I add to ip 0.8.1 I

i p no.
user pharmacy 0.8

ayment

display

((

((

add to ip 0.7.1

ayment

display

Test

P a g e | 23

ser

c atti

3.8 STRUCTURE CHART

HMS

USER LOGIN

ADMIN LOGIN

OP

IP

INFO

TEST

PHARMA CY

VIDEO
C O NFEREN C IN G

SETTING S

A@

87 63 23 05 04312 10)
VI I .
ID CARD CREATIO N

P a g e | 24

3.9 MENU TREE


V R U Y QV
I MI

R E I TR TI N

N U T TI N I MENT

I N

IN

ETTIN RM TE T IN TE T

RM

I R R E TI N

N EREN IN

F C

I E

SR Q Q R X U W V QV UU Q R T

I T R IN R R M IN

P H I H G I G E DC

P a g e | 25

4. PROCESSING ENVIORNMENT
4.1 Hardware S ecification Processor RAM Hard disk Intel Dual Core 1GB 40 GB

Input Keyboard,mouse&web camera 4.2 Software S ecification Operating system Language used Front end Back end windows 7 English C#.net 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

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 softs.net. Its an implementation for common language infra-structure(CLI) CLR runs a form of byte code.

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 namespaceshave received lot of attention. WPF Windows Presentation Foundation (WPF) is the code-name of the presentation (userinterfaces) 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

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

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 analysts 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 cant 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 dont 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.

P a g e | 30

Unit testing User Acce tance 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 Acce tance 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.

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.

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 added 2. Pharmacy is described simply we could add specific details about pharmacy and test 3. 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.

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: Corrective Corrective maintenance of a software product becomes necessary to rectify the bugs observed while the system is in use. Ada tive 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. Perfective A 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.

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.2Bibliogra hy
BOOKS

Fundamentals of Software Engineering ByRajib Mall Software Engineering By K.L James

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

9.3. Gantt chart Gantt 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.

P a g e | 35

NOV 15

DEC 1

DEC 25

JAN 11

JAN 31

March 10

S ecifications

Design database art

Design GUI art art Design database

Code database art

Code GUI database art Design art Integration and test

Designatabs

Write user manual art

9.4Meeting Minutes

Date Time Location Present

: November 15 to November 30 : 10:00 am :neyyattin kara :AKHIL S.V AKHIL GOPAL DEEPU

P a g e | 36 SACHIN vijeesh

Progress Re ort
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 Time Location Present

: December 1 to December 25 : 11:00 am :neyyattin kara :AKHIL S.V AKHIL GOPAL DEEPU SACHIN vijeesh

Progress Re ort
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

P a g e | 37

Time Location
Present

: 10:00 am :neyyattin kara


:AKHIL S.V AKHIL GOPAL DEEPU

SACHIN

VIJEESH

Progress Re ort

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 Time Location


Present

: February 1 to March 10 : 10:00 am :neyyattin kara


:AKHIL S.V AKHIL GOPAL DEEPU

SACHIN VIJEESH

P a g e | 38

Progress Re ort

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.

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); } }

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 {

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())); } dtDoctors.Clear();

P a g e | 42
} } 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; OnPropertyChanged(name); }

P a g e | 43
} 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 { doctor = value;

P a g e | 44
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())); } } }

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 connection publicbool OpenDB() { if (ConString != "") { try { con = new SqlConnection(ConString); con.Open(); returntrue; } catch { MessageBox.Show("Cannot open DB\nSource:Class DBManger.openDB(string)"); returnfalse; } } else returnfalse; } //function for checking if entry exits publicbool EntryExists(string query) { DataSet ds = new DataSet(); SqlDataAdapter ad = new SqlDataAdapter(); SqlCommand com = new SqlCommand(); com.Connection = ClassDbManager.con; com.CommandText = query; ad.SelectCommand = com; if (query != null)

P a g e | 46
{ try { if (ad.Fill(ds) > 0) { return (true); } else { return (false); } } catch { return (false); } } else returnfalse; } //function for inserting values publicint 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] + "',"; } query += tempQuery.Remove(tempQuery.Length - 1) + ")"; com.CommandText = query;

P a g e | 47
} 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 ID publicstring 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; public ResultEventArgs(bool ErrorOccured, string Error) { this.errorOccured = ErrorOccured;

P a g e | 48
this.message = Error; } publicstring Message { get { return message; } } publicbool ErrorOccured { get { return errorOccured; } } } } using using using using System; System.Collections.Generic; System.IO; 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(); } sw = File.AppendText(_path); //Time sw.WriteLine(""); sw.WriteLine("[" + DateTime.Now.ToString() + "]\n");

P a g e | 49

//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; } }

} }

P a g e | 50
using using using using using System; System.Collections.Generic; System.Data; System.Data.SqlClient; 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; } } publicint GetSelectedQuantity(string item) {

P a g e | 51
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; using System.Collections.Generic; using System.Linq; using System.Text;

P a g e | 52
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 { get { returnstring.Empty; } } }

P a g e | 53

} 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 data string[] 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 returnfalse; } else { returnfalse;

P a g e | 54
} } 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; else returnfalse; } 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) { ClassRoomWardManagement ward = new ClassRoomWardManagement(); //for (int i = 0; i < 30; i++) //{ // if (ward.AddNewRoom("ward" + i.ToString(), 10, 50, false)) ; // // MessageBox.Show("added");

P a g e | 55
//} 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; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // Form1

P a g e | 56
// 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) { } privatevoid buttonOK_Click(object sender, EventArgs e) { // Bitmap bmp; // if(imgSource!="")

P a g e | 57
// { // bmp = new Bitmap(imgSource); // } // WindowIDShow id = new WindowIDShow(textBoxCName.Text, textBoxName.Text, textBoxID.Text,comboBoxBGroup.Text,bmp); // id.Show(); //} using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Linq; System.Text; 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 using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Data.SqlClient; System.Text; System.Windows.Forms;

namespace WpfApplication2 { publicpartialclassFormOPCard : Form { int ID = 0; public FormOPCard(int ID) { this.ID = ID; InitializeComponent(); }

P a g e | 58
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 using using using using using using using using using using using using using using System; System.Collections.Generic; System.Linq; System.Text; System.Windows; System.Windows.Controls; System.Windows.Data; System.Windows.Documents; System.Windows.Input; System.Windows.Media; System.Windows.Media.Imaging; System.Windows.Navigation; System.Windows.Shapes; System.Data.SqlClient; System.Data;

namespace WpfApplication2 { ///<summary> /// Interaction logic for UserControlIP.xaml ///</summary> publicpartialclassUserControlIP : UserControl { public UserControlIP() { InitializeComponent(); } publicevent ResultEventHandler Result; protectedvirtualvoid OnResult(ResultEventArgs e) { ResultEventHandler handler = Result; if (handler != null) { handler(this, e); }

P a g e | 59
}

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 = ""; #endregion returntrue; } 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; } } else { textBoxComment_LostFocus(newobject(), new RoutedEventArgs());

P a g e | 60
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) { //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();

P a g e | 61
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) { textBoxComment.Style = (Style)this.Resources["textBoxInError"]; textBoxComment.ToolTip = "Comment Cannot be empty"; } else { textBoxComment.Style = (Style)TextBox.StyleProperty.DefaultMetadata.DefaultValue;

P a g e | 62
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) { foreach (Patient item in listBoxOPNumber.Items) { if (textBoxSearch.Text.ToUpper() == item.ToString().ToUpper()) { listBoxOPNumber.SelectedItem = item; break; }

P a g e | 63
} } 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; 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;

P a g e | 64
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); 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;

P a g e | 65
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 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!"; } } elseif (selectedButton == SelectedButton.IP) { userControlIP1.SubmitValues(); } } privatevoid 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);

P a g e | 66
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; } privatevoid tabButtonOPCons_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { selectedButton = SelectedButton.Consultation; tabButtonOPCons.IsSelected = true; tabButtonOP.IsSelected = false; tabButtonIP.IsSelected = false; buttonIPBill.Visibility = Visibility.Hidden;

P a g e | 67
// expander1.Visibility = Visibility.Hidden; OPCons.Visibility = Visibility.Visible; OPReg.Visibility = Visibility.Hidden; userControlIP1.Visibility = Visibility.Hidden; expander1.Visibility = Visibility.Visible; } #endregion privatevoid 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 { 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();

P a g e | 68
} 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 { 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; } }

P a g e | 69

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 using using using using using using using using using using using

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

namespace WpfApplication2 { ///<summary> /// Interaction logic for WindowAddRoom.xaml ///</summary> publicpartialclassWindowAddRoom : Window { public WindowAddRoom() { InitializeComponent(); } publicstructretVal { publicstring name; publicint NoOfWards; publicdecimal Rent; } public retVal val = new retVal(); privatevoid buttonAdd_Click(object sender, RoutedEventArgs e) { try { if (textBoxName.Text != "")

P a g e | 70
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() { InitializeComponent(); } privatevoid buttonCancel_Click(object sender, RoutedEventArgs e) { this.Close(); } publicstructretVal

P a g e | 71
{ publicstring name ; publicint NoOfWards ; publicdecimal Rent ; } public retVal val = new retVal(); privatevoid buttonAdd_Click(object sender, RoutedEventArgs e) { if (textBoxName.Text != "") val.name = textBoxName.Te 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 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; 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);

P a g e | 72
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; GridView1.Refresh(); } privatevoid buttonSave_Click(object sender, RoutedEventArgs e) { if (textBoxPaid.Text != null&& textBoxPaid.Text != "") { if (comboBox1.SelectedIndex != -1) {

P a g e | 73
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() + "," + 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

P a g e | 74
{ 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); } 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;

P a g e | 75
using using using using using System.Windows.Documents; System.Windows.Input; System.Windows.Media; System.Windows.Media.Imaging; 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 using using using using using using using using using using using System; System.Collections.Generic; System.Linq; System.Text; System.Windows; System.Windows.Controls; System.Windows.Data; System.Windows.Documents; System.Windows.Input; System.Windows.Media; System.Windows.Media.Imaging; System.Windows.Shapes;

namespace WpfApplication2 { ///<summary> /// Interaction logic for WindowIDShow.xaml ///</summary> publicpartialclassWindowIDShow : Window { 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;

P a g e | 76
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"; } 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);

P a g e | 77
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)) { 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) {

P a g e | 78
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.T ext)) { 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 { 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)

P a g e | 79
{ 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 { 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();

P a g e | 80
if (ph.UpdateQuantity(((DataRowView)(listBoxPharmItems.SelectedItem)).Row.ItemArray[0].ToStr ing(), 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())).To String(); } catch { } } } } using System; using System.Collections.Generic; using System.Linq;

P a g e | 81
using using using using using using using using using System.Text; System.Windows; System.Windows.Controls; System.Windows.Data; System.Windows.Documents; System.Windows.Input; System.Windows.Media; System.Windows.Media.Imaging; 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 using using using using using using using using using using using using using System; System.Collections.Generic; System.Linq; System.Text; System.Windows; System.Windows.Controls; System.Windows.Data; System.Windows.Documents; System.Windows.Input; System.Windows.Media; System.Windows.Media.Imaging; System.Windows.Shapes; System.Data; System.Data.SqlClient;

namespace WpfApplication2 { ///<summary> /// Interaction logic for WindowPharmacy.xaml ///</summary> publicpartialclassWindowPharmacy : Window

P a g e | 82
{ 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_MDFData Set1"))); // 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_MDFData Set2"))); // 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(); } 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;

P a g e | 83
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 due if (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"); } } else { MessageBox.Show("Nothing to save"); } } } } } using System; using System.Collections.Generic;

P a g e | 84
using using using using using using using using using using using using System.Linq; System.Text; System.Windows; System.Windows.Controls; System.Windows.Data; System.Windows.Documents; System.Windows.Input; System.Windows.Media; System.Windows.Media.Imaging; System.Windows.Shapes; System.Data; 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_MDFDataS et"))); // 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(); System.Windows.Data.CollectionViewSource classOPBillDataClassViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("classOPBillDataClassViewSo urce"))); // 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_MDFData Set1"))); // 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(); }

P a g e | 85

privatevoid buttonAdd_Click(object sender, RoutedEventArgs e) { //add to due if(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(); } } using using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Data.SqlClient; System.Text; System.Windows.Forms; System.IO;

namespace WpfApplication2 { publicpartialclassFormID : Form { public FormID() { InitializeComponent(); }

P a g e | 86
string imgSource = ""; privatevoid button1_Click(object sender, EventArgs e) { } privatevoid label2_Click(object sender, EventArgs e) { } privatevoid 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 = newMemoryStream(); 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(); a.Show(); } catch(Exception w) { MessageBox.Show(w.Message); } } privatevoid 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"); } }

P a g e | 87
} privatevoid FormID_Load(object sender, EventArgs e) { comboBoxBGroup.SelectedIndex = 0; } } }

using using using using using using using using using using using using using using

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

namespace WpfApplication2 { ///<summary> /// Interaction logic for Window1.xaml ///</summary> /// publicpartialclassWindow1 : Window { Thickness thick = new Thickness(2, 40, 2, 2); bool IsAdmin = false; public Window1(bool isadmin) { IsAdmin = isadmin; 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();

P a g e | 88
} } protectedoverridevoid OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); GlassHelper.ExtendGlass(this, thick); } #endregion privatevoid 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; } privatevoid buttonSave_Click(object sender, RoutedEventArgs e) { if (selectedButton == SelectedButton.OP) { OPReg.SubmitValues(); } elseif (selectedButton == SelectedButton.Consultation) { //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;

P a g e | 89
StatusLabel.Content = "No OP Selected!"; } } elseif (selectedButton == SelectedButton.IP) { userControlIP1.SubmitValues(); } } privatevoid 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; } } 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;

P a g e | 90
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; } 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; } #endregion privatevoid 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(); }

P a g e | 91

privatevoid 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; } } privatevoid buttonIPBill_Click(object sender, RoutedEventArgs e) { WindowBill bill = new WindowBill(); bill.ShowDialog(); } privatevoid label2_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (IsAdmin) { WindowMaster master = new WindowMaster(); master.ShowDialog(); } else { MessageBox.Show("Yo dont have privilage to perform this action!", "Access denied", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } 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{}

P a g e | 92
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; } }

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(); } privatevoid labelIDCard_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { FormID id = new FormID(); id.ShowDialog(); } privatevoid i(object sender, MouseButtonEventArgs e) { Form2 ns = new Form2(); ns.Show(); } privatevoid label5_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

P a g e | 93
{ VdoWindow cs = new VdoWindow(); cs.Show(); }

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

namespace WpfApplication2 { publicdelegatevoid ResultEventHandler(object sender, ResultEventArgs e); publicpartialclassUserControl1 : UserControl { public UserControl1() { InitializeComponent(); } publicevent ResultEventHandler Result; protectedvirtualvoid OnResult(ResultEventArgs e) { ResultEventHandler handler = Result; if (handler != null) { handler(this, e); } } SqlDataAdapter ad = new SqlDataAdapter(); SqlCommand com = new SqlCommand(); DataTable dt = new DataTable(); publicbool SubmitValues() { /* *Validate all columns\ *

P a g e | 94
*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 { 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 returntrue; }

P a g e | 95
else// Cannot add entry { ResultEventArgs e = new ResultEventArgs(true, "Please Check your data"); OnResult(e); returnfalse; } } else//Age empty { ResultEventArgs e = new ResultEventArgs(true, "New entry not added! Age not valid"); OnResult(e); returnfalse; } } else//Comment Empty { textBoxComment_LostFocus(newobject(), new RoutedEventArgs()); ResultEventArgs e = new ResultEventArgs(true, "New entry not added! Comment Cannot be empty"); OnResult(e); returnfalse; } } else//Name empty { textBoxName_LostFocus(newobject(), new RoutedEventArgs()); ResultEventArgs e = new ResultEventArgs(true, "New entry not added! Name Cannot be empty"); OnResult(e); returnfalse; } } privatevoid Usr1_Loaded(object sender, RoutedEventArgs e) { com.Connection = ClassDbManager.con; } #region validation... 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; } }

P a g e | 96

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) { 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")]

P a g e | 97
[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")] publicpartialclassHospitalDataSet1 : global::System.Data.DataSet { private OPBILLMASTERDataTable tableOPBILLMASTER; privateglobal::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] public HospitalDataSet1() { this.BeginInit(); this.InitClass(); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = newglobal::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.TypedDataSetG enerator", "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 = newglobal::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 = newglobal::System.Data.DataSet(); ds.ReadXmlSchema(newglobal::System.Xml.XmlTextReader(newglobal::System.IO.StringReader(st rSchema))); 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);

P a g e | 98
this.InitVars(); } else { this.ReadXmlSchema(newglobal::System.Xml.XmlTextReader(newglobal::System.IO.StringReader( strSchema))); } this.GetSerializationData(info, context); global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = newglobal::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.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentMo del.DesignerSerializationVisibility.Content)] public OPBILLMASTERDataTable OPBILLMASTER { get { returnthis.tableOPBILLMASTER; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.BrowsableAttribute(true)] [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.Co mponentModel.DesignerSerializationVisibility.Visible)] publicoverrideglobal::System.Data.SchemaSerializationMode SchemaSerializationMode { get { returnthis._schemaSerializationMode; } set { this._schemaSerializationMode = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.Co mponentModel.DesignerSerializationVisibility.Hidden)] publicnewglobal::System.Data.DataTableCollection Tables { get { returnbase.Tables; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

P a g e | 99

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.Co mponentModel.DesignerSerializationVisibility.Hidden)] publicnewglobal::System.Data.DataRelationCollection Relations { get { returnbase.Relations; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] protectedoverridevoid InitializeDerivedDataSet() { this.BeginInit(); this.InitClass(); this.EndInit(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicoverrideglobal::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.TypedDataSetG enerator", "4.0.0.0")] protectedoverridebool ShouldSerializeTables() { returnfalse; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] protectedoverridebool ShouldSerializeRelations() { returnfalse; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] protectedoverridevoid ReadXmlSerializable(global::System.Xml.XmlReader reader) { if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { this.Reset(); global::System.Data.DataSet ds = newglobal::System.Data.DataSet();

P a g e | 100
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.TypedDataSetG enerator", "4.0.0.0")] protectedoverrideglobal::System.Xml.Schema.XmlSchema GetSchemaSerializable() { global::System.IO.MemoryStream stream = newglobal::System.IO.MemoryStream(); this.WriteXmlSchema(newglobal::System.Xml.XmlTextWriter(stream, null)); stream.Position = 0; returnglobal::System.Xml.Schema.XmlSchema.Read(newglobal::System.Xml.XmlTextReader(stream ), null); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] internalvoid InitVars() { this.InitVars(true); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] internalvoid 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.TypedDataSetG enerator", "4.0.0.0")] privatevoid InitClass() { this.DataSetName = "HospitalDataSet1";

P a g e | 101
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.TypedDataSetG enerator", "4.0.0.0")] privatebool ShouldSerializeOPBILLMASTER() { returnfalse; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] privatevoid 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.TypedDataSetG enerator", "4.0.0.0")] publicstaticglobal::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { HospitalDataSet1 ds = new HospitalDataSet1(); global::System.Xml.Schema.XmlSchemaComplexType type = newglobal::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = newglobal::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = newglobal::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 = newglobal::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = newglobal::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;

P a g e | 102
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.TypedDataSetG enerator", "4.0.0.0")] publicdelegatevoid OPBILLMASTERRowChangeEventHandler(object sender, OPBILLMASTERRowChangeEvent e); ///<summary> ///Represents the strongly named DataTable class. ///</summary> [global::System.Serializable()] [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] publicpartialclassOPBILLMASTERDataTable : global::System.Data.TypedTableBase<OPBILLMASTERRow> { privateglobal::System.Data.DataColumn columnBillItem; privateglobal::System.Data.DataColumn columnAmount; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "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.TypedDataSetG enerator", "4.0.0.0")] internal OPBILLMASTERDataTable(global::System.Data.DataTable table) {

P a g e | 103
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.TypedDataSetG enerator", "4.0.0.0")] 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.TypedDataSetG enerator", "4.0.0.0")] publicglobal::System.Data.DataColumn BillItemColumn { get { returnthis.columnBillItem; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicglobal::System.Data.DataColumn AmountColumn { get { returnthis.columnAmount; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] publicint Count { get { returnthis.Rows.Count; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

P a g e | 104

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] public OPBILLMASTERRow this[int index] { get { return ((OPBILLMASTERRow)(this.Rows[index])); } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicevent OPBILLMASTERRowChangeEventHandler OPBILLMASTERRowChanging; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicevent OPBILLMASTERRowChangeEventHandler OPBILLMASTERRowChanged; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicevent OPBILLMASTERRowChangeEventHandler OPBILLMASTERRowDeleting; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicevent OPBILLMASTERRowChangeEventHandler OPBILLMASTERRowDeleted; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicvoid AddOPBILLMASTERRow(OPBILLMASTERRow row) { this.Rows.Add(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] public OPBILLMASTERRow AddOPBILLMASTERRow(string BillItem, decimal Amount) { OPBILLMASTERRow rowOPBILLMASTERRow = ((OPBILLMASTERRow)(this.NewRow())); object[] columnValuesArray = newobject[] { BillItem, Amount}; rowOPBILLMASTERRow.ItemArray = columnValuesArray; this.Rows.Add(rowOPBILLMASTERRow); return rowOPBILLMASTERRow; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] public OPBILLMASTERRow FindByBillItem(string BillItem) { return ((OPBILLMASTERRow)(this.Rows.Find(newobject[] { BillItem})));

P a g e | 105
} [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicoverrideglobal::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.TypedDataSetG enerator", "4.0.0.0")] protectedoverrideglobal::System.Data.DataTable CreateInstance() { returnnew OPBILLMASTERDataTable(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] internalvoid InitVars() { this.columnBillItem = base.Columns["BillItem"]; this.columnAmount = base.Columns["Amount"]; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] privatevoid InitClass() { this.columnBillItem = newglobal::System.Data.DataColumn("BillItem", typeof(string), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnBillItem); this.columnAmount = newglobal::System.Data.DataColumn("Amount", typeof(decimal), null, global::System.Data.MappingType.Element); base.Columns.Add(this.columnAmount); this.Constraints.Add(newglobal::System.Data.UniqueConstraint("Constraint1", newglobal::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.TypedDataSetG enerator", "4.0.0.0")] public OPBILLMASTERRow NewOPBILLMASTERRow() { return ((OPBILLMASTERRow)(this.NewRow())); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

P a g e | 106

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] protectedoverrideglobal::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { returnnew OPBILLMASTERRow(builder); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] protectedoverrideglobal::System.Type GetRowType() { returntypeof(OPBILLMASTERRow); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] protectedoverridevoid 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.TypedDataSetG enerator", "4.0.0.0")] protectedoverridevoid 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.TypedDataSetG enerator", "4.0.0.0")] protectedoverridevoid OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { 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.TypedDataSetG enerator", "4.0.0.0")] protectedoverridevoid OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { base.OnRowDeleting(e);

P a g e | 107
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.TypedDataSetG enerator", "4.0.0.0")] publicvoid RemoveOPBILLMASTERRow(OPBILLMASTERRow row) { this.Rows.Remove(row); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicstaticglobal::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = newglobal::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = newglobal::System.Xml.Schema.XmlSchemaSequence(); HospitalDataSet1 ds = new HospitalDataSet1(); global::System.Xml.Schema.XmlSchemaAny any1 = newglobal::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = newdecimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = newglobal::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = newdecimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = newglobal::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = newglobal::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 = newglobal::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = newglobal::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1);

P a g e | 108
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> publicpartialclassOPBILLMASTERRow : global::System.Data.DataRow { private OPBILLMASTERDataTable tableOPBILLMASTER; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "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.TypedDataSetG enerator", "4.0.0.0")] publicstring BillItem { get { return ((string)(this[this.tableOPBILLMASTER.BillItemColumn])); } set {

P a g e | 109
this[this.tableOPBILLMASTER.BillItemColumn] = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicdecimal Amount { get { try { return ((decimal)(this[this.tableOPBILLMASTER.AmountColumn])); } catch (global::System.InvalidCastException e) { thrownewglobal::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.TypedDataSetG enerator", "4.0.0.0")] publicbool IsAmountNull() { returnthis.IsNull(this.tableOPBILLMASTER.AmountColumn); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicvoid SetAmountNull() { this[this.tableOPBILLMASTER.AmountColumn] = global::System.Convert.DBNull; } } ///<summary> ///Row event argument class ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicclassOPBILLMASTERRowChangeEvent : global::System.EventArgs { private OPBILLMASTERRow eventRow; privateglobal::System.Data.DataRowAction eventAction; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] public OPBILLMASTERRowChangeEvent(OPBILLMASTERRow row, global::System.Data.DataRowAction action) {

P a g e | 110
this.eventRow = row; this.eventAction = action; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] public OPBILLMASTERRow Row { get { returnthis.eventRow; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicglobal::System.Data.DataRowAction Action { get { returnthis.eventAction; } } } } } 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")] publicpartialclassOPBILLMASTERTableAdapter : global::System.ComponentModel.Component { privateglobal::System.Data.SqlClient.SqlDataAdapter _adapter; privateglobal::System.Data.SqlClient.SqlConnection _connection; privateglobal::System.Data.SqlClient.SqlTransaction _transaction; privateglobal::System.Data.SqlClient.SqlCommand[] _commandCollection; privatebool _clearBeforeFill; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] public OPBILLMASTERTableAdapter() { this.ClearBeforeFill = true;

P a g e | 111
} [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] protectedinternalglobal::System.Data.SqlClient.SqlDataAdapter Adapter { get { if ((this._adapter == null)) { this.InitAdapter(); } returnthis._adapter; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] internalglobal::System.Data.SqlClient.SqlConnection Connection { get { if ((this._connection == null)) { this.InitConnection(); } returnthis._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.TypedDataSetG enerator", "4.0.0.0")] internalglobal::System.Data.SqlClient.SqlTransaction Transaction { get { returnthis._transaction; } set { this._transaction = value; for (int i = 0; (i <this.CommandCollection.Length); i = (i + 1)) {

P a g e | 112
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; } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] protectedglobal::System.Data.SqlClient.SqlCommand[] CommandCollection { get { if ((this._commandCollection == null)) { this.InitCommandCollection(); } returnthis._commandCollection; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicbool ClearBeforeFill { get { returnthis._clearBeforeFill; } set { this._clearBeforeFill = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] privatevoid InitAdapter() { this._adapter = newglobal::System.Data.SqlClient.SqlDataAdapter(); global::System.Data.Common.DataTableMapping tableMapping = newglobal::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 = newglobal::System.Data.SqlClient.SqlCommand(); this._adapter.DeleteCommand.Connection = this.Connection;

P a g e | 113
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(newglobal::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.DeleteCommand.Parameters.Add(newglobal::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(newglobal::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 = newglobal::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(newglobal::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(newglobal::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 = newglobal::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(newglobal::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(newglobal::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(newglobal::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(newglobal::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.UpdateCommand.Parameters.Add(newglobal::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, "", "", "")); }

P a g e | 114

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] privatevoid InitConnection() { this._connection = newglobal::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.TypedDataSetG enerator", "4.0.0.0")] privatevoid InitCommandCollection() { this._commandCollection = newglobal::System.Data.SqlClient.SqlCommand[1]; this._commandCollection[0] = newglobal::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.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.Da taObjectMethodType.Fill, true)] publicvirtualint Fill(HospitalDataSet1.OPBILLMASTERDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; if ((this.ClearBeforeFill == true)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); return returnValue; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.Da taObjectMethodType.Select, true)] publicvirtual HospitalDataSet1.OPBILLMASTERDataTable GetData() { this.Adapter.SelectCommand = this.CommandCollection[0]; HospitalDataSet1.OPBILLMASTERDataTable dataTable = new HospitalDataSet1.OPBILLMASTERDataTable(); this.Adapter.Fill(dataTable); return dataTable; }

P a g e | 115
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] publicvirtualint Update(HospitalDataSet1.OPBILLMASTERDataTable dataTable) { returnthis.Adapter.Update(dataTable); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] publicvirtualint Update(HospitalDataSet1 dataSet) { returnthis.Adapter.Update(dataSet, "OPBILLMASTER"); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] publicvirtualint Update(global::System.Data.DataRow dataRow) { returnthis.Adapter.Update(newglobal::System.Data.DataRow[] { dataRow}); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] publicvirtualint Update(global::System.Data.DataRow[] dataRows) { returnthis.Adapter.Update(dataRows); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.Da taObjectMethodType.Delete, true)] publicvirtualint Delete(string Original_BillItem, global::System.Nullable<decimal> Original_Amount) { if ((Original_BillItem == null)) { thrownewglobal::System.ArgumentNullException("Original_BillItem"); } else { this.Adapter.DeleteCommand.Parameters[0].Value = ((string)(Original_BillItem)); }

P a g e | 116
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; 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.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.Da taObjectMethodType.Insert, true)] publicvirtualint Insert(string BillItem, global::System.Nullable<decimal> Amount) { if ((BillItem == null)) { thrownewglobal::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;

P a g e | 117
} 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.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.Da taObjectMethodType.Update, true)] publicvirtualint Update(string BillItem, global::System.Nullable<decimal> Amount, string Original_BillItem, global::System.Nullable<decimal> Original_Amount) { if ((BillItem == null)) { thrownewglobal::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)) { thrownewglobal::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; } 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)) {

P a g e | 118
this.Adapter.UpdateCommand.Connection.Close(); } } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.Da taObjectMethodType.Update, true)] publicvirtualint Update(global::System.Nullable<decimal> Amount, string Original_BillItem, global::System.Nullable<decimal> Original_Amount) { returnthis.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") ] publicpartialclassTableAdapterManager : global::System.ComponentModel.Component { private UpdateOrderOption _updateOrder; private OPBILLMASTERTableAdapter _oPBILLMASTERTableAdapter; privatebool _backupDataSetBeforeUpdate; privateglobal::System.Data.IDbConnection _connection; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] public UpdateOrderOption UpdateOrder { get { returnthis._updateOrder; } set { this._updateOrder = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

P a g e | 119

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.Ta bleAdapterManagerPropertyEditor, Microso" + "ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + "a", "System.Drawing.Design.UITypeEditor")] public OPBILLMASTERTableAdapter OPBILLMASTERTableAdapter { get { returnthis._oPBILLMASTERTableAdapter; } set { this._oPBILLMASTERTableAdapter = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicbool BackupDataSetBeforeUpdate { get { returnthis._backupDataSetBeforeUpdate; } set { this._backupDataSetBeforeUpdate = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] publicglobal::System.Data.IDbConnection Connection { get { if ((this._connection != null)) { returnthis._connection; } if (((this._oPBILLMASTERTableAdapter != null) && (this._oPBILLMASTERTableAdapter.Connection != null))) { returnthis._oPBILLMASTERTableAdapter.Connection; } returnnull; } set { this._connection = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] [global::System.ComponentModel.Browsable(false)] publicint TableAdapterInstanceCount { get {

P a g e | 120
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.TypedDataSetG enerator", "4.0.0.0")] privateint 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) && (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.TypedDataSetG enerator", "4.0.0.0")] privateint 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>

P a g e | 121
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] privateint 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); } } 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.TypedDataSetG enerator", "4.0.0.0")] privateglobal::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 = newglobal::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.TypedDataSetG enerator", "4.0.0.0")] publicvirtualint UpdateAll(HospitalDataSet1 dataSet) {

P a g e | 122
if ((dataSet == null)) { thrownewglobal::System.ArgumentNullException("dataSet"); } if ((dataSet.HasChanges() == false)) { return 0; } if (((this._oPBILLMASTERTableAdapter != null) && (this.MatchTableAdapterConnection(this._oPBILLMASTERTableAdapter.Connection) == false))) { thrownewglobal::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + "tring."); } global::System.Data.IDbConnection workConnection = this.Connection; if ((workConnection == null)) { thrownewglobal::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)) { thrownewglobal::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 = newglobal::System.Collections.Generic.List<global::System.Data.DataRow>(); global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows = newglobal::System.Collections.Generic.List<global::System.Data.DataRow>(); global::System.Collections.Generic.List<global::System.Data.Common.DataAdapter> adaptersWithAcceptChangesDuringUpdate = newglobal::System.Collections.Generic.List<global::System.Data.Common.DataAdapter>(); global::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection> revertConnections = newglobal::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection>(); int result = 0; global::System.Data.DataSet backupDataSet = null; if (this.BackupDataSetBeforeUpdate) { backupDataSet = newglobal::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));

P a g e | 123
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(); 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();

P a g e | 124
row.SetAdded(); } } } throw ex; } finally { if (workConnOpened) { workConnection.Close(); } if ((this._oPBILLMASTERTableAdapter != null)) { this._oPBILLMASTERTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._oPBILLMASTERTableA dapter])); 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.TypedDataSetG enerator", "4.0.0.0")] protectedvirtualvoid 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.TypedDataSetG enerator", "4.0.0.0")] protectedvirtualbool MatchTableAdapterConnection(global::System.Data.IDbConnection inputConnection) { if ((this._connection != null)) { returntrue; } if (((this.Connection == null) || (inputConnection == null))) { returntrue; } if (string.Equals(this.Connection.ConnectionString, inputConnection.ConnectionString, global::System.StringComparison.Ordinal)) { returntrue; } returnfalse; }

P a g e | 125

///<summary> ///Update Order Option ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] publicenumUpdateOrderOption { InsertUpdateDelete = 0, UpdateInsertDelete = 1, } ///<summary> ///Used to sort self-referenced table's rows ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] privateclassSelfReferenceComparer : object, global::System.Collections.Generic.IComparer<global::System.Data.DataRow> { privateglobal::System.Data.DataRelation _relation; privateint _childFirst; [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "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; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetG enerator", "4.0.0.0")] privateglobal::System.Data.DataRow GetRoot(global::System.Data.DataRow row, outint 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 = newglobal::System.Collections.Generic.Dictionary<global::System.Data.DataRow, global::System.Data.DataRow>(); traversedRows[row] = row;

P a g e | 126
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.TypedDataSetG enerator", "4.0.0.0")] publicint 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 {

P a g e | 127
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 { partialclassForm2 { ///<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.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();

P a g e | 128
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(); 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();

P a g e | 129
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); 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();

P a g e | 130

((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(); ((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;

P a g e | 131
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, 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

P a g e | 132
// this.cOMMENTDataGridViewTextBoxColumn.DataPropertyName = "COMMENT"; this.cOMMENTDataGridViewTextBoxColumn.HeaderText = "COMMENT"; this.cOMMENTDataGridViewTextBoxColumn.Name = "cOMMENTDataGridViewTextBoxColumn"; // // pHONEDataGridViewTextBoxColumn // 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

P a g e | 133
// 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 // this.ageDataGridViewTextBoxColumn1.DataPropertyName = "Age"; this.ageDataGridViewTextBoxColumn1.HeaderText = "Age"; this.ageDataGridViewTextBoxColumn1.Name = "ageDataGridViewTextBoxColumn1";

P a g e | 134
// // 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"; // // dateLastPaidDataGridViewTextBoxColumn // this.dateLastPaidDataGridViewTextBoxColumn.DataPropertyName = "DateLastPaid"; this.dateLastPaidDataGridViewTextBoxColumn.HeaderText = "DateLastPaid"; this.dateLastPaidDataGridViewTextBoxColumn.Name = "dateLastPaidDataGridViewTextBoxColumn"; // // ipBindingSource // this.ipBindingSource.DataMember = "Ip"; this.ipBindingSource.DataSource = this.hospitalDataSet2; // // hospitalDataSet2 //

P a g e | 135
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"; 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);

P a g e | 136
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 // 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 //

P a g e | 137
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); 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

P a g e | 138
// 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"; 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);

P a g e | 139
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"; 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

P a g e | 140
// 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(); ((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 private private private private private System.Windows.Forms.TabControl OP; System.Windows.Forms.TabPage tabPage1; System.Windows.Forms.TabPage tabPage3; System.Windows.Forms.DataGridView dataGridView1; System.Windows.Forms.TabPage tabPage4; System.Windows.Forms.TabPage tabPage5;

P a g e | 141
private HospitalDataSet hospitalDataSet; private System.Windows.Forms.BindingSource oPBindingSource; private HospitalDataSetTableAdapters.OPTableAdapter oPTableAdapter; private System.Windows.Forms.DataGridViewTextBoxColumn iDDataGridViewTextBoxColumn; 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; 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;

P a g e | 142
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 using using using using using using using using using using using using using

System; System.Collections.Generic; System.Linq; System.Text; System.Windows; System.Windows.Controls; System.Windows.Data; System.Windows.Documents; System.Windows.Input; System.Windows.Media; System.Windows.Media.Imaging; System.Windows.Shapes; System.Data; 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) {

P a g e | 143

WpfApplication2._D__DB_HOSPITAL_MDFDataSet1 _D__DB_HOSPITAL_MDFDataSet1 = ((WpfApplication2._D__DB_HOSPITAL_MDFDataSet1)(this.FindResource("_D__DB_HOSPITAL_MDFData Set1"))); // 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_MDFData Set2"))); // 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(); } 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;

P a g e | 144
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) { 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 using using using using using using using using using using using

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

P a g e | 145
using System.Windows.Shapes; namespace WpfApplication2 { ///<summary> /// Interaction logic for WindowLogin.xaml ///</summary> publicpartialclassWindowLogin : Window { public WindowLogin() { InitializeComponent(); } bool DetectedUser = false; privatevoid buttonLogin_Click(object sender, RoutedEventArgs e) { ClassDbManager db = new ClassDbManager(global::WpfApplication2.Properties.Settings.Default.ConnectionString); 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);

P a g e | 146
} } privatevoid buttonCancel_Click(object sender, RoutedEventArgs e) { Environment.Exit(0); } privatevoid Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (!DetectedUser) Environment.Exit(0); } privatevoid Window_Loaded(object sender, RoutedEventArgs e) { } } }

11. SCREEN SHOTS

P a g e | 147

P a g e | 148

P a g e | 149

P a g e | 150

P a g e | 151

P a g e | 152

P a g e | 153

P a g e | 154

P a g e | 155

P a g e | 156

P a g e | 157

P a g e | 158

Вам также может понравиться