Medical Stores management system in C#.Net
February 15, 2017 | Author: Mayur Wankhede | Category: N/A
Short Description
Download Medical Stores management system in C#.Net...
Description
Introduction
INDEX
1. Introduction 1.1
Project Overview
1.2
Organization Profile
2. Problem Definition 2.1
Introduction
3.
Introduction
3.1 Introduction 3.2 Economical Feasibility 3.3 Technical Feasibility 3.4 Operational Feasibility
4. System Requirement Analysis 4.1 Introduction 4.2 Entity-Relationship Diagram (ERD) 4.3 Data Flow Diagram (DFD) 4.4
Data Dictionary
5. System Design
5.1 Introduction 5.2 Design Process 5.4 Database Design 5.3 Design Principles 5.5 Normalization
6. System Testing 6.1 Introduction 6.3 Black-Box Testing 6.2 White-Box Testing (GLASS-BOX TESTING) 6.4 Testing Strategies 6.4.1 Unit Testing 6.4.3 Validation Testing 6.4.2 Integration Testing
7. Software Implementation 7.1 Introduction 7.1.1 Direct Conversion 7.1.2 Parallel Conversion 7.1.3 Pilot Conversion 7.1.4 Phased Conversion 7.2 Software Requirements 7.3 Hardware Requirements
8. Literature Survey 8.2 About Microsoft SQL Server: 8.2.1 Microsoft SQL Server Database 8.2.2 Basic Database Concepts
8.2.3 Introduction to SQL
9. Forms (Snapsots) 10. Conclusion 11. Source Code 12. Future Expansion 13. Limitation 14.The End
1. Introduction 1.1
Medical
Store
Project Overview
Management
software
is
general
software
developed for Medical Store. This software helps them to do billing and stock maintenance. The
purpose
of
this
document
is
to
specify
requirements and to give guidelines for the development of above said project. In particular it gives guidelines on how to prepare the project. This document is intended to be a practical guide for people who want to develop this software. As this is generic software it can be used by a wide variety of outlets (Retailers and Wholesalers) to automate the process of manually maintaining the records related to the subject of maintaining the stock and cash flows. The main goal of the application is to maintain the records
of
purchase,
Sales
and
stock
details
with
cash
transaction maintenance. Medical Store Management software is very needy for Medical Store. This software helps them maintain day to day transactions in computer.
1.2 Organization Profile
Since 2002 IT-NetworkZ® has been providing creative lab training to businesses, professionals, individuals, and students to leverage the vendor certification and utilize the many new digital technologies available today. We've helped businesses, professionals, individuals, and students transform their career needs with vital, practical, flexible vendor certification training that meet their own changing needs as well as those of their customers and employee Staying ahead of the competition, innovation, creating business intelligence-they're all dependent on association and collaboration.IT-NetworkZ® has the specialized abilities in Network Training and Consultancy. It also specializes in project-based training. Headquartered in South Africa, USA, IT-NetworkZ® has its Regional Training Center facility in Nagpur, India. In tune with the vision of global excellence, the company is expected to strategically diversify into Offshore Project Services and Placement with its key strength in the area of Training and Consultancy. Today, IT-NetworkZ® is a leading training provider with brick and mortar presence in Nagpur. Its main aim is to provide confidence to its clientele (who are businessmen, organizations and individuals) to achieve vendor certification with sound knowledge.
Origin:
IT-NetworkZ® began its operations in February, 2002 and quickly achieved profitability. The company's clientele since has been consistently increasing, since its inception. The members of the technical team were sourced from the highest ranks of IT network services, and have extensive experience in Training, Knowledge Management & Network Technologies. Certified by multiple vendors of Industry
Standards: The process methodology adhered to at ITNetworkZ® results in reduced risks and lower costs in every phase of its complex training, network integration, platform transitions and development outsourcing. By offering various combinations of on-site/off-site/offshore training and consultancy, IT-NetworkZ® is able to deliver zero-defect training to the client, on time, every time, and well within the budget.
CHAPTER 2
Problem Definition
2.1 Introduction
Medical Store Management System t is very helpful to manage sales information of Medical Store. It can easily keep the record of Hospitals who done regular business deals. This software is comprehensiveness and the simple by which it handles complex tasks easily. Medical store management system project covers important details required for designing medical software application. Main objective of this project is to develop a software application for medical shops for performing tasks like billing, managing customer’s details, organizing stock details. This medical store management system project is implemented in C#.net programming language.
3. Feasibility Study 3.1 Introduction All projects are feasible – given unlimited resources and infinite time! Unfortunately, the development of computer-based system or product is more likely plagued by a scarcity of resources and difficult
delivery dates. It is both necessary and prudent to evaluate the feasibility of a project at the earliest possible time. Months or years of effort, thousands or millions of dollars, and untold professional embarrassment can be averted if an ill-conceived system is recognized early in the definition phase. Generally the feasibility study is used for determining the resource requirement cost, benefits and whether the proposed system is feasible with respect to the organization .The feasibility of proposed Automation of medical stores management system could be evaluated as follows. There are three types of feasibility which are equally important. They are
Economic feasibility
Technical feasibility
Operational feasibility
3.2 Economical Feasibility Economic feasibility is concerned with cost savings, increased profits & reductions in efforts. It shows how much beneficial is the new developed system over the existing system. System startup cost PC with good Processor Line Printer Furniture Indirect cost for site preparation Purchase of Software
Rest. 25,000/Rest. 6,500/Rest. 3,500/Rest. 20,000/Rest. 55, 000/-
System operating costs
Additional equipment (CDs, ribbons, power supply) maintenances
Program maintenance
Stationary
Total operating cost Total Cost of the Implementation of the Proposed System
Rs. 5,000/Rs. 55,000/Rs. 5,000/-
Rs. 60,000/As this project is related to service sector which aims at providing better service to users and viewers and does not yield any income. Providing better service is the basic requirement of any organization either service sector or financial sector. So the proposed system is economically feasible as it also reduces manpower utilization.
3.3 Technical Feasibility Technical feasibility deals with the existing technology, software and hardware requirements of the proposed system. The proposed system “Medical Stores Manangement System” needs the following:
Software required for development: •
Operating System:
•
Windows XP/Windows vista
•
Front End :
•
Microsoft Visual Studio 2008
•
Back End:
•
Microsoft SQL Server 2005
Hardware requirement for development: •
Processor:
•
Pentium IV500MHz or higher
•
Memory-RAM:
•
128MB or higher RAM
•
Memory-CACHE:
•
128MB or higher RAM
•
Hard Disk:
•
40GB or higher
In order to implement the proposed system necessary technology will be acquired. Hence the proposed system is technically feasible.
3.4 Operational Feasibility Operational feasibility is the willingness & ability of the management, employees, users and others to use & support a proposed system. As concerned to the Library of Noble College of Computer Sciences, all the staff is in desperate need of a Computer Based Information System (CBIS) to reduce the manual effort & for accurate information. There is no difficulty in handling the system. There is full support from Management. So the system is operationally feasible. The proposed Computer Based Information System (CBIS) for NIVT is in no way inferior to the existing manual system and it yields better results than the present manual system. This system can give good support and makes the services easy.
CHAPTER 4
System
4.SystemRequirementAnalysis 4.1 Introduction System analysis is an important activity that takes place when we are building a new information system or changing existing ones. Analysis is used to gain an understanding of an existing system and what is required of it. At the conclusion of analysis, there is system description and a set of requirements for a new system. If there is no existing system, the analysis defines only the requirements. System models are used to gain precision and to avoid the ambiguities often found in the natural language system descriptions. Modeling techniques used in system analysis avoids ambiguity by using precise modeling constructors and process descriptions.
They also
assist analysts to define precisely the requirements of the new system. Software tools that help analyst in their work now often support system analysis. These tools are the models developed during analysis and some convert these models to trail designs. This phase is detailed appraisal of the existing system. appraisal includes finding
The
how the system works and what it does. It
also includes system‟s problems and what the end-users require for any new or changed system. After this phase, analyst should be familiar with both the detailed operation of the system and what is required of the new system. Analysts must spend considerable time in examining components of existing system. Analysts have to find out what information is send between the end-users and the staff. One of the most important factors in system analysis is to understand the system and its problems. A good understanding of the system enables designers to identify and correct problems and suggest realistic solutions for them. It also helps them to develop solutions that satisfy all users and thus make the new system acceptable in an organization. System users are the first information source investigated by the analysts.
From users it is to find out the existing system activities and to develop the user‟s objectives and requirements. A system analyst must spend a lot of time talking to users and finding how they use the system, any problems they find with the system and what they expect from it. Thus a rule, system analysis is a difficult but rewarding job. There are many constraints to be compiled within this work and many people to satisfy. But there is the reward of seeing of a new system does its job perfectly.
Process Models Incremental model The incremental model combines elements of the waterfall model applied in an iterative fashion. The incremental process model, like prototyping and other evolutionary approaches, is iterative in nature. But unlike prototyping, the incremental model focuses on the delivery of an operational product with each increment. Incremental development is particularly useful when staffing is unavailable for a complete implementation by the business deadline that has been established for the project. Early increments can be implemented with fewer people. if the code product is well received, additional staff can be added to implement the next increment. Diagram: COMMUNICAION
PLANNING
MODELING
CONSTRUCTION
DEPLOYMENT
RAD Model Rapid Application Development (RAD) is an incremental software process model that emphasizes a short development cycle. RAD model is a high speed adoption of the waterfall model, in which rapid development is achieved by using a component based construction approach. If requirements are well understood and project scope is constrained, the RAD process enables a development team to create a fully functional system with in a very short period. In RAD model communication works to understand the business problem and information characteristics. Planning is essential because multiple software teams work in parallel on different system functions. Modeling establishes design representations that serve as the basis for RAD construction activity. Construction emphasizes the use of pre existing software components. Finally the deployment establishes a basis for subsequent iterations. The RAD process model is illustrated in the figure below. Diagram: Modeling
Communication
Team #n
construction
Planning Modeling
deployment
Team #2 Construction
Modeling
Team #1 construction
4.3 Entity-Relationship Diagram (ERD)
The Entity-Relationship Diagram depicts a relationship between data objects. The ERD is the notation that is used to conduct the data modeling activity. The attributes of each data object noted in the ERD can be described using a data object description. At first a set of primary components are identified for ERD i.e. Data objects, Attributes, Relationships and Various type indicators. Data objects are represented by labeled rectangles. Relationships are indicated with labeled lines connecting objects. Connectors between data objects and relationships are established using a variety of special symbols that indicate cardinality and modality. ERD notation also provides a mechanism that represents the association between objects. Data modeling and the entity-relationship diagram provide the analyst with a concise notation for examining data with in the context of data processing application.The ER Diagram for the overall proposed system is given in the figures 4.0,4.1(a).
4.4 Data Flow Diagram (DFD) The data flow diagram (DFD) is one the most important modeling tools. It is used to model the system components. These components are the system process, the data used by the process, an external entity that interacts with the system and the information flows in the system. DFD shows how the information moves through the system and how it is modified by a series of transformations. It is a graphical technique that depicts information flow and those transformations that are applied as data moves from input to output. DFD is also known as bubble chart. A DFD may be used to represent a system at any level of abstraction. DFD s may be partitioned into levels that represent increasing information flow and functional details. A level 0 DFD, also called as the context diagram, represents the entire system as a single module with input and output data indicated by incoming and outgoing arrows respectively. Additional process and information flow paths are represented, as the level 0 DFD is partitioned to reveal more details. A level 1 DFD, also called as top-level DFD, represent the system with major modules and data stores. The other levels will show each module in the top-level DFD in a more detailed fashion. Notation: Data Flow : Data move in a specific direction from an origin to a destination . The data flow is a “packet” of data. Process : People, procedures or devices that produce data. The physical component is not identified.
Source or Destination of data: External sources or destinations of data, which may be people or organizations or other entities.
Data Store : Here, the data referred by a process in the system.
(Data Flow Diagram)
Functional-level DFD (Level 1)
4.5 Data Dictionary A data dictionary is a catalog – a repository – of the elements in the system. As the name suggests, these elements center on data and the way they are structured to meet user requirements and organization needs. A data dictionary is a collection of data about data. The basic idea is to provide information on the definition, structure and the user of the element an organization uses. The data element is a unit of data that can‟t be decomposed. Customer Master:
Item Master:
Stock:
Purchase:
Sales:
CHAPTER 5
System Design
5. System Design 5.1 Introduction Design is the first step in the development phase for any engineering product (or) system. It may be defined as “the process of applying various techniques and principles for the purpose of defining a device, a process, or a system insufficient detail to permit its physical realization”. Software design is an iterative process through which requirements are translated into a „Blue print‟ for constructing the software. The design is represented at a high level of abstraction, a level that can be directly translated to specific data, functional and behavioral requirements. Preliminary
design
is
concerned
with
the
transformation
of
requirements into a data and software architecture. Detail design focuses on refinements to the architectural representation. That leads to detailed data structure and algorithmic representation for software. In the design step, the element of the analysis model gets converted in to a data design, an architectural design, an interface design and a procedural design. The data design transforms the information domain model created during analysis into the data structures that will be required to implement software. The architectural design defines the relationship among major structural elements of the program. The interface design describes how the software communicates within itself, to systems that interoperate with it, and with humans who use it. An interface implies a flow of information (e.g., data and/or control). Therefore, the data and control flow diagrams provide the information required for interface design.
5.2 Design Process
Design process is in between the analysis and implementation process. The following design diagrams (data flow diagrams and E-R diagrams) make it easy to understand and implement. The design process of software system has two levels. 1. Systems Design or Top Level Design. 2. Detailed Design or Logical Design.
System Design or Top Level Design: In the system design the focus is on deciding which modules are needed for the system, the specification of these modules and how these modules should be interconnected.
Detailed Design or Logical Design: In detailed design the interconnection of the modules or how the specifications of the modules can be satisfied is decided . Some properties for a software system design are
Verifiability. Completeness. Consistency. Traceability. Simplicity/understandability
5.3 Design Principles Basic design principles that enable the software engineer to navigate the design process are:
The design process should not suffer from “Tunnel vision”.
The design should be traceable to the analysis model.
The design should not reinvent the wheel.
The design should minimize the intellectual distance between the software and the problem, as it exists in the real world.
The design should exhibit uniformity and integrity.
The design should be structured to accommodate changes.
The design is not coding, the coding is not a design.
The design should be assessed for the quality, as it is being created, not after the fact.
The design should be reviewed to minimize the conceptual errors.
5.4 Database Design
The goal of Database Design is to generate a set of relation schemes that allow us to store information without unnecessary redundancy and allows us to retrieve information easily. We can achieve optimization, ease of use in maintenance by designing the database using relational model in which data is stored in the form of tables and there exists a relation between or among the tables . The design objectives must be: To reduce redundancy. To arrive at loss-less join. To reduce the time as compared to the present system. To reduce the number of errors.
5.5 Normalization Normalization of relation schema is done to eliminate insertion and deletion anomalies that exist in databases. Normalization is a step-by-step reversible process of converting given collection of relations to some more desirable form in which the relations have a progressively simpler and more regular structure. No information is lost in normalization process.
The objectives of Normalization are
To make it feasible to represent any relation in the database.
To obtain powerful retrieval algorithms based on a simpler collection of
relational operations than would otherwise be
necessary.
To free relations from undesirable insertions, update and deletion dependencies. To make the collection of relations neutral to query statistics where these statistics are liable to change as time goes by.
A relation R is said to be in 1NF if all underlying domains contain atomic values only.A relation R is said to be in 2NF if and only if it is in 1NF and every non-key attribute is non-transitively dependent on the primary key. A relationship is said to be in 3NF if and only if it does not feature any non-trivial functional dependencies between non-prime attributes. A nonprime attribute is one that does not belong to any candidate key.
All the database used in the project have atomic values.
CHAPTER 6
System Testing
6. System Testing 6.1 Introduction System testing is a critical element of software quality assurance and represents the ultimate review of specification, design and coding. Software testing fundamentals define the overriding objectives for software testing. Testing is one of the steps in the software engineering process that could be viewed (psychologically, at least) as destructive rather than constructive. Testing is a process of executing a program with the intent of finding an error. A good test case is one that has a high probability of finding a yet undiscovered error. A successful test is one that uncovers an as yet undiscovered error.
6.2 White-Box Testing (GLASS-BOX TESTING) White-box tests focus on the program control structures. Test cases are derived to ensure that all statement in the program has been executed at least once during testing and that all logical conditions have been exercised. Knowing the internal working of a product, tests can be conducted to ensure that “all gears mesh”, that is, the internal operation performs according to specification and all internal components have been adequately exercised. White Box Testing is a test case design methods that uses the control structure of the procedural design to design to derive test cases. Using white box testing methods, the test cases should
Guarantee that all independent paths within a module have been exercised at least once Exercise all logical decision on their and false sides Execute all loops at their boundaries and within their operational bounds Exercise internal data structures to ensure their validity
6.3 Black-Box Testing
Black-box testing focuses on the functional requirements of the software .It is not an alternative to white-box techniques. Rather, it is a complementary approach that is likely to uncover a different class of errors than white-box methods. Black-box testing attempts to find the following types of errors Incorrect or missing functions. Interface errors. Errors in data structures or external database access. Performance errors and Initialization and termination errors. In white-box testing, test cases are performing early n the testing processes where as in black-box testing process, it is applied during later stages of testing as the attention is focused on the information domain.
6.4 Testing Strategies Testing is a set of activities that can be planned in advance and conducted
systematically.
A
strategy
for
software
testing
must
accommodate low-level tests that are necessary to verify that a small source code segment has been correctly implemented as well as highlevel tests that validate system functions against customer requirements. Software testing is none element of verification and validation. Verification refers to the set of activities that ensure that software correctly implements a specific function. Validation refers to a different set of activities that ensure that the software has been built is traceable to customer requirements.
6.4.1 Unit Testing
Unit testing focuses verification effort on the smallest unit of software design. Using the procedural design description, important control paths are tested to uncover errors within the boundary of the module. The relative complexity of test and uncovered errors is limited by the constrained scope established for unit testing. The unit test is normally white box oriented, and the step can be conducted in parallel for multiple modules. The module interface is tested to ensure that information properly flows into and out of the program unit under test. The local data structure is examined to ensure that data stored temporarily maintains its integrity during all steps in an algorithm‟s execution. Boundary conditions are tested to ensure that the module operates properly at boundaries established to limit or restrict processing. All independent paths through the control structure are exercised to ensure that all statements in a module have been executed at least once. And finally, all error-handling paths are tested.
6.4.2 Integration Testing Integration testing is a systematic technique for constructing the program structure while conducting tests to uncover errors associated with interfacing. The objective is to take unit tested modules and build a program structure that has been dictated by design. There is often a tendency to attempt non-incremental integration to construct the program using a big bang approach. All modules are combined in advance. The entire program is tested as a whole. Incremental integration is the anti thesis of big bang approach. The program is constructed and tested in small segments where errors are easier to isolate and correct; interfaces are more likely to be tested completely; and systematic test applied. Modules are integrated by moving downward through the control hierarchy, beginning with the main control module.
6.4.3 Validation Testing
At the culmination of integration testing, software is completely assembled as a package; interfacing errors have been uncovered and corrected and a final series of software tests-validation testing-may begin. Validation can be defined in many ways, but a simple definition is that validation succeeds when software functions in a manner that can be reasonably expected by the customer. Software validation is achieved through a series of black box tests that demonstrates conformity with requirements. A test plan outlines the classes of tests to be conducted and a test procedure defines specific test cases that will be used in an attempt to uncover errors in conformity with requirements. Both the plan and procedure are designed to ensure that all functional requirements are satisfied; all performance requirements are achieved; documentation is correct and human-engineered; and other requirements are met. After each validation test case has been conducted, one of the two possible conditions exists:
The function or performance characteristics conform to specification and are accepted.
A deviation from specification is uncovered and deficiency list is created.
Validation testing has been performed after all the above four tests have been performed. During the validation testing it is found that the system is performing according to the requirements. All the five steps in the problem definition have been verified.
CHAPTER 7
7. SoftwareImplementation 7.1 Introduction Implementation is the process of assuring that the information system is operational and then allowing users take over its operation for use and evaluation. Implementation includes the following activities:
Obtaining and installing the system hardware.
Installing the system and making it run on its intended hardware.
Providing user access to the system.
Creating and updating the database.
Training the users on the new system.
Documenting the system for its users and for those who will be responsible for maintaining it in the future.
Making arrangements to support the users as the system is used.
Transferring ongoing responsibility for the system from its developers to the operations or maintenance part.
Evaluating the operation and use of the system.
The most visible component of implementation process is the system conversion. The four basic conversion strategies include:
Direct Conversion
Parallel Conversion
Pilot Conversion
Phased Conversion
7.1.1 Direct Conversion In direct conversion, the organization stops using the old system and starts using the new one at the same time.
7.1.2 Parallel Conversion Parallel conversion involves running both old system and new system and comparing their results. The new system is accepted only after the results have matched for an acceptable period.
7.1.3 Pilot Conversion Pilot conversion means introducing the new system to a small part of the organization, expanding its use once it is know to operate properly there. Eventually, it will be in use by the entire organization.
7.1.4 Phased Conversion Phased conversion means introducing a system in stages, one component or module at a time, waiting until that one is operating properly before introducing the next.
7.2 Software Requirements •
Operating System:
•
Windows XP/Windows vista
•
Front End :
•
Microsoft Visual Studio 2008
•
Back End:
•
Microsoft SQL Server 2005
7.3 Hardware Requirements •
Processor:
•
Pentium IV500MHz or higher
•
Memory-RAM:
•
128MB or higher RAM
CHAPTER 8
Literature Survey
ABOUT C# C# is a modern, general-purpose object oriented programming language developed by Microsoft and approved by Ecma and ISO. C# was developed by Anders Hejlsberg and his team during the development of .Net Framework. C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows use of various highlevel languages to be used on different computer platforms and Architectures.
The following reasons make C# a widely used professional language: l purpose programming language
Strong Programming Features of C#
Although C# constructs closely follows traditional high level languages C and C++ and being an object oriented Programming language, it has strong resemblance with Java, it has numerous strong programming features that make it endearing to multitude of programmers worldwide.
Following is the list of few important features:
cs
C# Environment The .Net framework The .Net framework is a revolutionary platform that helps you to write the following types of applications:
The .Net framework applications are multi-platform applications. The framework has been designed in such a way that it can be used from any of the following languages: C# , C++, Visual Basic, Jscript, COBOL etc. All these languages can access the framework as well as communicate with each other.
The .Net framework consists of an enormous library of codes used by the client languages like C#. Following are some of the components of the .Net framework:
Windows Presentation Foundation
Integrated Development Environment (IDE) For C# Microsoft provides the following development tools for C# programming:
Express (VCE)
The last two are freely available from Microsoft official website. Using these tools you can write all kinds of C# programs from simple command-line applications to more complex applications. You can also write C# source code files using a basic text editor, like Notepad, and compile the code into assemblies using the command-line compiler, which is again a part of the .NET Framework. Visual C# Express and Visual Web Developer Express edition are trimmed down versions of Visual Studio and has the same look and feel. They retain most features of Visual Studio. In this tutorial, we have used Visual C # 2010 Express. You can download it from Microsoft Visual Studio. It gets automatically installed in your machine. Please note that you need an active internet connection for installing the express edition.
Writing C# Programs on Linux or Mac OS Although the.NET Framework runs on the Windows operating system, there are some alternative versions that work on other operating systems. Mono is an open-source version of the .NET Framework, which includes a C# compiler and runs on several operating systems, including various flavors of Linux and Mac OS.
C# Program Structure A C# program basically consists of the following parts:
Compile & Execute a C# Program: Using Visual Studio.Net for compiling and executing C# programs, take the following steps: sual Studio.
lorer.
window appears that contains the
ompt tool and go to the directory where you saved the file.
8.2 About Microsoft SQL Server: Oracle is a multi-user relational database management system. It is a software product that specializes in managing a single, shared set of information among many concurrent users. Oracle products are based on a concept known as client/server technology. The concept involves segregating the processing of an application between two systems. One performs all activities related to the database (server) and the other performs the activities that help the user to interact the application (client).
A client or front-end database application also interacts with the database by requesting and receiving information from the database server. It acts an interface between the user and the database.
The database server and back-end is used to manage the database tables optimally among multiple clients who concurrently request the server for the same data. It also enforces data integrity across all client applications and controls database access and other security requirements.
Any programming environment used to create containers, to manage human data, in the conceptualization as a Data Management System. Traditionally, the block of human data being managed is called a Database. Hence, in very simple terms, these programming environments can the conceptualized as Database Management Systems.
All Databases Management Systems allow users to create containers for data storage and management. These containers are called „cells‟. The minimum information that has to be given to Oracle for a suitable container to be constructed, which can hold free from human data, is,The cell name,The cell length, A cell can also be called as a Field
8.2.1 Microsoft SQL Server Database Features
Important features are introduced with the release of the Oracle9i Database, including advancements in Real Application Clusters, systems management, availability, scalability, and security. The features are
Availability
Enhanced Disaster Recovery Environment
Many tasks for managing a standby database are now automated. LogMiner supports log queries based on changes and has for additional datatypes, plus an easy
now
comprehensive log analysis
to-use graphical user interface.
Precision Database Repair
Oracle9i includes better prevention and improved handling of disk corruption, is able to restore the database to a consistent state
and
after recovery.
Scalability
Scalable Session State Management
The footprint required for each user on Oracle9i is substantially allowing more users to be hosted on the same, or larger,
hardware platforms.
Fine-Grained, Automatic Resource Management
Administrators gain more granular control over resources through and can specify the maximum active sessions per
Security
reduced,
Strong Three-Tier Security
new
consumer group.
features,
Three-tier security is enhanced by proxy authentication, including proxy of X.509 certificates or distinguished names (DN),
credential
support for thick JDBC,
connection pooling for application users (thick and thin JDBC and OCI), and integration with LDAP.
Improved User and Security Policy Management A large number of enhancements have been made in areas ranging from
management
of
network
naming
and
password-based
management to new replication queue management and
user
reconciliation
tools.
Data Encryption and Label Security Oracle Label Security provides an out-of-the-box fine-grained
control solution. Encryption enhancements support most
access
popular algorithms for
encryption and data integrity.
8.2.2 Basic Database Concepts A database is a corporate collection of data with some inherent meaning, designed, built and populated with data for a specific purpose. A database stores data that is useful to us. This data is only a part of the entire data available in the world around us. To be able to successfully design and maintain databases we have to do the following:
Identify which part of the world‟s data is of interest to us. Identify what specific objects in that part of the world‟s data are of
interest to
us.
Identify a relationship between the objects. Hence the objects, their attributes and the relationship between them that are of interest to us are still owed in the database that is designed, built and populated with data for a specific purpose.
CHARACTERISTICS OF A DATABASE MANAGEMENT SYSTEM:
It represents a complex relationship between data.
Keeps a tight control of debtor redundancy.
Enforces user-defined rules to ensure integrity of table data.
Has a centralized data dictionary for the storage of information
pertaining
to data and its manipulation.
Ensures that data can be shared across applications.
Enforces data access authorization has automatic, intelligent backup
recovery procedures for data have different interfaces
and
via which users can
manipulate data. RELATIONAL DATABASE MANAGEMENT: A relational database management system uses only its relational capabilities to manage the information stored in its databases. INFORMATION REPRESENTATION: All information stored in a relational database is represented only by data item values, which are stored in the tables that make up the database. Associations between data items are not logically represented in any other way, such as the use of pointers from one table to the other. LOGICAL ACCESSIBILITY: Every data item value stored in relational database is accessible by stating the nature of the table it is stored in, the name of the column under which it is stored and the value of the primary key that defines the row in which it is stored. INTEGRITY CONSTRAINTS: Constraints that apply to entity integrity and referential integrity are specifiable by the data language implemented by the database management system and not by the statements coded into the application program.
DATA LANGUAGE: The relational database management system may support many types of languages for describing data and accessing the database. However, there must be at least one language that uses ordinary character strings to support the definition of data, the definition of views, the manipulation of data, constraints on data integrity, information concerning authorization and the boundaries for recovery of units.
8.2.3 Introduction to SQL SQL is the language that all users must use to access data with in oracle database. SQL was developed in a prototype relational database management, systems R, by IBM in the mid of 1970‟s. System R was described by Dr.E.F.CODD in November 1976 journal of R&D. In 1979 Oracle Corporation introduced the first commercial implementation of SQL. American National Standard Institute (ANSI) adapted SQL as the standard language for relational database management systems in October 1986. FEATURES OF SQL:
SQL is a non-procedural language i.e., you specify what information you require, not to get it.
SQL is a language for all users.
SQL is a common language for all relational databases.
SQL is a data administration language that defines the structure of the database, controls the users to accept the data.
SQL is a client/server language that allows application programs on PC‟ s connected via LAN to communicate with the database servers that stores shared data.
SQL is used for storing and retrieving information in Oracle. A table is a primary database object of SQL that is used to store data.
TYPES OF SQL COMMANDS:
SQL commands are divided into the following categories:
Data Definition Language
Data Manipulation Language
Transaction Control Language
Session Control Language
Data Definition Language: DDL statements define and maintain objects and drop objects when they are no longer needed. Examples of this type of commands are CREATE, ALTER, and DROP commands.
Data Manipulation Language: DML commands are the most frequently used SQL commands. This are used to query and manipulate existing objects like tables. Examples of these commands are INSERT, SELECT, UPDATE and DELETE.
Transaction Control Language: A transaction is a logical unit of work. All changes made to the database can be referred to as a transaction. Transaction control statements manage the changes made by DML statements. These Statements are used for controlling data stored in the database. Examples these types of commands are COMMIT ROLLBACK, SAVEPOINT etc.
Data Control Language: DCL provides users with privilege commands. The owner of database like tables has the sole authority over them. The owner can allow other database users access to the objects as per his/her discretion. Examples of these commands are GRANT, REVOKE.
Session Control language: SCL allows a user to control the properties of his current session including enabling and disabling roles and changing language settings. Examples of these commands are ALTER SESSION, SET ROLE.
9. SCREENS SHOTS
Login Form
Mdi Parent
Item Master
Sales Bill
Purchase Bill
Item Stoke
CHAPTER 10
Conclusion
This process system is more easy and reliable to use then manual system. There is a security system with password in the system that the manual system never had and there was theft of the data being stolen. There are difference forms for every record, there necessary to company to have maintained of data. There is also feature of showing the previous customer detail. Finally we have to come to the conclusion that whatever the medical store requirements is present in this software.
CHAPTER 11
Source Code
Common Header Files using System;
using using using using using using using using
System.Collections.Generic; System.ComponentModel; System.Data; System.Data.SqlClient; System.Drawing; System.Linq; System.Text; System.Windows.Forms;
LOGIN 1 namespace Medical_store { public partial class Login : Form { public Login() { InitializeComponent(); } private void label3_Click(object sender, EventArgs e) { } private void panel1_Paint(object sender, PaintEventArgs e) { } private void button2_Click(object sender, EventArgs e) { this.Close(); Application.Exit(); } private void Login_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'medicalDataSet6.Login' table. You can move, or remove it, as needed. //this.loginTableAdapter.Fill(this.medicalDataSet6.Login); textBox1.Text = ""; textBox2.Text = ""; textBox1.Focus(); } private void button1_Click(object sender, EventArgs e) { try { //Define object of SqlConnection and paasing of ConnectioString copied from database property SqlConnection conn = new SqlConnection(); //conn.ConnectionString = @"Data Source=SAGARC2F6419CA;Initial Catalog=info;Integrated Security=True"; conn.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; //Connection with Database starts conn.Open();
//Create object of SqlAdapter and pass the query and object of ConnectionString SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM Login", conn); //Create object of Dataset DataSet ds = new DataSet(); //dataset is fiiled with dataAdapter adptr.Fill(ds); //create object of DataTable and assign the table to it DataTable dt = ds.Tables[0]; //loops start Boolean b = false; for (int i = 0; i < dt.Rows.Count; i++) { //comparision with the username and password entered if ((textBox1.Text).Equals((dt.Rows[i][0]).ToString()) && (textBox2.Text).Equals((dt.Rows[i][1]).ToString())) { MessageBox.Show("You Are Successfully Loged in...", "Wel-Come To Medical-Store-Management-System", MessageBoxButtons.OK, MessageBoxIcon.None); //shows the mdi form and hide the login form Mdi_parent1 childMdi = new Mdi_parent1(); childMdi.Show(); this.Hide(); b = true; break; } } // if User name and password are not matched if (!b) { MessageBox.Show("Invalid Username and Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); textBox1.Text = ""; textBox2.Text = ""; textBox1.Focus(); } // Closing of database conn.Close(); } finally { } } }}
LOGIN 2
namespace Medical_store { public partial class loginEditcs : Form { public loginEditcs(Medical_store.Mdi_parent1 parent) { InitializeComponent(); this.MdiParent = parent; } private void label1_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { //new Button TextBox1.Text = ""; TextBox2.Text = ""; textBox3.Text = ""; TextBox1.Focus(); } private void loginEditcs_Load(object sender, EventArgs e) { TextBox1.Text = ""; TextBox2.Text = ""; textBox3.Text = ""; TextBox1.Focus(); } private void button5_Click(object sender, EventArgs e) { //add button //If three of one field is empty then invalid; if (TextBox1.Text.Equals("") || TextBox2.Text.Equals("") || textBox3.Text.Equals("")) { MessageBox.Show("Invalid User Name Or Password", "Not Valid", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBox1.Focus(); } else { SqlConnection conn = new SqlConnection(); conn.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; try { conn.Open(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM Login", conn); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0];
for (int i = 0; i < dt.Rows.Count; i++) { //Condition for checking existance of username; if (TextBox1.Text == (dt.Rows[i][0]).ToString()) { MessageBox.Show("Enter Different User Name", "User Name Already Exists", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBox1.Focus(); break; } } //checking of password matching if (TextBox2.Text == textBox3.Text) { SqlCommand cmd = new SqlCommand(); cmd = conn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO Login VALUES('" + TextBox1.Text + "','" + TextBox2.Text + "')"; cmd.ExecuteNonQuery(); MessageBox.Show("You Account Has Been Successfully Created", "CONGRATULATION", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DialogResult result = MessageBox.Show("Password Does Not Match", "Re-Enter PassWord", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (result == DialogResult.Retry) { TextBox2.Focus(); } else { button5.Focus(); } } conn.Close(); } catch (Exception s) { MessageBox.Show(s.Message); } finally { //finally it will clears all the fields; TextBox1.Text = ""; TextBox2.Text = ""; textBox3.Text = ""; TextBox1.Focus(); } } } private void button7_Click(object sender, EventArgs e) { //delete Account SqlConnection conn = new SqlConnection();
conn.ConnectionString = @"Data Source=HIREN-9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; try { conn.Open(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM Login", conn); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; int t = 0; for (int i = 0; i < dt.Rows.Count; i++) { if (TextBox1.Text == (dt.Rows[i][0]).ToString() && TextBox2.Text == (dt.Rows[i][1]).ToString()) { DialogResult result = MessageBox.Show("Do you really want to delete your account", "Confirm to delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (TextBox2.Text == textBox3.Text) { SqlCommand cmd = new SqlCommand(); cmd = conn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "DELETE FROM Login WHERE '" + TextBox1.Text + "' "; cmd.ExecuteNonQuery(); TextBox1.Focus(); TextBox2.Text = ""; textBox3.Text = ""; MessageBox.Show("Your account has been deleted", "DELETED", MessageBoxButtons.OK, MessageBoxIcon.Information); } } [User-Name]=
else { TextBox1.Text = ""; TextBox2.Text = ""; textBox3.Text = ""; TextBox1.Focus(); } t++; break; } } if (t == 0) { DialogResult result = MessageBox.Show("User Name and ID didn't get Matched", "Information Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation); if (result == DialogResult.Retry) { TextBox1.Text = ""; TextBox2.Text = "";
textBox3.Text = ""; TextBox1.Focus(); } else { TextBox1.Text = ""; TextBox2.Text = ""; textBox3.Text = ""; TextBox1.Focus(); } } conn.Close(); } catch (Exception s) { MessageBox.Show(s.Message); } } private void button2_Click(object sender, EventArgs e) { this.Close(); } } }
Calender 3 namespace Medical_store { public partial class Calander : Form { public Calander(Medical_store.Mdi_parent1 parent) { InitializeComponent(); this.MdiParent = parent; } private void Calander_Load(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { this.Close(); } }
Contact 4
namespace Medical_store { public partial class ContactUs : Form { public ContactUs(Medical_store.Mdi_parent1 parent) { InitializeComponent(); this.MdiParent = parent; } private void ContactUs_Load(object sender, EventArgs e) { } } }
Customer 5 namespace Medical_store { public partial class Customermaster : Form { public int id; public Customermaster(Medical_store.Mdi_parent1 parent) { InitializeComponent(); this.MdiParent = parent; } private void Customermaster_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'medicalDataSet3._Customer_Master' table. You can move, or remove it, as needed. // this.customer_MasterTableAdapter.Fill(this.medicalDataSet3._Customer_Master ); } private void button3_Click(object sender, EventArgs e) { this.Close(); } private void button1_Click(object sender, EventArgs e) { //new button textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; SqlConnection con = new SqlConnection();
con.ConnectionString = @"Data Source=HIREN-9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM [Customer-Master]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; int b = (dt.Rows.Count); b++; textBox1.Text = b.ToString(); } private void button7_Click(object sender, EventArgs e) { //insert try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); //insert query SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; //cmd.CommandText = "INSERT INTO supplier-master VALUES('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "')"; cmd.CommandText = "INSERT INTO [Customer-Master] VALUES('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "')"; cmd.ExecuteNonQuery(); MessageBox.Show("Record is succesfully added", "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information); cmd.Connection.Close(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM [Customer-Master]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; int b = (dt.Rows.Count); b++; textBox1.Text = b.ToString(); } catch (Exception s) { MessageBox.Show(s.Message); } finally
{ //textBox1.Text textBox2.Text = textBox3.Text = textBox4.Text = textBox5.Text = textBox6.Text =
= ""; ""; ""; ""; ""; "";
} } private void button6_Click(object sender, EventArgs e) { //update try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); //update query SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "UPDATE [Customer-Master] SET [CustomerId]='" + textBox1.Text + "',[Customer-Name]='" + textBox2.Text + "',[Address]= '" + textBox3.Text + "',[City] = '" + textBox4.Text + "',[MoNo] = '" + textBox5.Text + "',[Phone-No] = '" + textBox6.Text + "' WHERE [Customer-Id]= '" + textBox1.Text + "'"; cmd.ExecuteNonQuery(); MessageBox.Show("Record is succesfully updated", "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information); cmd.Connection.Close(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM [Customer-Master]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; } catch (Exception s) { MessageBox.Show(s.Message); } } private void button5_Click(object sender, EventArgs e) { //delete query try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; //con.ConnectionString = @"Data Source=PRAKASH\SQLEXPRESS;Initial Catalog=info;Integrated Security=True";
con.Open(); SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from [Customer-Master] "; DialogResult result = MessageBox.Show("Do You Really Want TO Delete This Record", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { textBox1.Focus(); } else { cmd.CommandText = "DELETE FROM [Customer-Master] WHERE [Customer-Id]= '" + textBox1.Text + "'"; cmd.ExecuteNonQuery(); MessageBox.Show("Selected Record is deleted", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } cmd.Connection.Close(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM [Customer-Master]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; } catch (Exception s) { MessageBox.Show(s.Message); } } private void button4_Click(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { //Next button try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; if (con.State == ConnectionState.Closed) con.Open(); SqlDataAdapter adptr = new SqlDataAdapter("Select * From [Customer-Master]", con);
DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i][0] = (i + 1); } id = int.Parse(textBox1.Text); id = id + 1; if (id 0) { button2.Enabled = true; button10.Enabled = true; textBox1.Text textBox2.Text textBox3.Text textBox4.Text textBox5.Text textBox6.Text
= = = = = =
(dt.Rows[id (dt.Rows[id (dt.Rows[id (dt.Rows[id (dt.Rows[id (dt.Rows[id
//textBox1.Focus(); con.Close(); } else { button10.Enabled = false; } } catch (Exception s) { MessageBox.Show(s.Message); }
-
1][0]).ToString(); 1][1]).ToString(); 1][2]).ToString(); 1][3]).ToString(); 1][4]).ToString(); 1][5]).ToString();
} private void groupBox3_Enter(object sender, EventArgs e) { } } }
INFO 6 namespace Medical_store { public partial class Info : Form { public int id; public Info(Medical_store.Mdi_parent1 parent) { InitializeComponent(); this.MdiParent = parent; } private void Info_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'medicalDataSet.info' table. You can move, or remove it, as needed. //this.infoTableAdapter.Fill(this.medicalDataSet.info); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; comboBox1.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; textBox10.Text = ""; } private void button5_Click(object sender, EventArgs e) { this.Close(); } private void button3_Click(object sender, EventArgs e) { //new button textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; comboBox1.Text = ""; textBox5.Text = ""; textBox6.Text = "";
textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; textBox10.Text = ""; //textBox1.Focus(); SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN-9CF1490E8;Initial Catalog=Medical;Integrated Security=True";
con.Open(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM info", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; int b = (dt.Rows.Count); b++; textBox1.Text = b.ToString(); } private void button2_Click(object sender, EventArgs e) { //insert query try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); //insert query SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO Info VALUES('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + comboBox1.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "')"; cmd.ExecuteNonQuery(); MessageBox.Show("Record is succesfully added", "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information); cmd.Connection.Close(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM info", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; }
catch (Exception s) { MessageBox.Show(s.Message); } finally { //After succeesful insertion, all the fields will be cleared //textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; comboBox1.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; textBox10.Text = ""; //textBoxSrNo.Text = textBoxSrNo.Text + 1; //textBox1.Focus(); } } private void button4_Click(object sender, EventArgs e) { //delete query try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); //delete query SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from [info]"; DialogResult result = MessageBox.Show("Do You Really Want TO Delete This Record", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { textBox1.Focus(); } else { cmd.CommandText = "DELETE FROM [info] WHERE Id= '" + textBox1.Text + "'"; cmd.ExecuteNonQuery(); MessageBox.Show("Selected Record is deleted", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } //cmd.CommandText = "select * from [info]"; cmd.Connection.Close();
SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM info", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; } catch (Exception s) { MessageBox.Show(s.Message); } } private void button6_Click(object sender, EventArgs e) { //update query try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); //update query SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "UPDATE info SET Id ='" + textBox1.Text + "', PartyName ='" + textBox2.Text + "', Name ='" + textBox3.Text + "', Gender ='" + comboBox1.Text + "', Age ='" + textBox5.Text + "', Address ='" + textBox6.Text + "', [Contac-No] ='" + textBox7.Text + "', [Mo-No] ='" + textBox8.Text + "', [Email Address] ='" + textBox9.Text + "', Remarks ='" + textBox10.Text + "' WHERE Id = '" + textBox1.Text + "'"; cmd.ExecuteNonQuery(); MessageBox.Show("Record is succesfully updated", "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information); cmd.Connection.Close(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM info", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; } catch (Exception s) { MessageBox.Show(s.Message); } } private void button1_Click(object sender, EventArgs e) { //next button try {
SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; if (con.State == ConnectionState.Closed) con.Open(); SqlDataAdapter adptr = new SqlDataAdapter("Select * From [info]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i][0] = (i + 1); } id = int.Parse(textBox1.Text); id = id + 1; if (id 0) { button1.Enabled = true; button10.Enabled = true; textBox1.Text = (dt.Rows[id - 1][0]).ToString(); textBox2.Text = (dt.Rows[id - 1][1]).ToString(); textBox3.Text = (dt.Rows[id - 1][2]).ToString(); comboBox1.Text = (dt.Rows[id - 1][3]).ToString(); textBox5.Text = (dt.Rows[id - 1][4]).ToString(); textBox6.Text = (dt.Rows[id - 1][5]).ToString(); textBox7.Text = (dt.Rows[id - 1][6]).ToString(); textBox8.Text = (dt.Rows[id - 1][7]).ToString(); textBox9.Text = (dt.Rows[id - 1][8]).ToString(); textBox10.Text = (dt.Rows[id - 1][9]).ToString(); textBox1.Focus(); con.Close(); } else { button1.Enabled = false; } } catch (Exception s) { MessageBox.Show(s.Message); } } private void panel1_Paint(object sender, PaintEventArgs e) { } } }
ITEM 7 namespace Medical_store { public partial class ItemMaster : Form { public int ch,id; public ItemMaster(Medical_store.Mdi_parent1 parent) { InitializeComponent(); this.MdiParent = parent; } private void ItemMaster_Load(object sender, EventArgs e) {
// TODO: This line of code loads data into the 'medicalDataSet1.Stock' table. You can move, or remove it, as needed. this.stockTableAdapter.Fill(this.medicalDataSet1.Stock); // TODO: This line of code loads data into the 'medicalDataSet._Item_master' table. You can move, or remove it, as needed. this.item_masterTableAdapter.Fill(this.medicalDataSet._Item_master); comboBox1.Text = ""; textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; groupBox3.Enabled=false; SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN-9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM [Itemmaster]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; int b = (dt.Rows.Count); b++; textBox1.Text = b.ToString(); } private void button8_Click(object sender, EventArgs e) { this.Close(); } private void button1_Click(object sender, EventArgs e) { //new button comboBox1.Text = ""; textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN-9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM [Itemmaster]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; int b = (dt.Rows.Count); b++; textBox1.Text = b.ToString(); } private void button2_Click(object sender, EventArgs e)
{ //insert query try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; if (con.State == ConnectionState.Closed) con.Open(); //insert query SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; int a = 0; cmd.CommandText = "INSERT INTO [Item-master] VALUES('" + textBox1.Text + "','" + comboBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "')"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Stock([Company-Name],[Itemid],[Sale-QTY],[Purchase-QTY],[Available-QTY])VALUES ('" + comboBox1.Text + "','" + textBox2.Text + "','" + a + "','" + a + "','" + a + "')"; cmd.ExecuteNonQuery(); MessageBox.Show("Record is succesfully added", "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information); cmd.Connection.Close(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM [Item-master]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; } catch (Exception s) { MessageBox.Show(s.Message); } finally { //After succeesful insertion, all the fields will be cleared comboBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; } } private void button4_Click(object sender, EventArgs e) { //update query try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open();
//update query SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "UPDATE [Item-master] SET [Sr-NO] = '" + textBox1.Text + "',[Company-Name] = '" + comboBox1.Text + "',[Item-id]='" + textBox2.Text + "', Prize ='" + textBox3.Text + "' WHERE [Item-id] ='" + textBox2.Text + "'"; cmd.ExecuteNonQuery(); MessageBox.Show("Record is succesfully updated", "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information); cmd.Connection.Close(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM [Item-master]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; } catch (Exception s) { MessageBox.Show(s.Message); } } private void button6_Click(object sender, EventArgs e) { //delete query try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); //delete query SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from [Item-master]"; DialogResult result = MessageBox.Show("Do You Really Want TO Delete This Record", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { textBox1.Focus(); } else { cmd.CommandText = "DELETE FROM [Item-master] WHERE [Item-id]= '" + textBox2.Text + "'"; cmd.ExecuteNonQuery(); MessageBox.Show("Selected Record is deleted", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); }
cmd.Connection.Close(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM [Item-master]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; } catch (Exception s) { MessageBox.Show(s.Message); } } private void button7_Click(object sender, EventArgs e) { groupBox3.Enabled = true; radioButton1.Focus(); } private void button11_Click(object sender, EventArgs e) { //search Ok button try { SqlConnection conn = new SqlConnection(); conn.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; if (conn.State == ConnectionState.Closed) conn.Open(); SqlCommand cmd = new SqlCommand(); cmd = conn.CreateCommand(); cmd.CommandType = CommandType.Text; if (ch == 1) { cmd.CommandText = "SELECT * FROM [Item-master] WHERE [Item-id] = '" + textBox4.Text + "' "; SqlDataAdapter adptr = new SqlDataAdapter(cmd.CommandText, conn); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; MessageBox.Show("Record Found", "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information); //groupBox3.Hide(); int s = int.Parse(textBox4.Text); s--; groupBox1.Show(); textBox1.Text = (dt.Rows[s][0]).ToString(); comboBox1.Text = (dt.Rows[s][1]).ToString(); textBox2.Text = (dt.Rows[s][2]).ToString(); textBox3.Text = (dt.Rows[s][3]).ToString();
textBox1.Focus(); } if (ch == 2) { cmd.CommandText = "SELECT * FROM [Item-master] WHERE [Company-Name] = '" + textBox5.Text + "' "; SqlDataAdapter adptr = new SqlDataAdapter(cmd.CommandText, conn); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; MessageBox.Show((dt.Rows.Count).ToString(), "No.Of Record Found", MessageBoxButtons.OK); } if (ch == 3) { cmd.CommandText = "SELECT * FROM [Item-master] WHERE Prize = '" + textBox6.Text + "' "; SqlDataAdapter adptr = new SqlDataAdapter(cmd.CommandText, conn); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; MessageBox.Show((dt.Rows.Count).ToString(), "No.Of Record Found", MessageBoxButtons.OK); } //groupBox1.Hide(); //buttonRefresh.Show(); conn.Close(); } catch (Exception s) { //MessageBox.Show(s.Message); } } private void button12_Click(object sender, EventArgs e) { groupBox3.Enabled = false; } private void button5_Click(object sender, EventArgs e) { //next button try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; if (con.State == ConnectionState.Closed) con.Open();
SqlDataAdapter adptr = new SqlDataAdapter("Select * From [Item-master]", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i][0] = (i + 1); } id = int.Parse(textBox1.Text); id = id + 1; if (id 0) { button5.Enabled = true; button10.Enabled = true; textBox1.Text = (dt.Rows[id - 1][0]).ToString(); comboBox1.Text = (dt.Rows[id - 1][1]).ToString(); textBox2.Text = (dt.Rows[id - 1][2]).ToString(); textBox3.Text = (dt.Rows[id - 1][3]).ToString();
//textBox1.Focus(); con.Close(); } else
{ button10.Enabled = false; } } catch (Exception s) { MessageBox.Show(s.Message); } } private void textBox3_TextChanged(object sender, EventArgs e) { } private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (radioButton1.Checked) { ch = 1; textBox4.Enabled = true; textBox5.Enabled = false; textBox6.Enabled = false; } } private void radioButton2_CheckedChanged(object sender, EventArgs e) { if (radioButton2.Checked) { ch = 2; textBox4.Enabled = false; textBox5.Enabled = true; textBox6.Enabled = false; } } private void radioButton3_CheckedChanged(object sender, EventArgs e) { if (radioButton3.Checked) { ch = 3; textBox4.Enabled = false; textBox5.Enabled = false; textBox6.Enabled = true; } } } }
Item Stock 8 namespace Medical_store { public partial class itemStock : Form { public itemStock(Medical_store.Mdi_parent1 parent) { InitializeComponent(); this.MdiParent = parent; } private void itemStock_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'medicalDataSet1.Stock' table. You can move, or remove it, as needed. // this.stockTableAdapter.Fill(this.medicalDataSet1.Stock); } private void button1_Click(object sender, EventArgs e) { this.Close(); } } }
Mdi Parent 9 namespace Medical_store { public partial class Mdi_parent1 : Form { private int childFormNumber = 0; public Mdi_parent1() { InitializeComponent(); } private void ShowNewForm(object sender, EventArgs e) { Form childForm = new Form(); childForm.MdiParent = this; childForm.Text = "Window " + childFormNumber++; childForm.Show(); } private void OpenFile(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
openFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string FileName = openFileDialog.FileName; } } private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); saveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { string FileName = saveFileDialog.FileName; } } private void ExitToolsStripMenuItem_Click(object sender, EventArgs e) { this.Close(); } private void CutToolStripMenuItem_Click(object sender, EventArgs e) { } private void CopyToolStripMenuItem_Click(object sender, EventArgs e) { } private void PasteToolStripMenuItem_Click(object sender, EventArgs e) { } private void ToolBarToolStripMenuItem_Click(object sender, EventArgs e) { // toolStrip.Visible = toolBarToolStripMenuItem.Checked; } private void StatusBarToolStripMenuItem_Click(object sender, EventArgs e) { statusStrip.Visible = statusBarToolStripMenuItem.Checked; } private void CascadeToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.Cascade); }
private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileVertical); } private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileHorizontal); } private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.ArrangeIcons); } private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form childForm in MdiChildren) { childForm.Close(); } } private void viewMenu_Click(object sender, EventArgs e) { } private void toolsMenu_Click(object sender, EventArgs e) { } private void windowsMenu_Click(object sender, EventArgs e) { } private void infoToolStripMenuItem_Click(object sender, EventArgs e) { Info child = new Info(this); child.Show(); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } private void modelMasterToolStripMenuItem_Click(object sender, EventArgs e) { ItemMaster child = new ItemMaster(this); child.Show(); }
private void supplierMasterToolStripMenuItem_Click(object sender, EventArgs e) { SupplierMaster child = new SupplierMaster(this); child.Show(); } private void customerMasterToolStripMenuItem_Click(object sender, EventArgs e) { Customermaster child = new Customermaster(this); child.Show(); } private void purchaseLedgerToolStripMenuItem_Click(object sender, EventArgs e) { PurechaseBill child = new PurechaseBill(this); child.Show(); } private void salesLedgerToolStripMenuItem_Click(object sender, EventArgs e) { SaleBill child = new SaleBill(this); child.Show(); } private void salesRegisterToolStripMenuItem_Click(object sender, EventArgs e) { salesreg child = new salesreg(this); child.Show(); } private void purchaseRegisterToolStripMenuItem_Click(object sender, EventArgs e) { PurchaseReg child = new PurchaseReg(this); child.Show(); } private void itemStockRegisterToolStripMenuItem_Click(object sender, EventArgs e) { itemStock child = new itemStock(this); child.Show(); } private void calenderToolStripMenuItem_Click(object sender, EventArgs e) { Calander child = new Calander(this); child.Show(); } private void contactUsToolStripMenuItem_Click(object sender, EventArgs e) { ContactUs child = new ContactUs(this);
child.Show(); } private void calculatorToolStripMenuItem_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start("calc"); } private void wordpadToolStripMenuItem_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start("wordpad"); } private void accountToolStripMenuItem1_Click(object sender, EventArgs e) { loginEditcs child = new loginEditcs(this); child.Show(); } } }
Purchase 10 namespace Medical_store { public partial class PurchaseReg : Form { public PurchaseReg(Medical_store.Mdi_parent1 parent) { InitializeComponent(); this.MdiParent = parent; } private void PurchaseReg_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'medicalDataSet5._Purchase_Final' table. You can move, or remove it, as needed. // this.purchase_FinalTableAdapter.Fill(this.medicalDataSet5._Purchase_Final); } private void button1_Click(object sender, EventArgs e) { this.Close(); } private void button2_Click(object sender, EventArgs e) { //Total AMT try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN-9CF1490E89CF1490E8-9CF1490E8-9CF1490E8-9CF1490E8-9CF1490E8;Initial Catalog=Medical;Integrated Security=True";
if (con.State == ConnectionState.Closed) con.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "select [Bill-No],Date,[PartyName],[Total-Net-AMT],[Total-Vat-AMT],[Total-AMT] FROM [Purchase-Final]"; SqlDataReader dar = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dar); dataGridView1.DataSource = dt; double total = 0; for (int i = 0; i < dataGridView1.Rows.Count; i++) { total += Convert.ToDouble(dataGridView1.Rows[i].Cells[5].Value.ToString().Trim()); textBox1.Text = total.ToString().Trim(); } //textBox1.Text = total.ToString().Trim(); con.Close(); } catch (Exception S) { //MessageBox.Show(S.Message); } } } }
Purchase Bill 11 namespace Medical_store { public partial class PurechaseBill : Form { public string st, st1; public int id; public PurechaseBill(Medical_store.Mdi_parent1 parent) { InitializeComponent(); this.MdiParent = parent; }
private void PurechaseBill_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'medicalDataSet._Item_master' table. You can move, or remove it, as needed. // this.item_masterTableAdapter.Fill(this.medicalDataSet._Item_master); // TODO: This line of code loads data into the 'medicalDataSet2._supplier_master' table. You can move, or remove it, as needed. //this.supplier_masterTableAdapter.Fill(this.medicalDataSet2._supplier_mast er); // TODO: This line of code loads data into the 'medicalDataSet1.Stock' table. You can move, or remove it, as needed. // this.stockTableAdapter.Fill(this.medicalDataSet1.Stock); // TODO: This line of code loads data into the 'medicalDataSet5._Purchase_Final' table. You can move, or remove it, as needed. //this.purchase_FinalTableAdapter.Fill(this.medicalDataSet5._Purchase_Final ); // TODO: This line of code loads data into the 'medicalDataSet5.Purchase' table. You can move, or remove it, as needed. //this.purchaseTableAdapter.Fill(this.medicalDataSet5.Purchase); // dataGridView2.Hide(); textBox10.Text = ""; comboBox1.Text = ""; textBox2.Text = ""; comboBox2.Text = ""; comboBox3.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox11.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = "";
SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN-9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); SqlDataAdapter adptr1 = new SqlDataAdapter("SELECT * FROM [Purchase-Final]", con); DataSet ds1 = new DataSet(); adptr1.Fill(ds1); DataTable dt1 = ds1.Tables[0]; dataGridView1.DataSource = dt1; int b = (dt1.Rows.Count); b++; textBox1.Text = b.ToString(); }
private void button8_Click(object sender, EventArgs e) { this.Close(); } private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { } private void button2_Click(object sender, EventArgs e) { //Clear Button textBox2.Text = ""; comboBox2.Text = ""; comboBox3.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox11.Text = ""; SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN-9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT * FROM Purchase", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; dataGridView1.DataSource = dt; int b = (dt.Rows.Count); b++; textBox2.Text = b.ToString(); } private void button3_Click(object sender, EventArgs e) { //add button //insert into purchase query update into stock try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); //insert into purchase SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT [Company-Name],[Item-id],[SaleQTY],[Purchase-QTY],[Available-QTY] FROM Stock WHERE [Item-id]='" + comboBox3.Text + "'";
SqlDataReader dar = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dar); dataGridView2.DataSource = dt; int q3=0,q1,q2,q4,q5=0; q1 =int.Parse(textBox5.Text); q2 = Convert.ToInt32(dataGridView2.Rows[0].Cells[3].Value.ToString().Trim()); q3 = q1 + q2; q4 = Convert.ToInt32(dataGridView2.Rows[0].Cells[4].Value.ToString().Trim()); q5 = q1 + q4; cmd.CommandText = "UPDATE Stock SET [Company-Name] ='" + comboBox2.Text + "', [Item-id] ='" + comboBox3.Text + "', [Purchase-QTY] ='" + q3 + "',[Available-QTY]='" + q5 + "' WHERE [Item-id] ='" + comboBox3.Text + "'"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Purchase VALUES('" + textBox1.Text + "','" + textBox10.Text + "','" + comboBox1.Text + "','" + textBox2.Text + "','" + comboBox2.Text + "','" + comboBox3.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox11.Text + "')"; cmd.ExecuteNonQuery(); MessageBox.Show("Record is succesfully added", "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information); DataSet ds = new DataSet(); SqlDataAdapter adptr = new SqlDataAdapter("SELECT [BillNo],Date,[Party-Name],[Sr.No],[Company-Name],[ModelId],Prize,Vat,Qty,[Total-vat],[Total-Prize] FROM Purchase WHERE [BillNo]='" + textBox1.Text + "'", con); //DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt1 = ds.Tables[0]; dataGridView1.DataSource = dt1; dataGridView1.Rows.Add(); cmd.Connection.Close(); } catch (Exception S) { //MessageBox.Show(S.Message); } } private void button4_Click(object sender, EventArgs e) { //delete from purchase //update into stock try { SqlConnection con = new SqlConnection();
con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; con.Open(); //delete query SqlCommand cmd = new SqlCommand(); cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from Purchase"; DialogResult result = MessageBox.Show("Do You Really Want TO Delete This Record", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { textBox2.Focus(); } else { cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT [Company-Name],[Itemid],[Sale-QTY],[Purchase-QTY],[Available-QTY] FROM Stock WHERE [Item-id]='" + comboBox3.Text + "'"; SqlDataReader dar = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(dar); dataGridView2.DataSource = dt; int q3 = 0, q1, q2, q4, q5 = 0; q1 = int.Parse(textBox5.Text); q2 = Convert.ToInt32(dataGridView2.Rows[0].Cells[3].Value.ToString().Trim()); q3 = q2 - q1; q4 = Convert.ToInt32(dataGridView2.Rows[0].Cells[4].Value.ToString().Trim()); q5 = q4 - q1; cmd.CommandText = "UPDATE Stock SET [Company-Name] ='" + comboBox2.Text + "', [Item-id] ='" + comboBox3.Text + "', [Purchase-QTY] ='" + q3 + "',[Available-QTY]='" + q5 + "' WHERE [Item-id] ='" + comboBox3.Text + "'"; cmd.ExecuteNonQuery(); cmd.CommandText = "DELETE FROM Purchase WHERE [BillNo]= '" + textBox1.Text + "' AND [Sr.No] = '" + textBox2.Text + "' AND [Model-Id]='" + comboBox3.Text + "'"; cmd.ExecuteNonQuery(); MessageBox.Show("Selected Record is deleted", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); }
//cmd.CommandText = "select * from Purchase ";
} catch (Exception s) { MessageBox.Show(s.Message); } } private void button12_Click(object sender, EventArgs e) { //next button try { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=HIREN9CF1490E8;Initial Catalog=Medical;Integrated Security=True"; if (con.State == ConnectionState.Closed) con.Open(); SqlDataAdapter adptr = new SqlDataAdapter("Select * From Purchase Where [Bill-No]='" + textBox1.Text + "'", con); DataSet ds = new DataSet(); adptr.Fill(ds); DataTable dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i][0] = (i + 1); } id = int.Parse(textBox2.Text); id = id + 1; if (id
View more...
Comments