Sunteți pe pagina 1din 312

BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

CHAPTER I
THE PROBLEM AND ITS BACKGROUND

Introduction

In a professional basketball scoring system, whether international, national or

local leagues, teams score two points for baskets made by players shooting from the

three-point arc and three points for baskets made from beyond the three-point arc. A

basket scored can count as one, two or three points, depending on your shooting

location. A free throw remains the only way to score outside of gameplay, as it occurs

after a whistle. Basketball rules determine when you will have an uncontested free

throw worth one point. The dimensions of the basketball court determine where a shot

must originate for it to count as three points. Scoring of these statistical references (such

as Field Goals, Fouls and Timeouts) is recorded in a specified score sheet. The

bookkeeper and the game statistician are tabulating this score sheet.

On another hand, statistical analysis is about constructing a sense of a set of data

or a series of interpretations. Statistical analysis can summarize and even illuminate a

set of data, depending on the type of analysis performed. In the case of basketball

games, statistical analysis involve of how many Field Goals, Fouls, Timeouts, etc., that

each team had made in a period, a half-time, a game or a season. Basketball statistical

evaluation ranges from basic to advance, depending if the game is a local (such as

barangay basketballs) or major league (collegiate and national basketballs).

Scores and statistical analysis of the game are just two of the most important

elements of each sports events. Committing errors on performing these tasks will surely

ruin the credibility of the game and of the organization who organized the sports events.

1
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Most of the errors, if it is not human errors, are sole because of the manual system used

in gathering the scores and computing the statistics of the game. These errors vary from

a simple wrong stroke of a pen to losing the scorebooks.

Lucena City Sports Office is the organization focused on the recreational and

sports activities such as basketball leagues in the City of Lucena. Mr. Arnold R. Riego

is a professional basketball official serving the organization. He started working as a

professional basketball official as a referee since 1999, that is when the first Basketball

Governor‟s Cup in Quezon was held. The organization used the traditional pen-and-

paper system of recording scores and computing statistical evaluation of teams and

players. They use a modified score sheet designed for the annual inter-barangay

basketball league of Lucena City.

They encounter some problems whenever they handle basketball leagues or

competitions. Two of these problems are: (1) the accuracy and reliability of the score

sheet. The official score sheet is more superior to the digital scoreboard. If the scorer is

not attentive on recording the scores or if the digital scoreboard does not match what the

records in the official score sheet, then the problem arises; and (2) they do not have a

permanent office for almost a year already and some of their records of the past inter-

barangay basketball games are missing. Thus, these problems will diminish the

formality and reliability of the future games.

The researchers‟ aim is to take the scoring and statistical evaluation of every

inter-barangay games to the higher level: organized, more efficient, quick, less error,

less time- and cost-consuming. It will also give the sports committee the statistical

computation in just a few clicks. The system will organize all the records in a secured

2
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

database, generates reports of every important stats of the game. Lucena City Sports

Office is looking for better ways to provide greater and higher quality basketball

leagues. The Computer-based Basketball Scoring and Statistical Evaluation System is

considered to serve as a tool to meet the growing demands of the organization.

Statement of the Problem

The study generally aimed to develop a Computer-based Basketball Scoring and

Statistical Evaluation System for Lucena City Sports Office that will improve and

enhance the ability in giving faster and accurate recording of scores and computing of

statistical computations of the players and teams.

Specifically, the study sought to answer the following questions:

1. What are the needs of Lucena City Sports Office in scoring and statistical

evaluation?

2. What is the most feasible (that is, best and possible) program to replace the

manual scoring and statistical evaluation system of Lucena City Sports Office in

terms of:

a. Scoring

b. Statistical evaluation of players and teams

c. Security of records

3. What is the client‟s evaluation of the proposed Computer-based Basketball

Scoring and Statistical Evaluation System for Lucena City Sports Office based on

ISO 9126 Software Quality Characteristics in terms of:

a. Usability

3
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

b. Efficiency

c. Functionality

d. Reliability

Objective of the Study

The study aims to develop the Computer-based Basketball Scoring and

Statistical Evaluation System that will improve the scoring and statistical evaluation of

their every basketball games.

The researchers‟ objectives for this study are the following:

1. To analyze the existing problems of the manual scoring and statistical evaluation

system used by the Lucena City Sports Office in terms of:

a. Scoring

b. Statistical evaluation of players and teams

c. Security of records

2. To develop the most viable program to replace the existing system of the Lucena

City Sports Office; and

3. To assess the proposed Computer-based Basketball Scoring and Statistical

Evaluation System to Lucena City Sports Office based on ISO 9126 Software

Quality Characteristics in terms of:

a. Usability

b. Efficiency

c. Functionality

d. Reliability

4
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Scope and Limitation of the Study

Computer-based Basketball Scoring and Statistical Evaluation is software that

allows the users to record the Field Goals and add other basketball stats such as Fouls

and Timeouts. Computations of the statistical evaluation of each team and players will

show automatically after all the inputs are filled up. The system provides an auto-

generated print of all records of score sheets and computed statistical of each team. The

system will also provide digital registration forms of every team, players, coaches and

officials who will be involved in every game. This will be stored electronically in the

database of the proposed system for future use. According to FIBA Official Basketball

Rules 2014, the registration of line-up players must be held at least 20 minutes before

the game begins and at least 10 minutes before the game, coaches must give the names

of five players who are to start the game.

Furthermore, this study is limited to the Lucena City Sports Office and its staff

only. This is also limited to basketball scoring and statistical evaluating of each team

and their players per game and per season only of the inter-barangay basketball games

and in Senior and Junior division. Other features, such as running score-game clock

features, score sheet and digital scoreboard connection and higher stats (Assists,

Rebounds, Turnovers, etc.) are not included.

The proposed system‟s Time Outs, Fouls and Scoring processes are based on

FIBA Official Basketball Rules 2014. Other rules that are not directly related to the

features of the proposed system are not or least considered by the researchers.

5
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Definition of Terms

The following terms are operationally defined terms for a better understanding

of the readers:

Computer-based System - is a complex system wherein information technology is

applied and diminishes time and cost spent on the task. This system includes a database

and at least one computer workstation connected to an integrated activities management

system.

Efficiency - this characteristic is concerned with the system resources used when

providing the required functionality.

Free-Throw Shot – shooting the ball to the basket outside of gameplay, as it occurs

after a whistle.

Functionality - is the essential purpose of the system.

Field Goal – a point earned when the ball shot on the basket on running time. Scores

depend on the location where he released the ball from his hand.

FIBA Official Basketball Rules 2014 – is the most recent international rules of

basketball that are approved on February 2, 2014, by FIBA (Federacion Internationale

de Basket-ball, or International Basketball Federation) and became effective October 1

of the year.

Fouls - an infraction of the rules concerning illegal personal contact with an opponent

and/or unsportsmanlike behavior.

ISO 9126 Software Quality Characteristics - is an international standard for the

evaluation of software. The standard is divided into four parts which address,

6
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

respectively, the following subjects: quality model; external metrics; internal metrics;

and quality in use metrics.

Maintainability – is the ability to identify and fix a fault within a software component is

what the maintainability characteristic addresses.

Manual System – is the use of pen and paper in performing a certain task.

Record – is the information stored in the system that is needed when they were making

reports.

Reliability – the capability of the system to maintain its service provision under defined

conditions for defined periods of time.

Scoring - A usually numerical record of a competitive event.

Statistical Analysis - is a component of data analytics. It involves collecting and

scrutinizing every data sample (such as Field Goals) in a set of items from which

samples can be drawn.

Three-point Field Goals - score gain after shooting the basketball to the basket made

from beyond the three-point arc.

Timeout - an interruption of the game requested by the coach or assistant coach.

Two-point Field Goals – score gain after shooting the basketball to the basket within

the three-point arc.

Usability – refers to the ease of use for a given function.

7
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

CHAPTER II
REVIEW OF THE RELATED LITERATURE AND STUDIES

This part focuses on related literature and study in the foreign and local setting.

The researchers gathered information through the help of internet, books, dissertations

and other forms of the medium that are available on their surroundings.

REVIEW OF RELATED LITERATURE

Computer Technology and Sports

From America to the Philippines, from Miami to Manila, computers are swiftly

becoming a part of the world of sports competition in the joy of triumph and the agony

of loss. Almost all sports official will say that computers are adding to the enjoyment of

both eyewitness and player alike. The use of these machines to score and time the

outcome of different sports, according to Eifler (2013), is almost as rapidly growing as

several of the sports themselves.

Technology is indeed growing as the researchers speak not only globally but

also locally; not only in the offices and industries but also in sports. Things that are

traditional are now being made virtually obsolete and replaced by digital ones,

Anyayahan (2011) wrote. The Philippines, with the influence of her neighbor countries,

are now adopting a new age: from manual systems of everything into computerized

systems. Examples of this, the National Automated Elections made the voting

mechanisms of the past years much faster and mass-broadcast and PBA‟s live streaming

of their every game. Technologically speaking, the Philippines is indeed evolving.

8
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

A computer-based system for managing workflow of particular kinds of actions

consists of a database and at least one computer workspace linked to an assimilated

activities managing system. Gardner (2013) wrote that innovation has made possible for

the operation of the computer easy enough in processing record systems such as the

creation of data records, storing, filing, and retrieval of data. Basketball scoring

processes in the same way: scores made by players is gestured by the referee and the

score booker will record it to the scorebook. The score will also display to the digital

scoreboard to be seen by the audience. One of the responsibilities of the basketball

committee is to keep each team‟s score data secured for their records and purposes.

Fort Worth Star-Telegram (2012) published a formal literature about their

prototype system pertaining to rating procedures and resulting accuracy of basketball

and football. This correspondence is unique in documenting a least squares system

resulting in college and pro football predictions. Basketball predictions have also been

premeditated. This system requires only past scores and opponents and precedes

directly from classical least squares, no learning of algorithm factors being required.

Accuracy is highly viable with all calculations to which evaluations have been made.

Benefits of Computer-based and Automated Systems

Because the automated scheme has become essential to small and big

organizations, they are expected to give the best services possible. Nevertheless, some

still prefer sticking with the system that is not integrated with technology. Probable

causes are computer illiterate staff and lack of funds. Companies, especially the big

ones are recommended to switch from manual to automated systems because this will

9
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

improve the efficiency and productivity of the business which will uplift the industry‟s

reputation. A computer-based system, according to Mondigo (2011), is a multifaceted

system in which information technology plays a main part. It makes the works easier,

quicker and more precise.

The rudimentary gains of the automated system are to make the course

proficient and fast which means they can process information much more swiftly than

humans (Navales, 2015). Scoring in basketball and its statistical evaluation done in a

manual way cannot compete globally because it consumes much time and much effort

and cost are used to maintain and store the data. The recovery of data is very sluggish

that it has to be sought in heaps of registers and these waste lots of time. In the current

system, scorebooks are logged manually that causes records to be not always

dependable as it is handwritten and some human errors might have happened. Most

records are saved and kept in filing cabinets and this consumes a lot of space.

Computerized statistical analysis of sports events such as in basketball leagues

makes every game more amusing and electronically prophesies the result of the

upcoming games. Virtually everyone, wrote Stefani (2010), has attempted to predict the

outcome of some sporting event. He focuses in asserting that it should be no surprise

that automated sports ratings, such as basketball, football and alike, predate both high-

speed digital computers and wire service ratings.

In this period of instantaneous replay and on-the-spot evaluation by TV

commentators, there is no boundary for error, Advincula (2011) wrote in her blog.

Ending results are expected - or in some circumstances, required - immediately upon

conclusion of a certain incident. The human mind is merely incapable of expressing

10
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

who gilts 4,657th in a marathon of 7,000, let only how distant in advance of the next

runner this individual is. A computer can. The sharpest arithmetician cannot promptly

compute the average total of numerous judges at an aerobics competition. A computer

can. The most trustworthy statistician cannot immediately output a statistical evaluation

of 12 to 30 basketball players who roam the court in just a jiffy. A computer can. A

thousand cabinets full of scorebooks of the past games and leagues cannot fit in the

grasp of the hand. A computer can.

Synthesis

Thus, the researchers gave the significance of the studying the related literature

to be able to justify the relevance, validity, and feasibility of the reviewed studies. The

researchers had managed to adopt some goals of related literature for the development

of the Computer-based Basketball Scoring and Statistical Evaluation System for Lucena

City Sports Office.

The literature stated above shows that a computerized scoring and statistical

evaluation system is an efficient and competitive tool in this contemporary time of

sports. Lucena City Sports Office will be able to modernize as well as to improve their

task by adopting a computerized system. In relation to the proposed system, the

literature stated above namely discussed the similarities and differences for the study of

the researchers‟ proposed system. The review of related literature serves as evidence

that a proposed system is an effective tool in a better way of managing the different

activities that are connected in recording, scoring and computing statistical evaluation

of basketball games.

11
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

REVIEW OF RELATED STUDIES

Information Technology in Sports Industries and Events

Sports and Information Technology are somehow getting “married”. From

National Basketball Association (NBA) of USA to International Basketball Federation

(FIBA) nowadays are not just pure ball shootings and dribbles but also an incredible

show off technology. These ranges from superb and high-definition live streaming of

the game to always updated statistical analysis of the scorebook.

Portable Touch Screen PC-Based Basketball Scoreboard Synchronizer via

Zigbee (Barroquillo et. al., 2012), made by the students of Mapua Institute of

Technology, is a wireless knowledge created to be modest and inexpensive than other

wireless Private Area Network (PAN). It is created for radio-frequency purposes that

need little data speed, extended battery life shelves, and locked networking. A

scoreboard is a big panel that holds connected facts on a specific game such as

basketball. It customarily shows the existing scores and time of a sport. Cords and

cables to its rheostat typically link scoreboards but with their scheme, the necessity for

cables is removed. They built a model scoreboard and formed a system with C# that

runs on a Windows-based computer. The scoreboard is linked wirelessly to the

computer using Zigbee technology. Touchscreen equipment is connected to the

computer for the comfort of usage. The computer shows the records through a

transceiver and obtained by the scoreboard recipient. There are insignificant intervals

that will not be seen by a person, the limit of the signal scopes up to 100 meters, and is

not hindered by obstacles. The model can be operated on street or barangay association

12
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

basketball competitions. The system is encoded for basketball but with a minor

alteration, it can be operated in other athletic events as well.

The System Design of Wireless Basketball Timer-Based on MCU and

NRF24L01 (Chua & Maranan, 2013) proves that sports and computer technology's

union is necessary nowadays. Currently, basketball players obliged discern the

development fit in time in the competition, the existence of electronic timer with LED

display impacts the basketball competition. The tapped operation affects the mechanism

expanse, mechanism consistency, mechanism efficacy and others. So in what way to

sort it lengthier, anti-interference, stress-free process, and great competence is a

problematic glitch. A sort of wireless basketball clock is aimed built on microcomputer

unit (MCU) and wireless nRF24L01 unit to recompense for the present difficulties,

which has LED digital cylinder of huge dimension for the section digit show and

medium dimensions for game display and 24s display. The operator is tranquil to

convey and manage the clock wirelessly at whichever location on the basketball court

by means of directing mechanism device. The assessment outcomes display that the

scheme, stress-free to operate and firm to function, is dependable to conduct the

wireless data.

The design of Timing and Score Device for Basketball Competitions (Carlos, et.

al, 2015) is a device is built on P89V51RB2 single-chip microcomputer, by means of

ZLG7289B peripheral display handling chip and with seven- part digital cylinder

organized with LED dot matrix to display the clock and score of the competitions. The

scheme can display the existing segment, the remaining time and the score, concurring

to real situations, the time and score can be modified.

13
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

The Control System in Basketball Scoreboard built in 89C51 SCM (Navarro, et.

al., 2016), presented by the students of De La Salle University of Manila, is to present

main control unit, to 16 × 16 dot matrix LED display unit for the scoreboard of the

features of the hardware and DBUG software, VB, programming.89C51, and PC

communications, to complete the hexadecimal code although the completion of data

storage, display, and simulation managing cycle. The scheme can be disconnected and

nonstop lasting process, is modest in structure, low price at the same moment can

display a limitless increase of the size, this is additional identical level products is

unparalleled.

Prototype of the Time and Score of Basketball Competition Built on Single-

Chip Computer (Pagkaliwagan & Bilaro, 2016) is clock-score program is attained by

means of 89C51, the program not only has the capability that the entire period is fixed

via software and the entire countdown is attained, and concurring to the guidelines,

offensive team had better create a shooting action in 24 seconds, else be considered as

illegal, so a 24 second countdown scheme is desired, nonetheless also the scores of two

sides are documented on the scoreboard. The clock button process and LED display are

operated in this scheme. The part of the software is modified and repaired. In the end,

software and hardware are joint well. The modular scheme, straightforward procedure

edifice, strong command and easy to organize, repair and alter are utilized.

Williamson (2012) published a system which used such factors as the hardness

of schedule, gameness, and a "guts" factor combined by calculus and least squares. An

intricate filing system implemented by a clerical staff and mini computers allowed him

14
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

to rate 400 college teams. This study tries to measure basketball players‟ strength and

weaknesses on the court in a computerized way – faster, less error and informative.

On the other hand, Litkenhaus (2012) of Vanderbilt University has provided

computer-aided high school football and basketball ratings for the Nashville Banner,

resulting in a state championship trophy. His study and the outcome support that

computerized system capable of “prophesying” more reliable than of manual system of

what will happen on next game.

In 2015, Mintz developed Compusport. Football predictions and ratings are

carried by more than 20 teams. The factors were generated by trial and error using

several hundred past game results. Compusport claims 75 percent accuracy in college

football, 71-72 percent accuracy in pro-football, and 55-58 percent correctness against

the point spread. Such system increased the every team‟s competitiveness.

The software tournament system, published by R2sports in 2012, and the

association Administrator application are both unified with the R2sports status

software and create it stress-free for recording game outcomes to recalculate the

standings after every event. Afterward, the Administrator has registered all game

outcomes they click the last link to conduct results to the ranking software. The sports

association ranking system has shifter selections that permit handlers to narrow

standing searches down by a particular extent or age group. You can also examine for a

competitor's name to get their bout account. Players are recorded with the maximum

ranked one in the search showing first, and then it carries on recording players by

standing spot. After an event acquiesces for outcomes and a competitor's spot in the

15
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

standing software has altered, the standing order also alters spontaneously on the

standings sheet on the website and bout history is enhanced to their sketch.

A system entitled Book-it Basketball Scoring System 3.0 Enter Statistic

published by downloadroute (2012) was created to permit the user to input statistics for

basketball competitions publically. The scheme permits for access of attempt position,

fouls, assists, steals, blocked shots, time out info and others. News present is shooting

one hundredth free throws, field goals and three-point shots for every player on

opposing teams. Information for numerous competitions is accessible after the

competitions statistics is inputted. A competitor's stats can be inputted if the

competition has previously been played. A measurement only, competition databank

folder can be joined with packed competition archives for numerous competition bout.

Pictures can be kept and showed alongside with competitor sketches. This system

contains clear graphs that display where all players made and missed shots. This

shareware platform was aimed to handle regeneration group running clock playoffs or

playoffs played in pro setups. Operate quarters or halves - Change of shot hues to select

from - Display competition bouts by quarters, halves or for finalized playoffs. Furnish

statistics to your preferred player to display how their performance is moving ahead.

Synthesis

The studies mentioned above, however, are to some extent related to the

researchers‟ study. Fundamentally, these studies will aid to build a new form of

managing the scoring system and statistical evaluation for basketball, which eliminates

the manual work of computing and analyzing data. The researchers‟ study gave

16
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

importance on studying some relative literature and studies to be able to justify the

relevance and feasibility of the proposed system. These studies help the researchers

understand the topic better because it clarifies vague points about the problems arising

during the development of the study. It also guides the researchers in making

comparisons between their findings with findings of other similar studies. Therefore, it

is necessary that the related materials should have true value.

The system helps the officials to record and analyze easily the data. It stated

that in terms of technology, communication becomes faster and easier in a tap of a

fingertip. The researchers collected data and information come from the related local

and foreign studies that helped the proponent in conceptualizing and visualizing the

possible output for the proposed system.

The literature and studies mention previously have similarities with the

developed system they have similarities in terms of goals and objectives that they

wanted to attain and to achieve, for better work of the staffs and officials. The related

literature and studies would serve as a proof that the developed system is yet effective

as its implementation.

This proves that the developed system will be an as effective tool in providing

better service for the staff, officials, and management.

17
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

CHAPTER III
RESEARCH METHODOLOGY

This chapter presents the methods used by the researchers in conducting the

study. It involved the research design of the said study, the sampling technique used,

the locale and instrumentation utilized, as well as brief discussion of the statistical

treatment and system planning of the study.

The researchers used the descriptive and developmental research with the

application of a set of facts or information regarding the system. It involved

observations, surveys, and interviews for the development of the said system. This type

of research may be used to reveal summary statistics by showing all respondents to all

possible questionnaire items. This method was employed because this type of research

method can be useful for the collection of data on phenomena that cannot be directly

observed. Questionnaires were employed in collecting data from respondents.

The researchers in developing the proposed system had utilized the

developmental research in the inclusion of the Software Development Life Cycle

(SDLC) since it has the inability to handle programs with complex needs.

System Planning

This is the first phase of the SDLC. The researchers looked for a client for

whom the system will be a help in specific tasks of their organization. The client

allowed the researchers to conduct studies about their existing system. This is when the

researchers decided a title for the study. After the title has been decided, the researchers

asked for the organization‟s permission and approval for the participation of the

18
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

researchers. After the title has been approved, the researchers found some related

studies and literature for the feasibility, using books, the Internet, and other theses. The

researchers observed that the organization has a problem in the manual system that is

used for the operation of the organization. This includes how they record manually the

score of each team using tally score sheet, which is printed on paper, and pencil,

evaluating the each statistical of the team and each player and how they keep the

records about the activity that they made. After the researchers analyzed the problem of

the company, the researchers planned a system and objectives of the study that will help

the organization.

The researchers started to get the necessary information. The researchers

conducted an interview with the people in charged in that organization. After the

interview and observation, the researchers found out that the association needs an

efficient, reliable, and inexpensive system that can help to the officials and staffs to

make their work easy.

To make the study more accurate and reliable, the researchers conducted a

survey in the organization. The researchers also used browse the Internet and some

libraries to gather more information. The researchers used the descriptive method to

gather the necessary data.

The researchers identified the requirements in organizing all the data and

information needed to achieve the goals needed by the client. After analyzing the

problems and difficulties that the organization encountered, the scope and constraints

have been planned. The objectives of the study have been reviewed and finalized.

19
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

The researchers then designed a program that will solve the Office‟s problems

using Microsoft Visual Studios‟ Visual C# as the platform and SQLite for the database.

The program is a computerized/computer-based of the Official Score Sheet of FIBA

Basketball Rules of 2014. The program underwent consistent consultation with the

client as well with the researcher‟s adviser. The developed system was pre-tested by the

client and made finalized. Then, the program was presented to the client after it was

finalized.

System Analysis

This is the second phase of the SDLC. System analysis phase‟s purpose is to

understand the office requirements and build a logical model of the system. This

includes the process of studying the procedure to identify the researchers‟ purposes and

create the system that will achieve them in an efficient way.

The researchers gathered data in order to understand the process involved, by

the use of identifying problems and also recommend feasible suggestions for improving

the system function. The result of this process is a logical design of a system.

Analysis of the Existing System

The existing system that the Lucena City Sports Office is manual, especially in

terms of record management, scoring and statistical analysis that did not meet the needs

of continuous changes brought by the innovation of the new technologies that caused

the poor processing of the said activities. The Registration Staff encodes the details

about the players and teams manually in the paper. They manually record the score in

20
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

the score sheets that are provided by the by the Registration Staff. The Book Scorer

records all Field Goals, Fouls and Timeouts each team made all throughout the game.

After the activity was done, they keep all the records in the cabinet. Nevertheless,

because they do not have a permanent office to keep a cabinet for record keeping, they

do not keep the score sheets anymore.

Existing Data Flow Diagram

Figure 3.1 Existing Data Flow Diagram

Figure 3.1 shows the existing system‟s data flow diagram of scoring and

statistical evaluation system in actual form. It is a manual process of how they

record/encodes, calculates, analyze the scores and statistics of each team and player

and in how they operate the existing system.

21
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

The Registration Staff records the information about the teams and players and

keeps it. He/she will prepare the official score sheet based on his/her information

gathered. When the game has started, as each team trying their best to earn points, the

Book Scorer records the stats in the score sheet manually. When the activity has done

they keep the recorded data in the cabinet.

Existing Entity Relationship Diagram

Figure 3.2 Existing Entity Relationship Diagram

Figure 3.2 illustrates the entity relationship of the current scoring and statistical

evaluation system of Lucena City Sports Office has a many-to-many relationship. This

shows that the officials are the one in charge of the process of the scoring and

evaluating statistics, it includes the records of the activities of the association.

22
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Existing Process Diagram

Figure 3.3 Existing Process Diagram

Figure 3.3 shows the current process of the existing system Lucena City Sports

Office with more on the manual process. The officials are the one who accesses and

monitor the process.

23
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Operational Analysis of the Existing System

The existing system manages the encoding, recording and evaluating the

statistical standards of each team and player. Since they are doing it manually, there are

times that they commit errors in encoding scores. In addition, keeping the records in a

cabinet is prone to be lost and may be damaged by disaster and paper-infesting pest.

Technical Analysis of the Existing System

Manual operation only uses the traditional operations, which usually lead to

consumption of too much time, sometimes they commit errors in encoding and

sometimes lose records.

Economic Analysis of the Existing System

Comparing the two systems, the existing system is less expensive than the

proposed system about equipment and materials because it just uses ordinary score

sheets, pencil, and calculator, while the proposed system is more expensive because this

needs a computer system and printer. On the other hand, a little more expensive as it is,

the proposed system had the great advantage over the existing system because in the

long run the association will save time and money since the cost of labor for recording

will be minimized and eliminated plus an added features that are very much

advantageous to the activity like; accuracy and reliability of records.

24
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Evaluation of the Existing System

In understanding the existing system, the researchers analyze the process and the

flow of the existing basketball scoring and statistical system of the organization.

The researchers conducted a survey to answer various questions directly from

the people involved in Lucena City Sports Office. The respondents consist of the City

Sports Coordinator, officials, and staff of the said organization.

This study‟s interviews all ten (10) officials of the organization that gave proofs

that the organization was truly having problems with the existing system and the

proposed system was feasible for Lucena City Sports Office in terms of scoring and

statistical evaluation of the players. The researchers used a cluster sampling method.

The data gathered by the researchers were analyzed, computed, and presented in tabular

form. The researchers used statistical treatment in data analysis is the Weighted Mean

Representation with the formula of:

Weighted Mean =

Where: ∑ = summation

w = weight

x = total number of respondents

25
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Usability of the Existing System

Table 3.1: Evaluation Result of the Existing System in Terms of Usability

SA A D SD
Statement (4) (3) (2) (1) Mean Evaluation
1. The system functions as the way 0 2 6
2 2 Disagree
it must. (6) (12)
2. The system design/interface is
1 3 5
user-friendly and guides the user 1 2.4 Disagree
(4) (9) (10)
throughout software operation.
3. The system is easy to understand
2 6
as it was explained to the staffs 0 2 2.2 Disagree
(8) (12)
of Lucena City Sports Office
4. The system can be navigated 8
0 0 2 1.8 Disagree
easily without much effort. (16)
5. The system can be used even if
1 1 5
the users do not have technical 3 2 Disagree
(4) (3) (10)
proficiency.
Grand Weighted Mean 2.6 Disagree

Table 3.1 shows the result from the respondents based on what they experienced

in terms of usability of the existing system. The respondents assessed that the existing

system with a Grand Weighted Mean of 2.6 which is interpreted as a Disagree.

Therefore, the existing system is not usable.

26
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Efficiency of the Existing System

Table 3.2: Evaluation Result of the Existing System in Terms of Efficiency

SA A D SD
Statement (4) (3) (2) (1) Mean Evaluation

1. The system saves time and 1 1 4 Strongly


4 1.9
money. (4) (3) (8) Disagree
2. The system has the fastest ways 2 5 Strongly
0 3 1.9
of locating records. (6) (10) Disagree
3. The scoring and statistical
5 Strongly
evaluation functionality of the 0 0 5 1.5
(10) Disagree
system process efficiently.
2 3 Strongly
4. The system responds quickly. 0 5 1.7
(6) (6) Disagree
2 6
5. The system operates in real time. 0 2 2.2 Disagree
(8) (12)
Strongly
Grand Weighted Mean 1.84
Disagree

Table 3.2 shows the results of the respondents based on what they experienced

in terms of efficiency of the existing system. The respondents assessed that the existing

system with a Grand Weighted Mean of 1.84 which is interpreted as a Strongly Disagree.

Therefore, the existing system is not efficient.

27
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Functionality of the Existing System

Table 3.3: Evaluation Result of the Existing System in Terms of Functionality

SA A D SD
Statement (4) (3) (2) (1) Mean Evaluation
1. The system prevents
2 5 Strongly
unauthorized users to utilize the 0 3 1.9
(6) (10) Disagree
system
2. The system records correct scores 1 4 Strongly
0 5 1.7
and other stats. (4) (8) Disagree

3. The system produces an accurate 2 1 5 Strongly


2 1.8
statistical result. (8) (3) (10) Disagree
4. The system can secure data and 2 3 Strongly
0 5 1.9
information. (8) (6) Disagree
5. The system can print the records 1 4 Strongly
0 5 1.7
correctly. (4) (8) Disagree
Strongly
Grand Weighted Mean 1.8
Disagree

Table 3.3 shows the results of the respondents based on what they experienced

in terms of functionality of the existing system. The respondents assessed that the

existing system with a Grand Weighted Mean of 1.8 which is interpreted as a Strongly

Disagree. Therefore, the existing system is not functional.

28
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Reliability of the Existing System

Table 3.4: Evaluation Result of the Existing System in Terms of Reliability

SA A D SD
Statement (4) (3) (2) (1) Mean Evaluation
1. All records are included in the
1 3 3
system and serve as a reliable 3 2.2 Disagree
(4) (9) (6)
source of information.
2. The system provides a reliable 2 6 Strongly
0 1 1.9
way of securing records. (6) (12) Disagree
3. The system has the ability to
withstand (fault tolerance) from 2 2 4
2 2.4 Disagree
the component, or environmental (8) (6) (8)
failure.
4. The system is able to recover a 1 3 3
3 2.2 Disagree
failed operation. (4) (9) (6)
5. The system provides consistent
1 2 3
and trustworthy behavior and 4 2.0 Disagree
(4) (6) (6)
processes.
Grand Weighted Mean 2.68 Disagree

Table 3.4 shows the results of the respondents based on what they experienced

in terms of reliability of the existing system. The respondents assessed that the existing

system with a Grand Weighted Mean of 2.68 which is interpreted as a Disagree.

Therefore, the existing system is not reliable.

Analysis of the Proposed System

The system entitled Computer-based Basketball Scoring and Statistical

Evaluation System for Lucena City Sports Office was developed to improve the

operation of the activity in terms of usability, efficiency, functionality, and reliability.

29
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

This part of the chapter shows the clear presentation of the proposed system for

the Lucena City Sports Office in terms of operations of their association particularly

scoring and evaluating the statistical standards of each team and player.

The proposed system is easy to operate and very useful. The system operation

will also be more manageable and detailed. It is also inexpensive compared to the

existing system because they do not need to hire a game statistician anymore. The

proposed system will automatically generate statistical evaluations after the user input

all the necessary information and data.

The developed system is technically feasible because facilities are available in

Lucena City Sports Office like computer unit, which is essential for the implementation

of the developed system. By means of this proposed system, the monitoring of the

records and data will not cost much since facilities are available in the organization.

Through the proposed system, the office will be more consistent service using modern

technologies.

30
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Proposed Data Flow Diagram

Figure 3.5 Data Flow Diagram of the Proposed System

Figure 3.5 shows the proposed system data flow diagram of scoring and

statistical evaluation system in computerized form. The diagram shows how the

official operates using the system.

The officials record the details about the players and team, second when the

game has started each team trying their best to earn points and the officials record the

scores in the computerized score sheet, and the system is the one who evaluates and

calculates the result. The system allows the user to view and print the reports.

31
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Proposed Entity Relationship Diagram

Figure 3.6 Entity Relationship Diagram of the Proposed System

Figure 3.6 shows the one-to-many and many-to-one relationships of the system.

It means that the owner entity is connected to many entities which are a menu, home

and log in.

The official has a many-to-one relationship to the login. The login has a one-to-

many relationship with the username and password.

32
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Proposed Process Diagram

Figure 3.7 Process Diagram of the Proposed System

In the proposed system, the officials are the one who operates the system. They

record first the details about the players. Once, the game has started the records the

points of each team, while the other officials calculate and evaluate the statistical

standings of the players and team. Then once the activity is done, they can easily print

and view the reports.

33
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Operational Analysis of the Proposed System

The proposed system entitled Computer-based Basketball Scoring and Statistical

Evaluation System for Lucena City Sports Office would be a very effective method for

all the activities and also procedures will be systemized to the Office by just adding all

the data into the computer and database.

The system is an opportunity to develop and improves the manual operation of

the association. Using the information technology in systematizing the process,

reliability and record management it allows each activity in association to become easy

to all.

Technical Analysis of the Proposed System

Personnel‟s qualification and technical knowledge somehow affect the possible

adoption of the improved automated system of the Office. The use of a computer is

popular in different ways and may provide greater benefits. To be able to control all the

activities, the system needs to be connected to the databases for the collected data.

Economic Analysis of the Proposed System

Economically, since it uses minimal requirements, the Office can use the system

as long as they have the specific operating system and the peripherals needed to use the

system. Lucena City Sports Office can install it on the desktop computers or even

laptops as long as they meet the desired and required requirements to work the system.

34
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Evaluation of the Proposed System

The researchers conducted the evaluation of the proposed system. The

researchers provided a framework for the evaluation that would be ISO 9126 Software

Quality Characteristics that supports the following categories: usability, efficiency,

functionality, and reliability. ISO 9126 Software Quality Characteristics is the software

product evaluation standard from the International Organization for Standardization

(ISO). It provides the definition of the characteristics and evaluating the quality

products throughout their life cycle.

The researchers conducted a survey using a cluster sampling. Their ten (10)

respondents, who are the officials of the Lucena City Sports Office, participate

willingly. The data gathered by the researchers were analyzed, computed, and presented

in tabular form.

35
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Usability of the Proposed System

Table 3.5: Evaluation Result of the Proposed System in Terms of Usability

SA A D SD
Statement (4) (3) (2) (1) Mean Evaluation
1. The system functions as the way 10
0 0 0 4 Strongly Agree
it must. (40)
2. The system design/interface is
9 1
user-friendly and guides the user 0 0 3.9 Strongly Agree
(36) (3)
throughout software operation.
3. The system is easy to understand
9 1
as it was explained to the staffs 0 0 3.9 Strongly Agree
(36) (3)
of Lucena City Sports Office.
4. The system can be navigated 8 2
0 0 3.8 Strongly Agree
easily without much effort. (32) (6)
5. The system can be used even if
8 2
the users do not have technical 0 0 3.8 Strongly Agree
(32) (6)
proficiency.
Strongly
Grand Weighted Mean 3.88
Agree

Table 3.5 shows the respondents assessed that the proposed system with a Grand

Weighted Mean of 3.88 which is interpreted as a Strongly Agree. Therefore, the

existing system is usable.

36
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Efficiency of the Proposed System

Table 3.6: Evaluation Result of the Proposed System in Terms of Efficiency

SA A D SD
Statement (4) (3) (2) (1) Mean Evaluation
1. The system saves time and 9 1
0 0 3.9 Strongly Agree
money. (36) (3)
2. The system has the fastest 10
0 0 0 4 Strongly Agree
ways of locating records. (40)
3. The scoring and statistical
9 1
evaluation functionality of 0 0 3.9 Strongly Agree
(36) (3)
the system process efficiently
4. The system responds quickly. 10
0 0 0 4 Strongly Agree
(40)
5. The system operates in real 10
0 0 0 4 Strongly Agree
time. (40)
Strongly
Grand Weighted Mean 3.96 Agree

Table 3.6 shows the respondents assessed that the proposed system with a Grand

Weighted Mean of 3.96 which is interpreted as a Strongly Agree. Therefore, the

existing system is efficient.

37
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Functionality of the Proposed System

Table 3.7: Evaluation Result of the Proposed System in Terms of Functionality

SA A D SD
Statement (4) (3) (2) (1) Mean Evaluation
1. The system prevents
10
unauthorized users to utilize 0 0 0 4 Strongly Agree
(40)
the system
2. The system records correct 10
0 0 0 4 Strongly Agree
scores and other stats. (40)
3. The system produces 10
0 0 0 4 Strongly Agree
accurate statistical result. (40)
4. The system can secure data 10
0 0 0 4 Strongly Agree
and information. (40)
5. The system can print the 9 1
0 0 3.9 Strongly Agree
records correctly. (36) (3)
Strongly
Grand Weighted Mean 3.98 Agree

Table 3.7 shows the respondents assessed that the proposed system with a Grand

Weighted Mean of 3.98 which is interpreted as a Strongly Agree. Therefore, the

existing system is functional.

38
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Reliability of the Proposed System

Table 3.8: Evaluation Result of the Proposed System in Terms of Reliability

SA A D SD
Statement (4) (3) (2) (1) Mean Evaluation
1. All records are included in
the system and serve as a 8 2
0 0 3.8 Strongly Agree
reliable source of (32) (6)
information.
2. The system provides a
7 3
reliable way of securing 0 0 3.7 Strongly Agree
(28) (99)
records.
3. The system has the ability to
withstand (fault tolerance) 9 1
0 0 3.9 Strongly Agree
from the component, or (36) (3)
environmental failure.
4. The system is able to recover 7 3
0 0 3.7 Strongly Agree
a failed operation. (28) (99)
5. The system provides
10
consistent and trustworthy 0 0 0 4 Strongly Agree
(40)
behavior and processes.
Strongly
Grand Weighted Mean 3.82 Agree

Table 3.8 shows the respondents assessed that the proposed system with a Grand

Weighted Mean of 3.82 which is interpreted as a Strongly Agree. Therefore, the

existing system is reliable.

System Design

The researchers have made the system analysis and system planning. The

design of the system is to create and manage the process of the scoring and evaluating

the statistical standards of each player and team and to record files electronically in a

database.

39
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

The researchers used the C# as the programming language for the system and

coding while SQLite for its database of the user. They used Microsoft Word for the

electronically making a documentations of the study.

C# (pronounced as „see‟ sharp) is a multi-paradigm programming language

encompassing strong typing, imperative, declarative, functional, generic, object-

oriented (class-based), and component-oriented programming disciplines.

On the other hand, SQLite is a unified visual tool for database architects,

developers, and DBAs. It provides data modeling, development and comprehensive

Administration tools for server configuration, user Administration, backups and much

more.

Microsoft Word is word processor developed by Microsoft. It was first

released in 1983 under the name Multi-tool Word for Xenix system. Commercial

versions of Word are licensed as a standalone product or as a component of Microsoft

Office, Windows RT or the discontinued Microsoft Works suite. Freeware editions of

Word are Microsoft Word Viewer and Office Online, both of which have limited

features.

40
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

CHAPTER IV
ANALYSIS AND DISCUSSION

A. Current Situation

Lucena City Sports Office is using the traditional pen-and-paper system of

recording scores and computing statistical evaluation of teams and players. They use a

modified score sheet designed for the annual inter-barangay basketball league of

Lucena City.

They encounter some problems whenever they handle basketball leagues or

competitions. Two of these problems are: (1) the accuracy and reliability of the score

sheet. The official score sheet is more superior to the digital scoreboard. If the scorer is

not attentive on recording the scores or if the digital scoreboard does not match what the

records in the official score sheet, then the problem arises; and (2) they do not have a

permanent office for almost a year already and some of their records of the past inter-

barangay basketball games are missing. Thus, these problems will diminish the

formality and reliability of the future games.

The researchers‟ aim is to take the scoring and statistical evaluation of every

inter-barangay games to the higher level: organized, more efficient, quick, less error,

less time- and cost-consuming. It will also give the sports committee the statistical

computation in just a few clicks. The system will organize all the records in a secured

database, generates reports of every important stats of the game.

Lucena City Sports Office is looking for better ways to provide greater and

higher quality basketball leagues. The Computer-based Basketball Scoring and

41
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Statistical Evaluation System is considered to serve as a tool to meet the growing

demands of the organization.

B. System Output

Under this part of this chapeter is the screenshots of the interface of the

proposed system.

Screen Number: 1

Screen Title: Login Form of the Computerized Basketball Scoring and Statistical

System

Narrative Overview: The system allows the user to be an Administrator or a Staff. If

the user logged in as an Administrator, he/she will be able to manage the Registration,

Game Logs, Game Report and Users tabs. On the other hand, if the user logged in as

Staff, he/she will be able to use the Game, Officials, and Game Report tabs. If wrong
42
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

username or password is entered, the system will display an error message. (For the

codes, see page 296.)

Screen Number: 2

Screen Title: Team Registration Form of the Computerized Basketball Scoring and

Statistical System

Narrative Overview: Once the user logged in as an Administrator, he/she will be able

to register basketball teams. The Administrator will provide the Team Name, Division

(either Junior or Senior), the name of their Coach and Assistant Coach. The

Administrator will also be able to add, edit and delete the said information. (For the

codes, see page 119.)

43
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 3

Screen Title: Player Registration of the Computerized Basketball Scoring and

Statistical System

Narrative Overview: The Administrator will also be able to input Players‟ information

such as Last Name, First Name, Middle Name, Age, Division (either Junior or Senior),

their respective Team, and their Jersey Number. The Administrator will also be able to

add, edit and delete the said inputted data. (For the codes, see page 127.)

44
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 4

Screen Title: Officials Game Logs of the Computerized Basketball Scoring and

Statistical System

Narrative Overview: This is the Officials Game Logs in which all the game officials

inputted by the Staff and only can be seen and manipulated by the Administrator. The

records contain the names of City Sports Coordinator, Board Scorer, Computer Scorer,

Timer, Announcer, Twenty-four Clock Operator, and Utility in every Game. (For the

codes, see page 147.)

45
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 5

Screen Title: Team Game Logs of the Computerized Basketball Scoring and Statistical

System

Narrative Overview: This is the Team Game Logs of the proposed system. In this

window, the Administrator will be able to see the Teams‟ Information as well as their

recent Games. Team Information includes their Division, name of their Coach and

Assistant Coach, their Wins and Loses. (For the codes, see page 140.)

46
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 6

Screen Title: Players Game Logs of the Computerized Basketball Scoring and

Statistical System

Narrative Overview: The Administrator will also be able to see the Players Game

Logs in which he/she will be able to see the Player‟s information and their recent

Games. Player Information includes Player‟s name, their respective Team, Division,

Jersey Number, and Season. (For the codes, see page 143.)

47
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 7

Screen Title: User Registration Form of the Computerized Basketball Scoring and

Statistical System

Narrative Overview: The Administrator will also be able to register other users.

He/she will be able to add another Administrator or input another Staff. (For the codes,

see page 152.)

48
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 8

Screen Title: Officials Input Form of the Computerized Basketball Scoring and

Statistical System

Narrative Overview: On the other hand, if the user logged in as a Staff, he/she will be

able to input Officials‟ name before he/she will be able to go to the Scoresheet form.

The Staff must input the name of the City Sports Coordinator, Board Scorer, Computer

Scorer, Timer, and Announcer, 24-Clock Operator, Utility, Head Technical, Referee,

and Umpires. (For the codes, see page 278.)

49
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 9

Screen Title: Score sheet Form of the Computerized Basketball Scoring and Statistical

System

Narrative Overview: This shows the official score sheet of the proposed system. The

Staff must first choose the Division, either Junior or Senior. (For the codes, see page

166.)

50
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 10

Screen Title: Inputting in Scoresheet Form of the Computerized Basketball Scoring

and Statistical System

Narrative Overview: The staff must then choose the scheduled teams to play that day.

The Scoresheet is divided into two panels for each team. After choosing the two teams

he/she must click the Lock buttons of both teams to activate the entire Scoresheet.

Name of the players for each team will automatically appear after each panel is locked.

Each panel has two tabs: Score and Foul. Score tabs are where the Staff will be able to

add, edit and delete Field Goals of the players while the Foul tabs are where the Staff

will be able to record the fouls of the players throughout the game. The total score of

each team will be displayed to each respective panel. Time outs are also in the Staff‟s

control. He/she will only be able to use two Timeouts each Team in the First Half, 3 in

51
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

the Second Half and 1 in every Extra Period; otherwise, an error message will display.

After a Period is ended, the Staff must click the next Period. If the Game ends, the Staff

must press the End Game button to save information in the Scoresheet. (For the codes,

see page 166.)

Screen Number: 11

Screen Title: Report – Game Number

Narrative Overview: The user must enter the Game Number of the game he/she

wanted to view or print. (For the codes, see page 159.)

52
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 12

Screen Title: Game Report

Narrative Overview: This shows the statistical summary of the game that is ready-to-

print and saved in the database. (For the codes, see pages 149 and 294.)

53
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Screen Number: 13

Screen Title: Logout Confirmation Message of the Computerized Basketball Scoring

and Statistical System

Narrative Overview: The user, after he/she use the system, should click the Logout in

the Menu. This screen shows the Logout confirmation message. (For the codes, see

page 139.)

54
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Use Case Diagram of the Proposed System

Figure 4.1 Use Case Diagram of the Proposed System

Login/Register. The Game Official must log in to the system to have an access to it. If

he/she does not have an account yet, it means he/she is not yet registered. Then, he/she

must ask the registered Computer Scorer to add an account for him/her.

Encode data/scores. Computer Scorer must input the details of the teams, players, and

game officials in every game.

Add, Edit, and Delete Records. Computer Scorer can add, edit, and delete records.

Print reports. Computer Scorer can print and view the reports.

Add Users. Computer Scorer may also add other users.

Log out. Computer Scorer must always close the system after use.

55
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Database Schema of the Proposed System

Database Connectivity Relationship

Figure 4.1 Database Table Connection of the Proposed System

56
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Figure 4.1 shows the one-to-one and one-to-many relationships of the database

tables of the proposed system.

Database Table Structure

Table 4.1: tbl_users

Field Data Type Description


No_ID INTEGER PRIMARY Stores the ID of the user
KEY
AUTOINCREMENT
User_Type VARCHAR Stores users‟ classification (either Admin or
Staff)
User_Name VARCHAR Stores usernames of the users
Password VARCHAR Stores passwords

This table shows the field names, data types and description of the tbl_users. It

contains the No_ID, User type, Username and Password of the users to access the

system.

57
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Table 4.2: tbl_gameofficials

Field Data Type Description


No_ID INTEGER PRIMARY Stores the ID of the user
KEY
AUTOINCREMENT
Game_Number INTEGER Stores the ordinal number of the current
game
Game_Date DATETIME Stores the date when the game was held
City_Sports_Coordinato VARCHAR Stores the name of the Sports Coordinator
r
Board_Scorer VARCHAR Stores the name of the Board Scorer of the
game
Computer_Scorer VARCHAR Stores the name of the Staff who use the
proposed system
Timer VARCHAR Stores the name of the Timer of the game
Announcer VARCHAR Stores the name of the Announcer of the
game
24_Clock_Operator VARCHAR Stores the name of the 24-Clock Operator
Utility VARCHAR Stores the name of the Head Officer of the
Utility department of the game
Head_Technical VARCHAR Stores the name of the Head Technical
Officer of the game
Referee VARCHAR Stores the name of the Referee of the game
Umpire_1 and VARCHAR Stores the name of the Umpires of the game
Umpire_2

Table 4.2 above shows the tbl_gameofficials of the proposed system. It contains

the No_ID, Game number, Date of Game, and the names of the Basketball officials.

58
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Table 4.3: tbl_gameofficialslogs

Field Data Type Description


No_ID INTEGER PRIMARY Stores the ID of the user
KEY
AUTOINCREMENT
Game_Number INTEGER Stores the ordinal number of the current
game
Game_Date DATETIME Stores the date when the game was held
City_Sports_Coordinato VARCHAR Stores the name of the Sports Coordinator
r
Board_Scorer VARCHAR Stores the name of the Board Scorer of the
game
Computer_Scorer VARCHAR Stores the name of the Staff who use the
proposed system
Timer VARCHAR Stores the name of the Timer of the game
Announcer VARCHAR Stores the name of the Announcer of the
game
24_Clock_Operator VARCHAR Stores the name of the 24-Clock Operator
Utility VARCHAR Stores the name of the Head Officer of the
Utility department of the game
Head_Technical VARCHAR Stores the name of the Head Technical
Officer of the game
Referee VARCHAR Stores the name of the Referee of the game
Umpire_1 and VARCHAR Stores the name of the Umpires of the game
Umpire_2

Table 4.3 shows the field names, data types, and description of the

tbl_gameofficialslogs. This holds is a duplicate of tbl_gameofficials but serves a

different function.

59
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Table 4.4: tbl_playersgame

Fields Data Type Description


No_ID INTEGER PRIMARY Stores the ID of the user
KEY
AUTOINCREMENT
Game_Date DATETIME Stores the date when the game was held
Game_Number INTEGER Stores the ordinal number of the current
game
Team_Name VARCHAR Stores the name of the team
Division VARCHAR Stores the Division game of the players
Last_Name VARCHAR Stores the Last Name of the player
First_Name VARCHAR Stores the First Name of the player
Middle_Initial VARCHAR Stores the Middle Initial of the player
Jersey_Number INTEGER Stores the Jersey Number of the player
In_or_Out VARCHAR Stores where a player is In or Out of the court
FirstQ_Score INTEGER Stores the score of the First Quarter of the
game
SecondQ_Score INTEGER Stores the score of the Second Quarter of the
game
ThirdQ_Score INTEGER Stores the score of the Third Quarter of the
game
FourthQ_Score INTEGER Stores the score of the Fourth Quarter of the
game
Overtime_Score INTEGER Stores the score of the Overtime play of the
game
Foul_1, Foul_2, Foul_3, VARCHAR Stores the Team Fouls of the game
Foul_3, Foul_4 and
Foul_5

Table 4.4 shows the field names, data types and description of tbl_playersgame

of the proposed system. This contains No_ID, Date of Game, Game Number, Name of

Teams, Division, Last, First, and Middle Initial of players, Jersey Number, In-or-out

status of the player, First, Second, Third, Fourth, and Overtime Period scores, and Team

Fouls.

60
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Table 4.5: tbl_playersgamelogs

Fields Data Type Description


No_ID INTEGER PRIMARY Stores the ID of the user
KEY
AUTOINCREMENT
Game_Date DATETIME Stores the date when the game was held
Game_Number INTEGER Stores the ordinal number of the current
game
Team_Name VARCHAR Stores the name of the team
Division VARCHAR Stores the Division game of the players
Last_Name VARCHAR Stores the Last Name of the player
First_Name VARCHAR Stores the First Name of the player
Middle_Initial VARCHAR Stores the Middle Initial of the player
Jersey_Number INTEGER Stores the Jersey Number of the player
FirstQ_Score INTEGER Stores the score of the First Quarter of the
game
SecondQ_Score INTEGER Stores the score of the Second Quarter of the
game
ThirdQ_Score INTEGER Stores the score of the Third Quarter of the
game
FourthQ_Score INTEGER Stores the score of the Fourth Quarter of the
game
Overtime_Score INTEGER Stores the score of the Overtime play of the
game
Foul_1, Foul_2, Foul_3, VARCHAR Stores the Team Fouls of the game
Foul_3, Foul_4 and
Foul_5

Table 4.5 shows the tbl_playersgamelogs. This contains a duplicate of

tbl_playersgame but serves a different function.

61
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Table 4.6: tbl_playersinfo

Field Data Type Description


No_ID INTEGER PRIMARY Stores the ID of the user
KEY
AUTOINCREMENT
Last_Name VARCHAR Stores the Last Name of the player
First_Name VARCHAR Stores the First Name of the player
Middle_Initial VARCHAR Stores the Middle Initial of the player
Age INTEGER Stores the age of the player
Team_Name VARCHAR Stores the name of the team in which the
player belongs
Division VARCHAR Stores the Division game of the players
Jersey_Number INTEGER Stores the Jersey Number of the player

Table 4.6 shows the tbl_playersinfo of the proposed system. This contains

No_ID, Last, First, and Middle Initial, Age, Team, Division and Jersey Number of

players.

62
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Table 4.7: tbl_teamsgame

Fields Data Type Description


No_ID INTEGER PRIMARY Stores the ID of the user
KEY
AUTOINCREMENT
Game_Date DATETIME Stores the date when the game was held
Game_Number INTEGER Stores the ordinal number of the current
game
Team_Name VARCHAR Stores the name of the team to which the
player belongs
Division VARCHAR Stores the Division game of the players
First_Half_Time_Out INTEGER Stores Time Outs of the team on First Half-
time
Second_Half_Time_Out INTEGER Stores Time Outs of the team on Second
Half-time
Extra_Time_Out INTEGER Stores extra Time Outs of the team
FirstQ_Team_Foul INTEGER Stores the Team Fouls of the team on First
Quarter of the game
SecondQ_Team_Foul INTEGER Stores the Team Fouls of the team on Second
Quarter of the game
ThirdQ_Team_Foul INTEGER Stores the Team Fouls of the team on Third
Quarter of the game
FourthQ_Team_Foul INTEGER Stores the Team Fouls of the team on Fourth
Quarter of the game
Opponent VARCHAR Stores the name of the Opponent team
Game_Score VARCHAR Stores the Score of the Team/Game
Game_Status VARCHAR Stores the Statistical Status of the team

Table 4.7 shows the tbl_teamsgame of the proposed system. This contains

No_ID, Game_Date, Game_Number, Team_Name, Division, First_Half_Time_Out,

Second_Half_Time_Out, Extra_Time_Out, FirstQ_Team_Foul, ThirdQ_Team_Foul,

FourthQ_Team_Foul, Opponent, Game_Score, and Game_Status.

63
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Table 4.8: tbl_teamsgamelogs

Fields Data Type Description


No_ID INTEGER PRIMARY Stores the ID of the user
KEY
AUTOINCREMENT
Game_Date DATETIME Stores the date when the game was held
Game_Number INTEGER Stores the ordinal number of the current
game
Team_Name VARCHAR Stores the name of the team to which the
player belongs
Division VARCHAR Stores the Division game of the players
First_Half_Time_Out INTEGER Stores Time Outs of the team on First Half-
time
Second_Half_Time_Out INTEGER Stores Time Outs of the team on Second
Half-time
Extra_Time_Out INTEGER Stores extra Time Outs of the team
FirstQ_Team_Foul INTEGER Stores the Team Fouls of the team on First
Quarter of the game
SecondQ_Team_Foul INTEGER Stores the Team Fouls of the team on Second
Quarter of the game
ThirdQ_Team_Foul INTEGER Stores the Team Fouls of the team on Third
Quarter of the game
FourthQ_Team_Foul INTEGER Stores the Team Fouls of the team on Fourth
Quarter of the game
Opponent VARCHAR Stores the name of the Opponent team
Game_Score VARCHAR Stores the Score of the Team/Game
Game_Status VARCHAR Stores the Statistical Status of the team

Table 4.8 shows the tbl_teamsgamelogs. This table is a duplicate of

tbl_teamsgame but serves a different function.

64
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Table 4.9: tbl_teamsinfo

Fields Data Type Description


No_ID INTEGER PRIMARY Stores the ID of the user
KEY
AUTOINCREMENT
Team_Name VARCHAR Stores the name of the Team
Division VARCHAR Stores the Division game of the players
Coach VARCHAR Stores the name of the Coach of the team
Assistant_Coach VARCHAR Stores the name of the Assistant Coach of the
team
Win INTEGER Stores the how many Wins the team has
Lose INTEGER Stores the how many Loses the team has

Table 4.9 shows the tbl_teamsgame. This table contains information about

teams, which are No_ID, Team_Name, Division, Coach, Assistant_Coach, Win, and

Lose.

System Implementation

In the implementation of the system, it will first be presented to the

organization. Then the researchers will introduce it to the officials and staffs followed

by giving the demonstration on how to use it. This system will be implemented through

the availability of the computer in the association. Testing of the system is needed for

the researchers to identify if there are still some errors and design to be improved.

The system shall be implemented to prove that it will be beneficial and can solve

all the problems that may be encountered. This will also be done to test the accuracy of

the proposed system and to determine if it will meet all the expectations that will

65
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

improve the existing system of the organization. This will also be done to check for

errors of the proposed system so that possible solution may be did too.

Figure 4.2 Process Diagram of the System Implementation

Based on the flow chart, the system can be implemented. The researchers

ensure that the codes of each form are correction order for the system to run properly to

attain its effectiveness and efficiency.

This diagram also depicts the implementation process of the researchers of the

proposed system. The researchers prepared the location and hardware for the

installation of the system. The user of the system must be aware of the system so the

researchers provide a user‟s manual. Once the user is knowledgeable enough, the

system is ready to be used.

66
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Software and Hardware Requirements

Hardware and software must be specified in order for the “Computer-based

Basketball Scoring and Statistical Evaluation System for Lucena City Sports Office”.

The following discuss these required resources.

Hardware Description
Memory 2.30 GHz
RAM 2.0 GB (minimum); 4.0 GB (suggested)
HDD 500 GB

Software Description
Operating System Windows XP or higher

Software Evaluation and Testing

Before the system is finally done, there is still a need for software evaluation

and testing of the system to make sure that the system to be installed in the

establishment is precise so that the organization will never encounter a code error

during the implementation of the system. The researchers used static testing at first

wherein the researchers gives a walkthrough, inspection and review, then dynamic

method wherein the codes are executed to see the result of the system coding. During

the testing of the system, the researchers encountered debugs regarding the code and the

connection established between the user of the database. The researchers handled the

problems through re-building of the connection and debugging some code errors.

In evaluating the system, the proponent used ISO 9126 as the quality standard

for the software. The fundamental objective of this standard is to address some of the

well-known human preferences that can adversely affect the delivery and perception of

the software development project.

67
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

In functional testing, the software program or system under test is viewed as a

“black box”. The selection of test cases for functional testing is based on the

requirement or design specification of the software entity under test. Functional testing

emphasizes on the external behavior of the software entity.

Structural testing also is known as “white box” testing is highly effective in

detecting and resolving problems because bugs (bug or fault is a manifestation of an

error in a software) can often be found before they cause trouble. We can shortly define

this method as testing software with the knowledge of the internal structure and coding

inside the program. White box testing is also called white-box analysis, clear box

testing or clear box analysis. It is a strategy for software debugging (it is the process of

locating and fixing bugs in computer program code or the engineering of a hardware

device) in which the tester has excellent knowledge of how the program components

interact.

The researchers, to see if there are errors during the run time of the system, did

the trial and error testing. Through this, the researchers will see if there would be some

modification to do in the system.

Using the proposed system it helps to eliminate some problems in terms of

recording scores, it only takes few efforts and time to operate by just using it. In

managing record, it takes one click to add data and it will easily be identified by the

system.

68
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

System Installation

The proposed system is to be set up for use. The system was tested and

evaluated to be able to find out the errors of the proposed system so that the system will

be further augmented. Lucena City Sports Office will adopt the proposed system and

then the system installation process takes place.

System Change Over Scheme

The researchers will use the direct scheme because they will replace the current

system, which is the manual scoring system, for Lucena City Sports Office. The

researchers will implement the proposed system in the organization.

After all the process that the researchers have done, the Computer-based

Basketball Scoring and Statistical Evaluation System for Lucena City Sports Office is

now ready to be used by the organization are available to be used by the staffs and

officials.

System Operation and Support

The system operation and support involve the installation, evaluation, and

testing of the system after the implementation. When the system has been approved and

used by the organization, it will be evaluated if there is a user‟s manual provided by the

researchers for those who will use the system. The researchers will provide a backup

system in case of an unexpected problem that may occur or when the installation

happens to ask for another copy of the system.

69
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

In order to support the system, the researchers will conduct training and provide

training manuals for those who will use the proposed system. The researchers may also

manage the maintenance and support of the proposed system if in case the organization

asks for their technical services.

User’s Training

Upon implementing the system, the researchers will have an orientation about

the system and about the flow of the system so the users can really understand the

system. After the training, the future users or the staffs of the organization will be

guided by the trained users.

70
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

CHAPTER V
SUMMARY, CONCLUSION, AND RECOMMENDATION

This chapter covers the summary, conclusion, and recommendation made by the

researchers based on the findings of the study.

Summary

The study focused on the acceptability of Computer-based Basketball Scoring

and Statistical Evaluation System for Lucena City Sports Office. The researchers found

out the status of the existing system used by the Lucena City Sports Office in terms of

scoring, statistical evaluation of the players and teams, and security of records.

The purpose of developing a Computer-based Basketball Scoring and Statistical

Evaluation System is to manage the records and information of players and teams, as

well as to provide an easy way of locating or access of the information of every inter-

barangay basketball games, to have fast and easy way of recording stats (such as Field

Goals, Fouls, and Timeouts) and to have centralized database storage for all the

information about the inter-barangay basketball leagues needed by the office.

The researchers used the descriptive and developmental research with the

application of a set of facts or information regarding the system to determine the

implication of proposed Computer-based Basketball Scoring and Statistical Evaluation

System to the existing manual process use by the Lucena City Sports Office. By using

this method, the researchers expected to construct significance of the proposed system.

The Computer-based Basketball Scoring and Statistical Evaluation System for

Lucena City Sports Office were created to answer the problems encountered by the

71
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

organization. The proposed system emphasized the more secured score sheets,

immediate process of releasing of the reports and retrieving records of every inter-

barangay basketball games. The system provided the system that is accurate, effective,

security, reliable, and user-friendly for the office, coaches, and players.

Conclusion

Upon conducting the study, the researchers concluded that:

1. The manual system is used by the Lucena City Sports Office was analyzed in

terms of scoring, statistical evaluation of the players and teams, and security of

records. They found out that the existing system‟s records may not be easily

located and could have a risk of lost or misplaced of the records and the scoring

and statistical evaluation system is not in line with the latest technology

available;

2. After the completion of the proposed system, the researchers concluded that

their research entitled “Computer-based Basketball Scoring and Statistical

Evaluation System for Lucena City Sports Office” would provide an easier

process of scoring and providing statistical reports. The system being developed

by the researchers provides an easy way of creating and accessing of the data yet

in a secured manner. The records are made secured since the collected data of

the players and teams are in a centralized database system. The proposed system

solved the problem in scoring and storing the records. Furthermore, the system

will ease the evaluating statistics of every player and searching past games‟

reports in a specified and organized way; and

72
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

3. The proposed system is assessed based on the ISO 9126 Software Quality

Characteristics. According to the survey, the proposed system is usable because

it is easy to use and easy to learn. It is also efficient because it saves time and

cost in doing the tasks. The proposed system is also functional because all of the

function, main or minor, are running and it will benefit the organization in terms

of scoring and statistical evaluation every players and team. The system is also

reliable because all records and the system itself are secured. Therefore, the

proposed system is fit for the needs of the organization.

Recommendations

The researchers recommend the additional features of the proposed system to

further enhance the efficiency of the proposed “Computer-based Basketball Scoring and

Statistical Evaluation System for Lucena City Sports Office.” This includes the

following:

1. There should be not only the information of players and teams but also the

information of the coaches and officials so that the organization can see their

credibility.

2. The researchers also recommend that widening the scope of the statistical

standards of the system by enhancing the system to be able to record higher

basketball stats such as Turnovers, Rebounds, and Assists and so on, thus, it will

make the system a LAN-based system and will be able to use not only to inter-

barangay basketball leagues but also to intercollegiate and national ones; and

73
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

3. The researchers also highly recommend that upgrading the proposed system by

connecting it wirelessly to a digital scoreboard to make the official score sheet

visible to the audience.

74
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

APPENDICES

75
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

BIBLIOGRAPHY

76
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

A. ELECTRONIC REFERENCES

Anyayahan, J. (2011). Age of Automation. Retrieved from

https://www.scribd.com/doc/204165317/201435715

Barroquillo, M. S., et al (2012). Portable Touch Screen PC-Based Basketball

Scoreboard Synchronizer via Zigbee. Retrieved from

http://fs.mapua.edu.ph/MapuaLibrary/Thesis/Portable%20Touch%20Screen%20

PC-Based%20Basketball%20Scoreboard%20Synchronizer%20via%20Zigbee.pdf

Carlos, G., et. al (2015). The Design of Timing and Score Device for Basketball

Competitions. Retrieved from

http://en.cnki.com.cn/Article_en/CJFDTOTAL-DLXZ201005015.htm

Chua, C. & Maranan, J. J. (2013). The System Design of Wireless Basketball Timer-

Based on MCU and NRF24L01. Retrieved from

http://www.maxwellsci.com/print/rjaset/v5-4909-4913.pdf

Downloadroute (2012). Book-it Basketball Scoring System. Retrieved from

bookitbasketballscoringsystem.download23362567.datapicks.com

Fort Worth Star-Telegram (2012) On the Selection of Parameters in Self-scaling

Variable. Retrieved from

https://www.scribd.com/doc/201589317/891405715

77
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Kurzweil, R. (2011). Online Reservation System. Retrieved from

http://www.studymode.com/subjects/online-reservation-system-related-

literature-chapter-2-page1.html

Litkenhaus, V. (2012). A Rapidly Convergent Descent Method for Minimization.

Retrieved from

http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=4309667

Mondigo, J. (2011). Computer-based Inventory System. Retrieved from

http://www.studymode.com/essays/Computer-Based-Inventory-System-

401903.html

Navarro, L. M., et al (2016). The Control System in Basketball Scoreboard built in

89C51 SCM. Retrieved from

en.cnki.com.cn/Article_en/CJFDTOTALSJKF200804023.htm

Pagkaliwagan, H. & Bilaro, J. M. (2016). Basketball Scoreboard Deluxe Software

Informer. Retrieved from

http://basketball-scoreboard-deluxe.software.informer.com/

R2sports (2015). The Software Tournament System. Retrieved from

78
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

http://www.r2sports.com/ranking-software.asp

Stefani, R. T. (2010). An Introduction to the World of Virtual Sports. Retrieved from

https://everymatrix.com/blog/introduction-world-virtual-sports.html

Williamson, P. B. (2012) P. B. Williamson "System". Retrieved from

http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=4309667

Eifler, T. A. (2013) Computers, and sports: a natural marriage. Retrieved from

http://dl.acm.org/citation.cfm?id=1500529

Gardner, E. (2013). Computer-based System. Retrieved from

www.google.co.in/patents/US5721913

Navales, Z. P. (2015). Disadvantages of Manual-based Systems. Retrieved from

www.answers.com/Q/Disadvantages_of_manual_based_information_systems

79
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

USER’S MANUAL

80
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

TABLE OF CONTENTS (User’s Manual)

ACTIVITY PAGE
A. Logging in as an Administrator 82 - 83
B. Registering Teams 83 - 84
C. Searching Teams 85
C. 1. Searching Teams by Team Name 85
C. 2. Searching Teams by Division 86
D. Registering Players 87 - 88
E. Searching Players 89
E. 1. Searching Players by Player Name 89
E. 2. Searching Players by Team Name 90
E. 3. Searching Players by Division 91
F. Game Logs 92
F. 1. Game Logs – Teams 93
F. 2. Game Logs – Players 93
F. 3. Game Logs – Officials 94
G. Adding Another User 95 - 96
H. Logging in as a Staff 96 - 97
I. Filling up the Game Official Form 98
J. The Computerized Basketball Score Sheet 99
J. 1. Setting the Team versus Team 100
J. 2. Assigning the First Five 101 - 102
J. 3. Locking the Score Sheet 103 - 104
J. 4. Recording Field Goals (Score) 104 - 105
J. 5. Recording Fouls 105
J. 5. 1 Dealing with Multiple Personal/Team Fouls 106
J. 5. 2 Dealing with a Fouled Out Player 107
J. 6. Substitution of Players (Putting Players In/Out of the Court) 108
J. 7. Recording Timeouts 109
J. 8. Periods 110
J. 9. End Game 111 - 112
J. 10. Keyboard Shortcuts 112
K.The Statistical Report 113 - 114
L. Logging Out 115

81
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

How to use the

COMPUTER-BASED BASKETBALL SCORING AND STATISTICAL

EVALUATION SYSTEM FOR LUCENA CITY SPORTS OFFICE?

A. Logging in as an Administrator

Administrators will be

able to add/register Teams and

Players. They can also see

recent games‟ statistical

evaluations and reports. They

can also add users who are

authorized to operate the

system. The user, if logging in

as an Administrator, must:

1. Press the combo box on the right of User Type. The combo box will show

two options: The user must

choose “Admin”.

2. Type the Username.

82
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

3. Type the Password. The Password will show like this:

This is to increase the

security features of the system.

4. After filling up the information, the user must press “Login” button to direct

him/her to the next window.

5. To exit or revoke the operation, press “Cancel” button.

B. Registering Teams

To register a team, Administrator must press the “Registration and choose

“Team”:

83
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Then, it will show the Team Information fill-up form. To add a team:

1. Press the “Add” button. The textboxes and combo boxes will be ready to receive

data.

2. Input the name of the team.

3. The “Division” combo box will show: . Choose

one.

4. Input the name of the Coach.

5. Input the name of the Assistant Coach.

6. To save, press “Save” button. Then, a pop-up window will show:

This is to make the user aware that he/she

already saved it. Press “OK.”

7. Press “Edit” button if you want to modify team‟s information.

8. Press “Delete” if you want to erase the team‟s information from the database.

9. To cancel the operation, press “Cancel” button.

84
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

C. Searching Teams

Administrators may search team‟s information by its Team Name or by its Division.

C. 1. Searching Teams by Team Name

To search a team by its Team Name:

1. Press the combo box on the right side of “Search”, and then choose Team Name.

2. Type the name of the team you want to see on the textbox on the right side of

“Team”.

85
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

C. 2. Searching Teams by Division

To search teams by its Division:

1. Choose “Division”.

2. Choose one between All, Junior, and Senior.

86
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

D. Registering Players

To register players, press “Registration” and then choose

“Players” to show the Player Information fill-up form.

To input and save player‟s information, the Administrator must:

1. Press “Add” button.

2. Fill up “Last Name” of the player.

3. Fill up “First Name” of the player.

4. Fill up “Middle Name” of the player.

5. Fill up “Age” of the player. Player‟s age will determine his/her respective

division.

87
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

6. Choose either “Junior” or “Senior”. An error trapping method which

automatically pop-up an error message if the “Age” and the “Division” chosen

by the user is incompatible.

7. Choose the team where he/she belongs.

8. Input the player‟s jersey number.

9. Press “Save” button to save information to the database. The system will

confirm the Administrator if the information is saved by showing a pop-up

window:

10. Press “Edit button to modify player‟s information.

11. Press “Delete” if you want to delete player‟s information from the database.

12. To cancel the operation, press “Cancel” button.

88
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

E. Searching Players

Administrators can search players by its Player Name, by his/her Team Name or by

Division.

E. 1 Searching Players by Player Name

To search players by Player Name:

1. Choose “Player Name”.

2. Type the player‟s name.

89
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

E. 2. Searching Players by its Team Name

To search players by its Team Name, Administrator must:

1. Choose “Team Name”.

2. Type the team‟s name to which the player belongs.

90
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

E. 3. Searching Players by its Division

To search players by its Division, Administrator must:

1. Choose “Division”.

2. Press the combo box to filter your searching whether by All, Junior, or Senior

division.

91
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

F. Game Logs

A Game Log shows the collection of records of the recent game. To view Game

Logs, press “Game Logs”. There are three logs available:

Teams, Players, and Officials.

F. 1. Game Logs – Teams

To see every team‟s recent games:

1. Press “Game Logs” and then choose “Teams”.

2. “Team Information” panel will show all recent games. To view a specific game,

press the game. “Team Games” panel will show the selected game (##).

92
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

F. 2. Game Logs – Players

To see every player‟s recent games:

1. Press “Game Logs” and then choose “Players”.

2. “Player Information” panel will show all recent games. To view a specific game,

press the game. “Player Games” panel will show the selected game (##).

93
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

F. 3. Game Logs – Officials

To see every game official‟s recent games:

1. Press “Game Logs” and then choose “Officials”.

2. You can filter the games showed in the “Officials Information” panel by “Game

Number” and “Versus”.

3. Search specific games by “Game Number” or the “Versus”.

4. “Officials Information” panel will show all game officials of the recent games.

94
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

G. Adding Another User

An Administrator also has the capacity to add another user, whether another

Administrator or a Staff. To do that, press the “User” on the ribbon.

To add another user:

1. Press “Add” button.

2. Choose if the user you are adding will be an Administrator or a Staff. An

Administrator can view, add, edit, and delete information about players, teams,

game officials, and users. A Staff is capable of using the Official Score Sheet.

Both types of user can view reports, as well as Game Logs. To choose, press the

combo box on the right side of “User Type” and then choose between “Admin”

and “Staff”.

95
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

3. Type “Username”.

4. Type your own unique password. The user must remember this password.

5. This button made to show/hide character of the password.

6. Press “Save” button to save the filled-up information.

7. Press “Edit” button to modify information.

8. Press “Delete” button to erase information from the database.

H. Logging in as a Staff

A Staff is capable of using the Official Score Sheet. They can also see recent

games‟ statistical evaluations and reports (Game Logs and Reports). The user, if

logging in as a Staff, must:

96
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

1. Press the combo box on the right of User Type. The combo box will show

two options: The user must choose Staff.

2. Type the Username.

3. Type the Password. The Password will show like this:

This is to increase the

security features of the system.

4. After filling up the information, the user must press “Login” button to direct

him/her to the next window.

5. To exit or revoke the operation, press “Cancel” button.

97
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

I. Filling up the Game Officials Form

The user will be directed to the Game Officials Form. It is a must to fill up every

name of the Game Officials before the game begin. To fill up:

1. Click the “Add” button.

2. The textboxes will be ready to accept inputs. Type all the corresponding names

to their respective position/task.

3. Click “Save” to save the information to the database. A pop-up window will

appear to confirm the user that the information has been

saved. If the user pressed the “OK” button or the exit button of the pop-up

message, he/she will be directed to the Official Score Sheet form.

4. Press “Edit” button to modify information.

5. Press “Cancel” button to exit from the Game Officials Form.

98
DALUBHASAAN NG LUNGSOD NG LUCENA
J. The Computerized Basketball Score Sheet:

The Score Sheet is composed of tables, combo boxes, buttons, pop-up windows, and display features. To sum up all

these:

DALUBHASAAN NG LUNGSOD NG LUCENA


BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

99
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

J. 1. Setting Team versus Team

To set up the score sheet, Staff must:

1. Click the combo box on the right side of “Division” and then choose one.

This is necessary because the “Team A” and “Team B” combo boxes will

only show the teams under the selected divisions. You cannot match two

teams that belong to a different division.

2. Click the combo box on the right side of the “Team A” and “Team B”.

Choose the teams which are playing on the court.

100
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

J. 2. Assigning the First Five

After you chose a team, a window will pop-up. This to assign the team‟s first

five players inside the court. To do so:

1. Choose five (5) players from the table by clicking “Out” text. After you do

this, “Out” will be “In”, indicating that that player is already noted inside the

court.

2. This will display how many players are already inside the court. The Staff

must only “In” exactly five (5) players. Otherwise, an error message will

pop-up.

101
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

3. Click the “OK” button. The “Team A” and/or ”Team B” panel will display

the first five players on its table. The result will be similar to this:

4. Click “Cancel” button if you want to revoke the operation.

102
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

J. 3. Locking the Score Sheet

The system has an error-trapping features that prevent mismatching teams

Meaning, this assures the Staff in assuring him whether if he/she is sure if the teams

he/she had chosen are the teams that will play at the moment. This feature is what the

researchers called Locking the Scoresheet. To do so:

1. Press the “Lock” buttons located on the right side of the “Team A”/”Team

B” combo boxes. This will activate all the necessary buttons for stats

recording. The Staff will know if the score sheet is activated if the Score

Display (the 2 in the picture above) if it turned white; similar to this one:

103
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

The Activity Log will also display a message to notify the Staff:

J. 4. Recording Field Goals (Score)

Now that the score sheet

is activated, the Staff may now

record Field Goals. To do so,

the Staff must:

1. Make sure that

the panel is on the “Score and

Foul” tab (%%). Click the

name of the player, which is on

the team panel‟s table, who

made the score. The team panel

will display the “Player

Selected” (**).

2. Press the button which corresponds to the number of the point made by the

player (i. e. press “+2” for a two-point score). The Score Display (##) will

show the total score a team already has. The Activity Log (&&) will display

all the recent activities, which will only last for five (5) seconds.

104
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

3. If the Staff made a mistake (i. e. wrong Score buttons are clicked), he/she

may undo it by pressing the corresponding buttons.

J. 5. Recording Foals

To record fouls, the Staff must:

1. Press the name that corresponds the name of the player who got fouled. The

player selected will display on the right side of the “Player Selected” (##).

2. Press the “F” button. The Activity Log (&&) will display the action for 5

seconds. The Team Fouls Counter (%%) will show the fouls made by the

team in every period.)

3. To undo a mistake clicked “F” button, press “-F” button.

105
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

J. 5. 1. Dealing with Multiple Personal/Team Fouls

A player who is marked with multiple personal fouls will have changes in the

Score Sheet. A player is only limited to get up to four (4) fouls in a game. To further

explain, the Staff must know that:

1. Players who got none up to two fouls will have no change in color (their

name and stats will remain black on the Score Sheet).

2. If the player got 3 fouls, the color of his/her name and stats in the Score

Sheet will turn into orange. This means, he/she got only 2 more fouls and

he/she will be fouled out. By rules, the Announcer must warn the player.

106
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

3. If the player got 4 fouls that his/her name and stats in the Score Sheet will be

turned into color indigo. This means that he/she only got one more foul and

he/she will be fouled out. By rules, the Announcer must warn the player.

4. The Team Fouls Counter will show how many fouls a team already made in

every period.

5. “Penalty” will show if the team already reach the maximum Team Fouls

allowed.

J. 5. 2. Dealing with a Fouled Out Player

If a player already made five

(5) fouls in a game, he/she will be

fouled out. He/she will not be

allowed to enter the court and play in

that game.

1. In the Score Sheet, he/she will

be removed to the team panel‟s

players on the court.

2. The Activity Log will inform

the Staff that that particular player

“has been fouled out due of having 5 (personal) fouls”.

107
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

J. 6. Substitution of Players (Putting Player In/Out of the Court)

Substitution of players (as well as adding other players in the court due to a fouled

out ones) is also handled in the researcher‟s proposed system.

The Staff can put in and

out players (maximum of 5

players on the court at a time).

To do so:

1. Go to the “All

Players” tab.

2. Click the name of

the player you want to be in/out.

The “Player Selected” (##) will

be displayed.

3. Press “In” button to indicate the selected player is inside the court and “Out”

button for outside the court. The Activity Log (&&) will show that the action

has been done. Otherwise, an error message will pop-up.

108
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

J. 7. Recording Timeouts

The proposed

system can also record

Timeouts. To do so, A

Staff must:

1. Go to “All

Players” tab.

2. Press the “Time

Out” button. The

“Activity Log” (&&)

will display a message

that the action has been

done. The “All

Players” tab will also display all the Timeout a team had in its panel (##). The

system will display an error message if a team reached its maximum number of

timeouts allowed in a period/half.

109
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

J. 8. Periods

If the period is over, the Staff must press the corresponding/next period to ready

the Score Sheet in recording stats for that next period. The Staff must keep in mind that:

1. The Score Sheet is recording stats in the highlighted (color orange) Period.

2. By clicking the next period, the system will pop-up a confirmation message

like this one: This is to make sure

Staff that he/she clicked the next period. Clicking “Yes” will give him/her a

ready Score Sheet for the particular period. Clicking “No” will make you go

back to the previous period.

J. 9. End Game

110
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

If the game is already over, the Staff must click the “End Game” button.

By pressing this button, a pop-up window will appear. The Staff has two options

how to end a game:

A. Press the radio button that corresponds to “Game Finished” if the game

ended in a not default decision. Meaning, their score will be the basis.

B. On the other hand, if the game needs a default decision, the Staff must

choose “Default” radio button. If chose it, the combo box below the radio buttons will

be activated. The Staff must choose the name of

the winner and then click the “OK” button.

A confirmation message will pop up, asking the Staff if he/she is sure to end the

game by Default.

111
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Clicking either “Game Finished” or “Default” will prompt a report of the game‟s

stats to show.

J. 10. Keyboard shortcuts

Team A panel:
Z – Lock Team B panel:
X – Unlock , – Lock
A – Timeout . – Unlock
E – In B – Timeout
R – Out P – In
S – Foul and Score Tab {– Out
D – All Players Tab L – Foul and Score Tab
1 – 1-point score : – All Players Tab
2 – Two-point score 7 – 1-point score
3 – Three-point score 8 – Two-point score
4 – Minus 1-point score 9 – Three-point score
5 – Minus two-point score 0 – Minus 1-point score
6 – Minus three-point score - – Minus two-point score
Q – Foul + – Minus three-point score
W – Minus Foul I – Foul
O – Minus Foul

Periods:
F2 – 1st Period Other keyboard shortcuts:
F3 – 2nd Period F10 – End Game
F4 – 3rd Period F11 – Clear Game
F5 – Overtime Period

112
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

K. The Statistical Report


The researchers made the report ready to print and with an allotted for Game
Officials‟ signatures.

113
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

A Staff must know the functions of the following buttons:

1. “Game Report” in the menu bar. This will show the Statistical evaluation report

of the recent games. A window will pop-up show:

The Staff may enter the Game Number of

the Statistical Evaluation Report they want to see.

2. “Export Report” button. Press this button if you want a copy of the Statistical

Evaluation Report in PDF format.

3. “Print Report” button. Press this if you want a printed copy of the Statistical

Evaluation Report. (Make sure that the computer is connected to a printer.)

4. “Refresh” button.

5. “Copy” button. To electronically copy the information in the report.

114
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

L. Logging Out

Users, whether Administrator or Staff, must always log out the system after or

not in use. This is to make sure that the records are only accessible to the authorized

users. To log out, press the “Logout” in the menu bar.

A confirmation message will pop up. Press the

“Yes” button.

115
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

PROGRAM

LISTING

116
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

Administrator.cs ACGLSPlayer();
cmbGLPSearch.Text =
using System; "Player Name";
using System.Collections.Generic;
using System.ComponentModel; LoadGLOInfo();
using System.Data; ACGLOffials();
using System.Drawing; cmbGLOSearch.Text = "Game
using System.Linq; Number";
using System.Text;
using System.Windows.Forms; LoadUser();
using System.Data.SQLite; ACUser();
using cmbUSearch.Text =
CrystalDecisions.CrystalReports.Engin "Username";
e; }
using CrystalDecisions.Shared;
private void
namespace Administrator_Activated(object
Lucena_Sports_Office_BSSE_System sender, EventArgs e)
{ {
public partial class ACRTeam();
Administrator : Form ACRPlayer();
{ ACGLSTeam();
DataTable myDatasetRT, ACGLSPlayer();
myDatasetRP, myDatasetGLT, ACGLOffials();
myDatasetGLTG, myDatasetGLP, ACUser();
myDatasetGLPG, myDatasetGLO,
myDatasetU; GameReport();
public static string }
sRTAddEdit = "", sRPAddEdit = "",
sTID = "", sPID = "", sGNum = "x", #region Navigation
sUAddEdit = "", sUID = ""; void ClearNav()
{
public Administrator() tsRegister.ForeColor =
{ Color.White;
InitializeComponent(); tsRPlayer.ForeColor =
Color.White;
LoadRT(); tsRTeam.ForeColor =
RTSearch(); Color.White;
ACRTeam(); tsGLogs.ForeColor =
cmbRTSearch.Text = "Team Color.White;
Name"; tsGTeams.ForeColor =
Color.White;
LoadRP(); tsGPlayers.ForeColor =
RPSearch(); Color.White;
ACRPlayer(); tsGOfficials.ForeColor =
cmbRPSearch.Text = Color.White;
"Player Name"; tsGReport.ForeColor =
Color.White;
LoadGLTInfo(); tsUser.ForeColor =
LoadGLTGames(); Color.White;
ACGLSTeam();
cmbGLTSearch.Text = "Team pnlMRPlayer.Visible =
Name"; false;
pnlMRTeam.Visible =
LoadGLPInfo(); false;
LoadGLPGames();

117
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
pnlMGLTeams.Visible = ClearNav();
false; tsGLogs.ForeColor =
pnlMGLPlayers.Visible = Color.FromArgb(236, 189, 0);
false; tsGPlayers.ForeColor =
pnlMGLOfficials.Visible = Color.FromArgb(236, 189, 0);
false;
pnlMGReport.Visible = pnlMGLPlayers.Visible =
false; true;
pnlMUser.Visible = false; }
}
private void
private void tsGOfficials_Click(object sender,
tsRPlayer_Click(object sender, EventArgs e)
EventArgs e) {
{ ClearNav();
ClearNav(); tsGLogs.ForeColor =
tsRegister.ForeColor = Color.FromArgb(236, 189, 0);
Color.FromArgb(236, 189, 0); tsGOfficials.ForeColor =
tsRPlayer.ForeColor = Color.FromArgb(236, 189, 0);
Color.FromArgb(236, 189, 0);
pnlMGLOfficials.Visible =
pnlMRPlayer.Visible = true;
true; }
}
private void
private void tsGReport_Click(object sender,
tsRTeam_Click(object sender, EventArgs e)
EventArgs e) {
{ Administrator_Game_Report
ClearNav(); w = new Administrator_Game_Report();
tsRegister.ForeColor = w.ShowDialog();
Color.FromArgb(236, 189, 0); }
tsRTeam.ForeColor =
Color.FromArgb(236, 189, 0); private void
tsUser_Click(object sender, EventArgs
pnlMRTeam.Visible = true; e)
} {
ClearNav();
private void tsUser.ForeColor =
tsGTeams_Click(object sender, Color.FromArgb(236, 189, 0);
EventArgs e)
{ pnlMUser.Visible = true;
ClearNav(); }
tsGLogs.ForeColor = #endregion
Color.FromArgb(236, 189, 0);
tsGTeams.ForeColor = #region Dropdown Menu
Color.FromArgb(236, 189, 0); private void
tsGLogs_DropDownOpened(object sender,
pnlMGLTeams.Visible = EventArgs e)
true; {
} if
(pnlMGLOfficials.Visible == false &&
private void pnlMGLPlayers.Visible == false &&
tsGPlayers_Click(object sender, pnlMGLTeams.Visible == false)
EventArgs e) {
{

118
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
tsGLogs.ForeColor = SQLiteCommand myCommand =
Color.FromArgb(236, 189, 0); new SQLiteCommand("SELECT No_ID,
} Team_Name AS 'Team Name', Division,
} Coach, Assistant_Coach AS 'Assistant
Coach' FROM tbl_teamsinfo ORDER BY
private void Team_Name;", myConn);
tsGLogs_DropDownClosed(object sender,
EventArgs e) try
{ {
if SQLiteDataAdapter
(pnlMGLOfficials.Visible == false && myAdapter = new SQLiteDataAdapter();
pnlMGLPlayers.Visible == false &&
pnlMGLTeams.Visible == false) myAdapter.SelectCommand = myCommand;
{ myDatasetRT = new
tsGLogs.ForeColor = DataTable();
Color.White;
} myAdapter.Fill(myDatasetRT);
} BindingSource
bdSource = new BindingSource();
private void bdSource.DataSource =
tsRegister_DropDownOpened(object myDatasetRT;
sender, EventArgs e) dgvRTTeams.DataSource
{ = bdSource;
if (pnlMRPlayer.Visible
== false && pnlMRTeam.Visible == myAdapter.Update(myDatasetRT);
false) }
{
tsRegister.ForeColor catch (Exception ex)
= Color.FromArgb(236, 189, 0); {
}
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
private void MessageBoxIcon.Error);
tsRegister_DropDownClosed(object }
sender, EventArgs e)
{
if (pnlMRPlayer.Visible dgvRTTeams.Columns[0].Visible =
== false && pnlMRTeam.Visible == false;
false)
{ }
tsRegister.ForeColor #endregion
= Color.White;
} #region Search
} void RTSearch()
#endregion {
if (cmbRTSearch.Text ==
//------------------------// "Team Name")
Registration : Team {
lblRTTeam.Visible =
#region Load Tables true;
void LoadRT() txtRTTeam.Visible =
{ true;
SQLiteConnection myConn = lblRTDivision.Visible
new = false;
SQLiteConnection(Conn.ConnString); cmbRTDivision.Visible
= false;

119
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{
txtRTTeam.Clear(); string tname =
cmbRTDivision.Text = myReader.GetValue(0).ToString();
"All"; acs.Add(tname);
} }
}
else if (cmbRTSearch.Text
== "Division") catch (SQLiteException
{ ex)
lblRTTeam.Visible = {
false;
txtRTTeam.Visible = MessageBox.Show(ex.Message, "Error",
false; MessageBoxButtons.OK,
lblRTDivision.Visible MessageBoxIcon.Error);
= true; }
cmbRTDivision.Visible
= true; finally
{
cmbRTDivision.Text = myConnection.Close();
"All"; }
txtRTTeam.Clear();
}
} txtRTTeam.AutoCompleteCustomSource =
#endregion acs;
}
#region AC and Filter Search
void ACRTeam() private void
{ txtRTTeam_TextChanged(object sender,
EventArgs e)
txtRTTeam.AutoCompleteMode = {
AutoCompleteMode.SuggestAppend; DataView myDV = new
DataView(myDatasetRT);
txtRTTeam.AutoCompleteSource = myDV.RowFilter =
AutoCompleteSource.CustomSource; string.Format("[Team Name] LIKE
'%{0}%'",
AutoCompleteStringCollection acs = EscapeLikeValue(txtRTTeam.Text));
new AutoCompleteStringCollection(); dgvRTTeams.DataSource =
myDV;
string myQuery = "SELECT
Team_Name FROM tbl_teamsinfo;"; if (dgvRTTeams.Rows.Count
SQLiteConnection == 0)
myConnection = new {
SQLiteConnection(Conn.ConnString); txtRTName.Clear();
SQLiteCommand myCommand =
new SQLiteCommand(myQuery, if
myConnection); (!cmbRTDiv.Items.Contains("-Select-
SQLiteDataReader "))
myReader; {

try cmbRTDiv.Items.Insert(0, "-Select-");


{ }
myConnection.Open();
myReader = cmbRTDiv.Text = "-
myCommand.ExecuteReader(); Select-";
while
(myReader.Read()) txtRTCoach.Clear();

120
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
txtRTACoach.Clear();
} public static string
} EscapeLikeValue(string
valueWithoutWildcards)
private void {
cmbRTSearch_SelectedIndexChanged(obje StringBuilder sb = new
ct sender, EventArgs e) StringBuilder();
{ for (int i = 0; i <
RTSearch(); valueWithoutWildcards.Length; i++)
} {
char c =
private void valueWithoutWildcards[i];
cmbRTDivision_SelectedIndexChanged(ob if (c == '*' || c ==
ject sender, EventArgs e) '%' || c == '[' || c == ']')
{
if (cmbRTDivision.Text == sb.Append("[").Append(c).Append("]");
"All") else if (c == '\'')
{ sb.Append("''");
LoadRT(); else
} sb.Append(c);
}
else return sb.ToString();
{ }
DataView myDV = new #endregion
DataView(myDatasetRT);
myDV.RowFilter = #region Cell Enter
string.Format("[Division] LIKE private void
'%{0}%'", dgvRTTeams_CellEnter(object sender,
EscapeLikeValue(cmbRTDivision.Text)); DataGridViewCellEventArgs e)
dgvRTTeams.DataSource {
= myDV; if (e.RowIndex >= 0)
{
if DataGridViewRow row =
(dgvRTTeams.Rows.Count == 0) this.dgvRTTeams.Rows[e.RowIndex];
{
txtRTName.Text =
txtRTName.Clear(); row.Cells["Team
Name"].Value.ToString();
if cmbRTDiv.Text =
(!cmbRTDiv.Items.Contains("-Select- row.Cells["Division"].Value.ToString(
")) );
{ txtRTCoach.Text=
row.Cells["Coach"].Value.ToString();
cmbRTDiv.Items.Insert(0, "-Select-"); txtRTACoach.Text =
} row.Cells["Assistant
Coach"].Value.ToString();
cmbRTDiv.Text = sTID =
"-Select-"; row.Cells["No_ID"].Value.ToString();
}
}
txtRTCoach.Clear(); #endregion

txtRTACoach.Clear(); #region Default -Select-


} private void
} cmbRTDiv_DropDown(object sender,
} EventArgs e)

121
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{ lblRTCoach.Enabled =
cmbRTDiv.Items.Remove("- true;
Select-"); lblRTACoach.Enabled =
} true;
txtRTName.Enabled = true;
private void cmbRTDiv.Enabled = true;
cmbRTDiv_DropDownClosed(object txtRTCoach.Enabled =
sender, EventArgs e) true;
{ txtRTACoach.Enabled =
if (cmbRTDiv.SelectedItem true;
== null)
{ btnRTAdd.Enabled = false;
if btnRTEdit.Enabled =
(!cmbRTDiv.Items.Contains("-Select- false;
")) btnRTDelete.Enabled =
{ false;

cmbRTDiv.Items.Add("-Select-"); btnRTCancel.Enabled =
} true;
btnRTSave.Enabled = true;
cmbRTDiv.Text = "- }
Select-"; #endregion
}
} #region Edit Team
#endregion string tn = "", dv = "", c =
"", ac = "";
#region Add Team private void
private void btnRTEdit_Click(object sender,
btnRTAdd_Click(object sender, EventArgs e)
EventArgs e) {
{ tn = txtRTName.Text;
pnlRTTeams.Enabled = dv = cmbRTDiv.Text;
false; c = txtRTCoach.Text;
txtRTTeam.Clear(); ac = txtRTACoach.Text;
cmbRTDivision.Text =
"All"; pnlRTTeams.Enabled =
sRTAddEdit = "Add"; false;

txtRTName.Clear(); sRTAddEdit = "Edit";

if if
(!cmbRTDiv.Items.Contains("-Select- (cmbRTDiv.Items.Contains("-Select-"))
")) {
{
cmbRTDiv.Items.Remove("-Select-");
cmbRTDiv.Items.Insert(0, "-Select-"); }
}
lblRTName.Enabled = true;
cmbRTDiv.Text = "-Select- lblRTDiv.Enabled = true;
"; lblRTCoach.Enabled =
txtRTCoach.Clear(); true;
txtRTACoach.Clear(); lblRTACoach.Enabled =
true;
lblRTName.Enabled = true; txtRTName.Enabled = true;
lblRTDiv.Enabled = true; cmbRTDiv.Enabled = true;

122
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
txtRTCoach.Enabled = LoadRT();
true; }
txtRTACoach.Enabled =
true; else if (sRTAddEdit ==
"Edit")
btnRTAdd.Enabled = false; {
btnRTEdit.Enabled = pnlRTTeams.Enabled =
false; true;
btnRTDelete.Enabled =
false; lblRTName.Enabled =
false;
btnRTCancel.Enabled = lblRTDiv.Enabled =
true; false;
btnRTSave.Enabled = true; lblRTCoach.Enabled =
} false;
#endregion lblRTACoach.Enabled =
false;
#region Cancel txtRTName.Enabled =
private void false;
btnRTCancel_Click(object sender, cmbRTDiv.Enabled =
EventArgs e) false;
{ txtRTCoach.Enabled =
if (sRTAddEdit == "Add") false;
{ txtRTACoach.Enabled =
pnlRTTeams.Enabled = false;
true;
btnRTAdd.Enabled =
lblRTName.Enabled = true;
false; btnRTEdit.Enabled =
lblRTDiv.Enabled = true;
false; btnRTDelete.Enabled =
lblRTCoach.Enabled = true;
false;
lblRTACoach.Enabled = btnRTCancel.Enabled =
false; false;
txtRTName.Enabled = btnRTSave.Enabled =
false; false;
cmbRTDiv.Enabled =
false; txtRTName.Text = tn;
txtRTCoach.Enabled = cmbRTDiv.Text = dv;
false; txtRTCoach.Text = c;
txtRTACoach.Enabled = txtRTACoach.Text =
false; ac;
}
btnRTAdd.Enabled = }
true; #endregion
btnRTEdit.Enabled =
true; #region Delete Team
btnRTDelete.Enabled = private void
true; btnRTDelete_Click(object sender,
EventArgs e)
btnRTCancel.Enabled = {
false; dynamic dialog =
btnRTSave.Enabled = MessageBox.Show("Are you sure you
false; want to delete team " +
txtRTName.Text + "?", "Delete Team",

123
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
MessageBoxButtons.YesNo, #endregion
MessageBoxIcon.Question);
if (dialog == #region Save Team
DialogResult.No) private void
{ } btnRTSave_Click(object sender,
EventArgs e)
else if (dialog == {
DialogResult.Yes) if (txtRTName.Text == "")
{ {
string myQuery =
"DELETE FROM tbl_teamsinfo WHERE MessageBox.Show("Please input team
Team_Name = '" + txtRTName.Text + "' name.", "Team Registration",
AND Division = '" + cmbRTDiv.Text + MessageBoxButtons.OK,
"';"; MessageBoxIcon.Error);
SQLiteConnection }
myConnection = new
SQLiteConnection(Conn.ConnString); else if (cmbRTDiv.Text ==
SQLiteCommand "-Select-")
myCommand = new {
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader MessageBox.Show("Please select
myReader; division.", "Team Registration",
MessageBoxButtons.OK,
try MessageBoxIcon.Error);
{ }

myConnection.Open(); else if (txtRTCoach.Text


myReader = == "")
myCommand.ExecuteReader(); {
while
(myReader.Read()) { } MessageBox.Show("Please input
coach.", "Team Registration",
MessageBoxButtons.OK,
MessageBox.Show(txtRTName.Text + " MessageBoxIcon.Error);
has been deleted", "Delete Team", }
MessageBoxButtons.OK,
MessageBoxIcon.Information); else if (txtRTACoach.Text
LoadRT(); == "")
} {

catch MessageBox.Show("Please input


(SQLiteException ex) assistant coach.", "Team
{ Registration", MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); else
} {
string duplicate =
finally "";
{ int d = 0;

myConnection.Close(); string myQuery =


} "SELECT COUNT(Team_Name) FROM
} tbl_teamsinfo WHERE Team_Name = '" +
}

124
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
txtRTName.Text + "' AND Division = '" tn =
+ cmbRTDiv.Text + "';"; txtRTName.Text;
SQLiteConnection dv =
myConnection = new cmbRTDiv.Text;
SQLiteConnection(Conn.ConnString); #region Add
SQLiteCommand string
myCommand = new myQuery1 = "INSERT INTO
SQLiteCommand(myQuery, myConnection); tbl_teamsinfo(Team_Name, Division,
SQLiteDataReader Coach, Assistant_Coach) "
myReader; + "VALUES('"
+ txtRTName.Text + "', '" +
try cmbRTDiv.Text + "', '" +
{ txtRTCoach.Text + "', '" +
txtRTACoach.Text + "');";
myConnection.Open();
myReader = SQLiteConnection myConnection1 = new
myCommand.ExecuteReader(); SQLiteConnection(Conn.ConnString);
while SQLiteCommand
(myReader.Read()) myCommand1 = new
{ SQLiteCommand(myQuery1,
duplicate = myConnection1);
myReader.GetValue(0).ToString();
} SQLiteDataReader myReader1;
}
try
catch {
(SQLiteException ex)
{ myConnection1.Open();
myReader1
MessageBox.Show(ex.Message, "Error", = myCommand1.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader1.Read()) { }
}

finally MessageBox.Show("Team " +


{ txtRTName.Text + " has been saved.",
"Team Registration",
myConnection.Close(); MessageBoxButtons.OK,
} MessageBoxIcon.Information);

if (sRTAddEdit ==
"Add") pnlRTTeams.Enabled = true;
{
if
(Int32.TryParse(duplicate, out d) && lblRTName.Enabled = false;
d >= 1)
{ lblRTDiv.Enabled = false;

MessageBox.Show("There were the same lblRTCoach.Enabled = false;


team saved.", "Team Registration",
MessageBoxButtons.OK, lblRTACoach.Enabled = false;
MessageBoxIcon.Error);
} txtRTName.Enabled = false;

else cmbRTDiv.Enabled = false;


{

125
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{
txtRTCoach.Enabled = false;
MessageBox.Show("There were the same
txtRTACoach.Enabled = false; team saved.", "Team Registration",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
btnRTAdd.Enabled = true; }

btnRTEdit.Enabled = true; else


{
btnRTDelete.Enabled = true; tn =
txtRTName.Text;
dv =
btnRTCancel.Enabled = false; cmbRTDiv.Text;
#region Edit
btnRTSave.Enabled = false; string
myQuery1 = "UPDATE tbl_teamsinfo SET
LoadRT(); Team_Name = '" + txtRTName.Text + "',
} "
+ "Division =
catch '" + cmbRTDiv.Text + "', Coach = '" +
(SQLiteException ex) txtRTCoach.Text + "', "
{ +
"Assistant_Coach = '" +
MessageBox.Show(ex.Message, "Error", txtRTACoach.Text + "' WHERE No_ID =
MessageBoxButtons.OK, '" + sTID + "';";
MessageBoxIcon.Error);
} SQLiteConnection myConnection1 = new
SQLiteConnection(Conn.ConnString);
finally SQLiteCommand
{ myCommand1 = new
SQLiteCommand(myQuery1,
myConnection1.Close(); myConnection1);
}
#endregion SQLiteDataReader myReader1;
}
} try
{
else if (sRTAddEdit
== "Edit") myConnection1.Open();
{ myReader1
if = myCommand1.ExecuteReader();
(Int32.TryParse(duplicate, out d) && while
d >= 1 && tn != txtRTName.Text) (myReader1.Read()) { }
{

MessageBox.Show("There were the same MessageBox.Show("Team " +


team saved.", "Team Registration", txtRTName.Text + " has been edited.",
MessageBoxButtons.OK, "Team Registration",
MessageBoxIcon.Error); MessageBoxButtons.OK,
} MessageBoxIcon.Information);

else if
(Int32.TryParse(duplicate, out d) && pnlRTTeams.Enabled = true;
d >= 1 && tn == txtRTName.Text && dv
!= cmbRTDiv.Text)

126
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
foreach
lblRTName.Enabled = false; (DataGridViewRow row in
dgvRTTeams.Rows)
lblRTDiv.Enabled = false; {
if
lblRTCoach.Enabled = false; (row.Cells[1].Value.ToString().Equals
(tn) &&
lblRTACoach.Enabled = false; row.Cells[2].Value.ToString().Equals(
dv))
txtRTName.Enabled = false; {

cmbRTDiv.Enabled = false; dgvRTTeams.CurrentCell =


dgvRTTeams[1, row.Index];
txtRTCoach.Enabled = false; }
}
txtRTACoach.Enabled = false; }
}
#endregion
btnRTAdd.Enabled = true;
//------------------------//
btnRTEdit.Enabled = true; Registration : Player

btnRTDelete.Enabled = true; #region Load Tables


void LoadRP()
{
btnRTCancel.Enabled = false; SQLiteConnection myConn =
new
btnRTSave.Enabled = false; SQLiteConnection(Conn.ConnString);
SQLiteCommand myCommand =
tn = new SQLiteCommand("SELECT No_ID,
txtRTName.Text; Last_Name, First_Name,
dv = Middle_Initial, "
cmbRTDiv.Text; + "Last_Name || ', ' ||
First_Name || ' ' || Middle_Initial
LoadRT(); AS 'Player Name', "
} + "Age, Division,
Team_Name AS 'Team Name',
catch Jersey_Number AS 'Jersey Number' FROM
(SQLiteException ex) tbl_playersinfo "
{ + "ORDER BY Last_Name ||
', ' || First_Name || ' ' ||
MessageBox.Show(ex.Message, "Error", Middle_Initial;", myConn);
MessageBoxButtons.OK,
MessageBoxIcon.Error); try
} {
SQLiteDataAdapter
finally myAdapter = new SQLiteDataAdapter();
{
myAdapter.SelectCommand = myCommand;
myConnection1.Close(); myDatasetRP = new
} DataTable();
#endregion
} myAdapter.Fill(myDatasetRP);
} BindingSource
bdSource = new BindingSource();

127
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
bdSource.DataSource = else if (cmbRPSearch.Text
myDatasetRP; == "Team Name")
{
dgvRPPlayers.DataSource = bdSource; txtRPPlayer.Visible =
false;
myAdapter.Update(myDatasetRP); lblRPPlayer.Visible =
} false;
txtRPTeam.Visible =
catch (Exception ex) true;
{ lblRPTeam.Visible =
true;
MessageBox.Show(ex.Message, "Error", cmbRPDivision.Visible
MessageBoxButtons.OK, = false;
MessageBoxIcon.Error); lblRPDivision.Visible
} = false;

txtRPPlayer.Clear();
dgvRPPlayers.Columns[0].Visible = txtRPTeam.Clear();
false; cmbRPDivision.Text =
"All";
dgvRPPlayers.Columns[1].Visible = }
false;
else if (cmbRPSearch.Text
dgvRPPlayers.Columns[2].Visible = == "Division")
false; {
txtRPPlayer.Visible =
dgvRPPlayers.Columns[3].Visible = false;
false; lblRPPlayer.Visible =
} false;
#endregion txtRPTeam.Visible =
false;
#region Search lblRPTeam.Visible =
void RPSearch() false;
{ cmbRPDivision.Visible
if (cmbRPSearch.Text == = true;
"Player Name") lblRPDivision.Visible
{ = true;
txtRPPlayer.Visible =
true; txtRPPlayer.Clear();
lblRPPlayer.Visible = txtRPTeam.Clear();
true; cmbRPDivision.Text =
txtRPTeam.Visible = "All";
false; }
lblRPTeam.Visible = }
false; #endregion
cmbRPDivision.Visible
= false; #region AC and Filter Search
lblRPDivision.Visible void ACRPlayer()
= false; {

txtRPPlayer.Clear(); txtRPPlayer.AutoCompleteMode =
txtRPTeam.Clear(); AutoCompleteMode.SuggestAppend;
cmbRPDivision.Text =
"All"; txtRPPlayer.AutoCompleteSource =
} AutoCompleteSource.CustomSource;

128
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
}
AutoCompleteStringCollection acs =
new AutoCompleteStringCollection();
txtRPPlayer.AutoCompleteCustomSource
= acs;
txtRPTeam.AutoCompleteMode =
AutoCompleteMode.SuggestAppend; txtRPTeam.AutoCompleteCustomSource =
acs1;
txtRPTeam.AutoCompleteSource = }
AutoCompleteSource.CustomSource;
private void
AutoCompleteStringCollection acs1 = cmbRPSearch_SelectedIndexChanged(obje
new AutoCompleteStringCollection(); ct sender, EventArgs e)
{
string myQuery = "SELECT RPSearch();
Last_Name || ', ' || First_Name || ' }
' || Middle_Initial, Team_Name FROM
tbl_playersinfo;"; private void
SQLiteConnection cmbRPDivision_SelectedIndexChanged(ob
myConnection = new ject sender, EventArgs e)
SQLiteConnection(Conn.ConnString); {
SQLiteCommand myCommand = if (cmbRPDivision.Text ==
new SQLiteCommand(myQuery, "All")
myConnection); {
SQLiteDataReader LoadRP();
myReader; }

try else
{ {
myConnection.Open(); DataView myDV = new
myReader = DataView(myDatasetRP);
myCommand.ExecuteReader(); myDV.RowFilter =
while string.Format("[Division] LIKE
(myReader.Read()) '%{0}%'",
{ EscapeLikeValue(cmbRPDivision.Text));
string pname =
myReader.GetValue(0).ToString(); dgvRPPlayers.DataSource = myDV;
string tname =
myReader.GetValue(1).ToString(); if
acs.Add(pname); (dgvRPPlayers.Rows.Count == 0)
acs1.Add(tname); {
}
} txtRPLName.Clear();

catch (SQLiteException txtRPFName.Clear();


ex) txtRPMI.Clear();
{ txtRPAge.Clear();

MessageBox.Show(ex.Message, "Error", txtRPJNumber.Clear();


MessageBoxButtons.OK,
MessageBoxIcon.Error); if
} (!cmbRPDiv.Items.Contains("-Select-
"))
finally {
{
myConnection.Close(); cmbRPDiv.Items.Insert(0, "-Select-");

129
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} {

cmbRPDiv.Text = cmbRPTName.Items.Insert(0, "-Select-


"-Select-"; ");
}
if
(!cmbRPTName.Items.Contains("-Select- cmbRPTName.Text = "-
")) Select-";
{ }
}
cmbRPTName.Items.Insert(0, "-Select-
"); private void
} txtRPTeam_TextChanged(object sender,
EventArgs e)
cmbRPTName.Text = {
"-Select-"; DataView myDV = new
} DataView(myDatasetRP);
} myDV.RowFilter =
} string.Format("[Team Name] LIKE
'%{0}%'",
private void EscapeLikeValue(txtRPTeam.Text));
txtRPPlayer_TextChanged(object dgvRPPlayers.DataSource =
sender, EventArgs e) myDV;
{
DataView myDV = new if
DataView(myDatasetRP); (dgvRPPlayers.Rows.Count == 0)
myDV.RowFilter = {
string.Format("[Player Name] LIKE txtRPLName.Clear();
'%{0}%'", txtRPFName.Clear();
EscapeLikeValue(txtRPPlayer.Text)); txtRPMI.Clear();
dgvRPPlayers.DataSource = txtRPAge.Clear();
myDV; txtRPJNumber.Clear();

if if
(dgvRPPlayers.Rows.Count == 0) (!cmbRPDiv.Items.Contains("-Select-
{ "))
txtRPLName.Clear(); {
txtRPFName.Clear();
txtRPMI.Clear(); cmbRPDiv.Items.Insert(0, "-Select-");
txtRPAge.Clear(); }
txtRPJNumber.Clear();
cmbRPDiv.Text = "-
if Select-";
(!cmbRPDiv.Items.Contains("-Select-
")) if
{ (!cmbRPTName.Items.Contains("-Select-
"))
cmbRPDiv.Items.Insert(0, "-Select-"); {
}
cmbRPTName.Items.Insert(0, "-Select-
cmbRPDiv.Text = "- ");
Select-"; }

if cmbRPTName.Text = "-
(!cmbRPTName.Items.Contains("-Select- Select-";
")) }

130
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} DataGridViewRow row =
#endregion this.dgvRPPlayers.Rows[e.RowIndex];

#region Populate Teams RPPopulateTeams();


void RPPopulateTeams()
{ txtRPLName.Text =
string myQuery = "SELECT row.Cells["Last_Name"].Value.ToString
Team_Name FROM tbl_teamsinfo WHERE ();
Division = '" + cmbRPDiv.Text + "';"; txtRPFName.Text =
SQLiteConnection row.Cells["First_Name"].Value.ToStrin
myConnection = new g();
SQLiteConnection(Conn.ConnString); txtRPMI.Text =
SQLiteCommand myCommand = row.Cells["Middle_Initial"].Value.ToS
new SQLiteCommand(myQuery, tring();
myConnection); txtRPAge.Text =
SQLiteDataReader row.Cells["Age"].Value.ToString();
myReader; cmbRPDiv.Text =
row.Cells["Division"].Value.ToString(
try );
{ cmbRPTName.Text =
myConnection.Open(); row.Cells["Team
myReader = Name"].Value.ToString();
myCommand.ExecuteReader(); txtRPJNumber.Text =
while row.Cells["Jersey
(myReader.Read()) Number"].Value.ToString();
{ sPID =
string category = row.Cells["No_ID"].Value.ToString();
myReader.GetString(0); }
}
cmbRPTName.Items.Add(category); #endregion
}
} #region Default -Select-
string pdiv = "-Select-";
catch (SQLiteException private void
ex) cmbRPDiv_SelectedIndexChanged(object
{ sender, EventArgs e)
{
MessageBox.Show(ex.Message, "Error", if (pdiv !=
MessageBoxButtons.OK, cmbRPDiv.Text)
MessageBoxIcon.Error); {
}
cmbRPTName.Items.Clear();
finally RPPopulateTeams();
{
myConnection.Close(); if
} (!cmbRPTName.Items.Contains("-Select-
} "))
#endregion {

#region Cell Enter cmbRPTName.Items.Insert(0, "-Select-


private void ");
dgvRPPlayers_CellEnter(object sender, }
DataGridViewCellEventArgs e)
{ cmbRPTName.Text = "-
if (e.RowIndex >= 0) Select-";
{

131
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
pdiv = cmbRPDiv.Text; private void
} btnRPAdd_Click(object sender,
} EventArgs e)
#endregion {
sRPAddEdit = "Add";
#region Number Exception pnlRPPlayers.Enabled =
private void false;
txtRPAge_KeyPress(object sender, txtRPPlayer.Clear();
KeyPressEventArgs e) txtRPTeam.Clear();
{ cmbRPDivision.Text =
char c = e.KeyChar; "All";

if (!Char.IsDigit(c) && c txtRPLName.Clear();


!= 8 && c != 46) txtRPFName.Clear();
{ txtRPMI.Clear();
e.Handled = true; txtRPAge.Clear();
}
if
if (c == '.') (!cmbRPDiv.Items.Contains("-Select-
{ "))
e.Handled = true; {
}
cmbRPDiv.Items.Insert(0, "-Select-");
if }
(txtRPAge.Text.StartsWith("0"))
{ cmbRPDiv.Text = "-Select-
if (c == '0') ";
{
e.Handled = true; cmbRPTName.Items.Clear();
} RPPopulateTeams();

if (c != '0' && c != if
8 && c != 46) (!cmbRPTName.Items.Contains("-Select-
{ "))
txtRPAge.Text = {
txtRPAge.Text.Remove(0, 1);
} cmbRPTName.Items.Insert(0, "-Select-
} ");
} }

private void cmbRPTName.Text = "-


txtRPJNumber_KeyPress(object sender, Select-";
KeyPressEventArgs e)
{ txtRPJNumber.Clear();
char c = e.KeyChar;
btnRPAdd.Enabled = false;
if (!Char.IsDigit(c) && c btnRPEdit.Enabled =
!= 8 && c != 46 || c == '.') false;
{ btnRPDelete.Enabled =
e.Handled = true; false;
}
} btnRPCancel.Enabled =
#endregion true;
btnRPSave.Enabled = true;
#region Add Player

132
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
lblRPLName.Enabled = }
true;
lblRPFName.Enabled = if
true; (cmbRPTName.Items.Contains("-Select-
lblRPMI.Enabled = true; "))
lblRPAge.Enabled = true; {
lblRPDiv.Enabled = true;
lblRPDiv.Enabled = true; cmbRPTName.Items.Remove("-Select-");
lblRPTName.Enabled = }
true;
lblRPJNumber.Enabled = cmbRPTName.Items.Clear();
true; RPPopulateTeams();
cmbRPTName.Text = team;
txtRPLName.Enabled =
true; pnlRPPlayers.Enabled =
txtRPFName.Enabled = false;
true;
txtRPMI.Enabled = true; btnRPAdd.Enabled = false;
txtRPAge.Enabled = true; btnRPEdit.Enabled =
cmbRPDiv.Enabled = true; false;
cmbRPDiv.Enabled = true; btnRPDelete.Enabled =
cmbRPTName.Enabled = false;
true;
txtRPJNumber.Enabled = btnRPCancel.Enabled =
true; true;
} btnRPSave.Enabled = true;
#endregion
lblRPLName.Enabled =
#region Edit Player true;
string ln = "", fn = "", mi = lblRPFName.Enabled =
"", a = "", pd = "", pt = "", jn = true;
"", pn = ""; lblRPMI.Enabled = true;
private void lblRPAge.Enabled = true;
btnRPEdit_Click(object sender, lblRPDiv.Enabled = true;
EventArgs e) lblRPDiv.Enabled = true;
{ lblRPTName.Enabled =
ln = txtRPLName.Text; true;
fn = txtRPFName.Text; lblRPJNumber.Enabled =
mi = txtRPMI.Text; true;
a = txtRPAge.Text;
pd = cmbRPDiv.Text; txtRPLName.Enabled =
pt = cmbRPTName.Text; true;
jn = txtRPJNumber.Text; txtRPFName.Enabled =
pn = txtRPLName.Text + ", true;
" + txtRPFName.Text + " " + txtRPMI.Enabled = true;
txtRPMI.Text; txtRPAge.Enabled = true;
cmbRPDiv.Enabled = true;
sRPAddEdit = "Edit"; cmbRPDiv.Enabled = true;
string team = cmbRPTName.Enabled =
cmbRPTName.Text; true;
txtRPJNumber.Enabled =
if true;
(cmbRPDiv.Items.Contains("-Select-")) }
{ #endregion

cmbRPDiv.Items.Remove("-Select-"); #region Cancel

133
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
private void
btnRPCancel_Click(object sender, else if (sRPAddEdit ==
EventArgs e) "Edit")
{ {
if (sRPAddEdit == "Add") pnlRPPlayers.Enabled
{ = true;
pnlRPPlayers.Enabled btnRPAdd.Enabled =
= true; true;
btnRPAdd.Enabled = btnRPEdit.Enabled =
true; true;
btnRPEdit.Enabled = btnRPDelete.Enabled =
true; true;
btnRPDelete.Enabled =
true; btnRPCancel.Enabled =
false;
btnRPCancel.Enabled = btnRPSave.Enabled =
false; false;
btnRPSave.Enabled =
false; lblRPLName.Enabled =
false;
lblRPLName.Enabled = lblRPFName.Enabled =
false; false;
lblRPFName.Enabled = lblRPMI.Enabled =
false; false;
lblRPMI.Enabled = lblRPAge.Enabled =
false; false;
lblRPAge.Enabled = lblRPDiv.Enabled =
false; false;
lblRPDiv.Enabled = lblRPDiv.Enabled =
false; false;
lblRPDiv.Enabled = lblRPTName.Enabled =
false; false;
lblRPTName.Enabled = lblRPJNumber.Enabled
false; = false;
lblRPJNumber.Enabled
= false; txtRPLName.Enabled =
false;
txtRPLName.Enabled = txtRPFName.Enabled =
false; false;
txtRPFName.Enabled = txtRPMI.Enabled =
false; false;
txtRPMI.Enabled = txtRPAge.Enabled =
false; false;
txtRPAge.Enabled = cmbRPDiv.Enabled =
false; false;
cmbRPDiv.Enabled = cmbRPDiv.Enabled =
false; false;
cmbRPDiv.Enabled = cmbRPTName.Enabled =
false; false;
cmbRPTName.Enabled = txtRPJNumber.Enabled
false; = false;
txtRPJNumber.Enabled
= false; txtRPLName.Text = ln;
txtRPFName.Text = fn;
LoadRP(); txtRPMI.Text = mi;
} txtRPAge.Text = a;

134
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
cmbRPDiv.Text = pd;
cmbRPTName.Text = pt; MessageBox.Show(txtRPLName.Text + ",
txtRPJNumber.Text = " + txtRPFName.Text + " " +
jn; txtRPMI.Text + " from team " +
} cmbRPTName.Text + " has been
} deleted", "Delete Player",
#endregion MessageBoxButtons.OK,
MessageBoxIcon.Information);
#region Delete Player LoadRP();
private void }
btnRPDelete_Click(object sender,
EventArgs e) catch
{ (SQLiteException ex)
dynamic dialog = {
MessageBox.Show("Are you sure you
want to delete team " + MessageBox.Show(ex.Message, "Error",
txtRPLName.Text + ", " + MessageBoxButtons.OK,
txtRPFName.Text + " " + txtRPMI.Text MessageBoxIcon.Error);
+ " from team " + cmbRPTName.Text + }
"?", "Delete Player",
MessageBoxButtons.YesNo, finally
MessageBoxIcon.Question); {
if (dialog ==
DialogResult.No) myConnection.Close();
{ } }
}
else if (dialog == }
DialogResult.Yes) #endregion
{
string myQuery = #region Save Player
"DELETE FROM tbl_playersinfo WHERE private void
Last_Name || ', ' || First_Name || ' btnRPSave_Click(object sender,
' || Middle_Initial = '" + EventArgs e)
txtRPLName.Text + ", " + {
txtRPFName.Text + " " + txtRPMI.Text int age = 0;
+ "' AND Team_Name = '" +
cmbRPTName.Text + "' AND Division = if (txtRPLName.Text ==
'" + cmbRPDiv.Text + "';"; "")
SQLiteConnection {
myConnection = new
SQLiteConnection(Conn.ConnString); MessageBox.Show("Please input last
SQLiteCommand name.", "Player Registration",
myCommand = new MessageBoxButtons.OK,
SQLiteCommand(myQuery, myConnection); MessageBoxIcon.Error);
SQLiteDataReader }
myReader;
else if (txtRPFName.Text
try == "")
{ {

myConnection.Open(); MessageBox.Show("Please input first


myReader = name.", "Player Registration",
myCommand.ExecuteReader(); MessageBoxButtons.OK,
while MessageBoxIcon.Error);
(myReader.Read()) { } }

135
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
else if (txtRPMI.Text == Registration", MessageBoxButtons.OK,
"") MessageBoxIcon.Error);
{ }

MessageBox.Show("Please input middle else if


initial.", "Player Registration", (Int32.TryParse(txtRPAge.Text, out
MessageBoxButtons.OK, age) && age >= 8 && age <= 17 &&
MessageBoxIcon.Error); cmbRPDiv.Text == "Senior")
} {
MessageBox.Show("The
else if (txtRPAge.Text == player is under age to senior
"") division.", "Player Registration",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show("Please input age.", }
"Player Registration",
MessageBoxButtons.OK, else if
MessageBoxIcon.Error); (Int32.TryParse(txtRPAge.Text, out
} age) && age >= 18 && cmbRPDiv.Text ==
"Junior")
else if (cmbRPDiv.Text == {
"-Select-") MessageBox.Show("The
{ player is over age to junior
division.", "Player Registration",
MessageBox.Show("Please select MessageBoxButtons.OK,
division.", "Player Registration", MessageBoxIcon.Error);
MessageBoxButtons.OK, }
MessageBoxIcon.Error);
} else
{
else if (cmbRPTName.Text string duplicate =
== "-Select-") "";
{ int d = 0;

MessageBox.Show("Please select string myQuery =


team.", "Player Registration", "SELECT COUNT(Jersey_Number) FROM
MessageBoxButtons.OK, tbl_playersinfo WHERE Jersey_Number =
MessageBoxIcon.Error); '" + txtRPJNumber.Text + "' AND
} Team_Name = '" + cmbRPTName.Text + "'
AND Division = '" + cmbRPDiv.Text +
else if "';";
(txtRPJNumber.Text == "") SQLiteConnection
{ myConnection = new
SQLiteConnection(Conn.ConnString);
MessageBox.Show("Please input jersey SQLiteCommand
number.", "Player Registration", myCommand = new
MessageBoxButtons.OK, SQLiteCommand(myQuery, myConnection);
MessageBoxIcon.Error); SQLiteDataReader
} myReader;

else if try
(Int32.TryParse(txtRPAge.Text, out {
age) && age < 8)
{ myConnection.Open();
MessageBox.Show("The myReader =
player is under age.", "Player myCommand.ExecuteReader();

136
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
while txtRPFName.Text + "', '" +
(myReader.Read()) txtRPMI.Text + "', '" + txtRPAge.Text
{ + "', '" + cmbRPDiv.Text + "', '" +
duplicate = cmbRPTName.Text + "', '" +
myReader.GetValue(0).ToString(); txtRPJNumber.Text + "');";
}
} SQLiteConnection myConnection1 = new
SQLiteConnection(Conn.ConnString);
catch SQLiteCommand
(SQLiteException ex) myCommand1 = new
{ SQLiteCommand(myQuery1,
myConnection1);
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, SQLiteDataReader myReader1;
MessageBoxIcon.Error);
} try
{
finally
{ myConnection1.Open();
myReader1
myConnection.Close(); = myCommand1.ExecuteReader();
} while
(myReader1.Read()) { }
if (sRPAddEdit ==
"Add")
{ MessageBox.Show(" Player " +
if txtRPLName.Text + ", " +
(Int32.TryParse(duplicate, out d) && txtRPFName.Text + " " + txtRPMI.Text
d >= 1) + " for team " + cmbRPTName.Text + "
{ has been saved.", "Player
Registration", MessageBoxButtons.OK,
MessageBox.Show("There were the same MessageBoxIcon.Information);
jersey number saved in this team.",
"Player Registration",
MessageBoxButtons.OK, pnlRPPlayers.Enabled = true;
MessageBoxIcon.Error);
} btnRPAdd.Enabled = true;

else btnRPEdit.Enabled = true;


{
pn = btnRPDelete.Enabled = true;
txtRPLName.Text + ", " +
txtRPFName.Text + " " + txtRPMI.Text;
pd = btnRPCancel.Enabled = false;
cmbRPDiv.Text;
pt = btnRPSave.Enabled = false;
cmbRPTName.Text;

#region Add lblRPLName.Enabled = false;


string
myQuery1 = "INSERT INTO lblRPFName.Enabled = false;
tbl_playersinfo(Last_Name,
First_Name, Middle_Initial, Age, lblRPMI.Enabled = false;
Division, Team_Name, Jersey_Number) "
+ "VALUES('" lblRPAge.Enabled = false;
+ txtRPLName.Text + "', '" +

137
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

lblRPDiv.Enabled = false; MessageBox.Show("There were the same


jersey number saved in this team.",
lblRPDiv.Enabled = false; "Player Registration",
MessageBoxButtons.OK,
lblRPTName.Enabled = false; MessageBoxIcon.Error);
}
lblRPJNumber.Enabled = false;
else
{
txtRPLName.Enabled = false; pn =
txtRPLName.Text + ", " +
txtRPFName.Enabled = false; txtRPFName.Text + " " + txtRPMI.Text;
pd =
txtRPMI.Enabled = false; cmbRPDiv.Text;
pt =
txtRPAge.Enabled = false; cmbRPTName.Text;

cmbRPDiv.Enabled = false; #region Edit


string
cmbRPDiv.Enabled = false; myQuery1 = "UPDATE tbl_playersinfo
SET Last_Name = '" + txtRPLName.Text
cmbRPTName.Enabled = false; + "', "
+ "First_Name
txtRPJNumber.Enabled = false; = '" + txtRPFName.Text + "',
Middle_Initial = '" + txtRPMI.Text +
LoadRP(); "', "
} + "Age = '" +
txtRPAge.Text + "', Division = '" +
catch cmbRPDiv.Text + "', "
(SQLiteException ex) + "Team_Name
{ = '" + cmbRPTName.Text + "',
Jersey_Number = '" +
MessageBox.Show(ex.Message, "Error", txtRPJNumber.Text + "' "
MessageBoxButtons.OK, + "WHERE
MessageBoxIcon.Error); No_ID = '" + sPID + "';";
}
SQLiteConnection myConnection1 = new
finally SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
myCommand1 = new
myConnection1.Close(); SQLiteCommand(myQuery1,
} myConnection1);
#endregion
} SQLiteDataReader myReader1;
}
try
else if (sRPAddEdit {
== "Edit")
{ myConnection1.Open();
if myReader1
(Int32.TryParse(duplicate, out d) && = myCommand1.ExecuteReader();
d >= 1 && pt == cmbRPTName.Text && pd while
== cmbRPDiv.Text) (myReader1.Read()) { }
{

138
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

MessageBox.Show(" Player " + LoadRP();


txtRPLName.Text + ", " + }
txtRPFName.Text + " " + txtRPMI.Text
+ " for team " + cmbRPTName.Text + " catch
has been edited.", "Player (SQLiteException ex)
Registration", MessageBoxButtons.OK, {
MessageBoxIcon.Information);
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
pnlRPPlayers.Enabled = true; MessageBoxIcon.Error);
}
btnRPAdd.Enabled = true;
finally
btnRPEdit.Enabled = true; {

btnRPDelete.Enabled = true; myConnection1.Close();


}
#endregion
btnRPCancel.Enabled = false; }
}
btnRPSave.Enabled = false;
foreach
(DataGridViewRow row in
lblRPLName.Enabled = false; dgvRPPlayers.Rows)
{
lblRPFName.Enabled = false; if
(row.Cells[4].Value.ToString().Equals
lblRPMI.Enabled = false; (pn) &&
row.Cells[6].Value.ToString().Equals(
lblRPAge.Enabled = false; pd) &&
row.Cells[7].Value.ToString().Equals(
lblRPDiv.Enabled = false; pt))
{
lblRPDiv.Enabled = false;
dgvRPPlayers.CurrentCell =
lblRPTName.Enabled = false; dgvRPPlayers[4, row.Index];
}
lblRPJNumber.Enabled = false; }
}
}
txtRPLName.Enabled = false; #endregion

txtRPFName.Enabled = false; //------------------------//


Logout, Exit and Shortcuts
txtRPMI.Enabled = false;
#region Logout and Exit
txtRPAge.Enabled = false; private void
tsLogout_Click(object sender,
cmbRPDiv.Enabled = false; EventArgs e)
{
cmbRPDiv.Enabled = false; dynamic dialog =
MessageBox.Show("Are you sure you
cmbRPTName.Enabled = false; want to logout?", "Logout",
MessageBoxButtons.YesNo,
txtRPJNumber.Enabled = false; MessageBoxIcon.Question);

139
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
if (dialog == if (e.Alt && e.KeyCode ==
DialogResult.No) Keys.T)
{ } {
tsRTeam_Click(sender,
else if (dialog == e);
DialogResult.Yes) }
{
Login w = new if (e.Alt && e.KeyCode ==
Login(); Keys.M)
this.Hide(); {
w.Show();
} tsGTeams_Click(sender, e);
} }

private void if (e.Alt && e.KeyCode ==


Administrator_FormClosing(object Keys.Y)
sender, FormClosingEventArgs e) {
{
if (e.CloseReason == tsGPlayers_Click(sender, e);
CloseReason.UserClosing) }
{
dynamic dialog = if (e.Alt && e.KeyCode ==
MessageBox.Show("Are you sure you Keys.O)
want to exit the program?", "Exit", {
MessageBoxButtons.YesNo,
MessageBoxIcon.Question); tsGOfficials_Click(sender, e);
if (dialog == }
DialogResult.No)
{ if (e.Alt && e.KeyCode ==
e.Cancel = true; Keys.U)
} {
tsUser_Click(sender,
else if (dialog == e);
DialogResult.Yes) }
{ }
e.Cancel = false; #endregion

Application.Exit(); //------------------------//
} Game Logs : Teams
}
} #region Load Tables
#endregion void LoadGLTInfo()
{
#region Shortcuts SQLiteConnection myConn =
private void new
Administrator_KeyDown(object sender, SQLiteConnection(Conn.ConnString);
KeyEventArgs e) SQLiteCommand myCommand =
{ new SQLiteCommand("SELECT i.Team_Name
if (e.Alt && e.KeyCode == || ' ' || i.Division AS 'Team Name
Keys.P) and Division', i.Team_Name AS 'Team
{ Name', i.Division, i.Coach, "
+ "i.Assistant_Coach AS
tsRPlayer_Click(sender, e); 'Assistant Coach', SUM(g.Game_Status
} = 'Win') AS 'Win', "

140
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "SUM(g.Game_Status = + "strftime('%Y-%m-%d',
'Lose') AS 'Lose', SUM(g.Game_Status Game_Date) AS 'Game Date', CASE WHEN
= 'Default') AS 'Default' " CAST(strftime('%H', Game_Date) AS
+ "FROM tbl_teamsinfo i INTEGER) = 00 "
LEFT JOIN tbl_teamsgamelogs g ON + "THEN strftime(12 ||
i.Team_Name || ' ' || i.Division = '%M', Game_Date) || ' AM' WHEN
g.Team_Name || ' ' || g.Division " CAST(strftime('%H', Game_Date) AS
+ "GROUP BY i.Team_Name INTEGER) = 12 "
ORDER BY i.Team_Name || ' ' || + "THEN strftime('%H:%M',
i.Division;", myConn); Game_Date) || ' PM' WHEN
CAST(strftime('%H', Game_Date) AS
try INTEGER) > 12 "
{ + "THEN strftime('%H:%M',
SQLiteDataAdapter Game_Date , '-12 HOURS')|| ' PM' ELSE
myAdapter = new SQLiteDataAdapter(); strftime('%H:%M', Game_Date) || ' AM'
END AS Time, "
myAdapter.SelectCommand = myCommand; + "First_Half_Time_Out AS
myDatasetGLT = new '1st Half Time Out',
DataTable(); Second_Half_Time_Out AS '2nd Half
Time Out', Extra_Time_Out AS 'Extra
myAdapter.Fill(myDatasetGLT); Time Out', "
BindingSource + "FirstP_Team_Foul AS
bdSource = new BindingSource(); '1st Period Team Foul',
bdSource.DataSource = SecondP_Team_Foul AS '2nd Period Team
myDatasetGLT; Foul', ThirdP_Team_Foul AS '3rd
dgvGLTInfo.DataSource Period Team Foul', "
= bdSource; + "Overtime_Team_Foul AS
'Overtime Team Foul', Opponent,
myAdapter.Update(myDatasetGLT); Game_Score AS 'Game Score',
} Game_Status AS 'Game Status' "
+ "FROM tbl_teamsgamelogs
catch (Exception ex) ORDER BY Game_Number;", myConn);
{
try
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK, SQLiteDataAdapter
MessageBoxIcon.Error); myAdapter = new SQLiteDataAdapter();
}
myAdapter.SelectCommand = myCommand;
myDatasetGLTG = new
dgvGLTInfo.Columns[0].Visible = DataTable();
false;
} myAdapter.Fill(myDatasetGLTG);
BindingSource
void LoadGLTGames() bdSource = new BindingSource();
{ bdSource.DataSource =
SQLiteConnection myConn = myDatasetGLTG;
new
SQLiteConnection(Conn.ConnString); dgvGLTGames.DataSource = bdSource;
SQLiteCommand myCommand =
new SQLiteCommand("SELECT Team_Name myAdapter.Update(myDatasetGLTG);
|| ' ' || Division AS 'Team Name and }
Division', Team_Name AS 'Team Name',
Division, Game_Number AS 'Game catch (Exception ex)
Number', " {

141
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

MessageBox.Show(ex.Message, "Error", txtGLSTeam.AutoCompleteMode =


MessageBoxButtons.OK, AutoCompleteMode.SuggestAppend;
MessageBoxIcon.Error);
} txtGLSTeam.AutoCompleteSource =
AutoCompleteSource.CustomSource;

dgvGLTGames.Columns[0].Visible = AutoCompleteStringCollection acs =


false; new AutoCompleteStringCollection();
}
#endregion string myQuery = "SELECT
Team_Name FROM tbl_teamsinfo;";
#region Search SQLiteConnection
void GLTSearch() myConnection = new
{ SQLiteConnection(Conn.ConnString);
if (cmbGLTSearch.Text == SQLiteCommand myCommand =
"Team Name") new SQLiteCommand(myQuery,
{ myConnection);
lblGLSTeam.Visible = SQLiteDataReader
true; myReader;
txtGLSTeam.Visible =
true; try
{
lblGLSDivision.Visible = false; myConnection.Open();
myReader =
cmbGLSDivision.Visible = false; myCommand.ExecuteReader();
while
txtGLSTeam.Clear(); (myReader.Read())
cmbGLSDivision.Text = {
"All"; string tname =
} myReader.GetValue(0).ToString();
acs.Add(tname);
else if }
(cmbGLTSearch.Text == "Division") }
{
lblGLSTeam.Visible = catch (SQLiteException
false; ex)
txtGLSTeam.Visible = {
false;
MessageBox.Show(ex.Message, "Error",
lblGLSDivision.Visible = true; MessageBoxButtons.OK,
MessageBoxIcon.Error);
cmbGLSDivision.Visible = true; }

cmbGLSDivision.Text = finally
"All"; {
txtGLSTeam.Clear(); myConnection.Close();
} }
}
#endregion
txtGLSTeam.AutoCompleteCustomSource =
#region AC and Filter Search acs;
void ACGLSTeam() }
{

142
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
private void DataGridViewRow row =
cmbGLSDivision_SelectedIndexChanged(o this.dgvGLTInfo.Rows[e.RowIndex];
bject sender, EventArgs e)
{ td = row.Cells["Team
if (cmbGLSDivision.Text Name and Division"].Value.ToString();
== "All")
{ DataView myDV = new
LoadGLTInfo(); DataView(myDatasetGLTG);
} myDV.RowFilter =
string.Format("[Team Name and
else Division] LIKE '%{0}%'",
{ EscapeLikeValue(td));
DataView myDV = new
DataView(myDatasetGLT); dgvGLTGames.DataSource = myDV;
myDV.RowFilter = }
string.Format("[Division] LIKE }
'%{0}%'", #endregion
EscapeLikeValue(cmbGLSDivision.Text))
; //------------------------//
dgvGLTInfo.DataSource Game Logs : Players
= myDV;
} #region Load Tables
} void LoadGLPInfo()
{
private void SQLiteConnection myConn =
txtGLSTeam_TextChanged(object sender, new
EventArgs e) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand myCommand =
DataView myDV = new new SQLiteCommand("SELECT i.Last_Name
DataView(myDatasetGLT); || ', ' || i.First_Name || ' ' ||
myDV.RowFilter = i.Middle_Initial || ' ' ||
string.Format("[Team Name] LIKE i.Team_Name || ' ' || i.Division AS
'%{0}%'", 'Player Name, Team Name and
EscapeLikeValue(txtGLSTeam.Text)); Division',"
dgvGLTInfo.DataSource = + "i.Last_Name || ', ' ||
myDV; i.First_Name || ' ' ||
} i.Middle_Initial AS 'Player Name', "
+ "i.Team_Name AS 'Team
private void Name', i.Division AS 'Division',
cmbGLTSearch_SelectedIndexChanged(obj i.Jersey_Number AS 'Jersey Number', "
ect sender, EventArgs e) + "SUM(g.FirstP_Score) +
{ SUM(SecondP_Score) +
GLTSearch(); SUM(g.ThirdP_Score) +
} SUM(g.FourthP_Score) + "
#endregion + "SUM(g.Overtime_Score)
AS 'Season Score' FROM
#region Cell Enter tbl_playersinfo i LEFT JOIN
private void tbl_playersgamelogs g ON "
dgvGLTInfo_CellEnter(object sender, + "i.Last_Name || ', ' ||
DataGridViewCellEventArgs e) i.First_Name || ' ' ||
{ i.Middle_Initial || ' ' ||
string td; i.Team_Name || ' ' || "
+ "i.Division =
if (e.RowIndex >= 0) g.Last_Name || ', ' || g.First_Name
{ || ' ' || g.Middle_Initial || ' ' ||
g.Team_Name "

143
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "|| ' ' || g.Division Number', strftime('%Y-%m-%d',
GROUP BY i.Last_Name || ', ' || Game_Date) AS 'Game Date', "
i.First_Name || ' ' || + "CASE WHEN
i.Middle_Initial " CAST(strftime('%H', Game_Date) AS
+ "|| ' ' || i.Team_Name INTEGER) = 00 THEN strftime(12 ||
|| ' ' || i.Division;", myConn); '%M', Game_Date) || ' AM' "
+ "WHEN
try CAST(strftime('%H', Game_Date) AS
{ INTEGER) = 12 THEN strftime('%H:%M',
SQLiteDataAdapter Game_Date) || ' PM' "
myAdapter = new SQLiteDataAdapter(); + "WHEN
CAST(strftime('%H', Game_Date) AS
myAdapter.SelectCommand = myCommand; INTEGER) > 12 THEN strftime('%H:%M',
myDatasetGLP = new Game_Date , '-12 HOURS')|| ' PM' "
DataTable(); + "ELSE strftime('%H:%M',
Game_Date) || ' AM' END AS
myAdapter.Fill(myDatasetGLP); Time,FirstP_Score AS '1st Period
BindingSource Score', "
bdSource = new BindingSource(); + "SecondP_Score AS '2nd
bdSource.DataSource = Period Score', ThirdP_Score AS '3rd
myDatasetGLP; Period Score', FourthP_Score AS '4th
dgvGLPInfo.DataSource Period Score', "
= bdSource; + "Overtime_Score AS
'Overtime Score', Foul_1 AS 'Foul 1',
myAdapter.Update(myDatasetGLP); Foul_2 AS 'Foul 2', Foul_3 AS 'Foul
} 3', Foul_4 AS 'Foul 4', "
+ "Foul_5 AS 'Foul 5'
catch (Exception ex) FROM tbl_playersgamelogs ORDER BY
{ Last_Name || ', ' || First_Name || '
' || Middle_Initial;", myConn);
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, try
MessageBoxIcon.Error); {
} SQLiteDataAdapter
myAdapter = new SQLiteDataAdapter();

dgvGLPInfo.Columns[0].Visible = myAdapter.SelectCommand = myCommand;


false; myDatasetGLPG = new
} DataTable();

void LoadGLPGames() myAdapter.Fill(myDatasetGLPG);


{ BindingSource
SQLiteConnection myConn = bdSource = new BindingSource();
new bdSource.DataSource =
SQLiteConnection(Conn.ConnString); myDatasetGLPG;
SQLiteCommand myCommand =
new SQLiteCommand("SELECT Last_Name dgvGLPGames.DataSource = bdSource;
|| ', ' || First_Name || ' ' ||
Middle_Initial || ' ' " myAdapter.Update(myDatasetGLPG);
+ "|| Team_Name || ' ' || }
Division AS 'Player Name, Team Name
and Division', Last_Name || ', ' || catch (Exception ex)
First_Name || ' ' || Middle_Initial {
AS 'Player Name', "
+ "Team_Name AS 'Team MessageBox.Show(ex.Message, "Error",
Name', Division, Game_Number AS 'Game

144
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
MessageBoxButtons.OK,
MessageBoxIcon.Error); else if
} (cmbGLPSearch.Text == "Division")
{
txtGLSPlayer.Visible
dgvGLPGames.Columns[0].Visible = = false;
false; lblGLSPlayer.Visible
} = false;
#endregion txtGLPTeam.Visible =
false;
#region Search lblGLPTeam.Visible =
void GLPSearch() false;
{
if (cmbGLPSearch.Text == cmbGLPDivision.Visible = true;
"Player Name")
{ lblGLPDivision.Visible = true;
txtGLSPlayer.Visible
= true; txtGLSPlayer.Clear();
lblGLSPlayer.Visible txtGLPTeam.Clear();
= true; cmbGLPDivision.Text =
txtGLPTeam.Visible = "All";
false; }
lblGLPTeam.Visible = }
false; #endregion

cmbGLPDivision.Visible = false; #region AC and Filter Search


void ACGLSPlayer()
lblGLPDivision.Visible = false; {

txtGLSPlayer.Clear(); txtGLSPlayer.AutoCompleteMode =
txtGLPTeam.Clear(); AutoCompleteMode.SuggestAppend;
cmbGLPDivision.Text =
"All"; txtGLSPlayer.AutoCompleteSource =
} AutoCompleteSource.CustomSource;

else if AutoCompleteStringCollection acs =


(cmbGLPSearch.Text == "Team Name") new AutoCompleteStringCollection();
{
txtGLSPlayer.Visible
= false; txtGLPTeam.AutoCompleteMode =
lblGLSPlayer.Visible AutoCompleteMode.SuggestAppend;
= false;
txtGLPTeam.Visible = txtGLPTeam.AutoCompleteSource =
true; AutoCompleteSource.CustomSource;
lblGLPTeam.Visible =
true; AutoCompleteStringCollection acs1 =
new AutoCompleteStringCollection();
cmbGLPDivision.Visible = false;
string myQuery = "SELECT
lblGLPDivision.Visible = false; Last_Name || ', ' || First_Name || '
' || Middle_Initial, Team_Name FROM
txtGLSPlayer.Clear(); tbl_playersinfo;";
txtGLPTeam.Clear(); SQLiteConnection
cmbGLPDivision.Text = myConnection = new
"All"; SQLiteConnection(Conn.ConnString);
}

145
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteCommand myCommand = DataView myDV = new
new SQLiteCommand(myQuery, DataView(myDatasetGLP);
myConnection); myDV.RowFilter =
SQLiteDataReader string.Format("[Player Name] LIKE
myReader; '%{0}%'",
EscapeLikeValue(txtGLSPlayer.Text));
try dgvGLPInfo.DataSource =
{ myDV;
myConnection.Open(); }
myReader =
myCommand.ExecuteReader(); private void
while txtGLPTeam_TextChanged(object sender,
(myReader.Read()) EventArgs e)
{ {
string pname = DataView myDV = new
myReader.GetValue(0).ToString(); DataView(myDatasetGLP);
string tname = myDV.RowFilter =
myReader.GetValue(1).ToString(); string.Format("[Team Name] LIKE
acs.Add(pname); '%{0}%'",
acs1.Add(tname); EscapeLikeValue(txtGLPTeam.Text));
} dgvGLPInfo.DataSource =
} myDV;
}
catch (SQLiteException
ex) private void
{ cmbGLPDivision_SelectedIndexChanged(o
bject sender, EventArgs e)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK, if (cmbGLPDivision.Text
MessageBoxIcon.Error); == "All")
} {
LoadGLPInfo();
finally }
{
myConnection.Close(); else
} {
DataView myDV = new
DataView(myDatasetGLP);
txtGLSPlayer.AutoCompleteCustomSource myDV.RowFilter =
= acs; string.Format("[Division] LIKE
'%{0}%'",
txtGLPTeam.AutoCompleteCustomSource = EscapeLikeValue(cmbGLPDivision.Text))
acs1; ;
} dgvGLPInfo.DataSource
= myDV;
private void }
cmbGLPSearch_SelectedIndexChanged(obj }
ect sender, EventArgs e) #endregion
{
GLPSearch(); #region Cell Enter
} private void
dgvGLPInfo_CellEnter(object sender,
private void DataGridViewCellEventArgs e)
txtGLSPlayer_TextChanged(object {
sender, EventArgs e) string ptd;
{

146
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
if (e.RowIndex >= 0) {
{ SQLiteDataAdapter
DataGridViewRow row = myAdapter = new SQLiteDataAdapter();
this.dgvGLPInfo.Rows[e.RowIndex];
myAdapter.SelectCommand = myCommand;
ptd = myDatasetGLO = new
row.Cells["Player Name, Team Name and DataTable();
Division"].Value.ToString();
myAdapter.Fill(myDatasetGLO);
DataView myDV = new BindingSource
DataView(myDatasetGLPG); bdSource = new BindingSource();
myDV.RowFilter = bdSource.DataSource =
string.Format("[Player Name, Team myDatasetGLO;
Name and Division] LIKE '%{0}%'", dgvGLOInfo.DataSource
EscapeLikeValue(ptd)); = bdSource;

dgvGLPGames.DataSource = myDV; myAdapter.Update(myDatasetGLO);


} }
}
#endregion catch (Exception ex)
{
//------------------------//
Game Logs : Officials MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
#region Load Tables MessageBoxIcon.Error);
void LoadGLOInfo() }
{ }
SQLiteConnection myConn =
new private void
SQLiteConnection(Conn.ConnString); tsGLogs_Click(object sender,
SQLiteCommand myCommand = EventArgs e)
new SQLiteCommand("SELECT {
o.Game_Number AS 'Game Number',
t.Team_Name || ' VS. ' || Opponent AS }
'Versus', "
+ private void
"o.City_Sports_Coordinator AS 'City tsRegister_Click(object sender,
Sports Coordinator', o.Board_Scorer EventArgs e)
AS 'Board Scorer', " {
+ "o.Computer_Scorer AS
'Computer Scorer', o.Timer, }
o.Announcer, #endregion
o.Twentyfour_Clock_Operator "
+ "AS 'Twenty Four Clock #region Search
Operator', o.Utility, void GLOSearch()
o.Head_Technical AS 'Head Technical', {
" if (cmbGLOSearch.Text ==
+ "o.Referee, o.Umpire_1 "Game Number")
AS 'Umpire 1', o.Umpire_2 AS 'Umpire {
2' FROM tbl_gameofficialslogs o " txtGLONumber.Visible
+ "LEFT JOIN = true;
tbl_teamsgamelogs t ON o.Game_Number lblGLONumber.Visible
= t.Game_Number GROUP BY = true;
o.Game_Number;", myConn); txtGLOVersus.Visible
= false;
try

147
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
lblGLOVersus.Visible SQLiteConnection
= false; myConnection = new
SQLiteConnection(Conn.ConnString);
txtGLONumber.Clear(); SQLiteCommand myCommand =
txtGLOVersus.Clear(); new SQLiteCommand(myQuery,
} myConnection);
SQLiteDataReader
else if myReader;
(cmbGLOSearch.Text == "Versus")
{ try
txtGLONumber.Visible {
= false; myConnection.Open();
lblGLONumber.Visible myReader =
= false; myCommand.ExecuteReader();
txtGLOVersus.Visible while
= true; (myReader.Read())
lblGLOVersus.Visible {
= true; string gnum =
myReader.GetValue(0).ToString();
txtGLONumber.Clear(); string vs =
txtGLOVersus.Clear(); myReader.GetValue(1).ToString();
} acs.Add(gnum);
} acs1.Add(vs);
#endregion }
}
#region AC and Filter Search
void ACGLOffials() catch (SQLiteException
{ ex)
{
txtGLONumber.AutoCompleteMode =
AutoCompleteMode.SuggestAppend; MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
txtGLONumber.AutoCompleteSource = MessageBoxIcon.Error);
AutoCompleteSource.CustomSource; }

AutoCompleteStringCollection acs = finally


new AutoCompleteStringCollection(); {
myConnection.Close();
}
txtGLOVersus.AutoCompleteMode =
AutoCompleteMode.SuggestAppend;
txtGLONumber.AutoCompleteCustomSource
txtGLOVersus.AutoCompleteSource = = acs;
AutoCompleteSource.CustomSource;
txtGLOVersus.AutoCompleteCustomSource
AutoCompleteStringCollection acs1 = = acs1;
new AutoCompleteStringCollection(); }

string myQuery = "SELECT private void


o.Game_Number, t.Team_Name || ' VS. ' cmbGLOSearch_SelectedIndexChanged(obj
|| Opponent FROM ect sender, EventArgs e)
tbl_gameofficialslogs o LEFT JOIN {
tbl_teamsgamelogs t ON o.Game_Number GLOSearch();
= t.Game_Number GROUP BY }
o.Game_Number;";

148
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
private void if (c != '0' && c !=
txtGLONumber_TextChanged(object 8 && c != 46)
sender, EventArgs e) {
{ txtGLONumber.Text
DataView myDV = new = txtGLONumber.Text.Remove(0, 1);
DataView(myDatasetGLO); }
myDV.RowFilter = }
string.Format("[Game Number] LIKE }
'%{0}%'", #endregion
EscapeLikeValue(txtGLONumber.Text));
dgvGLOInfo.DataSource = //------------------------//
myDV; Game Report
}
#region Game Report
private void void GameReport()
txtGLOVersus_TextChanged(object {
sender, EventArgs e) if (sGNum == "")
{ {
DataView myDV = new sGNum = "x";
DataView(myDatasetGLO);
myDV.RowFilter = MessageBox.Show("Please input game
string.Format("[Versus] LIKE number.", "Game Report",
'%{0}%'", MessageBoxButtons.OK,
EscapeLikeValue(txtGLOVersus.Text)); MessageBoxIcon.Error);
dgvGLOInfo.DataSource =
myDV; Administrator_Game_Report w = new
} Administrator_Game_Report();
#endregion w.ShowDialog();
}
#region Number Exception
private void else if (sGNum != "" &&
txtGLONumber_KeyPress(object sender, sGNum != "x")
KeyPressEventArgs e) {
{ string num, count =
char c = e.KeyChar; "";
int ct = 0;
if (!Char.IsDigit(c) && c num = sGNum;
!= 8 && c != 46) sGNum = "x";
{
e.Handled = true; string myQuery =
} "SELECT COUNT(Game_Number) FROM
tbl_teamsgamelogs WHERE Game_Number =
if (c == '.') '" + num + "';";
{ SQLiteConnection
e.Handled = true; myConnection = new
} SQLiteConnection(Conn.ConnString);
SQLiteCommand
if myCommand = new
(txtGLONumber.Text.StartsWith("0")) SQLiteCommand(myQuery, myConnection);
{ SQLiteDataReader
if (c == '0') myReader;
{
e.Handled = true; try
} {

myConnection.Open();

149
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
myReader = SQLiteCommand
myCommand.ExecuteReader(); myCommand1 = new
while SQLiteCommand(myQuery1,
(myReader.Read()) myConnection1);
{ SQLiteDataReader
count = myReader1;
myReader.GetValue(0).ToString();
} try
} {

catch myConnection1.Open();
(SQLiteException ex) myReader1 =
{ myCommand1.ExecuteReader();
while
MessageBox.Show(ex.Message, "Error", (myReader1.Read())
MessageBoxButtons.OK, {
MessageBoxIcon.Error); wteam =
} myReader1.GetValue(0).ToString();
wstatus =
finally myReader1.GetValue(1).ToString();
{ }
}
myConnection.Close();
} catch
(SQLiteException ex)
if {
(Int32.TryParse(count, out ct) && ct
== 0) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show("No game number " + }
num + " found in the record.", "Game
Report", MessageBoxButtons.OK, finally
MessageBoxIcon.Error); {

Administrator_Game_Report w = new myConnection1.Close();


Administrator_Game_Report(); }
w.ShowDialog();
} string myQuery2 =
"SELECT Team_Name, Game_Status FROM
else tbl_teamsgamelogs WHERE Game_Status
{ != 'Win' AND Game_Number = '" + num +
string wteam = "';";
"", ldteam = "", wstatus = "", SQLiteConnection
ldstatus = "", teama = "", teamb = myConnection2 = new
""; SQLiteConnection(Conn.ConnString);
SQLiteCommand
string myQuery1 = myCommand2 = new
"SELECT Team_Name, Game_Status FROM SQLiteCommand(myQuery2,
tbl_teamsgamelogs WHERE Game_Status = myConnection2);
'Win' AND Game_Number = '" + num + SQLiteDataReader
"';"; myReader2;
SQLiteConnection
myConnection1 = new try
SQLiteConnection(Conn.ConnString); {

150
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

myConnection2.Open(); catch
myReader2 = (SQLiteException ex)
myCommand2.ExecuteReader(); {
while
(myReader2.Read()) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
ldteam = MessageBoxIcon.Error);
myReader2.GetValue(0).ToString(); }
ldstatus
= myReader2.GetValue(1).ToString(); finally
} {
}
myConnection3.Close();
catch }
(SQLiteException ex)
{ string myQuery4 =
"SELECT Team_Name FROM
MessageBox.Show(ex.Message, "Error", tbl_teamsgamelogs WHERE A_or_B = 'B'
MessageBoxButtons.OK, AND Game_Number = '" + num + "';";
MessageBoxIcon.Error); SQLiteConnection
} myConnection4 = new
SQLiteConnection(Conn.ConnString);
finally SQLiteCommand
{ myCommand4 = new
SQLiteCommand(myQuery4,
myConnection2.Close(); myConnection4);
} SQLiteDataReader
myReader4;
string myQuery3 =
"SELECT Team_Name FROM try
tbl_teamsgamelogs WHERE A_or_B = 'A' {
AND Game_Number = '" + num + "';";
SQLiteConnection myConnection4.Open();
myConnection3 = new myReader4 =
SQLiteConnection(Conn.ConnString); myCommand4.ExecuteReader();
SQLiteCommand while
myCommand3 = new (myReader4.Read())
SQLiteCommand(myQuery3, {
myConnection3); teamb =
SQLiteDataReader myReader4.GetValue(0).ToString();
myReader3; }
}
try
{ catch
(SQLiteException ex)
myConnection3.Open(); {
myReader3 =
myCommand3.ExecuteReader(); MessageBox.Show(ex.Message, "Error",
while MessageBoxButtons.OK,
(myReader3.Read()) MessageBoxIcon.Error);
{ }
teama =
myReader3.GetValue(0).ToString(); finally
} {
}

151
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
Game_Report r =
myConnection4.Close(); new Game_Report();
} r.Refresh();

ReportDocument crGViewer.ReportSource = game;


game = new ReportDocument();
crGViewer.Refresh();
game.Load(Application.StartupPath +
"\\Game_Report.rpt"); ClearNav();

string mr = pnlMGReport.Visible = true;


"{Officials.Game Number} = '" + num +
"';"; tsGReport.ForeColor =
Color.FromArgb(236, 189, 0);
string tar = }
"{TeamGameA.Team Name} = '" + teama + }
"' AND {TeamA.Game Number} = '" + num }
+ "';"; #endregion
string tbr =
"{TeamGameB.Team Name} = '" + teamb + //------------------------//
"' AND {TeamB.Game Number} = '" + num User
+ "';";
#region Load Tables
void LoadUser()
crGViewer.SelectionFormula = mr; {
SQLiteConnection myConn =
game.Subreports[0].RecordSelectionFor new
mula = tar; SQLiteConnection(Conn.ConnString);
SQLiteCommand myCommand =
game.Subreports[1].RecordSelectionFor new SQLiteCommand("SELECT No_ID,
mula = tbr; Password, User_Type AS 'User Type',
Username FROM tbl_users;", myConn);
TextObject win =
(TextObject)game.ReportDefinition.Sec try
tions["ReportHeaderSection2"].ReportO {
bjects["txtTWin"]; SQLiteDataAdapter
win.Text = wteam; myAdapter = new SQLiteDataAdapter();
TextObject ws =
(TextObject)game.ReportDefinition.Sec myAdapter.SelectCommand = myCommand;
tions["ReportHeaderSection2"].ReportO myDatasetU = new
bjects["txtGSWin"]; DataTable();
ws.Text =
wstatus; myAdapter.Fill(myDatasetU);
BindingSource
TextObject ld = bdSource = new BindingSource();
(TextObject)game.ReportDefinition.Sec bdSource.DataSource =
tions["ReportHeaderSection2"].ReportO myDatasetU;
bjects["txtTLD"]; dgvUser.DataSource =
ld.Text = ldteam; bdSource;
TextObject lds =
(TextObject)game.ReportDefinition.Sec myAdapter.Update(myDatasetU);
tions["ReportHeaderSection2"].ReportO }
bjects["txtGSLD"];
lds.Text = catch (Exception ex)
ldstatus; {

152
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

MessageBox.Show(ex.Message, "Error", txtSUsername.AutoCompleteMode =


MessageBoxButtons.OK, AutoCompleteMode.SuggestAppend;
MessageBoxIcon.Error);
} txtSUsername.AutoCompleteSource =
AutoCompleteSource.CustomSource;

dgvUser.Columns[0].Visible = false; AutoCompleteStringCollection acs =


new AutoCompleteStringCollection();
dgvUser.Columns[1].Visible = false;
} string myQuery = "SELECT
#endregion Username FROM tbl_users;";
SQLiteConnection
#region Search myConnection = new
void USearch() SQLiteConnection(Conn.ConnString);
{ SQLiteCommand myCommand =
if (cmbUSearch.Text == new SQLiteCommand(myQuery,
"Username") myConnection);
{ SQLiteDataReader
lblSUsername.Visible myReader;
= true;
txtSUsername.Visible try
= true; {
lblSUType.Visible = myConnection.Open();
false; myReader =
cmbSUType.Visible = myCommand.ExecuteReader();
false; while
(myReader.Read())
txtSUsername.Clear(); {
cmbSUType.Text = string user =
"All"; myReader.GetValue(0).ToString();
} acs.Add(user);
}
else if (cmbUSearch.Text }
== "User Type")
{ catch (SQLiteException
lblSUsername.Visible ex)
= false; {
txtSUsername.Visible
= false; MessageBox.Show(ex.Message, "Error",
lblSUType.Visible = MessageBoxButtons.OK,
true; MessageBoxIcon.Error);
cmbSUType.Visible = }
true;
finally
txtSUsername.Clear(); {
cmbSUType.Text = myConnection.Close();
"All"; }
}
}
#endregion txtSUsername.AutoCompleteCustomSource
= acs;
#region AC and Filter Search }
void ACUser()
{

153
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
private void cmbUType.Text =
cmbSUType_SelectedIndexChanged(object row.Cells["User
sender, EventArgs e) Type"].Value.ToString();
{ txtUsername.Text =
if (cmbSUType.Text == row.Cells["Username"].Value.ToString(
"All") );
{ txtPassword.Text =
LoadUser(); row.Cells["Password"].Value.ToString(
} );
sUID =
else row.Cells["No_ID"].Value.ToString();
{ }
DataView myDV = new }
DataView(myDatasetU); #endregion
myDV.RowFilter =
string.Format("[User Type] LIKE #region Default -Select-
'%{0}%'", private void
EscapeLikeValue(cmbSUType.Text)); cmbUType_DropDown(object sender,
dgvUser.DataSource = EventArgs e)
myDV; {
} cmbUType.Items.Remove("-
} Select-");
}
private void
txtSUsername_TextChanged(object private void
sender, EventArgs e) cmbUType_DropDownClosed(object
{ sender, EventArgs e)
DataView myDV = new {
DataView(myDatasetU); if (cmbUType.SelectedItem
myDV.RowFilter = == null)
string.Format("[Username] LIKE {
'%{0}%'", if
EscapeLikeValue(txtSUsername.Text)); (!cmbUType.Items.Contains("-Select-
dgvUser.DataSource = "))
myDV; {
}
cmbUType.Items.Add("-Select-");
private void }
cmbUSearch_SelectedIndexChanged(objec
t sender, EventArgs e) cmbUType.Text = "-
{ Select-";
USearch(); }
} }
#endregion #endregion

#region Cell Enter #region Show Password


private void private void
dgvUser_CellEnter(object sender, btnSH_Click(object sender, EventArgs
DataGridViewCellEventArgs e) e)
{ {
if (e.RowIndex >= 0) if (btnSH.Text == "S&how
{ Password")
DataGridViewRow row = {
this.dgvUser.Rows[e.RowIndex]; btnSH.Text = "&Hide
Password";

154
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
#endregion
txtPassword.PasswordChar = '\0';
} #region Edit User
string un = "", ut = "", ps =
else "";
{ private void
btnSH.Text = "S&how btnUEdit_Click(object sender,
Password"; EventArgs e)
{
txtPassword.PasswordChar = '*'; ut = cmbUType.Text;
} un = txtUsername.Text;
} ps = txtPassword.Text;
#endregion
pnlUser.Enabled = false;
#region Add User sUAddEdit = "Edit";
private void
btnUAdd_Click(object sender, if
EventArgs e) (cmbUType.Items.Contains("-Select-"))
{ {
pnlUser.Enabled = false;
sUAddEdit = "Add"; cmbUType.Items.Remove("-Select-");
}
if
(!cmbUType.Items.Contains("-Select- lblUType.Enabled = true;
")) lblUsername.Enabled =
{ true;
lblPassword.Enabled =
cmbUType.Items.Insert(0, "-Select-"); true;
}
cmbUType.Enabled = true;
cmbUType.Text = "-Select- txtUsername.Enabled =
"; true;
txtUsername.Clear(); txtPassword.Enabled =
txtPassword.Clear(); true;

lblUType.Enabled = true; btnUAdd.Enabled = false;


lblUsername.Enabled = btnUEdit.Enabled = false;
true; btnUDelete.Enabled =
lblPassword.Enabled = false;
true;
btnUSave.Enabled = true;
cmbUType.Enabled = true; btnUCancel.Enabled =
txtUsername.Enabled = true;
true; }
txtPassword.Enabled = #endregion
true;
#region Cancel
btnUAdd.Enabled = false; private void
btnUEdit.Enabled = false; btnUCancel_Click(object sender,
btnUDelete.Enabled = EventArgs e)
false; {
if (sUAddEdit == "Add")
btnUSave.Enabled = true; {
btnUCancel.Enabled = pnlUser.Enabled =
true; true;
}

155
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
lblUType.Enabled = btnUSave.Enabled =
false; false;
lblUsername.Enabled = btnUCancel.Enabled =
false; false;
lblPassword.Enabled =
false; cmbUType.Text = ut;
txtUsername.Text =
cmbUType.Enabled = un;
false; txtPassword.Text =
txtUsername.Enabled = ps;
false; }
txtPassword.Enabled = }
false; #endregion

btnUAdd.Enabled = #region Delete


true; private void
btnUEdit.Enabled = btnUDelete_Click(object sender,
true; EventArgs e)
btnUDelete.Enabled = {
true; dynamic dialog =
MessageBox.Show("Are you sure you
btnUSave.Enabled = want to delete user " +
false; txtUsername.Text + "?", "Delete
btnUCancel.Enabled = User", MessageBoxButtons.YesNo,
false; MessageBoxIcon.Question);
if (dialog ==
LoadUser(); DialogResult.No)
} { }

else if (sUAddEdit == else if (dialog ==


"Edit") DialogResult.Yes)
{ {
pnlUser.Enabled = string myQuery =
true; "DELETE FROM tbl_users WHERE No_ID =
lblUType.Enabled = '" + sUID + "';";
false; SQLiteConnection
lblUsername.Enabled = myConnection = new
false; SQLiteConnection(Conn.ConnString);
lblPassword.Enabled = SQLiteCommand
false; myCommand = new
SQLiteCommand(myQuery, myConnection);
cmbUType.Enabled = SQLiteDataReader
false; myReader;
txtUsername.Enabled =
false; try
txtPassword.Enabled = {
false;
myConnection.Open();
btnUAdd.Enabled = myReader =
true; myCommand.ExecuteReader();
btnUEdit.Enabled = while
true; (myReader.Read()) { }
btnUDelete.Enabled =
true; MessageBox.Show(
txtUsername.Text + " has been
deleted", "Delete User",

156
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
MessageBoxButtons.OK,
MessageBoxIcon.Information); else
LoadUser(); {
} if (sUAddEdit ==
"Add")
catch {
(SQLiteException ex) un =
{ txtUsername.Text;

MessageBox.Show(ex.Message, "Error", string myQuery =


MessageBoxButtons.OK, "INSERT INTO tbl_users(User_Type,
MessageBoxIcon.Error); Username, Password) VALUES('" +
} cmbUType.Text + "', '" +
txtUsername.Text + "', '" +
finally txtPassword.Text + "');";
{ SQLiteConnection
myConnection = new
myConnection.Close(); SQLiteConnection(Conn.ConnString);
} SQLiteCommand
} myCommand = new
} SQLiteCommand(myQuery, myConnection);
#endregion SQLiteDataReader
myReader;
#region Save
private void try
btnUSave_Click(object sender, {
EventArgs e)
{ myConnection.Open();
if (cmbUType.Text == "- myReader =
Select-") myCommand.ExecuteReader();
{ while
(myReader.Read()) { }
MessageBox.Show("Please select user
type.", "User", MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show("User " +
} txtUsername.Text + " has been
saved.", "User",
else if (txtUsername.Text MessageBoxButtons.OK,
== "") MessageBoxIcon.Information);
{

MessageBox.Show("Please input pnlUser.Enabled = true;


username.", "User",
MessageBoxButtons.OK, lblUType.Enabled = false;
MessageBoxIcon.Error);
} lblUsername.Enabled = false;

else if (txtPassword.Text lblPassword.Enabled = false;


== "")
{
cmbUType.Enabled = false;
MessageBox.Show("Please input
password.", "User", txtUsername.Enabled = false;
MessageBoxButtons.OK,
MessageBoxIcon.Error); txtPassword.Enabled = false;
}

157
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ txtPassword.Text + "' WHERE No_ID =
btnUAdd.Enabled = true; '" + sUID + "';";
SQLiteConnection
btnUEdit.Enabled = true; myConnection = new
SQLiteConnection(Conn.ConnString);
btnUDelete.Enabled = true; SQLiteCommand
myCommand = new
SQLiteCommand(myQuery, myConnection);
btnUSave.Enabled = false; SQLiteDataReader
myReader;
btnUCancel.Enabled = false;
try
LoadUser(); {
}
myConnection.Open();
catch myReader =
(SQLiteException ex) myCommand.ExecuteReader();
{ while
if (myReader.Read()) { }
(ex.Message.Contains("UNIQUE
constraint failed"))
{ MessageBox.Show("User " +
txtUsername.Text + " has been
MessageBox.Show("User " + edited.", "User",
txtUsername.Text + " is already MessageBoxButtons.OK,
exist.", "User", MessageBoxIcon.Information);
MessageBoxButtons.OK,
MessageBoxIcon.Error);
} pnlUser.Enabled = true;

else lblUType.Enabled = false;


{
lblUsername.Enabled = false;
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, lblPassword.Enabled = false;
MessageBoxIcon.Error);
}
} cmbUType.Enabled = false;

finally txtUsername.Enabled = false;


{
txtPassword.Enabled = false;
myConnection.Close();
}
} btnUAdd.Enabled = true;

else if (sUAddEdit == btnUEdit.Enabled = true;


"Edit")
{ btnUDelete.Enabled = true;
un =
txtUsername.Text;
btnUSave.Enabled = false;
string myQuery =
"UPDATE tbl_users SET User_Type = '" btnUCancel.Enabled = false;
+ cmbUType.Text + "', Username = '" +
txtUsername.Text + "', Password = '" LoadUser();

158
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} using System.Collections.Generic;
using System.ComponentModel;
catch using System.Data;
(SQLiteException ex) using System.Drawing;
{ using System.Linq;
if using System.Text;
(ex.Message.Contains("UNIQUE using System.Windows.Forms;
constraint failed"))
{ namespace
Lucena_Sports_Office_BSSE_System
MessageBox.Show("User " + {
txtUsername.Text + " is already public partial class
exist.", "User", Administrator_Game_Report : Form
MessageBoxButtons.OK, {
MessageBoxIcon.Error); public
} Administrator_Game_Report()
{
else InitializeComponent();
{ }

MessageBox.Show(ex.Message, "Error", #region Question Mark Icon


MessageBoxButtons.OK, private const int
MessageBoxIcon.Error); column_width = 150;
} private const int row_height
} = 50;

finally private void


{ DrawIconSample(Graphics gr, ref int
x, int y, Icon ico, string ico_name)
myConnection.Close(); {
}
} gr.DrawIconUnstretched(ico, new
Rectangle(x, y, ico.Width,
foreach ico.Height));
(DataGridViewRow row in dgvUser.Rows) int text_y = y +
{ (int)(ico.Height -
if gr.MeasureString(ico_name,
(row.Cells[1].Value.ToString().Equals this.Font).Height) / 2;
(un)) gr.DrawString(ico_name,
{ this.Font, Brushes.Black, x +
ico.Width + 5, text_y);
dgvUser.CurrentCell = dgvUser[2, x += column_width;
row.Index]; }
}
} private void
} Administrator_Game_Report_Paint(objec
} t sender, PaintEventArgs e)
#endregion {
int x = 25;
} int y = 25;
}

DrawIconSample(e.Graphics, ref x, y,
Administrator_Game_Report.cs SystemIcons.Question, "");
}
using System; #endregion

159
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

#region Number Exception }


private void }
txtGNumber_KeyPress(object sender,
KeyPressEventArgs e)
{
char c = e.KeyChar;
Conn.cs
if (!Char.IsDigit(c) && c
!= 8 && c != 46) using System;
{ using System.Collections.Generic;
e.Handled = true; using System.Linq;
} using System.Text;

if (c == '.') namespace
{ Lucena_Sports_Office_BSSE_System
e.Handled = true; {
} class Conn
{
if public static string
(txtGNumber.Text.StartsWith("0")) ConnString = "Data Source = bsse.db;
{ Version = 3; Pooling = True; Max Pool
if (c == '0') Size = 100;";
{ }
e.Handled = true; }
}

if (c != '0' && c != End_Game.cs


8 && c != 46)
{ using System;
txtGNumber.Text = using System.Collections.Generic;
txtGNumber.Text.Remove(0, 1); using System.ComponentModel;
} using System.Data;
} using System.Drawing;
} using System.Linq;
#endregion using System.Text;
using System.Windows.Forms;
#region Cancel using System.Data.SQLite;
private void
btnCancel_Click(object sender, namespace
EventArgs e) Lucena_Sports_Office_BSSE_System
{ {
this.Hide(); public partial class End_Game :
} Form
#endregion {
public static string sDTeam =
#region OK "";
private void
btnOk_Click(object sender, EventArgs public End_Game()
e) {
{ InitializeComponent();
Administrator.sGNum = DefaultTeam();
txtGNumber.Text;
this.Hide(); cmbDTeam.Items.Add(Game.sTNameA);
}
#endregion cmbDTeam.Items.Add(Game.sTNameB);

160
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
cmbDTeam.Text = "-Select- private void
"; btnCancel_Click(object sender,
EventArgs e)
if (Game.sEGame == "gf") {
{ this.Hide();
rdbGFinished.Checked }
= true; #endregion
}
#region OK
else if (Game.sEGame == private void
"def") btnOk_Click(object sender, EventArgs
{ e)
rdbDefault.Checked = {
true; if (rdbDefault.Checked)
} {
} Game.sEGame = "sdef";
sDTeam =
#region Question Mark Icon cmbDTeam.Text;
private const int }
column_width = 150;
private const int row_height else
= 50; {
Game.sEGame = "sgf";
private void }
DrawIconSample(Graphics gr, ref int
x, int y, Icon ico, string ico_name) this.Hide();
{ }
#endregion
gr.DrawIconUnstretched(ico, new
Rectangle(x, y, ico.Width, #region Default or Game
ico.Height)); Finished
int text_y = y + void DefaultTeam()
(int)(ico.Height - {
gr.MeasureString(ico_name, if (rdbGFinished.Checked)
this.Font).Height) / 2; {
gr.DrawString(ico_name, lblDTeam.Enabled =
this.Font, Brushes.Black, x + false;
ico.Width + 5, text_y); cmbDTeam.Enabled =
x += column_width; false;
} }

private void else


End_Game_Paint(object sender, {
PaintEventArgs e) lblDTeam.Enabled =
{ true;
int x = 25; cmbDTeam.Enabled =
int y = 25; true;
}
}
DrawIconSample(e.Graphics, ref x, y,
SystemIcons.Question, ""); private void
} rdbDefault_CheckedChanged(object
#endregion sender, EventArgs e)
{
#region Cancel DefaultTeam();
}

161
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
private const int row_height
private void = 50;
rdbGFinished_CheckedChanged(object
sender, EventArgs e) private void
{ DrawIconSample(Graphics gr, ref int
DefaultTeam(); x, int y, Icon ico, string ico_name)
} {
#endregion
gr.DrawIconUnstretched(ico, new
#region Read Only ComboBox Rectangle(x, y, ico.Width,
private void ico.Height));
cmbDTeam_KeyPress(object sender, int text_y = y +
KeyPressEventArgs e) (int)(ico.Height -
{ gr.MeasureString(ico_name,
e.KeyChar = this.Font).Height) / 2;
(char)Keys.None; gr.DrawString(ico_name,
} this.Font, Brushes.Black, x +
#endregion ico.Width + 5, text_y);
x += column_width;
} }
}
private void
First_Five_Paint(object sender,
PaintEventArgs e)
First_Five.cs {
int x = 25;
using System; int y = 25;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data; DrawIconSample(e.Graphics, ref x, y,
using System.Drawing; SystemIcons.Question, "");
using System.Linq; }
using System.Text; #endregion
using System.Windows.Forms;
using System.Data.SQLite; #region Load Table
using System.Collections; void LoadFF()
{
namespace SQLiteConnection myConn =
Lucena_Sports_Office_BSSE_System new
{ SQLiteConnection(Conn.ConnString);
public partial class First_Five : SQLiteCommand myCommand =
Form new SQLiteCommand("SELECT No_ID,
{ Last_Name || ', ' || First_Name || '
DataTable myDatasetFF; ' || "
public static string sTeam = + "Middle_Initial AS
"", sTL = "", sIo = "0"; 'Players Name', In_or_Out AS 'In or
Out' FROM tbl_playersgame WHERE
public First_Five() Team_Name = '" + sTeam + "' "
{ + "ORDER BY Last_Name ||
InitializeComponent(); ', ' || First_Name || ' ' ||
Middle_Initial;", myConn);
LoadFF();
} try
{
#region Question Mark Icon SQLiteDataAdapter
private const int myAdapter = new SQLiteDataAdapter();
column_width = 150;

162
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
}
myAdapter.SelectCommand = myCommand; }
myDatasetFF = new
DataTable(); catch (SQLiteException
ex)
myAdapter.Fill(myDatasetFF); {
BindingSource
bdSource = new BindingSource(); MessageBox.Show(ex.Message, "Error",
bdSource.DataSource = MessageBoxButtons.OK,
myDatasetFF; MessageBoxIcon.Error);
dgvFFive.DataSource = }
bdSource;
finally
myAdapter.Update(myDatasetFF); {
} myConnection.Close();
}
catch (Exception ex) }
{ #endregion

MessageBox.Show(ex.Message, "Error", #region Row Coloring


MessageBoxButtons.OK, private void
MessageBoxIcon.Error); dgvFFive_CellFormatting(object
} sender,
DataGridViewCellFormattingEventArgs
e)
dgvFFive.Columns[0].Visible = false; {
CPlayers(); foreach (DataGridViewRow
} row in dgvFFive.Rows)
#endregion {
string rs =
#region Count Players row.Cells[2].Value.ToString();
void CPlayers()
{ if (sTL == "A")
string myQuery = "SELECT {
COUNT(In_or_Out) FROM tbl_playersgame if (rs == "In")
WHERE Team_Name = '" + sTeam + "' AND {
In_or_Out = 'In';";
SQLiteConnection row.DefaultCellStyle.ForeColor =
myConnection = new Color.Red;
SQLiteConnection(Conn.ConnString); }
SQLiteCommand myCommand =
new SQLiteCommand(myQuery, else if (rs ==
myConnection); "Out")
SQLiteDataReader {
myReader;
row.DefaultCellStyle.ForeColor =
try Color.Black;
{ }
myConnection.Open(); }
myReader =
myCommand.ExecuteReader(); else if (sTL == "B")
while {
(myReader.Read()) if (rs == "In")
{ {
txtNPlayers.Text
= myReader.GetValue(0).ToString();

163
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

row.DefaultCellStyle.ForeColor = myConnection.Open();
Color.Blue; myReader =
} myCommand.ExecuteReader();
while
else if (rs == (myReader.Read()) { }
"Out")
{ LoadFF();
}
row.DefaultCellStyle.ForeColor =
Color.Black; catch
} (SQLiteException ex)
} {
}
} MessageBox.Show(ex.Message, "Error",
#endregion MessageBoxButtons.OK,
MessageBoxIcon.Error);
#region Cell Click }
private void
dgvFFive_CellClick(object sender, finally
DataGridViewCellEventArgs e) {
{
string id = "", inout = myConnection.Close();
"", pname = ""; }
}
if (e.RowIndex >= 0)
{ if (inout == "In")
DataGridViewRow row = {
this.dgvFFive.Rows[e.RowIndex]; string myQuery =
"UPDATE tbl_playersgame SET In_or_Out
pname = = 'Out' WHERE No_ID = '" + id + "';";
row.Cells["Players SQLiteConnection
Name"].Value.ToString(); myConnection = new
inout = row.Cells["In SQLiteConnection(Conn.ConnString);
or Out"].Value.ToString(); SQLiteCommand
id = myCommand = new
row.Cells["No_ID"].Value.ToString(); SQLiteCommand(myQuery, myConnection);
} SQLiteDataReader
myReader;
if (inout == "Out")
{ try
string myQuery = {
"UPDATE tbl_playersgame SET In_or_Out
= 'In' WHERE No_ID = '" + id + "';"; myConnection.Open();
SQLiteConnection myReader =
myConnection = new myCommand.ExecuteReader();
SQLiteConnection(Conn.ConnString); while
SQLiteCommand (myReader.Read()) { }
myCommand = new
SQLiteCommand(myQuery, myConnection); LoadFF();
SQLiteDataReader }
myReader;
catch
try (SQLiteException ex)
{ {

164
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteConnection
MessageBox.Show(ex.Message, "Error", myConnection = new
MessageBoxButtons.OK, SQLiteConnection(Conn.ConnString);
MessageBoxIcon.Error); SQLiteCommand myCommand =
} new SQLiteCommand(myQuery,
myConnection);
finally SQLiteDataReader
{ myReader;

myConnection.Close(); try
} {
} myConnection.Open();
myReader =
foreach (DataGridViewRow myCommand.ExecuteReader();
row in dgvFFive.Rows) while
{ (myReader.Read())
if {
(row.Cells[1].Value.ToString().Equals sIo =
(pname)) myReader.GetValue(0).ToString();
{ }

dgvFFive.CurrentCell = dgvFFive[1, int i;


row.Index]; i =
} Convert.ToInt32(sIo);
}
} if (i < 5)
#endregion {
if (sTL == "A")
#region Cancel {
private void Game.sFFive =
btnCancel_Click(object sender, "AOk";
EventArgs e) }
{
if (sTL == "A") else if (sTL ==
{ "B")
Game.sFFive = "AC"; {
} Game.sFFive =
"BOk";
else if (sTL == "B") }
{
Game.sFFive = "BC"; Game.sFT = sTeam;
} Game.sFError =
} "less";
#endregion
this.Hide();
#region OK }
private void
btnOk_Click(object sender, EventArgs else if (i > 5)
e) {
{ if (sTL == "A")
string myQuery = "SELECT {
COUNT(In_or_Out) FROM tbl_playersgame Game.sFFive =
WHERE In_or_Out = 'In' AND Team_Name "AOk";
= '" + sTeam + "';"; }

165
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
else if (sTL == private void
"B") First_Five_FormClosing(object sender,
{ FormClosingEventArgs e)
Game.sFFive = {
"BOk"; if (e.CloseReason ==
} CloseReason.UserClosing)
{
Game.sFT = sTeam; if (sTL == "A")
Game.sFError = {
"more"; Game.sFFive =
"AC";
this.Hide(); }
}
else if (sTL == "B")
else {
{ Game.sFFive =
if (sTL == "A") "BC";
{ }
Game.sFFive = }
"AOk"; }
} #endregion

else if (sTL == }
"B") }
{
Game.sFFive =
"BOk";
}
Game.cs

Game.sFError = using System;


"none"; using System.Collections.Generic;
using System.ComponentModel;
this.Hide(); using System.Data;
} using System.Drawing;
} using System.Linq;
using System.Text;
catch (SQLiteException using System.Windows.Forms;
ex) using System.Data.SQLite;
{ using
CrystalDecisions.CrystalReports.Engin
MessageBox.Show(ex.Message, "Error", e;
MessageBoxButtons.OK, using CrystalDecisions.Shared;
MessageBoxIcon.Error);
} namespace
Lucena_Sports_Office_BSSE_System
finally {
{ public partial class Game : Form
myConnection.Close(); {
} DataTable myDatasetTA,
myDatasetTB;
} public static string
#endregion sDateTime = "", sTeamA = "", sTeamB =
"", sJerseyA = "", sJerseyB = "",
#region Exit sInA = "", sInB = "", sTOfficials =
"", sTQuarter = "", sOLogin = "",
sSNotif = "", sEGame = "", sTNameA =

166
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
"", sTNameB = "", sLock = "", sFFive MessageBoxButtons.OK,
= "", sFError = "", sFT = ""; MessageBoxIcon.Error);
public static string sFoulA = First_Five.sTeam
"", sQValueA = "", sTeamFoulA = ""; = sFT;
public static string sFoulB = First_Five.sTL =
"", sQValueB = "", sTeamFoulB = ""; "A";
int iTimeoutA = 0, iTimeoutB
= 0, iTO = 0, iDT = 4; First_Five w =
new First_Five();
public Game() w.ShowDialog();
{ }
InitializeComponent();
else if (sFError ==
ClearAllPlayers(); "more")
ClearAllTeams(); {
ClearOfficials(); sFError = "";

cmbDivision.SelectedIndex
= 0; MessageBox.Show("Please select only
tmrDTime.Start(); five players.", "First Five",
GameNumber(); MessageBoxButtons.OK,
cmbTeamA.SelectedIndex = MessageBoxIcon.Error);
0; First_Five.sTeam
cmbTeamB.SelectedIndex = = sFT;
0; First_Five.sTL =
"A";
GameReport();
First_Five w =
LoadTeamA(); new First_Five();
LoadTeamB(); w.ShowDialog();
} }

private void else if (sFError ==


Game_Activated(object sender, "none")
EventArgs e) {
{ LoadTeamA();
OLogin(); CountTeamA();
SureDG(); }
FirstFive(); }
}
else if (sFFive == "AC")
#region First Five {
void FirstFive() sFFive = "";
{
if (sFFive == "AOk")
{ cmbTeamA.Items.Insert(0, "-Select-");
sFFive = ""; cmbTeamA.SelectedItem
= "-Select-";
if (sFError == }
"less")
{ if (sFFive == "BOk")
sFError = ""; {
sFFive = "";

MessageBox.Show("Please select five if (sFError ==


players.", "First Five", "less")

167
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{ #endregion
sFError = "";
#region Navigation
private void
MessageBox.Show("Please select five tsGame_Click(object sender, EventArgs
players.", "First Five", e)
MessageBoxButtons.OK, {
MessageBoxIcon.Error); tsGame.ForeColor =
First_Five.sTeam Color.FromArgb(236, 189, 0);
= sFT; tsOfficials.ForeColor =
First_Five.sTL = Color.White;
"B"; tsGReport.ForeColor =
Color.White;
First_Five w =
new First_Five(); pnlMGame.Visible = true;
w.ShowDialog(); pnlMOfficials.Visible =
} false;
pnlMGReport.Visible =
else if (sFError == false;
"more")
{ btnOCancel_Click(sender,
sFError = ""; e);
}

MessageBox.Show("Please select only private void


five players.", "First Five", tsOfficials_Click(object sender,
MessageBoxButtons.OK, EventArgs e)
MessageBoxIcon.Error); {
First_Five.sTeam if (pnlMOfficials.Visible
= sFT; == false)
First_Five.sTL = {
"B"; Officials_Login w =
new Officials_Login();
First_Five w = w.ShowDialog();
new First_Five(); }
w.ShowDialog(); }
}
private void
else if (sFError == tsGReport_Click(object sender,
"none") EventArgs e)
{ {
LoadTeamB(); tsGame.ForeColor =
CountTeamB(); Color.White;
} tsOfficials.ForeColor =
} Color.White;
tsGReport.ForeColor =
else if (sFFive == "BC") Color.FromArgb(236, 189, 0);
{
sFFive = ""; pnlMGame.Visible = false;
pnlMOfficials.Visible =
false;
cmbTeamB.Items.Insert(0, "-Select-"); pnlMGReport.Visible =
cmbTeamB.SelectedItem true;
= "-Select-"; }
}
} void OLogin()

168
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{ cmbDivision.Text = "-
if (sOLogin == "1") Select-";
{ }
tsGame.ForeColor = }
Color.White; #endregion
tsOfficials.ForeColor
= Color.FromArgb(236, 189, 0); #region Selecting Division
tsGReport.ForeColor = string div = "-Select-";
Color.White; private void
cmbDivision_SelectedIndexChanged(obje
txtOGame.Text = ct sender, EventArgs e)
txtGGNumber.Text; {
txtOGame.Text = if (cmbDivision.Text !=
cmbTeamA.Text + " vs. " + div)
cmbTeamB.Text; {
txtODivision.Text = if (cmbDivision.Text
cmbDivision.Text; != "-Select-" && cmbDivision.Text !=
"")
pnlMGame.Visible = {
false; pnlTeamA.Enabled
pnlMOfficials.Visible = true;
= true; pnlTeamB.Enabled
pnlMGReport.Visible = = true;
false;

sOLogin = ""; cmbTeamA.Items.Clear();


}
} cmbTeamB.Items.Clear();

#endregion cmbTeamA.Items.Insert(0, "-Select-");

#region Division Default - cmbTeamA.SelectedItem = "-Select-";


Select-
private void cmbTeamB.Items.Insert(0, "-Select-");
cmbDivision_DropDown(object sender,
EventArgs e) cmbTeamB.SelectedItem = "-Select-";
{ PopulateTeams();

cmbDivision.Items.Remove("-Select-"); lblNotif.Text =
} cmbDivision.Text + " division has
been selected.";
private void lblNotif.Visible
cmbDivision_DropDownClosed(object = true;
sender, EventArgs e) iDT = 4;
{ tmrNotif.Start();
if }
(cmbDivision.SelectedItem == null)
{ else
if {
(!cmbDivision.Items.Contains("- pnlTeamA.Enabled
Select-")) = false;
{ pnlTeamB.Enabled
= false;
cmbDivision.Items.Add("-Select-"); }
}
TeamASelect();

169
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
TeamBSelect(); }
div =
cmbDivision.Text; catch (SQLiteException
} ex)
} {
#endregion
MessageBox.Show(ex.Message, "Error",
#region System Time MessageBoxButtons.OK,
private void MessageBoxIcon.Error);
tmrDTime_Tick(object sender, }
EventArgs e)
{ finally
string gamedate, {
gametime; myConnection.Close();
}
DateTime datetime = }
DateTime.Now; #endregion
sDateTime =
datetime.ToString("yyyy-MM-dd #region Populate Teams
HH:mm:ss.fff"); void PopulateTeams()
gamedate = {
datetime.ToString("MMMM dd, yyyy"); string myQuery = "SELECT
gametime = Team_Name FROM tbl_teamsinfo WHERE
datetime.ToString("hh:mm tt"); Division = '" + cmbDivision.Text +
"';";
txtDate.Text = gamedate; SQLiteConnection
txtTime.Text = gametime; myConnection = new
} SQLiteConnection(Conn.ConnString);
#endregion SQLiteCommand myCommand =
new SQLiteCommand(myQuery,
#region Game Number myConnection);
void GameNumber() SQLiteDataReader
{ myReader;
string myQuery = "SELECT
IFNULL(MAX(Game_Number + 1), 1) FROM try
tbl_playersgamelogs;"; {
SQLiteConnection myConnection.Open();
myConnection = new myReader =
SQLiteConnection(Conn.ConnString); myCommand.ExecuteReader();
SQLiteCommand myCommand = while
new SQLiteCommand(myQuery, (myReader.Read())
myConnection); {
SQLiteDataReader string category =
myReader; myReader.GetString(0);

try cmbTeamA.Items.Add(category);
{
myConnection.Open(); cmbTeamB.Items.Add(category);
myReader = }
myCommand.ExecuteReader(); }
while
(myReader.Read()) catch (SQLiteException
{ ex)
txtGGNumber.Text {
= myReader.GetInt32(0).ToString();
} MessageBox.Show(ex.Message, "Error",

170
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
MessageBoxButtons.OK, if
MessageBoxIcon.Error); (!cmbTeamB.Items.Contains("-Select-
} "))
{
finally
{ cmbTeamB.Items.Insert(0, "-Select-");
myConnection.Close(); }
}
} cmbTeamB.Text = "-
#endregion Select-";
}
#region Team A and B Default }
-Select- #endregion
private void
cmbTeamA_DropDown(object sender, #region Same Team Error Trap
EventArgs e) void SameTeam()
{ {
cmbTeamA.Items.Remove("- if (cmbTeamA.Text ==
Select-"); cmbTeamB.Text && cmbTeamA.Text != "-
} Select-" && cmbTeamB.Text != "-
Select-")
private void {
cmbTeamA_DropDownClosed(object MessageBox.Show("You
sender, EventArgs e) are trying to match-up the same
{ team.", "Same Team",
if (cmbTeamA.SelectedItem MessageBoxButtons.OK,
== null) MessageBoxIcon.Error);
{ }
if }
(!cmbTeamA.Items.Contains("-Select- #endregion
"))
{ #region Team A Record Default
void TeamARecord()
cmbTeamA.Items.Insert(0, "-Select-"); {
} string myQuery = "UPDATE
tbl_playersgame SET In_or_Out =
cmbTeamA.Text = "- 'Out', FirstP_Score = 0, "
Select-"; + "SecondP_Score = 0,
} ThirdP_Score = 0, FourthP_Score = 0,
} Overtime_Score = 0, Foul_1 = 0, "
+ "Foul_2 = 0, Foul_3 =
private void 0, Foul_4 = 0, Foul_5 = 0 WHERE
cmbTeamB_DropDown(object sender, Team_Name = '" + cmbTeamA.Text +
EventArgs e) "';";
{ SQLiteConnection
cmbTeamB.Items.Remove("- myConnection = new
Select-"); SQLiteConnection(Conn.ConnString);
} SQLiteCommand myCommand =
new SQLiteCommand(myQuery,
private void myConnection);
cmbTeamB_DropDownClosed(object SQLiteDataReader
sender, EventArgs e) myReader;
{
if (cmbTeamB.SelectedItem try
== null) {
{ myConnection.Open();

171
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
myReader = MessageBoxButtons.OK,
myCommand.ExecuteReader(); MessageBoxIcon.Error);
while }
(myReader.Read()) { }
} finally
{
catch (SQLiteException
ex) myConnection1.Close();
{ }
}
MessageBox.Show(ex.Message, "Error", #endregion
MessageBoxButtons.OK,
MessageBoxIcon.Error); #region Team B Record Default
} void TeamBRecord()
{
finally string myQuery = "UPDATE
{ tbl_playersgame SET In_or_Out =
myConnection.Close(); 'Out', FirstP_Score = 0, "
} + "SecondP_Score = 0,
ThirdP_Score = 0, FourthP_Score = 0,
string myQuery1 = "UPDATE Overtime_Score = 0, Foul_1 = 0, "
tbl_teamsgame SET First_Half_Time_Out + "Foul_2 = 0, Foul_3 =
= 0, Second_Half_Time_Out = 0, " 0, Foul_4 = 0, Foul_5 = 0 WHERE
+ "Extra_Time_Out = 0, Team_Name = '" + cmbTeamB.Text +
FirstP_Team_Foul = 0, "';";
SecondP_Team_Foul = 0, SQLiteConnection
ThirdP_Team_Foul = 0, " myConnection = new
+ "FourthP_Team_Foul = 0, SQLiteConnection(Conn.ConnString);
Overtime_Team_Foul = 0, Game_Score = SQLiteCommand myCommand =
'0-0', Game_Status = '-' WHERE new SQLiteCommand(myQuery,
Team_Name = '" + cmbTeamA.Text + myConnection);
"';"; SQLiteDataReader
SQLiteConnection myReader;
myConnection1 = new
SQLiteConnection(Conn.ConnString); try
SQLiteCommand myCommand1 {
= new SQLiteCommand(myQuery1, myConnection.Open();
myConnection1); myReader =
SQLiteDataReader myCommand.ExecuteReader();
myReader1; while
(myReader.Read()) { }
try }
{
myConnection1.Open(); catch (SQLiteException
myReader1 = ex)
myCommand1.ExecuteReader(); {
while
(myReader1.Read()) { } MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
catch (SQLiteException }
ex)
{ finally
{
MessageBox.Show(ex.Message, "Error", myConnection.Close();
}

172
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
TeamASelect();
string myQuery1 = "UPDATE
tbl_teamsgame SET First_Half_Time_Out ClearTeamA();
= 0, Second_Half_Time_Out = 0, " FillTeamA();
+ "Extra_Time_Out = 0, TeamARecord();
FirstP_Team_Foul = 0, LoadTeamA();
SecondP_Team_Foul = 0, sTeamA =
ThirdP_Team_Foul = 0, " cmbTeamA.Text;
+ "FourthP_Team_Foul = 0, ta = cmbTeamA.Text;
Overtime_Team_Foul = 0, Game_Score =
'0-0', Game_Status = '-' WHERE SameTeam();
Team_Name = '" + cmbTeamB.Text +
"';"; if (cmbTeamA.Text ==
SQLiteConnection cmbTeamB.Text && cmbTeamA.Text != "-
myConnection1 = new Select-" && cmbTeamB.Text != "-
SQLiteConnection(Conn.ConnString); Select-")
SQLiteCommand myCommand1 {
= new SQLiteCommand(myQuery1,
myConnection1); cmbTeamA.Items.Insert(0, "-Select-");
SQLiteDataReader
myReader1; cmbTeamA.SelectedItem = "-Select-";
}
try
{ else if
myConnection1.Open(); (dgvTeamA.Rows.Count == 0 &&
myReader1 = cmbTeamA.Text != "-Select-")
myCommand1.ExecuteReader(); {
while
(myReader1.Read()) { } MessageBox.Show("Team " +
} cmbTeamA.Text + " has no players to
play.", "No Players",
catch (SQLiteException MessageBoxButtons.OK,
ex) MessageBoxIcon.Error);
{

MessageBox.Show(ex.Message, "Error", cmbTeamA.Items.Insert(0, "-Select-");


MessageBoxButtons.OK,
MessageBoxIcon.Error); cmbTeamA.SelectedItem = "-Select-";
} }

finally else if
{ (dgvTeamA.Rows.Count < 5 &&
cmbTeamA.Text != "-Select-")
myConnection1.Close(); {
}
} MessageBox.Show("Team " +
#endregion cmbTeamA.Text + " has less than 5
players to play.", "Less Players",
#region Team A Select MessageBoxButtons.OK,
string ta = "-Select-"; MessageBoxIcon.Error);
private void
cmbTeamA_SelectedIndexChanged(object
sender, EventArgs e) cmbTeamA.Items.Insert(0, "-Select-");
{
if (ta != cmbTeamA.Text) cmbTeamA.SelectedItem = "-Select-";
{ }

173
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
btnM1A.Visible = true;
if (cmbTeamA.Text != btnM2A.Visible = true;
"-Select-" && cmbTeamA.Text != "") btnM3A.Visible = true;
{
chkLockA.Enabled btnPFoulA.Visible = true;
= true; btnMFoulA.Visible = true;

lblNotif.Text = rdb1stP.Checked = true;


cmbTeamA.Text + " for team A has been rdb2ndP.Checked = false;
selected."; rdb3rdP.Checked = false;
lblNotif.Visible rdb4thP.Checked = false;
= true; rdbOTime.Checked = false;
iDT = 4;
tmrNotif.Start(); rdb1stP.Enabled = true;
rdb2ndP.Enabled = true;
First_Five.sTeam rdb3rdP.Enabled = true;
= cmbTeamA.Text; rdb4thP.Enabled = true;
First_Five.sTL = rdbOTime.Enabled = true;
"A"; }
#endregion
First_Five w =
new First_Five(); #region Team B Select
w.ShowDialog(); string tb = "-Select-";
} private void
cmbTeamB_SelectedIndexChanged(object
else sender, EventArgs e)
{ {
chkLockA.Enabled if (tb != cmbTeamB.Text)
= false; {
} TeamBSelect();
}
} ClearTeamB();
FillTeamB();
void TeamASelect() TeamBRecord();
{ LoadTeamB();
txtScoreA.Text = "000"; sTeamB =
txtPlayerA.Text = "None"; cmbTeamB.Text;
txtCPlayersA.Text = "0"; tb = cmbTeamB.Text;
txt1HTOA.Text = "0";
txt2HTOA.Text = "0"; SameTeam();
txtETOA.Text = "0";
txt1TFA.Text = "0"; if (cmbTeamA.Text ==
txt2TFA.Text = "0"; cmbTeamB.Text && cmbTeamA.Text != "-
txt3TFA.Text = "0"; Select-" && cmbTeamB.Text != "-
txt4TFA.Text = "0"; Select-")
txtOTFA.Text = "0"; {
txtPenaltyA.Visible =
false; cmbTeamB.Items.Insert(0, "-Select-");

rdbFSA.Checked = true; cmbTeamB.SelectedItem = "-Select-";


pnlFSA.Visible = false; }

btnP1A.Visible = true; else if


btnP2A.Visible = true; (dgvTeamB.Rows.Count == 0 &&
btnP3A.Visible = true; cmbTeamB.Text != "-Select-")
{

174
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
chkLockB.Enabled
MessageBox.Show("Team " + = false;
cmbTeamB.Text + " has no players to }
play.", "No Players", }
MessageBoxButtons.OK, }
MessageBoxIcon.Error);
void TeamBSelect()
{
cmbTeamB.Items.Insert(0, "-Select-"); txtScoreB.Text = "000";
txtPlayerB.Text = "None";
cmbTeamB.SelectedItem = "-Select-"; txtCPlayersB.Text = "0";
} txt1HTOB.Text = "0";
txt2HTOB.Text = "0";
else if txtETOB.Text = "0";
(dgvTeamB.Rows.Count < 5 && txt1TFB.Text = "0";
cmbTeamB.Text != "-Select-") txt2TFB.Text = "0";
{ txt3TFB.Text = "0";
txt4TFB.Text = "0";
MessageBox.Show("Team " + txtOTFB.Text = "0";
cmbTeamB.Text + " has less than 5 txtPenaltyB.Visible =
players to play.", "Less Players", false;
MessageBoxButtons.OK,
MessageBoxIcon.Error); rdbFSB.Checked = true;
pnlFSB.Visible = false;

cmbTeamB.Items.Insert(0, "-Select-"); btnP1B.Visible = true;


btnP2B.Visible = true;
cmbTeamB.SelectedItem = "-Select-"; btnP3B.Visible = true;
}
btnM1B.Visible = true;
if (cmbTeamB.Text != btnM2B.Visible = true;
"-Select-" && cmbTeamB.Text != "") btnM3B.Visible = true;
{
chkLockB.Enabled btnPFoulB.Visible = true;
= true; btnMFoulB.Visible = true;

lblNotif.Text = rdb1stP.Checked = true;


cmbTeamB.Text + " for team B has been rdb2ndP.Checked = false;
selected."; rdb3rdP.Checked = false;
lblNotif.Visible rdb4thP.Checked = false;
= true; rdbOTime.Checked = false;
iDT = 4;
tmrNotif.Start(); rdb1stP.Enabled = true;
rdb2ndP.Enabled = true;
First_Five.sTeam rdb3rdP.Enabled = true;
= cmbTeamB.Text; rdb4thP.Enabled = true;
First_Five.sTL = rdbOTime.Enabled = true;
"B"; }
#endregion
First_Five w =
new First_Five(); #region Clear Team A
w.ShowDialog(); void ClearTeamA()
} {
string myQuery = "DELETE
else FROM tbl_playersgame WHERE Team_Name
{ = '" + sTeamA + "';";

175
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteConnection
myConnection = new MessageBox.Show(ex.Message, "Error",
SQLiteConnection(Conn.ConnString); MessageBoxButtons.OK,
SQLiteCommand myCommand = MessageBoxIcon.Error);
new SQLiteCommand(myQuery, }
myConnection);
SQLiteDataReader finally
myReader; {

try myConnection1.Close();
{ }
myConnection.Open(); }
myReader = #endregion
myCommand.ExecuteReader();
while #region Clear Team B
(myReader.Read()) { } void ClearTeamB()
} {
string myQuery = "DELETE
catch (SQLiteException FROM tbl_playersgame WHERE Team_Name
ex) = '" + sTeamB + "';";
{ SQLiteConnection
myConnection = new
MessageBox.Show(ex.Message, "Error", SQLiteConnection(Conn.ConnString);
MessageBoxButtons.OK, SQLiteCommand myCommand =
MessageBoxIcon.Error); new SQLiteCommand(myQuery,
} myConnection);
SQLiteDataReader
finally myReader;
{
myConnection.Close(); try
} {
myConnection.Open();
string myQuery1 = "DELETE myReader =
FROM tbl_teamsgame WHERE Team_Name = myCommand.ExecuteReader();
'" + sTeamA + "';"; while
SQLiteConnection (myReader.Read()) { }
myConnection1 = new }
SQLiteConnection(Conn.ConnString);
SQLiteCommand myCommand1 catch (SQLiteException
= new SQLiteCommand(myQuery1, ex)
myConnection1); {
SQLiteDataReader
myReader1; MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
try MessageBoxIcon.Error);
{ }
myConnection1.Open();
myReader1 = finally
myCommand1.ExecuteReader(); {
while myConnection.Close();
(myReader1.Read()) { } }
}
string myQuery1 = "DELETE
catch (SQLiteException FROM tbl_teamsgame WHERE Team_Name =
ex) '" + sTeamB + "';";
{

176
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteConnection
myConnection1 = new try
SQLiteConnection(Conn.ConnString); {
SQLiteCommand myCommand1 myConnection.Open();
= new SQLiteCommand(myQuery1, myReader =
myConnection1); myCommand.ExecuteReader();
SQLiteDataReader while
myReader1; (myReader.Read()) { }
}
try
{ catch (SQLiteException
myConnection1.Open(); ex)
myReader1 = {
myCommand1.ExecuteReader();
while MessageBox.Show(ex.Message, "Error",
(myReader1.Read()) { } MessageBoxButtons.OK,
} MessageBoxIcon.Error);
}
catch (SQLiteException
ex) finally
{ {
myConnection.Close();
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); string myQuery1 = "INSERT
} INTO tbl_teamsgame(Team_Name,
Division) SELECT Team_Name, Division
finally "
{ + "FROM tbl_teamsinfo
WHERE Team_Name = '" + cmbTeamA.Text
myConnection1.Close(); + "';";
} SQLiteConnection
} myConnection1 = new
#endregion SQLiteConnection(Conn.ConnString);
SQLiteCommand myCommand1
#region Fill Team A = new SQLiteCommand(myQuery1,
void FillTeamA() myConnection1);
{ SQLiteDataReader
string myQuery = "INSERT myReader1;
INTO tbl_playersgame(Team_Name,
Division, Last_Name, First_Name, " try
+ "Middle_Initial, {
Jersey_Number) SELECT Team_Name, myConnection1.Open();
Division, Last_Name, First_Name, " myReader1 =
+ "Middle_Initial, myCommand1.ExecuteReader();
Jersey_Number FROM tbl_playersinfo while
WHERE Team_Name = '" + cmbTeamA.Text (myReader1.Read()) { }
+ "';"; }
SQLiteConnection
myConnection = new catch (SQLiteException
SQLiteConnection(Conn.ConnString); ex)
SQLiteCommand myCommand = {
new SQLiteCommand(myQuery,
myConnection); MessageBox.Show(ex.Message, "Error",
SQLiteDataReader MessageBoxButtons.OK,
myReader; MessageBoxIcon.Error);

177
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} + "Middle_Initial,
Jersey_Number FROM tbl_playersinfo
finally WHERE Team_Name = '" + cmbTeamB.Text
{ + "';";
SQLiteConnection
myConnection1.Close(); myConnection = new
} SQLiteConnection(Conn.ConnString);
SQLiteCommand myCommand =
string myQuery2 = "UPDATE new SQLiteCommand(myQuery,
tbl_teamsgame SET A_or_B = 'A' WHERE myConnection);
Team_Name = '" + cmbTeamA.Text + SQLiteDataReader
"';"; myReader;
SQLiteConnection
myConnection2 = new try
SQLiteConnection(Conn.ConnString); {
SQLiteCommand myCommand2 myConnection.Open();
= new SQLiteCommand(myQuery2, myReader =
myConnection2); myCommand.ExecuteReader();
SQLiteDataReader while
myReader2; (myReader.Read()) { }
}
try
{ catch (SQLiteException
myConnection2.Open(); ex)
myReader2 = {
myCommand2.ExecuteReader();
while MessageBox.Show(ex.Message, "Error",
(myReader2.Read()) { } MessageBoxButtons.OK,
} MessageBoxIcon.Error);
}
catch (SQLiteException
ex) finally
{ {
myConnection.Close();
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); string myQuery1 = "INSERT
} INTO tbl_teamsgame(Team_Name,
Division) SELECT Team_Name, Division
finally "
{ + "FROM tbl_teamsinfo
WHERE Team_Name = '" + cmbTeamB.Text
myConnection2.Close(); + "';";
} SQLiteConnection
} myConnection1 = new
#endregion SQLiteConnection(Conn.ConnString);
SQLiteCommand myCommand1
#region Fill Team B = new SQLiteCommand(myQuery1,
void FillTeamB() myConnection1);
{ SQLiteDataReader
string myQuery = "INSERT myReader1;
INTO tbl_playersgame(Team_Name,
Division, Last_Name, First_Name, " try
+ "Middle_Initial, {
Jersey_Number) SELECT Team_Name, myConnection1.Open();
Division, Last_Name, First_Name, "

178
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
myReader1 = }
myCommand1.ExecuteReader(); }
while #endregion
(myReader1.Read()) { }
} #region Clear All Players
void ClearAllPlayers()
catch (SQLiteException {
ex) string myQuery = "DROP
{ TABLE IF EXISTS tbl_playersgame;";
SQLiteConnection
MessageBox.Show(ex.Message, "Error", myConnection = new
MessageBoxButtons.OK, SQLiteConnection(Conn.ConnString);
MessageBoxIcon.Error); SQLiteCommand myCommand =
} new SQLiteCommand(myQuery,
myConnection);
finally SQLiteDataReader
{ myReader;

myConnection1.Close(); try
} {
myConnection.Open();
string myQuery2 = "UPDATE myReader =
tbl_teamsgame SET A_or_B = 'B' WHERE myCommand.ExecuteReader();
Team_Name = '" + cmbTeamB.Text + while
"';"; (myReader.Read()) { }
SQLiteConnection }
myConnection2 = new
SQLiteConnection(Conn.ConnString); catch (SQLiteException
SQLiteCommand myCommand2 ex)
= new SQLiteCommand(myQuery2, {
myConnection2);
SQLiteDataReader MessageBox.Show(ex.Message, "Error",
myReader2; MessageBoxButtons.OK,
MessageBoxIcon.Error);
try }
{
myConnection2.Open(); finally
myReader2 = {
myCommand2.ExecuteReader(); myConnection.Close();
while }
(myReader2.Read()) { }
} string myQuery1 = "CREATE
TABLE IF NOT EXISTS
catch (SQLiteException `tbl_playersgame`"
ex) + "(`No_ID` INTEGER
{ PRIMARY KEY AUTOINCREMENT,"
+ "`Game_Date`
MessageBox.Show(ex.Message, "Error", DATETIME,"
MessageBoxButtons.OK, + "`Game_Number`
MessageBoxIcon.Error); INTEGER,"
} + "`Team_Name`
VARCHAR,"
finally + "`Division`
{ VARCHAR,"
+ "`Last_Name`
myConnection2.Close(); VARCHAR,"

179
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "`First_Name` }
VARCHAR," #endregion
+ "`Middle_Initial`
VARCHAR," #region Clear All Teams
+ "`Jersey_Number` void ClearAllTeams()
INTEGER," {
+ "`In_or_Out` string myQuery = "DROP
VARCHAR," TABLE IF EXISTS tbl_teamsgame;";
+ "`FirstP_Score` SQLiteConnection
INTEGER," myConnection = new
+ "`SecondP_Score` SQLiteConnection(Conn.ConnString);
INTEGER," SQLiteCommand myCommand =
+ "`ThirdP_Score` new SQLiteCommand(myQuery,
INTEGER," myConnection);
+ "`FourthP_Score` SQLiteDataReader
INTEGER," myReader;
+ "`Overtime_Score`
INTEGER," try
+ "`Foul_1` VARCHAR," {
+ "`Foul_2` VARCHAR," myConnection.Open();
+ "`Foul_3` VARCHAR," myReader =
+ "`Foul_4` VARCHAR," myCommand.ExecuteReader();
+ "`Foul_5` while
VARCHAR);"; (myReader.Read()) { }
SQLiteConnection }
myConnection1 = new
SQLiteConnection(Conn.ConnString); catch (SQLiteException
SQLiteCommand myCommand1 ex)
= new SQLiteCommand(myQuery1, {
myConnection1);
SQLiteDataReader MessageBox.Show(ex.Message, "Error",
myReader1; MessageBoxButtons.OK,
MessageBoxIcon.Error);
try }
{
myConnection1.Open(); finally
myReader1 = {
myCommand1.ExecuteReader(); myConnection.Close();
while }
(myReader1.Read()) { }
} string myQuery1 = "CREATE
TABLE IF NOT EXISTS `tbl_teamsgame` (
catch (SQLiteException "
ex) + "`No_ID` INTEGER
{ PRIMARY KEY AUTOINCREMENT, "
+ "`Game_Date`
MessageBox.Show(ex.Message, "Error", DATETIME, "
MessageBoxButtons.OK, + "`Game_Number`
MessageBoxIcon.Error); INTEGER, "
} + "`Team_Name`
VARCHAR, "
finally + "`Division`
{ VARCHAR, "
+
myConnection1.Close(); "`First_Half_Time_Out` INTEGER,
} "

180
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+
"`Second_Half_Time_Out` INTEGER, #region Clear Officials
" void ClearOfficials()
+ "`Extra_Time_Out` {
INTEGER, " string myQuery = "DROP
+ "`FirstP_Team_Foul` TABLE IF EXISTS tbl_gameofficials;";
INTEGER, " SQLiteConnection
+ "`SecondP_Team_Foul` myConnection = new
INTEGER, " SQLiteConnection(Conn.ConnString);
+ "`ThirdP_Team_Foul` SQLiteCommand myCommand =
INTEGER, " new SQLiteCommand(myQuery,
+ "`FourthP_Team_Foul` myConnection);
INTEGER, " SQLiteDataReader
+ "`Overtime_Team_Foul` myReader;
INTEGER, "
+ "`Opponent` try
VARCHAR, " {
+ "`Game_Score` myConnection.Open();
VARCHAR, " myReader =
+ "`Game_Status` myCommand.ExecuteReader();
VARCHAR, " while
+ "`A_or_B` VARCHAR);"; (myReader.Read()) { }
SQLiteConnection }
myConnection1 = new
SQLiteConnection(Conn.ConnString); catch (SQLiteException
SQLiteCommand myCommand1 ex)
= new SQLiteCommand(myQuery1, {
myConnection1);
SQLiteDataReader MessageBox.Show(ex.Message, "Error",
myReader1; MessageBoxButtons.OK,
MessageBoxIcon.Error);
try }
{
myConnection1.Open(); finally
myReader1 = {
myCommand1.ExecuteReader(); myConnection.Close();
while }
(myReader1.Read()) { }
} string myQuery1 = "CREATE
TABLE IF NOT EXISTS
catch (SQLiteException `tbl_gameofficials` ( "
ex) + "`No_ID` INTEGER
{ PRIMARY KEY AUTOINCREMENT, "
+ "`Game_Number`
MessageBox.Show(ex.Message, "Error", INTEGER, "
MessageBoxButtons.OK, +
MessageBoxIcon.Error); "`City_Sports_Coordinator` VARCHAR,
} "
+ "`Board_Scorer`
finally VARCHAR, "
{ + "`Computer_Scorer`
VARCHAR, "
myConnection1.Close(); + "`Timer` VARCHAR,
} "
} + "`Announcer`
#endregion VARCHAR, "

181
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ SQLiteConnection myConn =
"`Twentyfour_Clock_Operator` new
VARCHAR, " SQLiteConnection(Conn.ConnString);
+ "`Utility` VARCHAR, SQLiteCommand myCommand =
" new SQLiteCommand("SELECT Last_Name
+ "`Head_Technical` || ', ' || First_Name || ' ' || "
VARCHAR, " + "Middle_Initial AS
+ "`Referee` VARCHAR, 'Players Name', Jersey_Number AS
" 'Jersey Number', In_or_Out AS 'In or
+ "`Umpire_1` VARCHAR, Out', "
" + "FirstP_Score AS '1st
+ "`Umpire_2` P. Score', SecondP_Score AS '2nd P.
VARCHAR);"; Score', ThirdP_Score AS '3rd P.
SQLiteConnection Score', "
myConnection1 = new + "FourthP_Score AS '4th
SQLiteConnection(Conn.ConnString); P. Score', Overtime_Score AS
SQLiteCommand myCommand1 'Overtime Score', CASE WHEN Foul_1 =
= new SQLiteCommand(myQuery1, 0 THEN '-' WHEN Foul_1 = 5 THEN 'OP'
myConnection1); ELSE Foul_1 || 'P' END AS 'Foul 1', "
SQLiteDataReader + "CASE WHEN Foul_2 = 0
myReader1; THEN '-' WHEN Foul_2 = 5 THEN 'OP'
ELSE Foul_2 || 'P' END AS 'Foul 2',
try CASE WHEN Foul_3 = 0 THEN '-' WHEN
{ Foul_3 = 5 THEN 'OP' ELSE Foul_3 ||
myConnection1.Open(); 'P' END AS 'Foul 3', "
myReader1 = + "CASE WHEN Foul_4 = 0
myCommand1.ExecuteReader(); THEN '-' WHEN Foul_4 = 5 THEN 'OP'
while ELSE Foul_4 || 'P' END AS 'Foul 4',
(myReader1.Read()) { } CASE WHEN Foul_5 = 0 THEN '-' WHEN
} Foul_5 = 5 THEN 'OP' ELSE Foul_5 ||
'P' END AS 'Foul 5', "
catch (SQLiteException + "CASE WHEN Foul_1 != 0
ex) THEN 1 ELSE Foul_1 END + CASE WHEN
{ Foul_2 != 0 THEN 1 ELSE Foul_2 END "
+ "+ CASE WHEN Foul_3 !=
MessageBox.Show(ex.Message, "Error", 0 THEN 1 ELSE Foul_3 END + CASE WHEN
MessageBoxButtons.OK, Foul_4 != 0 THEN 1 ELSE Foul_4 END "
MessageBoxIcon.Error); + "+ CASE WHEN Foul_5 !=
} 0 THEN 1 ELSE Foul_5 END AS 'Total
Foul' FROM tbl_playersgame "
finally + "WHERE Team_Name = '" +
{ cmbTeamA.Text + "' ORDER BY
In_or_Out, Jersey_Number;", myConn);
myConnection1.Close();
} try
} {
#endregion SQLiteDataAdapter
myAdapter = new SQLiteDataAdapter();
#region Load Teams
void LoadTeamA() myAdapter.SelectCommand = myCommand;
{ myDatasetTA = new
string p; DataTable();

p = txtPlayerA.Text; myAdapter.Fill(myDatasetTA);
BindingSource
bdSource = new BindingSource();

182
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
bdSource.DataSource = Alignment =
myDatasetTA; DataGridViewContentAlignment.MiddleRi
dgvTeamA.DataSource = ght;
bdSource;
dgvTeamA.Columns[9].DefaultCellStyle.
myAdapter.Update(myDatasetTA); Alignment =
} DataGridViewContentAlignment.MiddleRi
ght;
catch (Exception ex)
{ dgvTeamA.Columns[10].DefaultCellStyle
.Alignment =
MessageBox.Show(ex.Message, "Error", DataGridViewContentAlignment.MiddleRi
MessageBoxButtons.OK, ght;
MessageBoxIcon.Error);
} dgvTeamA.Columns[11].DefaultCellStyle
.Alignment =
DataGridViewContentAlignment.MiddleRi
dgvTeamA.Columns[0].Frozen = true; ght;

dgvTeamA.Columns[12].DefaultCellStyle
dgvTeamA.Columns[1].DefaultCellStyle. .Alignment =
Alignment = DataGridViewContentAlignment.MiddleRi
DataGridViewContentAlignment.MiddleRi ght;
ght;
dgvTeamA.Columns[13].DefaultCellStyle
dgvTeamA.Columns[2].DefaultCellStyle. .Alignment =
Alignment = DataGridViewContentAlignment.MiddleRi
DataGridViewContentAlignment.MiddleRi ght;
ght;
try
dgvTeamA.Columns[3].DefaultCellStyle. {
Alignment = foreach
DataGridViewContentAlignment.MiddleRi (DataGridViewRow row in
ght; dgvTeamA.Rows)
{
dgvTeamA.Columns[4].DefaultCellStyle. if
Alignment = (row.Cells[0].Value.ToString().Equals
DataGridViewContentAlignment.MiddleRi (p))
ght; {

dgvTeamA.Columns[5].DefaultCellStyle. dgvTeamA.CurrentCell = dgvTeamA[0,


Alignment = row.Index];
DataGridViewContentAlignment.MiddleRi CountFoulA();
ght; }
}
dgvTeamA.Columns[6].DefaultCellStyle. }
Alignment =
DataGridViewContentAlignment.MiddleRi catch (Exception ex) { }
ght;
ScoreFoulAPA();
dgvTeamA.Columns[7].DefaultCellStyle. }
Alignment =
DataGridViewContentAlignment.MiddleRi void ScoreFoulAPA()
ght; {
if (rdbFSA.Checked)
dgvTeamA.Columns[8].DefaultCellStyle. {

183
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

dgvTeamA.Columns[8].Visible = false; dgvTeamA.Columns[7].Visible = false;


}
dgvTeamA.Columns[9].Visible = false;
else if
dgvTeamA.Columns[10].Visible = false; (rdb4thP.Checked)
{
dgvTeamA.Columns[11].Visible = false;
dgvTeamA.Columns[3].Visible = false;
dgvTeamA.Columns[12].Visible = false;
dgvTeamA.Columns[4].Visible = false;
dgvTeamA.Columns[13].Visible = true;
dgvTeamA.Columns[5].Visible = false;
dgvTeamA.Columns[2].Visible = false;
dgvTeamA.Columns[6].Visible = true;
if (rdb1stP.Checked)
{ dgvTeamA.Columns[7].Visible = false;
}
dgvTeamA.Columns[3].Visible = true;
else if
dgvTeamA.Columns[4].Visible = false; (rdbOTime.Checked)
{
dgvTeamA.Columns[5].Visible = false;
dgvTeamA.Columns[3].Visible = false;
dgvTeamA.Columns[6].Visible = false;
dgvTeamA.Columns[4].Visible = false;
dgvTeamA.Columns[7].Visible = false;
} dgvTeamA.Columns[5].Visible = false;

else if dgvTeamA.Columns[6].Visible = false;


(rdb2ndP.Checked)
{ dgvTeamA.Columns[7].Visible = true;
}
dgvTeamA.Columns[3].Visible = false;
pnlFSA.Visible =
dgvTeamA.Columns[4].Visible = true; true;
pnlAPA.Visible =
dgvTeamA.Columns[5].Visible = false; false;

dgvTeamA.Columns[6].Visible = false; btnP1A.Visible =


true;
dgvTeamA.Columns[7].Visible = false; btnP2A.Visible =
} true;
btnP3A.Visible =
else if true;
(rdb3rdP.Checked)
{ btnM1A.Visible =
true;
dgvTeamA.Columns[3].Visible = false; btnM2A.Visible =
true;
dgvTeamA.Columns[4].Visible = false; btnM3A.Visible =
true;
dgvTeamA.Columns[5].Visible = true;
btnPFoulA.Visible =
dgvTeamA.Columns[6].Visible = false; true;

184
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
btnMFoulA.Visible =
true; dgvTeamA.Columns[3].Visible = true;

pnlFSA.Visible =
dgvTeamA.Columns[0].Frozen = false; false;
pnlAPA.Visible =
dgvTeamA.AutoSizeColumnsMode = true;
DataGridViewAutoSizeColumnsMode.Fill;
btnP1A.Visible =
CurrencyManager cm = false;
(CurrencyManager)BindingContext[dgvTe btnP2A.Visible =
amA.DataSource]; false;
cm.SuspendBinding(); btnP3A.Visible =
false;
foreach
(DataGridViewRow row in btnM1A.Visible =
dgvTeamA.Rows) false;
{ btnM2A.Visible =
if false;
(row.Cells[2].Value.ToString() == btnM3A.Visible =
"Out") false;
{
row.Visible = btnPFoulA.Visible =
false; false;
} btnMFoulA.Visible =
} false;

cm.ResumeBinding();
} dgvTeamA.Columns[0].Frozen = true;

else if (rdbAPA.Checked) dgvTeamA.AutoSizeColumnsMode =


{ DataGridViewAutoSizeColumnsMode.AllCe
lls;
dgvTeamA.Columns[8].Visible = true;
CurrencyManager cm =
dgvTeamA.Columns[9].Visible = true; (CurrencyManager)BindingContext[dgvTe
amA.DataSource];
dgvTeamA.Columns[10].Visible = true; cm.SuspendBinding();

dgvTeamA.Columns[11].Visible = true; foreach


(DataGridViewRow row in
dgvTeamA.Columns[12].Visible = true; dgvTeamA.Rows)
{
dgvTeamA.Columns[13].Visible = false; if
(row.Cells[2].Value.ToString() ==
dgvTeamA.Columns[2].Visible = false; "Out")
{
row.Visible =
dgvTeamA.Columns[7].Visible = true; true;
}
dgvTeamA.Columns[6].Visible = true; }

dgvTeamA.Columns[5].Visible = true; cm.ResumeBinding();


}
dgvTeamA.Columns[4].Visible = true; }

185
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
void ScoreFoulAPB()
{ dgvTeamB.Columns[5].Visible = true;
if (rdbFSB.Checked)
{ dgvTeamB.Columns[6].Visible = false;

dgvTeamB.Columns[8].Visible = false; dgvTeamB.Columns[7].Visible = false;


}
dgvTeamB.Columns[9].Visible = false;
else if
dgvTeamB.Columns[10].Visible = false; (rdb4thP.Checked)
{
dgvTeamB.Columns[11].Visible = false;
dgvTeamB.Columns[3].Visible = false;
dgvTeamB.Columns[12].Visible = false;
dgvTeamB.Columns[4].Visible = false;
dgvTeamB.Columns[13].Visible = true;
dgvTeamB.Columns[5].Visible = false;
dgvTeamB.Columns[2].Visible = false;
dgvTeamB.Columns[6].Visible = true;
if (rdb1stP.Checked)
{ dgvTeamB.Columns[7].Visible = false;
}
dgvTeamB.Columns[3].Visible = true;
else if
dgvTeamB.Columns[4].Visible = false; (rdbOTime.Checked)
{
dgvTeamB.Columns[5].Visible = false;
dgvTeamB.Columns[3].Visible = false;
dgvTeamB.Columns[6].Visible = false;
dgvTeamB.Columns[4].Visible = false;
dgvTeamB.Columns[7].Visible = false;
} dgvTeamB.Columns[5].Visible = false;

else if dgvTeamB.Columns[6].Visible = false;


(rdb2ndP.Checked)
{ dgvTeamB.Columns[7].Visible = true;
}
dgvTeamB.Columns[3].Visible = false;
pnlFSB.Visible =
dgvTeamB.Columns[4].Visible = true; true;
pnlAPB.Visible =
dgvTeamB.Columns[5].Visible = false; false;

dgvTeamB.Columns[6].Visible = false; btnP1B.Visible =


true;
dgvTeamB.Columns[7].Visible = false; btnP2B.Visible =
} true;
btnP3B.Visible =
else if true;
(rdb3rdP.Checked)
{ btnM1B.Visible =
true;
dgvTeamB.Columns[3].Visible = false; btnM2B.Visible =
true;
dgvTeamB.Columns[4].Visible = false; btnM3B.Visible =
true;

186
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

btnPFoulB.Visible = dgvTeamB.Columns[4].Visible = true;


true;
btnMFoulB.Visible = dgvTeamB.Columns[3].Visible = true;
true;
pnlFSB.Visible =
false;
dgvTeamB.Columns[0].Frozen = false; pnlAPB.Visible =
true;
dgvTeamB.AutoSizeColumnsMode =
DataGridViewAutoSizeColumnsMode.Fill; btnP1B.Visible =
false;
CurrencyManager cm = btnP2B.Visible =
(CurrencyManager)BindingContext[dgvTe false;
amB.DataSource]; btnP3B.Visible =
cm.SuspendBinding(); false;

foreach btnM1B.Visible =
(DataGridViewRow row in false;
dgvTeamB.Rows) btnM2B.Visible =
{ false;
if btnM3B.Visible =
(row.Cells[2].Value.ToString() == false;
"Out")
{ btnPFoulB.Visible =
row.Visible = false;
false; btnMFoulB.Visible =
} false;
}

cm.ResumeBinding(); dgvTeamB.Columns[0].Frozen = true;


}
dgvTeamB.AutoSizeColumnsMode =
else if (rdbAPB.Checked) DataGridViewAutoSizeColumnsMode.AllCe
{ lls;

dgvTeamB.Columns[8].Visible = true; CurrencyManager cm =


(CurrencyManager)BindingContext[dgvTe
dgvTeamB.Columns[9].Visible = true; amB.DataSource];
cm.SuspendBinding();
dgvTeamB.Columns[10].Visible = true;
foreach
dgvTeamB.Columns[11].Visible = true; (DataGridViewRow row in
dgvTeamB.Rows)
dgvTeamB.Columns[12].Visible = true; {
if
dgvTeamB.Columns[13].Visible = false; (row.Cells[2].Value.ToString() ==
"Out")
dgvTeamB.Columns[2].Visible = false; {
row.Visible =
true;
dgvTeamB.Columns[7].Visible = true; }
}
dgvTeamB.Columns[6].Visible = true;
cm.ResumeBinding();
dgvTeamB.Columns[5].Visible = true; }

187
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
}
myAdapter.SelectCommand = myCommand;
void LoadTeamB() myDatasetTB = new
{ DataTable();
string p;
myAdapter.Fill(myDatasetTB);
p = txtPlayerB.Text; BindingSource
bdSource = new BindingSource();
SQLiteConnection myConn = bdSource.DataSource =
new myDatasetTB;
SQLiteConnection(Conn.ConnString); dgvTeamB.DataSource =
SQLiteCommand myCommand = bdSource;
new SQLiteCommand("SELECT Last_Name
|| ', ' || First_Name || ' ' || " myAdapter.Update(myDatasetTB);
+ "Middle_Initial AS }
'Players Name', Jersey_Number AS
'Jersey Number', In_or_Out AS 'In or catch (Exception ex)
Out', " {
+ "FirstP_Score AS '1st
P. Score', SecondP_Score AS '2nd P. MessageBox.Show(ex.Message, "Error",
Score', ThirdP_Score AS '3rd P. MessageBoxButtons.OK,
Score', " MessageBoxIcon.Error);
+ "FourthP_Score AS '4th }
P. Score', Overtime_Score AS
'Overtime Score', CASE WHEN Foul_1 =
0 THEN '-' WHEN Foul_1 = 5 THEN 'OP' dgvTeamB.Columns[0].Frozen = true;
ELSE Foul_1 || 'P' END AS 'Foul 1', "
+ "CASE WHEN Foul_2 = 0
THEN '-' WHEN Foul_2 = 5 THEN 'OP' dgvTeamB.Columns[1].DefaultCellStyle.
ELSE Foul_2 || 'P' END AS 'Foul 2', Alignment =
CASE WHEN Foul_3 = 0 THEN '-' WHEN DataGridViewContentAlignment.MiddleRi
Foul_3 = 5 THEN 'OP' ELSE Foul_3 || ght;
'P' END AS 'Foul 3', "
+ "CASE WHEN Foul_4 = 0 dgvTeamB.Columns[2].DefaultCellStyle.
THEN '-' WHEN Foul_4 = 5 THEN 'OP' Alignment =
ELSE Foul_4 || 'P' END AS 'Foul 4', DataGridViewContentAlignment.MiddleRi
CASE WHEN Foul_5 = 0 THEN '-' WHEN ght;
Foul_5 = 5 THEN 'OP' ELSE Foul_5 ||
'P' END AS 'Foul 5', " dgvTeamB.Columns[3].DefaultCellStyle.
+ "CASE WHEN Foul_1 != 0 Alignment =
THEN 1 ELSE Foul_1 END + CASE WHEN DataGridViewContentAlignment.MiddleRi
Foul_2 != 0 THEN 1 ELSE Foul_2 END " ght;
+ "+ CASE WHEN Foul_3 !=
0 THEN 1 ELSE Foul_3 END + CASE WHEN dgvTeamB.Columns[4].DefaultCellStyle.
Foul_4 != 0 THEN 1 ELSE Foul_4 END " Alignment =
+ "+ CASE WHEN Foul_5 != DataGridViewContentAlignment.MiddleRi
0 THEN 1 ELSE Foul_5 END AS 'Total ght;
Foul' FROM tbl_playersgame "
+ "WHERE Team_Name = '" + dgvTeamB.Columns[5].DefaultCellStyle.
cmbTeamB.Text + "' ORDER BY Alignment =
In_or_Out, Jersey_Number;", myConn); DataGridViewContentAlignment.MiddleRi
try ght;
{
SQLiteDataAdapter dgvTeamB.Columns[6].DefaultCellStyle.
myAdapter = new SQLiteDataAdapter(); Alignment =

188
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
DataGridViewContentAlignment.MiddleRi catch (Exception ex) { }
ght;
ScoreFoulAPB();
dgvTeamB.Columns[7].DefaultCellStyle. }
Alignment = #endregion
DataGridViewContentAlignment.MiddleRi
ght; #region Row Coloring A
private void
dgvTeamB.Columns[8].DefaultCellStyle. dgvTeamA_CellFormatting(object
Alignment = sender,
DataGridViewContentAlignment.MiddleRi DataGridViewCellFormattingEventArgs
ght; e)
{
dgvTeamB.Columns[9].DefaultCellStyle. foreach (DataGridViewRow
Alignment = row in dgvTeamA.Rows)
DataGridViewContentAlignment.MiddleRi {
ght; string rs =
row.Cells[13].Value.ToString();
dgvTeamB.Columns[10].DefaultCellStyle
.Alignment = if (rs == "3")
DataGridViewContentAlignment.MiddleRi {
ght;
row.DefaultCellStyle.ForeColor =
dgvTeamB.Columns[11].DefaultCellStyle Color.Orange;
.Alignment = }
DataGridViewContentAlignment.MiddleRi
ght; else if (rs == "4")
{
dgvTeamB.Columns[12].DefaultCellStyle
.Alignment = row.DefaultCellStyle.ForeColor =
DataGridViewContentAlignment.MiddleRi Color.BlueViolet;
ght; }

dgvTeamB.Columns[13].DefaultCellStyle else if (rs == "5")


.Alignment = {
DataGridViewContentAlignment.MiddleRi
ght; row.DefaultCellStyle.ForeColor =
Color.Red;
try }
{
foreach else
(DataGridViewRow row in {
dgvTeamB.Rows)
{ row.DefaultCellStyle.ForeColor =
if Color.Black;
(row.Cells[0].Value.ToString().Equals }
(p)) }
{ }
#endregion
dgvTeamB.CurrentCell = dgvTeamB[0,
row.Index]; #region Row Coloring B
CountFoulB(); private void
} dgvTeamB_CellFormatting(object
} sender,
} DataGridViewCellFormattingEventArgs
e)

189
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{ pnlPeriods.Enabled =
foreach (DataGridViewRow false;
row in dgvTeamB.Rows) tmrDTime.Stop();
{ }
string rs =
row.Cells[13].Value.ToString(); else if
(!chkLockA.Checked &&
if (rs == "3") chkLockB.Checked)
{ {
cmbDivision.Enabled =
row.DefaultCellStyle.ForeColor = false;
Color.Orange; cmbTeamB.Enabled =
} false;
cmbTeamA.Enabled =
else if (rs == "4") true;
{
pnlTeamSA.Enabled =
row.DefaultCellStyle.ForeColor = false;
Color.BlueViolet; pnlTeamSB.Enabled =
} false;
pnlPeriods.Enabled =
else if (rs == "5") false;
{ tmrDTime.Stop();
}
row.DefaultCellStyle.ForeColor =
Color.Red; else if
} (!chkLockA.Checked &&
!chkLockB.Checked)
else {
{ cmbDivision.Enabled =
true;
row.DefaultCellStyle.ForeColor = cmbTeamB.Enabled =
Color.Black; true;
} cmbTeamA.Enabled =
} true;
}
#endregion pnlTeamSA.Enabled =
false;
#region Lock pnlTeamSB.Enabled =
void Lock() false;
{ pnlPeriods.Enabled =
if (chkLockA.Checked && false;
!chkLockB.Checked) tmrDTime.Start();
{ }
cmbDivision.Enabled =
false; else if (chkLockA.Checked
cmbTeamA.Enabled = && chkLockB.Checked)
false; {
cmbTeamB.Enabled = cmbDivision.Enabled =
true; false;
cmbTeamB.Enabled =
pnlTeamSA.Enabled = false;
false; cmbTeamA.Enabled =
pnlTeamSB.Enabled = false;
false;

190
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
pnlTeamSA.Enabled = }
true; }
pnlTeamSB.Enabled =
true; private void
pnlPeriods.Enabled = chkLockB_CheckedChanged(object
true; sender, EventArgs e)
tmrDTime.Stop(); {
GameDTNO(); Lock();
sLock = "Lock";
} if (chkLockA.Checked &&
} !chkLockB.Checked && sLock == "Lock")
{
private void dynamic dialog =
chkLockA_CheckedChanged(object MessageBox.Show("If this message
sender, EventArgs e) shows, two teams are already lock in.
{ "
Lock(); + "If the team you
are trying to unlock has already
if (!chkLockA.Checked && records, it will be clear when you
chkLockB.Checked && sLock == "Lock") try "
{ + "to change the
dynamic dialog = team.\n\n Are you sure you want to
MessageBox.Show("If this message Unlock?", "Unlock Teams",
shows, two teams are already lock in. MessageBoxButtons.YesNo,
" MessageBoxIcon.Warning);
+ "If the team you if (dialog ==
are trying to unlock has already DialogResult.No)
records, it will be clear when you {
try " chkLockB.Checked
+ "to change the = true;
team.\n\n Are you sure you want to }
Unlock?", "Unlock Teams",
MessageBoxButtons.YesNo, else if (dialog ==
MessageBoxIcon.Warning); DialogResult.Yes)
if (dialog == {
DialogResult.No) sLock = "";
{ }
chkLockA.Checked }
= true;
} if (chkLockB.Checked)
{
else if (dialog == lblNotif.Text = "Team
DialogResult.Yes) B has been locked.";
{ lblNotif.Visible =
sLock = ""; true;
} iDT = 4;
} tmrNotif.Start();
}
if (chkLockA.Checked) }
{ #endregion
lblNotif.Text = "Team
A has been locked."; #region Input of Game Date,
lblNotif.Visible = Time, Date and Opponent
true; void GameDTNO()
iDT = 4; {
tmrNotif.Start();

191
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
string myQuery = "UPDATE }
tbl_playersgame SET Game_Date = '" +
sDateTime + "', Game_Number = '" + catch (SQLiteException
txtGGNumber.Text + "';"; ex)
SQLiteConnection {
myConnection = new
SQLiteConnection(Conn.ConnString); MessageBox.Show(ex.Message, "Error",
SQLiteCommand myCommand = MessageBoxButtons.OK,
new SQLiteCommand(myQuery, MessageBoxIcon.Error);
myConnection); }
SQLiteDataReader
myReader; finally
{
try
{ myConnection1.Close();
myConnection.Open(); }
myReader =
myCommand.ExecuteReader(); string myQuery2 = "UPDATE
while tbl_teamsgame SET Opponent = '" +
(myReader.Read()) { } cmbTeamB.Text + "' WHERE Team_Name =
} '" + cmbTeamA.Text + "';";
SQLiteConnection
catch (SQLiteException myConnection2 = new
ex) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand myCommand2
= new SQLiteCommand(myQuery2,
MessageBox.Show(ex.Message, "Error", myConnection2);
MessageBoxButtons.OK, SQLiteDataReader
MessageBoxIcon.Error); myReader2;
}
try
finally {
{ myConnection2.Open();
myConnection.Close(); myReader2 =
} myCommand2.ExecuteReader();
while
string myQuery1 = "UPDATE (myReader2.Read()) { }
tbl_teamsgame SET Game_Date = '" + }
sDateTime + "', Game_Number = '" +
txtGGNumber.Text + "';"; catch (SQLiteException
SQLiteConnection ex)
myConnection1 = new {
SQLiteConnection(Conn.ConnString);
SQLiteCommand myCommand1 MessageBox.Show(ex.Message, "Error",
= new SQLiteCommand(myQuery1, MessageBoxButtons.OK,
myConnection1); MessageBoxIcon.Error);
SQLiteDataReader }
myReader1;
finally
try {
{
myConnection1.Open(); myConnection2.Close();
myReader1 = }
myCommand1.ExecuteReader();
while string myQuery3 = "UPDATE
(myReader1.Read()) { } tbl_teamsgame SET Opponent = '" +

192
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
cmbTeamA.Text + "' WHERE Team_Name =
'" + cmbTeamB.Text + "';"; MessageBox.Show(txtPlayerA.Text + "
SQLiteConnection is already in.", "Player to Set In",
myConnection3 = new MessageBoxButtons.OK,
SQLiteConnection(Conn.ConnString); MessageBoxIcon.Error);
SQLiteCommand myCommand3 }
= new SQLiteCommand(myQuery3,
myConnection3); else if
SQLiteDataReader (txtCPlayersA.Text == "5")
myReader3; {
MessageBox.Show("You
try can only set 5 players per team.",
{ "Player to Set In",
myConnection3.Open(); MessageBoxButtons.OK,
myReader3 = MessageBoxIcon.Error);
myCommand3.ExecuteReader(); }
while
(myReader3.Read()) { } else if(sFoulA == "5")
} {

catch (SQLiteException MessageBox.Show(txtPlayerA.Text + "


ex) is already fouled out.", "Player to
{ Set In", MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); else
} {
string myQuery =
finally "UPDATE tbl_playersgame SET In_or_Out
{ = 'In' WHERE Last_Name || ', ' ||
First_Name || ' ' || Middle_Initial =
myConnection3.Close(); '" + txtPlayerA.Text + "' "
} + "AND Jersey_Number
} = '" + sJerseyA + "' AND Team_Name =
#endregion '" + cmbTeamA.Text + "';";
SQLiteConnection
#region Team A Substitution myConnection = new
In SQLiteConnection(Conn.ConnString);
private void SQLiteCommand
btnInA_Click(object sender, EventArgs myCommand = new
e) SQLiteCommand(myQuery, myConnection);
{ SQLiteDataReader
if (txtPlayerA.Text == myReader;
"None")
{ try
{
MessageBox.Show("Please select player
to set in.", "Player to Set In", myConnection.Open();
MessageBoxButtons.OK, myReader =
MessageBoxIcon.Error); myCommand.ExecuteReader();
} while
(myReader.Read()) { }
else if (sInA == "In")
{ sInA = "In";

193
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
lblNotif.Text = else if
"Team A : " + txtPlayerA.Text + " has (txtCPlayersB.Text == "5")
been set in."; {
lblNotif.Visible MessageBox.Show("You
= true; can only set 5 players per team.",
iDT = 4; "Player to Set In",
tmrNotif.Start(); MessageBoxButtons.OK,
MessageBoxIcon.Error);
LoadTeamA(); }
}
else if (sFoulB == "5")
catch {
(SQLiteException ex)
{ MessageBox.Show(txtPlayerB.Text + "
is already fouled out.", "Player to
MessageBox.Show(ex.Message, "Error", Set In", MessageBoxButtons.OK,
MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBoxIcon.Error); }
}
else
finally {
{ string myQuery =
"UPDATE tbl_playersgame SET In_or_Out
myConnection.Close(); = 'In' WHERE Last_Name || ', ' ||
} First_Name || ' ' || Middle_Initial =
} '" + txtPlayerB.Text + "' "
+ "AND Jersey_Number
CountTeamA(); = '" + sJerseyB + "' AND Team_Name =
} '" + cmbTeamB.Text + "';";
#endregion SQLiteConnection
myConnection = new
#region Team B Substitution SQLiteConnection(Conn.ConnString);
In SQLiteCommand
private void myCommand = new
btnInB_Click(object sender, EventArgs SQLiteCommand(myQuery, myConnection);
e) SQLiteDataReader
{ myReader;
if (txtPlayerB.Text ==
"None") try
{ {

MessageBox.Show("Please select player myConnection.Open();


to set in.", "Player to Set In", myReader =
MessageBoxButtons.OK, myCommand.ExecuteReader();
MessageBoxIcon.Error); while
} (myReader.Read()) { }

else if (sInB == "In") sInB = "In";


{
lblNotif.Text =
MessageBox.Show(txtPlayerB.Text + " "Team B : " + txtPlayerB.Text + " has
is already in.", "Player to Set In", been set in.";
MessageBoxButtons.OK, lblNotif.Visible
MessageBoxIcon.Error); = true;
} iDT = 4;
tmrNotif.Start();

194
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "AND Jersey_Number
LoadTeamB(); = '" + sJerseyA + "' AND Team_Name =
} '" + cmbTeamA.Text + "';";
SQLiteConnection
catch myConnection = new
(SQLiteException ex) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
myCommand = new
MessageBox.Show(ex.Message, "Error", SQLiteCommand(myQuery, myConnection);
MessageBoxButtons.OK, SQLiteDataReader
MessageBoxIcon.Error); myReader;
}
try
finally {
{
myConnection.Open();
myConnection.Close(); myReader =
} myCommand.ExecuteReader();
} while
(myReader.Read()) { }
CountTeamB();
} sInA = "Out";
#endregion
lblNotif.Text =
#region Team A Substitution "Team A : " + txtPlayerA.Text + " has
Out been set out.";
private void lblNotif.Visible
btnOutA_Click(object sender, = true;
EventArgs e) iDT = 4;
{ tmrNotif.Start();
if (txtPlayerA.Text ==
"None") LoadTeamA();
{ }

MessageBox.Show("Please select player catch


to set out.", "Player to Set Out", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
else if (sInA == "Out") MessageBoxIcon.Error);
{ }

MessageBox.Show(txtPlayerA.Text + " finally


is already out.", "Player to Set {
Out", MessageBoxButtons.OK,
MessageBoxIcon.Error); myConnection.Close();
} }
}
else
{ CountTeamA();
string myQuery = }
"UPDATE tbl_playersgame SET In_or_Out #endregion
= 'Out' WHERE Last_Name || ', ' ||
First_Name || ' ' || Middle_Initial = #region Team B Substitution
'" + txtPlayerA.Text + "' " Out

195
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
private void lblNotif.Visible
btnOutB_Click(object sender, = true;
EventArgs e) iDT = 4;
{ tmrNotif.Start();
if (txtPlayerB.Text ==
"None") LoadTeamB();
{ }

MessageBox.Show("Please select player catch


to set out.", "Player to Set Out", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
else if (sInB == "Out") MessageBoxIcon.Error);
{ }

MessageBox.Show(txtPlayerB.Text + " finally


is already out.", "Player to Set {
Out", MessageBoxButtons.OK,
MessageBoxIcon.Error); myConnection.Close();
} }
}
else
{ CountTeamB();
string myQuery = }
"UPDATE tbl_playersgame SET In_or_Out #endregion
= 'Out' WHERE Last_Name || ', ' ||
First_Name || ' ' || Middle_Initial = #region Team A Cell Enter
'" + txtPlayerB.Text + "' " private void
+ "AND Jersey_Number dgvTeamA_CellEnter(object sender,
= '" + sJerseyB + "' AND Team_Name = DataGridViewCellEventArgs e)
'" + cmbTeamB.Text + "';"; {
SQLiteConnection if (e.RowIndex >= 0)
myConnection = new {
SQLiteConnection(Conn.ConnString); DataGridViewRow row =
SQLiteCommand this.dgvTeamA.Rows[e.RowIndex];
myCommand = new
SQLiteCommand(myQuery, myConnection); txtPlayerA.Text =
SQLiteDataReader row.Cells["Players
myReader; Name"].Value.ToString();
sJerseyA =
try row.Cells["Jersey
{ Number"].Value.ToString();
sInA = row.Cells["In
myConnection.Open(); or Out"].Value.ToString();
myReader = CountFoulA();
myCommand.ExecuteReader(); }
while }
(myReader.Read()) { } #endregion

sInB = "Out"; #region Team B Cell Enter


private void
lblNotif.Text = dgvTeamB_CellEnter(object sender,
"Team B : " + txtPlayerB.Text + " has DataGridViewCellEventArgs e)
been set out."; {

196
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
if (e.RowIndex >= 0)
{ finally
DataGridViewRow row = {
this.dgvTeamB.Rows[e.RowIndex]; myConnection.Close();
}
txtPlayerB.Text = }
row.Cells["Players #endregion
Name"].Value.ToString();
sJerseyB = #region Team B Count Current
row.Cells["Jersey Players
Number"].Value.ToString(); void CountTeamB()
sInB = row.Cells["In {
or Out"].Value.ToString(); string myQuery = "SELECT
CountFoulB(); COUNT(In_or_Out) FROM tbl_playersgame
} WHERE In_or_Out = 'In' AND Team_Name
} = '" + cmbTeamB.Text + "';";
#endregion SQLiteConnection
myConnection = new
#region Team A Count Current SQLiteConnection(Conn.ConnString);
Players SQLiteCommand myCommand =
void CountTeamA() new SQLiteCommand(myQuery,
{ myConnection);
string myQuery = "SELECT SQLiteDataReader
COUNT(In_or_Out) FROM tbl_playersgame myReader;
WHERE In_or_Out = 'In' AND Team_Name
= '" + cmbTeamA.Text + "';"; try
SQLiteConnection {
myConnection = new myConnection.Open();
SQLiteConnection(Conn.ConnString); myReader =
SQLiteCommand myCommand = myCommand.ExecuteReader();
new SQLiteCommand(myQuery, while
myConnection); (myReader.Read())
SQLiteDataReader {
myReader; txtCPlayersB.Text
= myReader.GetValue(0).ToString();
try }
{ }
myConnection.Open();
myReader = catch (SQLiteException
myCommand.ExecuteReader(); ex)
while {
(myReader.Read())
{ MessageBox.Show(ex.Message, "Error",
txtCPlayersA.Text MessageBoxButtons.OK,
= myReader.GetValue(0).ToString(); MessageBoxIcon.Error);
} }
}
finally
catch (SQLiteException {
ex) myConnection.Close();
{ }
}
MessageBox.Show(ex.Message, "Error", #endregion
MessageBoxButtons.OK,
MessageBoxIcon.Error); #region Enable Disable Score
} Board A

197
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
private void if (tsa >= tsb)
txtCPlayersA_TextChanged(object {
sender, EventArgs e) string myQuery =
{ "UPDATE tbl_teamsgame SET Game_Score
int p = 0; = '" + tsa + "-" + tsb + "';";
SQLiteConnection
if myConnection = new
(Int32.TryParse(txtCPlayersA.Text, SQLiteConnection(Conn.ConnString);
out p) && p >= 2) SQLiteCommand
{ myCommand = new
pnlTeamSSA.Enabled = SQLiteCommand(myQuery, myConnection);
true; SQLiteDataReader
} myReader;

else try
{ {
pnlTeamSSA.Enabled =
false; myConnection.Open();
} myReader =
} myCommand.ExecuteReader();
#endregion while
(myReader.Read()) { }
#region Enable Disable Score }
Board B
private void catch
txtCPlayersB_TextChanged(object (SQLiteException ex)
sender, EventArgs e) {
{
int p = 0; MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
if MessageBoxIcon.Error);
(Int32.TryParse(txtCPlayersB.Text, }
out p) && p >= 2)
{ finally
pnlTeamSSB.Enabled = {
true;
} myConnection.Close();
}
else }
{
pnlTeamSSB.Enabled = else if (tsa < tsb)
false; {
} string myQuery =
} "UPDATE tbl_teamsgame SET Game_Score
#endregion = '" + tsb + "-" + tsa + "';";
SQLiteConnection
#region Teams Score myConnection = new
void TeamScore() SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
int tsa, tsb; myCommand = new
SQLiteCommand(myQuery, myConnection);
tsa = SQLiteDataReader
Convert.ToInt32(txtScoreA.Text); myReader;
tsb =
Convert.ToInt32(txtScoreB.Text); try
{

198
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
string myQuery =
myConnection.Open(); "UPDATE tbl_teamsgame SET
myReader = First_Half_Time_Out =
myCommand.ExecuteReader(); First_Half_Time_Out + 1 WHERE
while Team_Name = '" + cmbTeamA.Text +
(myReader.Read()) { } "';";
} SQLiteConnection
myConnection = new
catch SQLiteConnection(Conn.ConnString);
(SQLiteException ex) SQLiteCommand
{ myCommand = new
SQLiteCommand(myQuery, myConnection);
MessageBox.Show(ex.Message, "Error", SQLiteDataReader
MessageBoxButtons.OK, myReader;
MessageBoxIcon.Error);
} try
{
finally
{ myConnection.Open();
myReader =
myConnection.Close(); myCommand.ExecuteReader();
} while
} (myReader.Read()) { }
} }
#endregion
catch
#region Time-Out A (SQLiteException ex)
void NTOutA() {
{
lblNotif.Text = " Team A MessageBox.Show(ex.Message, "Error",
: Call for a time-out."; MessageBoxButtons.OK,
lblNotif.Visible = true; MessageBoxIcon.Error);
iDT = 4; }
tmrNotif.Start();
} finally
{
private void
btnTOutA_Click(object sender, myConnection.Close();
EventArgs e) }
{
if (rdb1stP.Checked || NTOutA();
rdb2ndP.Checked) }
{ }
if (txt1HTOA.Text ==
"2") else if (rdb3rdP.Checked
{ || rdb4thP.Checked)
{
MessageBox.Show(cmbTeamA.Text + " has if (txt2HTOA.Text ==
already taken their alotted time-out "3")
for the 1st half.", "No Time-Out", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(cmbTeamA.Text + " has
} already taken their alotted time-out
for the 2nd half.", "No Time-Out",
else MessageBoxButtons.OK,
{ MessageBoxIcon.Error);

199
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} for the over time.", "No Time-Out",
MessageBoxButtons.OK,
else MessageBoxIcon.Error);
{ }
string myQuery =
"UPDATE tbl_teamsgame SET else
Second_Half_Time_Out = {
Second_Half_Time_Out + 1 WHERE string myQuery =
Team_Name = '" + cmbTeamA.Text + "UPDATE tbl_teamsgame SET
"';"; Extra_Time_Out = Extra_Time_Out + 1
SQLiteConnection WHERE Team_Name = '" + cmbTeamA.Text
myConnection = new + "';";
SQLiteConnection(Conn.ConnString); SQLiteConnection
SQLiteCommand myConnection = new
myCommand = new SQLiteConnection(Conn.ConnString);
SQLiteCommand(myQuery, myConnection); SQLiteCommand
SQLiteDataReader myCommand = new
myReader; SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
try myReader;
{
try
myConnection.Open(); {
myReader =
myCommand.ExecuteReader(); myConnection.Open();
while myReader =
(myReader.Read()) { } myCommand.ExecuteReader();
} while
(myReader.Read()) { }
catch
(SQLiteException ex) iTimeoutA =
{ 1;
}
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, catch
MessageBoxIcon.Error); (SQLiteException ex)
} {

finally MessageBox.Show(ex.Message, "Error",


{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
myConnection.Close(); }
}
finally
NTOutA(); {
}
} myConnection.Close();
}
else if
(rdbOTime.Checked) NTOutA();
{ }
if (iTimeoutA == 1) }
{
string myQuery1 = "SELECT
MessageBox.Show(cmbTeamA.Text + " has First_Half_Time_Out,
already taken their alotted time-out Second_Half_Time_Out, Extra_Time_Out

200
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
FROM tbl_teamsgame WHERE Team_Name = private void
'" + cmbTeamA.Text + "';"; btnTOutB_Click(object sender,
SQLiteConnection EventArgs e)
myConnection1 = new {
SQLiteConnection(Conn.ConnString); if (rdb1stP.Checked ||
SQLiteCommand myCommand1 rdb2ndP.Checked)
= new SQLiteCommand(myQuery1, {
myConnection1); if (txt1HTOB.Text ==
SQLiteDataReader "2")
myReader1; {

try MessageBox.Show(cmbTeamB.Text + " has


{ already taken their alotted time-out
myConnection1.Open(); for the 1st half.", "No Time-Out",
myReader1 = MessageBoxButtons.OK,
myCommand1.ExecuteReader(); MessageBoxIcon.Error);
while }
(myReader1.Read())
{ else
txt1HTOA.Text = {
myReader1.GetValue(0).ToString(); string myQuery =
txt2HTOA.Text = "UPDATE tbl_teamsgame SET
myReader1.GetValue(1).ToString(); First_Half_Time_Out =
txtETOA.Text = First_Half_Time_Out + 1 WHERE
myReader1.GetValue(2).ToString(); Team_Name = '" + cmbTeamB.Text +
} "';";
} SQLiteConnection
myConnection = new
catch (SQLiteException SQLiteConnection(Conn.ConnString);
ex) SQLiteCommand
{ myCommand = new
SQLiteCommand(myQuery, myConnection);
MessageBox.Show(ex.Message, "Error", SQLiteDataReader
MessageBoxButtons.OK, myReader;
MessageBoxIcon.Error);
} try
{
finally
{ myConnection.Open();
myReader =
myConnection1.Close(); myCommand.ExecuteReader();
} while
} (myReader.Read()) { }
#endregion }

#region Time-Out B catch


void NTOutB() (SQLiteException ex)
{ {
lblNotif.Text = " Team B
: Call for a time-out."; MessageBox.Show(ex.Message, "Error",
lblNotif.Visible = true; MessageBoxButtons.OK,
iDT = 4; MessageBoxIcon.Error);
tmrNotif.Start(); }
}
finally
{

201
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
}
myConnection.Close();
} finally
{
NTOutB();
} myConnection.Close();
} }

else if (rdb3rdP.Checked NTOutB();


|| rdb4thP.Checked) }
{ }
if (txt2HTOB.Text ==
"3") else if
{ (rdbOTime.Checked)
{
MessageBox.Show(cmbTeamB.Text + " has if (iTimeoutB == 1)
already taken their alotted time-out {
for the 2nd half.", "No Time-Out",
MessageBoxButtons.OK, MessageBox.Show(cmbTeamB.Text + " has
MessageBoxIcon.Error); already taken their alotted time-out
} for the over time.", "No Time-Out",
MessageBoxButtons.OK,
else MessageBoxIcon.Error);
{ }
string myQuery =
"UPDATE tbl_teamsgame SET else
Second_Half_Time_Out = {
Second_Half_Time_Out + 1 WHERE string myQuery =
Team_Name = '" + cmbTeamB.Text + "UPDATE tbl_teamsgame SET
"';"; Extra_Time_Out = Extra_Time_Out + 1
SQLiteConnection WHERE Team_Name = '" + cmbTeamB.Text
myConnection = new + "';";
SQLiteConnection(Conn.ConnString); SQLiteConnection
SQLiteCommand myConnection = new
myCommand = new SQLiteConnection(Conn.ConnString);
SQLiteCommand(myQuery, myConnection); SQLiteCommand
SQLiteDataReader myCommand = new
myReader; SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
try myReader;
{
try
myConnection.Open(); {
myReader =
myCommand.ExecuteReader(); myConnection.Open();
while myReader =
(myReader.Read()) { } myCommand.ExecuteReader();
} while
(myReader.Read()) { }
catch
(SQLiteException ex) iTimeoutB =
{ 1;
}
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, catch
MessageBoxIcon.Error); (SQLiteException ex)

202
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{
finally
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); myConnection1.Close();
} }
}
finally #endregion
{
#region A and B Score Foul AP
myConnection.Close(); Transition
} private void
dgvTeamA_ColumnHeaderMouseClick(objec
NTOutB(); t sender,
} DataGridViewCellMouseEventArgs e)
} {
ScoreFoulAPA();
string myQuery1 = "SELECT }
First_Half_Time_Out, private void
Second_Half_Time_Out, Extra_Time_Out rdbScoreA_Click(object sender,
FROM tbl_teamsgame WHERE Team_Name = EventArgs e)
'" + cmbTeamB.Text + "';"; {
SQLiteConnection ScoreFoulAPA();
myConnection1 = new }
SQLiteConnection(Conn.ConnString);
SQLiteCommand myCommand1 private void
= new SQLiteCommand(myQuery1, rdbFoulA_CheckedChanged(object
myConnection1); sender, EventArgs e)
SQLiteDataReader {
myReader1; ScoreFoulAPA();
}
try
{ private void
myConnection1.Open(); rdbAPA_Click(object sender, EventArgs
myReader1 = e)
myCommand1.ExecuteReader(); {
while ScoreFoulAPA();
(myReader1.Read()) }
{
txt1HTOB.Text = private void
myReader1.GetValue(0).ToString(); dgvTeamB_ColumnHeaderMouseClick(objec
txt2HTOB.Text = t sender,
myReader1.GetValue(1).ToString(); DataGridViewCellMouseEventArgs e)
txtETOB.Text = {
myReader1.GetValue(2).ToString(); ScoreFoulAPB();
} }
}
private void
catch (SQLiteException rdbScoreB_CheckedChanged(object
ex) sender, EventArgs e)
{ {
ScoreFoulAPB();
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}

203
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
private void private void
rdbFoulB_CheckedChanged(object dgvTeamB_CellDoubleClick(object
sender, EventArgs e) sender, DataGridViewCellEventArgs e)
{ {
ScoreFoulAPB(); if (rdbAPB.Checked)
} {
if (sInB == "Out")
private void {
rdbAPB_Click(object sender, EventArgs
e) btnInB_Click(sender, e);
{ sInA = "In";
ScoreFoulAPB(); }
}
#endregion else if (sInB == "In")
{
#region Notification
private void btnOutB_Click(sender, e);
tmrNotif_Tick(object sender, sInA = "Out";
EventArgs e) }
{ }
iDT--; }
if (iDT == 0) #endregion
{
tmrNotif.Stop(); //------------------------//
lblNotif.Visible = Team A Scoring
false;
} #region Team A Score
} void TeamAScore()
#endregion {
string myQuery = "SELECT
#region Cell D-Cick A SUM(FirstP_Score) +
private void SUM(SecondP_Score) +
dgvTeamA_CellDoubleClick(object SUM(ThirdP_Score) +
sender, DataGridViewCellEventArgs e) SUM(FourthP_Score) +
{ SUM(Overtime_Score) FROM
if (rdbAPA.Checked) tbl_playersgame WHERE Team_Name = '"
{ + cmbTeamA.Text + "';";
if (sInA == "Out") SQLiteConnection
{ myConnection = new
SQLiteConnection(Conn.ConnString);
btnInA_Click(sender, e); SQLiteCommand myCommand =
sInA = "In"; new SQLiteCommand(myQuery,
} myConnection);
SQLiteDataReader
else if (sInA == myReader;
"In")
{ try
{
btnOutA_Click(sender, e); myConnection.Open();
sInA = "Out"; myReader =
} myCommand.ExecuteReader();
} while
} (myReader.Read())
#endregion {
txtScoreA.Text =
#region Cell D-Click B myReader.GetInt32(0).ToString("D3");

204
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} + "AND Jersey_Number
} = '" + sJerseyA + "' AND Team_Name =
'" + cmbTeamA.Text + "';";
catch (SQLiteException SQLiteConnection
ex) myConnection = new
{ SQLiteConnection(Conn.ConnString);
SQLiteCommand
MessageBox.Show(ex.Message, "Error", myCommand = new
MessageBoxButtons.OK, SQLiteCommand(myQuery, myConnection);
MessageBoxIcon.Error); SQLiteDataReader
} myReader;

finally try
{ {
myConnection.Close();
} myConnection.Open();
myReader =
TeamScore(); myCommand.ExecuteReader();
} while
#endregion (myReader.Read()) { }

#region Score Notification sSNotif = "+1";


void ScoreNotifA() ScoreNotifA();
{
lblNotif.Text = "Team A : TeamAScore();
" + txtPlayerA.Text + " got " + LoadTeamA();
sSNotif + " points."; }
lblNotif.Visible = true;
iDT = 4; catch
tmrNotif.Start(); (SQLiteException ex)
} {
#endregion
MessageBox.Show(ex.Message, "Error",
#region Team A +1 Score MessageBoxButtons.OK,
private void MessageBoxIcon.Error);
btnP1A_Click(object sender, EventArgs }
e)
{ finally
if (sInA == "Out") {
{
MessageBox.Show("You myConnection.Close();
are trying to score an out playing }
player.", "Out of Score", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); else if (rdb2ndP.Checked)
} {
string myQuery =
else if (rdb1stP.Checked) "UPDATE tbl_playersgame SET
{ SecondP_Score = SecondP_Score + 1
string myQuery = WHERE Last_Name || ', ' || First_Name
"UPDATE tbl_playersgame SET || ' ' || Middle_Initial = '" +
FirstP_Score = FirstP_Score + 1 WHERE txtPlayerA.Text + "' "
Last_Name || ', ' || First_Name || ' + "AND Jersey_Number
' || Middle_Initial = '" + = '" + sJerseyA + "' AND Team_Name =
txtPlayerA.Text + "' " '" + cmbTeamA.Text + "';";

205
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteConnection SQLiteCommand
myConnection = new myCommand = new
SQLiteConnection(Conn.ConnString); SQLiteCommand(myQuery, myConnection);
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+1";
(myReader.Read()) { } ScoreNotifA();

sSNotif = "+1"; TeamAScore();


ScoreNotifA(); LoadTeamA();
}
TeamAScore();
LoadTeamA(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close();
} else if (rdb4thP.Checked)
} {
string myQuery =
else if (rdb3rdP.Checked) "UPDATE tbl_playersgame SET
{ FourthP_Score = FourthP_Score + 1
string myQuery = WHERE Last_Name || ', ' || First_Name
"UPDATE tbl_playersgame SET || ' ' || Middle_Initial = '" +
ThirdP_Score = ThirdP_Score + 1 WHERE txtPlayerA.Text + "' "
Last_Name || ', ' || First_Name || ' + "AND Jersey_Number
' || Middle_Initial = '" + = '" + sJerseyA + "' AND Team_Name =
txtPlayerA.Text + "' " '" + cmbTeamA.Text + "';";
+ "AND Jersey_Number SQLiteConnection
= '" + sJerseyA + "' AND Team_Name = myConnection = new
'" + cmbTeamA.Text + "';"; SQLiteConnection(Conn.ConnString);
SQLiteConnection SQLiteCommand
myConnection = new myCommand = new
SQLiteConnection(Conn.ConnString); SQLiteCommand(myQuery, myConnection);

206
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+1";
(myReader.Read()) { } ScoreNotifA();

sSNotif = "+1"; TeamAScore();


ScoreNotifA(); LoadTeamA();
}
TeamAScore();
LoadTeamA(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close(); }
} #endregion
}
#region Team A +2 Score
else if private void
(rdbOTime.Checked) btnP2A_Click(object sender, EventArgs
{ e)
string myQuery = {
"UPDATE tbl_playersgame SET if (sInA == "Out")
Overtime_Score = Overtime_Score + 1 {
WHERE Last_Name || ', ' || First_Name MessageBox.Show("You
|| ' ' || Middle_Initial = '" + are trying to score an out playing
txtPlayerA.Text + "' " player.", "Out of Score",
+ "AND Jersey_Number MessageBoxButtons.OK,
= '" + sJerseyA + "' AND Team_Name = MessageBoxIcon.Error);
'" + cmbTeamA.Text + "';"; }
SQLiteConnection
myConnection = new else if (rdb1stP.Checked)
SQLiteConnection(Conn.ConnString); {
SQLiteCommand string myQuery =
myCommand = new "UPDATE tbl_playersgame SET
SQLiteCommand(myQuery, myConnection); FirstP_Score = FirstP_Score + 2 WHERE
SQLiteDataReader Last_Name || ', ' || First_Name || '
myReader; ' || Middle_Initial = '" +
txtPlayerA.Text + "' "

207
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "AND Jersey_Number SQLiteConnection
= '" + sJerseyA + "' AND Team_Name = myConnection = new
'" + cmbTeamA.Text + "';"; SQLiteConnection(Conn.ConnString);
SQLiteConnection SQLiteCommand
myConnection = new myCommand = new
SQLiteConnection(Conn.ConnString); SQLiteCommand(myQuery, myConnection);
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+2";
(myReader.Read()) { } ScoreNotifA();

sSNotif = "+2"; TeamAScore();


ScoreNotifA(); LoadTeamA();
}
TeamAScore();
LoadTeamA(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close();
} else if (rdb3rdP.Checked)
} {
string myQuery =
else if (rdb2ndP.Checked) "UPDATE tbl_playersgame SET
{ ThirdP_Score = ThirdP_Score + 2 WHERE
string myQuery = Last_Name || ', ' || First_Name || '
"UPDATE tbl_playersgame SET ' || Middle_Initial = '" +
SecondP_Score = SecondP_Score + 2 txtPlayerA.Text + "' "
WHERE Last_Name || ', ' || First_Name + "AND Jersey_Number
|| ' ' || Middle_Initial = '" + = '" + sJerseyA + "' AND Team_Name =
txtPlayerA.Text + "' " '" + cmbTeamA.Text + "';";
+ "AND Jersey_Number SQLiteConnection
= '" + sJerseyA + "' AND Team_Name = myConnection = new
'" + cmbTeamA.Text + "';"; SQLiteConnection(Conn.ConnString);

208
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+2";
(myReader.Read()) { } ScoreNotifA();

sSNotif = "+2"; TeamAScore();


ScoreNotifA(); LoadTeamA();
}
TeamAScore();
LoadTeamA(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close();
} else if
} (rdbOTime.Checked)
{
else if (rdb4thP.Checked) string myQuery =
{ "UPDATE tbl_playersgame SET
string myQuery = Overtime_Score = Overtime_Score + 2
"UPDATE tbl_playersgame SET WHERE Last_Name || ', ' || First_Name
FourthP_Score = FourthP_Score + 2 || ' ' || Middle_Initial = '" +
WHERE Last_Name || ', ' || First_Name txtPlayerA.Text + "' "
|| ' ' || Middle_Initial = '" + + "AND Jersey_Number
txtPlayerA.Text + "' " = '" + sJerseyA + "' AND Team_Name =
+ "AND Jersey_Number '" + cmbTeamA.Text + "';";
= '" + sJerseyA + "' AND Team_Name = SQLiteConnection
'" + cmbTeamA.Text + "';"; myConnection = new
SQLiteConnection SQLiteConnection(Conn.ConnString);
myConnection = new SQLiteCommand
SQLiteConnection(Conn.ConnString); myCommand = new
SQLiteCommand SQLiteCommand(myQuery, myConnection);
myCommand = new SQLiteDataReader
SQLiteCommand(myQuery, myConnection); myReader;

209
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
try + "AND Jersey_Number
{ = '" + sJerseyA + "' AND Team_Name =
'" + cmbTeamA.Text + "';";
myConnection.Open(); SQLiteConnection
myReader = myConnection = new
myCommand.ExecuteReader(); SQLiteConnection(Conn.ConnString);
while SQLiteCommand
(myReader.Read()) { } myCommand = new
SQLiteCommand(myQuery, myConnection);
sSNotif = "+2"; SQLiteDataReader
ScoreNotifA(); myReader;

TeamAScore(); try
LoadTeamA(); {
}
myConnection.Open();
catch myReader =
(SQLiteException ex) myCommand.ExecuteReader();
{ while
(myReader.Read()) { }
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, sSNotif = "+3";
MessageBoxIcon.Error); ScoreNotifA();
}
TeamAScore();
finally LoadTeamA();
{ }

myConnection.Close(); catch
} (SQLiteException ex)
} {
}
#endregion MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
#region Team A +3 Score MessageBoxIcon.Error);
private void }
btnP3A_Click(object sender, EventArgs
e) finally
{ {
if (sInA == "Out")
{ myConnection.Close();
MessageBox.Show("You }
are trying to score an out playing }
player.", "Out of Score",
MessageBoxButtons.OK, else if (rdb2ndP.Checked)
MessageBoxIcon.Error); {
} string myQuery =
"UPDATE tbl_playersgame SET
else if (rdb1stP.Checked) SecondP_Score = SecondP_Score + 3
{ WHERE Last_Name || ', ' || First_Name
string myQuery = || ' ' || Middle_Initial = '" +
"UPDATE tbl_playersgame SET txtPlayerA.Text + "' "
FirstP_Score = FirstP_Score + 3 WHERE + "AND Jersey_Number
Last_Name || ', ' || First_Name || ' = '" + sJerseyA + "' AND Team_Name =
' || Middle_Initial = '" + '" + cmbTeamA.Text + "';";
txtPlayerA.Text + "' "

210
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteConnection SQLiteCommand
myConnection = new myCommand = new
SQLiteConnection(Conn.ConnString); SQLiteCommand(myQuery, myConnection);
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+3";
(myReader.Read()) { } ScoreNotifA();

sSNotif = "+3"; TeamAScore();


ScoreNotifA(); LoadTeamA();
}
TeamAScore();
LoadTeamA(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close();
} else if (rdb4thP.Checked)
} {
string myQuery =
else if (rdb3rdP.Checked) "UPDATE tbl_playersgame SET
{ FourthP_Score = FourthP_Score + 3
string myQuery = WHERE Last_Name || ', ' || First_Name
"UPDATE tbl_playersgame SET || ' ' || Middle_Initial = '" +
ThirdP_Score = ThirdP_Score + 3 WHERE txtPlayerA.Text + "' "
Last_Name || ', ' || First_Name || ' + "AND Jersey_Number
' || Middle_Initial = '" + = '" + sJerseyA + "' AND Team_Name =
txtPlayerA.Text + "' " '" + cmbTeamA.Text + "';";
+ "AND Jersey_Number SQLiteConnection
= '" + sJerseyA + "' AND Team_Name = myConnection = new
'" + cmbTeamA.Text + "';"; SQLiteConnection(Conn.ConnString);
SQLiteConnection SQLiteCommand
myConnection = new myCommand = new
SQLiteConnection(Conn.ConnString); SQLiteCommand(myQuery, myConnection);

211
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+3";
(myReader.Read()) { } ScoreNotifA();

sSNotif = "+3"; TeamAScore();


ScoreNotifA(); LoadTeamA();
}
TeamAScore();
LoadTeamA(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close(); }
} #endregion
}
#region Team A -1 Score
else if private void
(rdbOTime.Checked) btnM1A_Click(object sender, EventArgs
{ e)
string myQuery = {
"UPDATE tbl_playersgame SET if (sInA == "Out")
Overtime_Score = Overtime_Score + 3 {
WHERE Last_Name || ', ' || First_Name MessageBox.Show("You
|| ' ' || Middle_Initial = '" + are trying to score an out playing
txtPlayerA.Text + "' " player.", "Out of Score",
+ "AND Jersey_Number MessageBoxButtons.OK,
= '" + sJerseyA + "' AND Team_Name = MessageBoxIcon.Error);
'" + cmbTeamA.Text + "';"; }
SQLiteConnection
myConnection = new else if (txtScoreA.Text
SQLiteConnection(Conn.ConnString); == "000")
SQLiteCommand {
myCommand = new MessageBox.Show("Team
SQLiteCommand(myQuery, myConnection); score is already 0.", "Out of Score",
SQLiteDataReader MessageBoxButtons.OK,
myReader; MessageBoxIcon.Error);
}

212
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
if (s == 0)
else if (rdb1stP.Checked) {
{
#region 1st MessageBox.Show(txtPlayerA.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT FirstP_Score FROM
tbl_playersgame WHERE Last_Name || ', else
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerA.Text string myQuery1 =
+ "' " "UPDATE tbl_playersgame SET
+ "AND Jersey_Number FirstP_Score = FirstP_Score - 1 WHERE
= '" + sJerseyA + "' AND Team_Name = Last_Name || ', ' || First_Name || '
'" + cmbTeamA.Text + "';"; ' || Middle_Initial = '" +
SQLiteConnection txtPlayerA.Text + "' "
myConnection = new + "AND
SQLiteConnection(Conn.ConnString); Jersey_Number = '" + sJerseyA + "'
SQLiteCommand AND Team_Name = '" + cmbTeamA.Text +
myCommand = new "';";
SQLiteCommand(myQuery, myConnection); SQLiteConnection
SQLiteDataReader myConnection1 = new
myReader; SQLiteConnection(Conn.ConnString);
SQLiteCommand
try myCommand1 = new
{ SQLiteCommand(myQuery1,
myConnection1);
myConnection.Open(); SQLiteDataReader
myReader = myReader1;
myCommand.ExecuteReader();
while try
(myReader.Read()) {
{
q = myConnection1.Open();
myReader.GetValue(0).ToString(); myReader1 =
s = myCommand1.ExecuteReader();
Convert.ToInt32(q); while
} (myReader1.Read()) { }
}
sSNotif = "-
catch 1";
(SQLiteException ex)
{ ScoreNotifA();

MessageBox.Show(ex.Message, "Error", TeamAScore();


MessageBoxButtons.OK, LoadTeamA();
MessageBoxIcon.Error); }
}
catch
finally (SQLiteException ex)
{ {

myConnection.Close(); MessageBox.Show(ex.Message, "Error",


} MessageBoxButtons.OK,
MessageBoxIcon.Error);

213
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
finally }
{
finally
myConnection1.Close(); {
}
} myConnection.Close();
#endregion }
}
if (s == 0)
else if (rdb2ndP.Checked) {
{
#region 2nd MessageBox.Show(txtPlayerA.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT SecondP_Score FROM
tbl_playersgame WHERE Last_Name || ', else
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerA.Text string myQuery1 =
+ "' " "UPDATE tbl_playersgame SET
+ "AND Jersey_Number SecondP_Score = SecondP_Score - 1
= '" + sJerseyA + "' AND Team_Name = WHERE Last_Name || ', ' || First_Name
'" + cmbTeamA.Text + "';"; || ' ' || Middle_Initial = '" +
SQLiteConnection txtPlayerA.Text + "' "
myConnection = new + "AND
SQLiteConnection(Conn.ConnString); Jersey_Number = '" + sJerseyA + "'
SQLiteCommand AND Team_Name = '" + cmbTeamA.Text +
myCommand = new "';";
SQLiteCommand(myQuery, myConnection); SQLiteConnection
SQLiteDataReader myConnection1 = new
myReader; SQLiteConnection(Conn.ConnString);
SQLiteCommand
try myCommand1 = new
{ SQLiteCommand(myQuery1,
myConnection1);
myConnection.Open(); SQLiteDataReader
myReader = myReader1;
myCommand.ExecuteReader();
while try
(myReader.Read()) {
{
q = myConnection1.Open();
myReader.GetValue(0).ToString(); myReader1 =
s = myCommand1.ExecuteReader();
Convert.ToInt32(q); while
} (myReader1.Read()) { }
}
sSNotif = "-
catch 1";
(SQLiteException ex)
{ ScoreNotifA();

MessageBox.Show(ex.Message, "Error", TeamAScore();

214
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
LoadTeamA(); s =
} Convert.ToInt32(q);
}
catch }
(SQLiteException ex)
{ catch
(SQLiteException ex)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
finally }
{
finally
myConnection1.Close(); {
}
} myConnection.Close();
#endregion }
}
if (s == 0)
else if (rdb3rdP.Checked) {
{
#region 3rd MessageBox.Show(txtPlayerA.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT ThirdP_Score FROM
tbl_playersgame WHERE Last_Name || ', else
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerA.Text string myQuery1 =
+ "' " "UPDATE tbl_playersgame SET
+ "AND Jersey_Number ThirdP_Score = ThirdP_Score - 1 WHERE
= '" + sJerseyA + "' AND Team_Name = Last_Name || ', ' || First_Name || '
'" + cmbTeamA.Text + "';"; ' || Middle_Initial = '" +
SQLiteConnection txtPlayerA.Text + "' "
myConnection = new + "AND
SQLiteConnection(Conn.ConnString); Jersey_Number = '" + sJerseyA + "'
SQLiteCommand AND Team_Name = '" + cmbTeamA.Text +
myCommand = new "';";
SQLiteCommand(myQuery, myConnection); SQLiteConnection
SQLiteDataReader myConnection1 = new
myReader; SQLiteConnection(Conn.ConnString);
SQLiteCommand
try myCommand1 = new
{ SQLiteCommand(myQuery1,
myConnection1);
myConnection.Open(); SQLiteDataReader
myReader = myReader1;
myCommand.ExecuteReader();
while try
(myReader.Read()) {
{
q = myConnection1.Open();
myReader.GetValue(0).ToString();

215
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
myReader1 = try
myCommand1.ExecuteReader(); {
while
(myReader1.Read()) { } myConnection.Open();
myReader =
sSNotif = "- myCommand.ExecuteReader();
1"; while
(myReader.Read())
ScoreNotifA(); {
q =
TeamAScore(); myReader.GetValue(0).ToString();
LoadTeamA(); s =
} Convert.ToInt32(q);
}
catch }
(SQLiteException ex)
{ catch
(SQLiteException ex)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
finally }
{
finally
myConnection1.Close(); {
}
} myConnection.Close();
#endregion }
}
if (s == 0)
else if (rdb4thP.Checked) {
{
#region 4th MessageBox.Show(txtPlayerA.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT FourthP_Score FROM
tbl_playersgame WHERE Last_Name || ', else
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerA.Text string myQuery1 =
+ "' " "UPDATE tbl_playersgame SET
+ "AND Jersey_Number FourthP_Score = FourthP_Score - 1
= '" + sJerseyA + "' AND Team_Name = WHERE Last_Name || ', ' || First_Name
'" + cmbTeamA.Text + "';"; || ' ' || Middle_Initial = '" +
SQLiteConnection txtPlayerA.Text + "' "
myConnection = new + "AND
SQLiteConnection(Conn.ConnString); Jersey_Number = '" + sJerseyA + "'
SQLiteCommand AND Team_Name = '" + cmbTeamA.Text +
myCommand = new "';";
SQLiteCommand(myQuery, myConnection); SQLiteConnection
SQLiteDataReader myConnection1 = new
myReader; SQLiteConnection(Conn.ConnString);

216
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteCommand + "AND Jersey_Number
myCommand1 = new = '" + sJerseyA + "' AND Team_Name =
SQLiteCommand(myQuery1, '" + cmbTeamA.Text + "';";
myConnection1); SQLiteConnection
SQLiteDataReader myConnection = new
myReader1; SQLiteConnection(Conn.ConnString);
SQLiteCommand
try myCommand = new
{ SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
myConnection1.Open(); myReader;
myReader1 =
myCommand1.ExecuteReader(); try
while {
(myReader1.Read()) { }
myConnection.Open();
sSNotif = "- myReader =
1"; myCommand.ExecuteReader();
while
ScoreNotifA(); (myReader.Read())
{
TeamAScore(); q =
LoadTeamA(); myReader.GetValue(0).ToString();
} s =
Convert.ToInt32(q);
catch }
(SQLiteException ex) }
{
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {
}
#endregion myConnection.Close();
} }

else if if (s == 0)
(rdbOTime.Checked) {
{
#region Overtime MessageBox.Show(txtPlayerA.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT Overtime_Score FROM
tbl_playersgame WHERE Last_Name || ', else
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerA.Text string myQuery1 =
+ "' " "UPDATE tbl_playersgame SET

217
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
Overtime_Score = Overtime_Score - 1 #region Team A -2 Score
WHERE Last_Name || ', ' || First_Name private void
|| ' ' || Middle_Initial = '" + btnM2A_Click(object sender, EventArgs
txtPlayerA.Text + "' " e)
+ "AND {
Jersey_Number = '" + sJerseyA + "' if (sInA == "Out")
AND Team_Name = '" + cmbTeamA.Text + {
"';"; MessageBox.Show("You
SQLiteConnection are trying to score an out playing
myConnection1 = new player.", "Out of Score",
SQLiteConnection(Conn.ConnString); MessageBoxButtons.OK,
SQLiteCommand MessageBoxIcon.Error);
myCommand1 = new }
SQLiteCommand(myQuery1,
myConnection1); else if (txtScoreA.Text
SQLiteDataReader == "000")
myReader1; {
MessageBox.Show("Team
try score is already 0.", "Out of Score",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
myConnection1.Open(); }
myReader1 =
myCommand1.ExecuteReader(); else if (rdb1stP.Checked)
while {
(myReader1.Read()) { } #region 1st
string q;
sSNotif = "- int s = 0;
1";
string myQuery =
ScoreNotifA(); "SELECT FirstP_Score FROM
tbl_playersgame WHERE Last_Name || ',
TeamAScore(); ' || First_Name || ' ' ||
LoadTeamA(); Middle_Initial = '" + txtPlayerA.Text
} + "' "
+ "AND Jersey_Number
catch = '" + sJerseyA + "' AND Team_Name =
(SQLiteException ex) '" + cmbTeamA.Text + "';";
{ SQLiteConnection
myConnection = new
MessageBox.Show(ex.Message, "Error", SQLiteConnection(Conn.ConnString);
MessageBoxButtons.OK, SQLiteCommand
MessageBoxIcon.Error); myCommand = new
} SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
finally myReader;
{
try
myConnection1.Close(); {
}
} myConnection.Open();
#endregion myReader =
} myCommand.ExecuteReader();
} while
#endregion (myReader.Read())
{

218
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
q = SQLiteCommand
myReader.GetValue(0).ToString(); myCommand1 = new
s = SQLiteCommand(myQuery1,
Convert.ToInt32(q); myConnection1);
} SQLiteDataReader
} myReader1;

catch try
(SQLiteException ex) {
{
myConnection1.Open();
MessageBox.Show(ex.Message, "Error", myReader1 =
MessageBoxButtons.OK, myCommand1.ExecuteReader();
MessageBoxIcon.Error); while
} (myReader1.Read()) { }

finally sSNotif = "-


{ 2";

myConnection.Close(); ScoreNotifA();
}
TeamAScore();
if (s == 0) LoadTeamA();
{ }

MessageBox.Show(txtPlayerA.Text + " catch


score is already 0.", "Out of Score", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
else if (s < 2) MessageBoxIcon.Error);
{ }

MessageBox.Show(txtPlayerA.Text + " finally


score cannot be negative.", "Out of {
Score", MessageBoxButtons.OK,
MessageBoxIcon.Error); myConnection1.Close();
} }
}
else #endregion
{ }
string myQuery1 =
"UPDATE tbl_playersgame SET else if (rdb2ndP.Checked)
FirstP_Score = FirstP_Score - 2 WHERE {
Last_Name || ', ' || First_Name || ' #region 2nd
' || Middle_Initial = '" + string q;
txtPlayerA.Text + "' " int s = 0;
+ "AND
Jersey_Number = '" + sJerseyA + "' string myQuery =
AND Team_Name = '" + cmbTeamA.Text + "SELECT SecondP_Score FROM
"';"; tbl_playersgame WHERE Last_Name || ',
SQLiteConnection ' || First_Name || ' ' ||
myConnection1 = new Middle_Initial = '" + txtPlayerA.Text
SQLiteConnection(Conn.ConnString); + "' "

219
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "AND Jersey_Number score cannot be negative.", "Out of
= '" + sJerseyA + "' AND Team_Name = Score", MessageBoxButtons.OK,
'" + cmbTeamA.Text + "';"; MessageBoxIcon.Error);
SQLiteConnection }
myConnection = new
SQLiteConnection(Conn.ConnString); else
SQLiteCommand {
myCommand = new string myQuery1 =
SQLiteCommand(myQuery, myConnection); "UPDATE tbl_playersgame SET
SQLiteDataReader SecondP_Score = SecondP_Score - 2
myReader; WHERE Last_Name || ', ' || First_Name
|| ' ' || Middle_Initial = '" +
try txtPlayerA.Text + "' "
{ + "AND
Jersey_Number = '" + sJerseyA + "'
myConnection.Open(); AND Team_Name = '" + cmbTeamA.Text +
myReader = "';";
myCommand.ExecuteReader(); SQLiteConnection
while myConnection1 = new
(myReader.Read()) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
q = myCommand1 = new
myReader.GetValue(0).ToString(); SQLiteCommand(myQuery1,
s = myConnection1);
Convert.ToInt32(q); SQLiteDataReader
} myReader1;
}
try
catch {
(SQLiteException ex)
{ myConnection1.Open();
myReader1 =
MessageBox.Show(ex.Message, "Error", myCommand1.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader1.Read()) { }
}
sSNotif = "-
finally 2";
{
ScoreNotifA();
myConnection.Close();
} TeamAScore();
LoadTeamA();
if (s == 0) }
{
catch
MessageBox.Show(txtPlayerA.Text + " (SQLiteException ex)
score is already 0.", "Out of Score", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
else if (s < 2) }
{
finally
MessageBox.Show(txtPlayerA.Text + " {

220
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
finally
myConnection1.Close(); {
}
} myConnection.Close();
#endregion }
}
if (s == 0)
else if (rdb3rdP.Checked) {
{
#region 3rd MessageBox.Show(txtPlayerA.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT ThirdP_Score FROM
tbl_playersgame WHERE Last_Name || ', else if (s < 2)
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerA.Text
+ "' " MessageBox.Show(txtPlayerA.Text + "
+ "AND Jersey_Number score cannot be negative.", "Out of
= '" + sJerseyA + "' AND Team_Name = Score", MessageBoxButtons.OK,
'" + cmbTeamA.Text + "';"; MessageBoxIcon.Error);
SQLiteConnection }
myConnection = new
SQLiteConnection(Conn.ConnString); else
SQLiteCommand {
myCommand = new string myQuery1 =
SQLiteCommand(myQuery, myConnection); "UPDATE tbl_playersgame SET
SQLiteDataReader ThirdP_Score = ThirdP_Score - 2 WHERE
myReader; Last_Name || ', ' || First_Name || '
' || Middle_Initial = '" +
try txtPlayerA.Text + "' "
{ + "AND
Jersey_Number = '" + sJerseyA + "'
myConnection.Open(); AND Team_Name = '" + cmbTeamA.Text +
myReader = "';";
myCommand.ExecuteReader(); SQLiteConnection
while myConnection1 = new
(myReader.Read()) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
q = myCommand1 = new
myReader.GetValue(0).ToString(); SQLiteCommand(myQuery1,
s = myConnection1);
Convert.ToInt32(q); SQLiteDataReader
} myReader1;
}
try
catch {
(SQLiteException ex)
{ myConnection1.Open();
myReader1 =
MessageBox.Show(ex.Message, "Error", myCommand1.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader1.Read()) { }
}

221
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
sSNotif = "- myReader =
2"; myCommand.ExecuteReader();
while
ScoreNotifA(); (myReader.Read())
{
TeamAScore(); q =
LoadTeamA(); myReader.GetValue(0).ToString();
} s =
Convert.ToInt32(q);
catch }
(SQLiteException ex) }
{
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {
}
#endregion myConnection.Close();
} }

else if (rdb4thP.Checked) if (s == 0)
{ {
#region 4th
string q; MessageBox.Show(txtPlayerA.Text + "
int s = 0; score is already 0.", "Out of Score",
MessageBoxButtons.OK,
string myQuery = MessageBoxIcon.Error);
"SELECT FourthP_Score FROM }
tbl_playersgame WHERE Last_Name || ',
' || First_Name || ' ' || else if (s < 2)
Middle_Initial = '" + txtPlayerA.Text {
+ "' "
+ "AND Jersey_Number MessageBox.Show(txtPlayerA.Text + "
= '" + sJerseyA + "' AND Team_Name = score cannot be negative.", "Out of
'" + cmbTeamA.Text + "';"; Score", MessageBoxButtons.OK,
SQLiteConnection MessageBoxIcon.Error);
myConnection = new }
SQLiteConnection(Conn.ConnString);
SQLiteCommand else
myCommand = new {
SQLiteCommand(myQuery, myConnection); string myQuery1 =
SQLiteDataReader "UPDATE tbl_playersgame SET
myReader; FourthP_Score = FourthP_Score - 2
WHERE Last_Name || ', ' || First_Name
try || ' ' || Middle_Initial = '" +
{ txtPlayerA.Text + "' "
+ "AND
myConnection.Open(); Jersey_Number = '" + sJerseyA + "'

222
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
AND Team_Name = '" + cmbTeamA.Text + string myQuery =
"';"; "SELECT Overtime_Score FROM
SQLiteConnection tbl_playersgame WHERE Last_Name || ',
myConnection1 = new ' || First_Name || ' ' ||
SQLiteConnection(Conn.ConnString); Middle_Initial = '" + txtPlayerA.Text
SQLiteCommand + "' "
myCommand1 = new + "AND Jersey_Number
SQLiteCommand(myQuery1, = '" + sJerseyA + "' AND Team_Name =
myConnection1); '" + cmbTeamA.Text + "';";
SQLiteDataReader SQLiteConnection
myReader1; myConnection = new
SQLiteConnection(Conn.ConnString);
try SQLiteCommand
{ myCommand = new
SQLiteCommand(myQuery, myConnection);
myConnection1.Open(); SQLiteDataReader
myReader1 = myReader;
myCommand1.ExecuteReader();
while try
(myReader1.Read()) { } {

sSNotif = "- myConnection.Open();


2"; myReader =
myCommand.ExecuteReader();
ScoreNotifA(); while
(myReader.Read())
TeamAScore(); {
LoadTeamA(); q =
} myReader.GetValue(0).ToString();
s =
catch Convert.ToInt32(q);
(SQLiteException ex) }
{ }

MessageBox.Show(ex.Message, "Error", catch


MessageBoxButtons.OK, (SQLiteException ex)
MessageBoxIcon.Error); {
}
MessageBox.Show(ex.Message, "Error",
finally MessageBoxButtons.OK,
{ MessageBoxIcon.Error);
}
myConnection1.Close();
} finally
} {
#endregion
} myConnection.Close();
}
else if
(rdbOTime.Checked) if (s == 0)
{ {
#region Overtime
string q; MessageBox.Show(txtPlayerA.Text + "
int s = 0; score is already 0.", "Out of Score",
MessageBoxButtons.OK,
MessageBoxIcon.Error);

223
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
else if (s < 2) }
{
finally
MessageBox.Show(txtPlayerA.Text + " {
score cannot be negative.", "Out of
Score", MessageBoxButtons.OK, myConnection1.Close();
MessageBoxIcon.Error); }
} }
#endregion
else }
{ }
string myQuery1 = #endregion
"UPDATE tbl_playersgame SET
Overtime_Score = Overtime_Score - 2 #region Team A -3 Score
WHERE Last_Name || ', ' || First_Name private void
|| ' ' || Middle_Initial = '" + btnM3A_Click(object sender, EventArgs
txtPlayerA.Text + "' " e)
+ "AND {
Jersey_Number = '" + sJerseyA + "' if (sInA == "Out")
AND Team_Name = '" + cmbTeamA.Text + {
"';"; MessageBox.Show("You
SQLiteConnection are trying to score an out playing
myConnection1 = new player.", "Out of Score",
SQLiteConnection(Conn.ConnString); MessageBoxButtons.OK,
SQLiteCommand MessageBoxIcon.Error);
myCommand1 = new }
SQLiteCommand(myQuery1,
myConnection1); else if (txtScoreA.Text
SQLiteDataReader == "000")
myReader1; {
MessageBox.Show("Team
try score is already 0.", "Out of Score",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
myConnection1.Open(); }
myReader1 =
myCommand1.ExecuteReader(); else if (rdb1stP.Checked)
while {
(myReader1.Read()) { } #region 1st
string q;
sSNotif = "- int s = 0;
2";
string myQuery =
ScoreNotifA(); "SELECT FirstP_Score FROM
tbl_playersgame WHERE Last_Name || ',
TeamAScore(); ' || First_Name || ' ' ||
LoadTeamA(); Middle_Initial = '" + txtPlayerA.Text
} + "' "
+ "AND Jersey_Number
catch = '" + sJerseyA + "' AND Team_Name =
(SQLiteException ex) '" + cmbTeamA.Text + "';";
{ SQLiteConnection
myConnection = new
MessageBox.Show(ex.Message, "Error", SQLiteConnection(Conn.ConnString);

224
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteCommand {
myCommand = new string myQuery1 =
SQLiteCommand(myQuery, myConnection); "UPDATE tbl_playersgame SET
SQLiteDataReader FirstP_Score = FirstP_Score - 3 WHERE
myReader; Last_Name || ', ' || First_Name || '
' || Middle_Initial = '" +
try txtPlayerA.Text + "' "
{ + "AND
Jersey_Number = '" + sJerseyA + "'
myConnection.Open(); AND Team_Name = '" + cmbTeamA.Text +
myReader = "';";
myCommand.ExecuteReader(); SQLiteConnection
while myConnection1 = new
(myReader.Read()) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
q = myCommand1 = new
myReader.GetValue(0).ToString(); SQLiteCommand(myQuery1,
s = myConnection1);
Convert.ToInt32(q); SQLiteDataReader
} myReader1;
}
try
catch {
(SQLiteException ex)
{ myConnection1.Open();
myReader1 =
MessageBox.Show(ex.Message, "Error", myCommand1.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader1.Read()) { }
}
sSNotif = "-
finally 3";
{
ScoreNotifA();
myConnection.Close();
} TeamAScore();
LoadTeamA();
if (s == 0) }
{
catch
MessageBox.Show(txtPlayerA.Text + " (SQLiteException ex)
score is already 0.", "Out of Score", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
else if (s < 3) }
{
finally
MessageBox.Show(txtPlayerA.Text + " {
score cannot be negative.", "Out of
Score", MessageBoxButtons.OK, myConnection1.Close();
MessageBoxIcon.Error); }
} }
#endregion
else }

225
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
if (s == 0)
else if (rdb2ndP.Checked) {
{
#region 2nd MessageBox.Show(txtPlayerA.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT SecondP_Score FROM
tbl_playersgame WHERE Last_Name || ', else if (s < 3)
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerA.Text
+ "' " MessageBox.Show(txtPlayerA.Text + "
+ "AND Jersey_Number score cannot be negative.", "Out of
= '" + sJerseyA + "' AND Team_Name = Score", MessageBoxButtons.OK,
'" + cmbTeamA.Text + "';"; MessageBoxIcon.Error);
SQLiteConnection }
myConnection = new
SQLiteConnection(Conn.ConnString); else
SQLiteCommand {
myCommand = new string myQuery1 =
SQLiteCommand(myQuery, myConnection); "UPDATE tbl_playersgame SET
SQLiteDataReader SecondP_Score = SecondP_Score - 3
myReader; WHERE Last_Name || ', ' || First_Name
|| ' ' || Middle_Initial = '" +
try txtPlayerA.Text + "' "
{ + "AND
Jersey_Number = '" + sJerseyA + "'
myConnection.Open(); AND Team_Name = '" + cmbTeamA.Text +
myReader = "';";
myCommand.ExecuteReader(); SQLiteConnection
while myConnection1 = new
(myReader.Read()) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
q = myCommand1 = new
myReader.GetValue(0).ToString(); SQLiteCommand(myQuery1,
s = myConnection1);
Convert.ToInt32(q); SQLiteDataReader
} myReader1;
}
try
catch {
(SQLiteException ex)
{ myConnection1.Open();
myReader1 =
MessageBox.Show(ex.Message, "Error", myCommand1.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader1.Read()) { }
}
sSNotif = "-
finally 3";
{
ScoreNotifA();
myConnection.Close();
} TeamAScore();
LoadTeamA();

226
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} s =
Convert.ToInt32(q);
catch }
(SQLiteException ex) }
{
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {
}
#endregion myConnection.Close();
} }

else if (rdb3rdP.Checked) if (s == 0)
{ {
#region 3rd
string q; MessageBox.Show(txtPlayerA.Text + "
int s = 0; score is already 0.", "Out of Score",
MessageBoxButtons.OK,
string myQuery = MessageBoxIcon.Error);
"SELECT ThirdP_Score FROM }
tbl_playersgame WHERE Last_Name || ',
' || First_Name || ' ' || else if (s < 3)
Middle_Initial = '" + txtPlayerA.Text {
+ "' "
+ "AND Jersey_Number MessageBox.Show(txtPlayerA.Text + "
= '" + sJerseyA + "' AND Team_Name = score cannot be negative.", "Out of
'" + cmbTeamA.Text + "';"; Score", MessageBoxButtons.OK,
SQLiteConnection MessageBoxIcon.Error);
myConnection = new }
SQLiteConnection(Conn.ConnString);
SQLiteCommand else
myCommand = new {
SQLiteCommand(myQuery, myConnection); string myQuery1 =
SQLiteDataReader "UPDATE tbl_playersgame SET
myReader; ThirdP_Score = ThirdP_Score - 3 WHERE
Last_Name || ', ' || First_Name || '
try ' || Middle_Initial = '" +
{ txtPlayerA.Text + "' "
+ "AND
myConnection.Open(); Jersey_Number = '" + sJerseyA + "'
myReader = AND Team_Name = '" + cmbTeamA.Text +
myCommand.ExecuteReader(); "';";
while SQLiteConnection
(myReader.Read()) myConnection1 = new
{ SQLiteConnection(Conn.ConnString);
q = SQLiteCommand
myReader.GetValue(0).ToString(); myCommand1 = new

227
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteCommand(myQuery1, SQLiteConnection
myConnection1); myConnection = new
SQLiteDataReader SQLiteConnection(Conn.ConnString);
myReader1; SQLiteCommand
myCommand = new
try SQLiteCommand(myQuery, myConnection);
{ SQLiteDataReader
myReader;
myConnection1.Open();
myReader1 = try
myCommand1.ExecuteReader(); {
while
(myReader1.Read()) { } myConnection.Open();
myReader =
sSNotif = "- myCommand.ExecuteReader();
3"; while
(myReader.Read())
ScoreNotifA(); {
q =
TeamAScore(); myReader.GetValue(0).ToString();
LoadTeamA(); s =
} Convert.ToInt32(q);
}
catch }
(SQLiteException ex)
{ catch
(SQLiteException ex)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
finally }
{
finally
myConnection1.Close(); {
}
} myConnection.Close();
#endregion }
}
if (s == 0)
else if (rdb4thP.Checked) {
{
#region 4th MessageBox.Show(txtPlayerA.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT FourthP_Score FROM
tbl_playersgame WHERE Last_Name || ', else if (s < 3)
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerA.Text
+ "' " MessageBox.Show(txtPlayerA.Text + "
+ "AND Jersey_Number score cannot be negative.", "Out of
= '" + sJerseyA + "' AND Team_Name = Score", MessageBoxButtons.OK,
'" + cmbTeamA.Text + "';"; MessageBoxIcon.Error);

228
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} }
#endregion
else }
{
string myQuery1 = else if
"UPDATE tbl_playersgame SET (rdbOTime.Checked)
FourthP_Score = FourthP_Score - 3 {
WHERE Last_Name || ', ' || First_Name #region Overtime
|| ' ' || Middle_Initial = '" + string q;
txtPlayerA.Text + "' " int s = 0;
+ "AND
Jersey_Number = '" + sJerseyA + "' string myQuery =
AND Team_Name = '" + cmbTeamA.Text + "SELECT Overtime_Score FROM
"';"; tbl_playersgame WHERE Last_Name || ',
SQLiteConnection ' || First_Name || ' ' ||
myConnection1 = new Middle_Initial = '" + txtPlayerA.Text
SQLiteConnection(Conn.ConnString); + "' "
SQLiteCommand + "AND Jersey_Number
myCommand1 = new = '" + sJerseyA + "' AND Team_Name =
SQLiteCommand(myQuery1, '" + cmbTeamA.Text + "';";
myConnection1); SQLiteConnection
SQLiteDataReader myConnection = new
myReader1; SQLiteConnection(Conn.ConnString);
SQLiteCommand
try myCommand = new
{ SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
myConnection1.Open(); myReader;
myReader1 =
myCommand1.ExecuteReader(); try
while {
(myReader1.Read()) { }
myConnection.Open();
sSNotif = "- myReader =
3"; myCommand.ExecuteReader();
while
ScoreNotifA(); (myReader.Read())
{
TeamAScore(); q =
LoadTeamA(); myReader.GetValue(0).ToString();
} s =
Convert.ToInt32(q);
catch }
(SQLiteException ex) }
{
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {

229
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

myConnection.Close(); ScoreNotifA();
}
TeamAScore();
if (s == 0) LoadTeamA();
{ }

MessageBox.Show(txtPlayerA.Text + " catch


score is already 0.", "Out of Score", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
else if (s < 3) MessageBoxIcon.Error);
{ }

MessageBox.Show(txtPlayerA.Text + " finally


score cannot be negative.", "Out of {
Score", MessageBoxButtons.OK,
MessageBoxIcon.Error); myConnection1.Close();
} }
}
else #endregion
{ }
string myQuery1 = }
"UPDATE tbl_playersgame SET #endregion
Overtime_Score = Overtime_Score - 3
WHERE Last_Name || ', ' || First_Name //------------------------//
|| ' ' || Middle_Initial = '" + Team B Scoring
txtPlayerA.Text + "' "
+ "AND #region Team B Score
Jersey_Number = '" + sJerseyA + "' void TeamBScore()
AND Team_Name = '" + cmbTeamA.Text + {
"';"; string myQuery = "SELECT
SQLiteConnection SUM(FirstP_Score) +
myConnection1 = new SUM(SecondP_Score) +
SQLiteConnection(Conn.ConnString); SUM(ThirdP_Score) +
SQLiteCommand SUM(FourthP_Score) +
myCommand1 = new SUM(Overtime_Score) FROM
SQLiteCommand(myQuery1, tbl_playersgame WHERE Team_Name = '"
myConnection1); + cmbTeamB.Text + "';";
SQLiteDataReader SQLiteConnection
myReader1; myConnection = new
SQLiteConnection(Conn.ConnString);
try SQLiteCommand myCommand =
{ new SQLiteCommand(myQuery,
myConnection);
myConnection1.Open(); SQLiteDataReader
myReader1 = myReader;
myCommand1.ExecuteReader();
while try
(myReader1.Read()) { } {
myConnection.Open();
sSNotif = "- myReader =
3"; myCommand.ExecuteReader();

230
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
while FirstP_Score = FirstP_Score + 1 WHERE
(myReader.Read()) Last_Name || ', ' || First_Name || '
{ ' || Middle_Initial = '" +
txtScoreB.Text = txtPlayerB.Text + "' "
myReader.GetInt32(0).ToString("D3"); + "AND Jersey_Number
} = '" + sJerseyB + "' AND Team_Name =
} '" + cmbTeamB.Text + "';";
SQLiteConnection
catch (SQLiteException myConnection = new
ex) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
myCommand = new
MessageBox.Show(ex.Message, "Error", SQLiteCommand(myQuery, myConnection);
MessageBoxButtons.OK, SQLiteDataReader
MessageBoxIcon.Error); myReader;
}
try
finally {
{
myConnection.Close(); myConnection.Open();
} myReader =
myCommand.ExecuteReader();
TeamScore(); while
} (myReader.Read()) { }
#endregion
sSNotif = "+1";
#region Score Notification ScoreNotifB();
void ScoreNotifB()
{ TeamBScore();
lblNotif.Text = "Team B : LoadTeamB();
" + txtPlayerB.Text + " got " + }
sSNotif + " points.";
lblNotif.Visible = true; catch
iDT = 4; (SQLiteException ex)
tmrNotif.Start(); {
}
#endregion MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
#region Team B +1 Score MessageBoxIcon.Error);
private void }
btnP1B_Click(object sender, EventArgs
e) finally
{ {
if (sInB == "Out")
{ myConnection.Close();
MessageBox.Show("You }
are trying to score an out playing }
player.", "Out of Score",
MessageBoxButtons.OK, else if (rdb2ndP.Checked)
MessageBoxIcon.Error); {
} string myQuery =
"UPDATE tbl_playersgame SET
else if (rdb1stP.Checked) SecondP_Score = SecondP_Score + 1
{ WHERE Last_Name || ', ' || First_Name
string myQuery = || ' ' || Middle_Initial = '" +
"UPDATE tbl_playersgame SET txtPlayerB.Text + "' "

231
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "AND Jersey_Number SQLiteConnection
= '" + sJerseyB + "' AND Team_Name = myConnection = new
'" + cmbTeamB.Text + "';"; SQLiteConnection(Conn.ConnString);
SQLiteConnection SQLiteCommand
myConnection = new myCommand = new
SQLiteConnection(Conn.ConnString); SQLiteCommand(myQuery, myConnection);
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+1";
(myReader.Read()) { } ScoreNotifB();

sSNotif = "+1"; TeamBScore();


ScoreNotifB(); LoadTeamB();
}
TeamBScore();
LoadTeamB(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close();
} else if (rdb4thP.Checked)
} {
string myQuery =
else if (rdb3rdP.Checked) "UPDATE tbl_playersgame SET
{ FourthP_Score = FourthP_Score + 1
string myQuery = WHERE Last_Name || ', ' || First_Name
"UPDATE tbl_playersgame SET || ' ' || Middle_Initial = '" +
ThirdP_Score = ThirdP_Score + 1 WHERE txtPlayerB.Text + "' "
Last_Name || ', ' || First_Name || ' + "AND Jersey_Number
' || Middle_Initial = '" + = '" + sJerseyB + "' AND Team_Name =
txtPlayerB.Text + "' " '" + cmbTeamB.Text + "';";
+ "AND Jersey_Number SQLiteConnection
= '" + sJerseyB + "' AND Team_Name = myConnection = new
'" + cmbTeamB.Text + "';"; SQLiteConnection(Conn.ConnString);

232
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+1";
(myReader.Read()) { } ScoreNotifB();

sSNotif = "+1"; TeamBScore();


ScoreNotifB(); LoadTeamB();
}
TeamBScore();
LoadTeamB(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close(); }
} #endregion
}
#region Team B +2 Score
else if private void
(rdbOTime.Checked) btnP2B_Click(object sender, EventArgs
{ e)
string myQuery = {
"UPDATE tbl_playersgame SET if (sInB == "Out")
Overtime_Score = Overtime_Score + 1 {
WHERE Last_Name || ', ' || First_Name MessageBox.Show("You
|| ' ' || Middle_Initial = '" + are trying to score an out playing
txtPlayerB.Text + "' " player.", "Out of Score",
+ "AND Jersey_Number MessageBoxButtons.OK,
= '" + sJerseyB + "' AND Team_Name = MessageBoxIcon.Error);
'" + cmbTeamB.Text + "';"; }
SQLiteConnection
myConnection = new else if (rdb1stP.Checked)
SQLiteConnection(Conn.ConnString); {
SQLiteCommand string myQuery =
myCommand = new "UPDATE tbl_playersgame SET
SQLiteCommand(myQuery, myConnection); FirstP_Score = FirstP_Score + 2 WHERE

233
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
Last_Name || ', ' || First_Name || ' + "AND Jersey_Number
' || Middle_Initial = '" + = '" + sJerseyB + "' AND Team_Name =
txtPlayerB.Text + "' " '" + cmbTeamB.Text + "';";
+ "AND Jersey_Number SQLiteConnection
= '" + sJerseyB + "' AND Team_Name = myConnection = new
'" + cmbTeamB.Text + "';"; SQLiteConnection(Conn.ConnString);
SQLiteConnection SQLiteCommand
myConnection = new myCommand = new
SQLiteConnection(Conn.ConnString); SQLiteCommand(myQuery, myConnection);
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+2";
(myReader.Read()) { } ScoreNotifB();

sSNotif = "+2"; TeamBScore();


ScoreNotifB(); LoadTeamB();
}
TeamBScore();
LoadTeamB(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close();
} else if (rdb3rdP.Checked)
} {
string myQuery =
else if (rdb2ndP.Checked) "UPDATE tbl_playersgame SET
{ ThirdP_Score = ThirdP_Score + 2 WHERE
string myQuery = Last_Name || ', ' || First_Name || '
"UPDATE tbl_playersgame SET ' || Middle_Initial = '" +
SecondP_Score = SecondP_Score + 2 txtPlayerB.Text + "' "
WHERE Last_Name || ', ' || First_Name + "AND Jersey_Number
|| ' ' || Middle_Initial = '" + = '" + sJerseyB + "' AND Team_Name =
txtPlayerB.Text + "' " '" + cmbTeamB.Text + "';";

234
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteConnection SQLiteCommand
myConnection = new myCommand = new
SQLiteConnection(Conn.ConnString); SQLiteCommand(myQuery, myConnection);
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+2";
(myReader.Read()) { } ScoreNotifB();

sSNotif = "+2"; TeamBScore();


ScoreNotifB(); LoadTeamB();
}
TeamBScore();
LoadTeamB(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close();
} else if
} (rdbOTime.Checked)
{
else if (rdb4thP.Checked) string myQuery =
{ "UPDATE tbl_playersgame SET
string myQuery = Overtime_Score = Overtime_Score + 2
"UPDATE tbl_playersgame SET WHERE Last_Name || ', ' || First_Name
FourthP_Score = FourthP_Score + 2 || ' ' || Middle_Initial = '" +
WHERE Last_Name || ', ' || First_Name txtPlayerB.Text + "' "
|| ' ' || Middle_Initial = '" + + "AND Jersey_Number
txtPlayerB.Text + "' " = '" + sJerseyB + "' AND Team_Name =
+ "AND Jersey_Number '" + cmbTeamB.Text + "';";
= '" + sJerseyB + "' AND Team_Name = SQLiteConnection
'" + cmbTeamB.Text + "';"; myConnection = new
SQLiteConnection SQLiteConnection(Conn.ConnString);
myConnection = new SQLiteCommand
SQLiteConnection(Conn.ConnString); myCommand = new
SQLiteCommand(myQuery, myConnection);

235
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteDataReader Last_Name || ', ' || First_Name || '
myReader; ' || Middle_Initial = '" +
txtPlayerB.Text + "' "
try + "AND Jersey_Number
{ = '" + sJerseyB + "' AND Team_Name =
'" + cmbTeamB.Text + "';";
myConnection.Open(); SQLiteConnection
myReader = myConnection = new
myCommand.ExecuteReader(); SQLiteConnection(Conn.ConnString);
while SQLiteCommand
(myReader.Read()) { } myCommand = new
SQLiteCommand(myQuery, myConnection);
sSNotif = "+2"; SQLiteDataReader
ScoreNotifB(); myReader;

TeamBScore(); try
LoadTeamB(); {
}
myConnection.Open();
catch myReader =
(SQLiteException ex) myCommand.ExecuteReader();
{ while
(myReader.Read()) { }
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, sSNotif = "+3";
MessageBoxIcon.Error); ScoreNotifB();
}
TeamBScore();
finally LoadTeamB();
{ }

myConnection.Close(); catch
} (SQLiteException ex)
} {
}
#endregion MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
#region Team B +3 Score MessageBoxIcon.Error);
private void }
btnP3B_Click(object sender, EventArgs
e) finally
{ {
if (sInB == "Out")
{ myConnection.Close();
MessageBox.Show("You }
are trying to score an out playing }
player.", "Out of Score",
MessageBoxButtons.OK, else if (rdb2ndP.Checked)
MessageBoxIcon.Error); {
} string myQuery =
"UPDATE tbl_playersgame SET
else if (rdb1stP.Checked) SecondP_Score = SecondP_Score + 3
{ WHERE Last_Name || ', ' || First_Name
string myQuery = || ' ' || Middle_Initial = '" +
"UPDATE tbl_playersgame SET txtPlayerB.Text + "' "
FirstP_Score = FirstP_Score + 3 WHERE

236
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "AND Jersey_Number SQLiteConnection
= '" + sJerseyB + "' AND Team_Name = myConnection = new
'" + cmbTeamB.Text + "';"; SQLiteConnection(Conn.ConnString);
SQLiteConnection SQLiteCommand
myConnection = new myCommand = new
SQLiteConnection(Conn.ConnString); SQLiteCommand(myQuery, myConnection);
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+3";
(myReader.Read()) { } ScoreNotifB();

sSNotif = "+3"; TeamBScore();


ScoreNotifB(); LoadTeamB();
}
TeamBScore();
LoadTeamB(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close();
} else if (rdb4thP.Checked)
} {
string myQuery =
else if (rdb3rdP.Checked) "UPDATE tbl_playersgame SET
{ FourthP_Score = FourthP_Score + 3
string myQuery = WHERE Last_Name || ', ' || First_Name
"UPDATE tbl_playersgame SET || ' ' || Middle_Initial = '" +
ThirdP_Score = ThirdP_Score + 3 WHERE txtPlayerB.Text + "' "
Last_Name || ', ' || First_Name || ' + "AND Jersey_Number
' || Middle_Initial = '" + = '" + sJerseyB + "' AND Team_Name =
txtPlayerB.Text + "' " '" + cmbTeamB.Text + "';";
+ "AND Jersey_Number SQLiteConnection
= '" + sJerseyB + "' AND Team_Name = myConnection = new
'" + cmbTeamB.Text + "';"; SQLiteConnection(Conn.ConnString);

237
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteCommand SQLiteDataReader
myCommand = new myReader;
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader try
myReader; {

try myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader();
while sSNotif = "+3";
(myReader.Read()) { } ScoreNotifB();

sSNotif = "+3"; TeamBScore();


ScoreNotifB(); LoadTeamB();
}
TeamBScore();
LoadTeamB(); catch
} (SQLiteException ex)
{
catch
(SQLiteException ex) MessageBox.Show(ex.Message, "Error",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Error", }
MessageBoxButtons.OK,
MessageBoxIcon.Error); finally
} {

finally myConnection.Close();
{ }
}
myConnection.Close(); }
} #endregion
}
#region Team B -1 Score
else if private void
(rdbOTime.Checked) btnM1B_Click(object sender, EventArgs
{ e)
string myQuery = {
"UPDATE tbl_playersgame SET if (sInB == "Out")
Overtime_Score = Overtime_Score + 3 {
WHERE Last_Name || ', ' || First_Name MessageBox.Show("You
|| ' ' || Middle_Initial = '" + are trying to score an out playing
txtPlayerB.Text + "' " player.", "Out of Score",
+ "AND Jersey_Number MessageBoxButtons.OK,
= '" + sJerseyB + "' AND Team_Name = MessageBoxIcon.Error);
'" + cmbTeamB.Text + "';"; }
SQLiteConnection
myConnection = new else if (txtScoreB.Text
SQLiteConnection(Conn.ConnString); == "000")
SQLiteCommand {
myCommand = new MessageBox.Show("Team
SQLiteCommand(myQuery, myConnection); score is already 0.", "Out of Score",

238
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
MessageBoxButtons.OK,
MessageBoxIcon.Error); myConnection.Close();
} }

else if (rdb1stP.Checked) if (s == 0)
{ {
#region 1st
string q; MessageBox.Show(txtPlayerB.Text + "
int s = 0; score is already 0.", "Out of Score",
MessageBoxButtons.OK,
string myQuery = MessageBoxIcon.Error);
"SELECT FirstP_Score FROM }
tbl_playersgame WHERE Last_Name || ',
' || First_Name || ' ' || else
Middle_Initial = '" + txtPlayerB.Text {
+ "' " string myQuery1 =
+ "AND Jersey_Number "UPDATE tbl_playersgame SET
= '" + sJerseyB + "' AND Team_Name = FirstP_Score = FirstP_Score - 1 WHERE
'" + cmbTeamB.Text + "';"; Last_Name || ', ' || First_Name || '
SQLiteConnection ' || Middle_Initial = '" +
myConnection = new txtPlayerB.Text + "' "
SQLiteConnection(Conn.ConnString); + "AND
SQLiteCommand Jersey_Number = '" + sJerseyB + "'
myCommand = new AND Team_Name = '" + cmbTeamB.Text +
SQLiteCommand(myQuery, myConnection); "';";
SQLiteDataReader SQLiteConnection
myReader; myConnection1 = new
SQLiteConnection(Conn.ConnString);
try SQLiteCommand
{ myCommand1 = new
SQLiteCommand(myQuery1,
myConnection.Open(); myConnection1);
myReader = SQLiteDataReader
myCommand.ExecuteReader(); myReader1;
while
(myReader.Read()) try
{ {
q =
myReader.GetValue(0).ToString(); myConnection1.Open();
s = myReader1 =
Convert.ToInt32(q); myCommand1.ExecuteReader();
} while
} (myReader1.Read()) { }

catch sSNotif = "-


(SQLiteException ex) 1";
{
ScoreNotifB();
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, TeamBScore();
MessageBoxIcon.Error); LoadTeamB();
} }

finally catch
{ (SQLiteException ex)
{

239
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {
}
#endregion myConnection.Close();
} }

else if (rdb2ndP.Checked) if (s == 0)
{ {
#region 2nd
string q; MessageBox.Show(txtPlayerB.Text + "
int s = 0; score is already 0.", "Out of Score",
MessageBoxButtons.OK,
string myQuery = MessageBoxIcon.Error);
"SELECT SecondP_Score FROM }
tbl_playersgame WHERE Last_Name || ',
' || First_Name || ' ' || else
Middle_Initial = '" + txtPlayerB.Text {
+ "' " string myQuery1 =
+ "AND Jersey_Number "UPDATE tbl_playersgame SET
= '" + sJerseyB + "' AND Team_Name = SecondP_Score = SecondP_Score - 1
'" + cmbTeamB.Text + "';"; WHERE Last_Name || ', ' || First_Name
SQLiteConnection || ' ' || Middle_Initial = '" +
myConnection = new txtPlayerB.Text + "' "
SQLiteConnection(Conn.ConnString); + "AND
SQLiteCommand Jersey_Number = '" + sJerseyB + "'
myCommand = new AND Team_Name = '" + cmbTeamB.Text +
SQLiteCommand(myQuery, myConnection); "';";
SQLiteDataReader SQLiteConnection
myReader; myConnection1 = new
SQLiteConnection(Conn.ConnString);
try SQLiteCommand
{ myCommand1 = new
SQLiteCommand(myQuery1,
myConnection.Open(); myConnection1);
myReader = SQLiteDataReader
myCommand.ExecuteReader(); myReader1;
while
(myReader.Read()) try
{ {
q =
myReader.GetValue(0).ToString(); myConnection1.Open();
s = myReader1 =
Convert.ToInt32(q); myCommand1.ExecuteReader();
} while
} (myReader1.Read()) { }

240
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
sSNotif = "- myReader =
1"; myCommand.ExecuteReader();
while
ScoreNotifB(); (myReader.Read())
{
TeamBScore(); q =
LoadTeamB(); myReader.GetValue(0).ToString();
} s =
Convert.ToInt32(q);
catch }
(SQLiteException ex) }
{
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {
}
#endregion myConnection.Close();
} }

else if (rdb3rdP.Checked) if (s == 0)
{ {
#region 3rd
string q; MessageBox.Show(txtPlayerB.Text + "
int s = 0; score is already 0.", "Out of Score",
MessageBoxButtons.OK,
string myQuery = MessageBoxIcon.Error);
"SELECT ThirdP_Score FROM }
tbl_playersgame WHERE Last_Name || ',
' || First_Name || ' ' || else
Middle_Initial = '" + txtPlayerB.Text {
+ "' " string myQuery1 =
+ "AND Jersey_Number "UPDATE tbl_playersgame SET
= '" + sJerseyB + "' AND Team_Name = ThirdP_Score = ThirdP_Score - 1 WHERE
'" + cmbTeamB.Text + "';"; Last_Name || ', ' || First_Name || '
SQLiteConnection ' || Middle_Initial = '" +
myConnection = new txtPlayerB.Text + "' "
SQLiteConnection(Conn.ConnString); + "AND
SQLiteCommand Jersey_Number = '" + sJerseyB + "'
myCommand = new AND Team_Name = '" + cmbTeamB.Text +
SQLiteCommand(myQuery, myConnection); "';";
SQLiteDataReader SQLiteConnection
myReader; myConnection1 = new
SQLiteConnection(Conn.ConnString);
try SQLiteCommand
{ myCommand1 = new
SQLiteCommand(myQuery1,
myConnection.Open(); myConnection1);

241
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteDataReader SQLiteConnection
myReader1; myConnection = new
SQLiteConnection(Conn.ConnString);
try SQLiteCommand
{ myCommand = new
SQLiteCommand(myQuery, myConnection);
myConnection1.Open(); SQLiteDataReader
myReader1 = myReader;
myCommand1.ExecuteReader();
while try
(myReader1.Read()) { } {

sSNotif = "- myConnection.Open();


1"; myReader =
myCommand.ExecuteReader();
ScoreNotifB(); while
(myReader.Read())
TeamBScore(); {
LoadTeamB(); q =
} myReader.GetValue(0).ToString();
s =
catch Convert.ToInt32(q);
(SQLiteException ex) }
{ }

MessageBox.Show(ex.Message, "Error", catch


MessageBoxButtons.OK, (SQLiteException ex)
MessageBoxIcon.Error); {
}
MessageBox.Show(ex.Message, "Error",
finally MessageBoxButtons.OK,
{ MessageBoxIcon.Error);
}
myConnection1.Close();
} finally
} {
#endregion
} myConnection.Close();
}
else if (rdb4thP.Checked)
{ if (s == 0)
#region 4th {
string q;
int s = 0; MessageBox.Show(txtPlayerB.Text + "
score is already 0.", "Out of Score",
string myQuery = MessageBoxButtons.OK,
"SELECT FourthP_Score FROM MessageBoxIcon.Error);
tbl_playersgame WHERE Last_Name || ', }
' || First_Name || ' ' ||
Middle_Initial = '" + txtPlayerB.Text else
+ "' " {
+ "AND Jersey_Number string myQuery1 =
= '" + sJerseyB + "' AND Team_Name = "UPDATE tbl_playersgame SET
'" + cmbTeamB.Text + "';"; FourthP_Score = FourthP_Score - 1
WHERE Last_Name || ', ' || First_Name

242
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
|| ' ' || Middle_Initial = '" + string q;
txtPlayerB.Text + "' " int s = 0;
+ "AND
Jersey_Number = '" + sJerseyB + "' string myQuery =
AND Team_Name = '" + cmbTeamB.Text + "SELECT Overtime_Score FROM
"';"; tbl_playersgame WHERE Last_Name || ',
SQLiteConnection ' || First_Name || ' ' ||
myConnection1 = new Middle_Initial = '" + txtPlayerB.Text
SQLiteConnection(Conn.ConnString); + "' "
SQLiteCommand + "AND Jersey_Number
myCommand1 = new = '" + sJerseyB + "' AND Team_Name =
SQLiteCommand(myQuery1, '" + cmbTeamB.Text + "';";
myConnection1); SQLiteConnection
SQLiteDataReader myConnection = new
myReader1; SQLiteConnection(Conn.ConnString);
SQLiteCommand
try myCommand = new
{ SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
myConnection1.Open(); myReader;
myReader1 =
myCommand1.ExecuteReader(); try
while {
(myReader1.Read()) { }
myConnection.Open();
sSNotif = "- myReader =
1"; myCommand.ExecuteReader();
while
ScoreNotifB(); (myReader.Read())
{
TeamBScore(); q =
LoadTeamB(); myReader.GetValue(0).ToString();
} s =
Convert.ToInt32(q);
catch }
(SQLiteException ex) }
{
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {
}
#endregion myConnection.Close();
} }

else if if (s == 0)
(rdbOTime.Checked) {
{
#region Overtime MessageBox.Show(txtPlayerB.Text + "

243
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
score is already 0.", "Out of Score",
MessageBoxButtons.OK, myConnection1.Close();
MessageBoxIcon.Error); }
} }
#endregion
else }
{ }
string myQuery1 = #endregion
"UPDATE tbl_playersgame SET
Overtime_Score = Overtime_Score - 1 #region Team B -2 Score
WHERE Last_Name || ', ' || First_Name private void
|| ' ' || Middle_Initial = '" + btnM2B_Click(object sender, EventArgs
txtPlayerB.Text + "' " e)
+ "AND {
Jersey_Number = '" + sJerseyB + "' if (sInB == "Out")
AND Team_Name = '" + cmbTeamB.Text + {
"';"; MessageBox.Show("You
SQLiteConnection are trying to score an out playing
myConnection1 = new player.", "Out of Score",
SQLiteConnection(Conn.ConnString); MessageBoxButtons.OK,
SQLiteCommand MessageBoxIcon.Error);
myCommand1 = new }
SQLiteCommand(myQuery1,
myConnection1); else if (txtScoreB.Text
SQLiteDataReader == "000")
myReader1; {
MessageBox.Show("Team
try score is already 0.", "Out of Score",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
myConnection1.Open(); }
myReader1 =
myCommand1.ExecuteReader(); else if (rdb1stP.Checked)
while {
(myReader1.Read()) { } #region 1st
string q;
sSNotif = "- int s = 0;
1";
string myQuery =
ScoreNotifB(); "SELECT FirstP_Score FROM
tbl_playersgame WHERE Last_Name || ',
TeamBScore(); ' || First_Name || ' ' ||
LoadTeamB(); Middle_Initial = '" + txtPlayerB.Text
} + "' "
+ "AND Jersey_Number
catch = '" + sJerseyB + "' AND Team_Name =
(SQLiteException ex) '" + cmbTeamB.Text + "';";
{ SQLiteConnection
myConnection = new
MessageBox.Show(ex.Message, "Error", SQLiteConnection(Conn.ConnString);
MessageBoxButtons.OK, SQLiteCommand
MessageBoxIcon.Error); myCommand = new
} SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
finally myReader;
{

244
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
try ' || Middle_Initial = '" +
{ txtPlayerB.Text + "' "
+ "AND
myConnection.Open(); Jersey_Number = '" + sJerseyB + "'
myReader = AND Team_Name = '" + cmbTeamB.Text +
myCommand.ExecuteReader(); "';";
while SQLiteConnection
(myReader.Read()) myConnection1 = new
{ SQLiteConnection(Conn.ConnString);
q = SQLiteCommand
myReader.GetValue(0).ToString(); myCommand1 = new
s = SQLiteCommand(myQuery1,
Convert.ToInt32(q); myConnection1);
} SQLiteDataReader
} myReader1;

catch try
(SQLiteException ex) {
{
myConnection1.Open();
MessageBox.Show(ex.Message, "Error", myReader1 =
MessageBoxButtons.OK, myCommand1.ExecuteReader();
MessageBoxIcon.Error); while
} (myReader1.Read()) { }

finally sSNotif = "-


{ 2";

myConnection.Close(); ScoreNotifB();
}
TeamBScore();
if (s == 0) LoadTeamB();
{ }

MessageBox.Show(txtPlayerB.Text + " catch


score is already 0.", "Out of Score", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
else if (s < 2) MessageBoxIcon.Error);
{ }

MessageBox.Show(txtPlayerB.Text + " finally


score cannot be negative.", "Out of {
Score", MessageBoxButtons.OK,
MessageBoxIcon.Error); myConnection1.Close();
} }
}
else #endregion
{ }
string myQuery1 =
"UPDATE tbl_playersgame SET else if (rdb2ndP.Checked)
FirstP_Score = FirstP_Score - 2 WHERE {
Last_Name || ', ' || First_Name || ' #region 2nd
string q;

245
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT SecondP_Score FROM
tbl_playersgame WHERE Last_Name || ', else if (s < 2)
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerB.Text
+ "' " MessageBox.Show(txtPlayerB.Text + "
+ "AND Jersey_Number score cannot be negative.", "Out of
= '" + sJerseyB + "' AND Team_Name = Score", MessageBoxButtons.OK,
'" + cmbTeamB.Text + "';"; MessageBoxIcon.Error);
SQLiteConnection }
myConnection = new
SQLiteConnection(Conn.ConnString); else
SQLiteCommand {
myCommand = new string myQuery1 =
SQLiteCommand(myQuery, myConnection); "UPDATE tbl_playersgame SET
SQLiteDataReader SecondP_Score = SecondP_Score - 2
myReader; WHERE Last_Name || ', ' || First_Name
|| ' ' || Middle_Initial = '" +
try txtPlayerB.Text + "' "
{ + "AND
Jersey_Number = '" + sJerseyB + "'
myConnection.Open(); AND Team_Name = '" + cmbTeamB.Text +
myReader = "';";
myCommand.ExecuteReader(); SQLiteConnection
while myConnection1 = new
(myReader.Read()) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
q = myCommand1 = new
myReader.GetValue(0).ToString(); SQLiteCommand(myQuery1,
s = myConnection1);
Convert.ToInt32(q); SQLiteDataReader
} myReader1;
}
try
catch {
(SQLiteException ex)
{ myConnection1.Open();
myReader1 =
MessageBox.Show(ex.Message, "Error", myCommand1.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader1.Read()) { }
}
sSNotif = "-
finally 2";
{
ScoreNotifB();
myConnection.Close();
} TeamBScore();
LoadTeamB();
if (s == 0) }
{
catch
MessageBox.Show(txtPlayerB.Text + " (SQLiteException ex)
score is already 0.", "Out of Score", {

246
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {
}
#endregion myConnection.Close();
} }

else if (rdb3rdP.Checked) if (s == 0)
{ {
#region 3rd
string q; MessageBox.Show(txtPlayerB.Text + "
int s = 0; score is already 0.", "Out of Score",
MessageBoxButtons.OK,
string myQuery = MessageBoxIcon.Error);
"SELECT ThirdP_Score FROM }
tbl_playersgame WHERE Last_Name || ',
' || First_Name || ' ' || else if (s < 2)
Middle_Initial = '" + txtPlayerB.Text {
+ "' "
+ "AND Jersey_Number MessageBox.Show(txtPlayerB.Text + "
= '" + sJerseyB + "' AND Team_Name = score cannot be negative.", "Out of
'" + cmbTeamB.Text + "';"; Score", MessageBoxButtons.OK,
SQLiteConnection MessageBoxIcon.Error);
myConnection = new }
SQLiteConnection(Conn.ConnString);
SQLiteCommand else
myCommand = new {
SQLiteCommand(myQuery, myConnection); string myQuery1 =
SQLiteDataReader "UPDATE tbl_playersgame SET
myReader; ThirdP_Score = ThirdP_Score - 2 WHERE
Last_Name || ', ' || First_Name || '
try ' || Middle_Initial = '" +
{ txtPlayerB.Text + "' "
+ "AND
myConnection.Open(); Jersey_Number = '" + sJerseyB + "'
myReader = AND Team_Name = '" + cmbTeamB.Text +
myCommand.ExecuteReader(); "';";
while SQLiteConnection
(myReader.Read()) myConnection1 = new
{ SQLiteConnection(Conn.ConnString);
q = SQLiteCommand
myReader.GetValue(0).ToString(); myCommand1 = new
s = SQLiteCommand(myQuery1,
Convert.ToInt32(q); myConnection1);
} SQLiteDataReader
} myReader1;

try

247
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{ SQLiteDataReader
myReader;
myConnection1.Open();
myReader1 = try
myCommand1.ExecuteReader(); {
while
(myReader1.Read()) { } myConnection.Open();
myReader =
sSNotif = "- myCommand.ExecuteReader();
2"; while
(myReader.Read())
ScoreNotifB(); {
q =
TeamBScore(); myReader.GetValue(0).ToString();
LoadTeamB(); s =
} Convert.ToInt32(q);
}
catch }
(SQLiteException ex)
{ catch
(SQLiteException ex)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
finally }
{
finally
myConnection1.Close(); {
}
} myConnection.Close();
#endregion }
}
if (s == 0)
else if (rdb4thP.Checked) {
{
#region 4th MessageBox.Show(txtPlayerB.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT FourthP_Score FROM
tbl_playersgame WHERE Last_Name || ', else if (s < 2)
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerB.Text
+ "' " MessageBox.Show(txtPlayerB.Text + "
+ "AND Jersey_Number score cannot be negative.", "Out of
= '" + sJerseyB + "' AND Team_Name = Score", MessageBoxButtons.OK,
'" + cmbTeamB.Text + "';"; MessageBoxIcon.Error);
SQLiteConnection }
myConnection = new
SQLiteConnection(Conn.ConnString); else
SQLiteCommand {
myCommand = new string myQuery1 =
SQLiteCommand(myQuery, myConnection); "UPDATE tbl_playersgame SET

248
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
FourthP_Score = FourthP_Score - 2 {
WHERE Last_Name || ', ' || First_Name #region Overtime
|| ' ' || Middle_Initial = '" + string q;
txtPlayerB.Text + "' " int s = 0;
+ "AND
Jersey_Number = '" + sJerseyB + "' string myQuery =
AND Team_Name = '" + cmbTeamB.Text + "SELECT Overtime_Score FROM
"';"; tbl_playersgame WHERE Last_Name || ',
SQLiteConnection ' || First_Name || ' ' ||
myConnection1 = new Middle_Initial = '" + txtPlayerB.Text
SQLiteConnection(Conn.ConnString); + "' "
SQLiteCommand + "AND Jersey_Number
myCommand1 = new = '" + sJerseyB + "' AND Team_Name =
SQLiteCommand(myQuery1, '" + cmbTeamB.Text + "';";
myConnection1); SQLiteConnection
SQLiteDataReader myConnection = new
myReader1; SQLiteConnection(Conn.ConnString);
SQLiteCommand
try myCommand = new
{ SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
myConnection1.Open(); myReader;
myReader1 =
myCommand1.ExecuteReader(); try
while {
(myReader1.Read()) { }
myConnection.Open();
sSNotif = "- myReader =
2"; myCommand.ExecuteReader();
while
ScoreNotifB(); (myReader.Read())
{
TeamBScore(); q =
LoadTeamB(); myReader.GetValue(0).ToString();
} s =
Convert.ToInt32(q);
catch }
(SQLiteException ex) }
{
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {
}
#endregion myConnection.Close();
} }

else if if (s == 0)
(rdbOTime.Checked) {

249
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
catch
MessageBox.Show(txtPlayerB.Text + " (SQLiteException ex)
score is already 0.", "Out of Score", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
else if (s < 2) }
{
finally
MessageBox.Show(txtPlayerB.Text + " {
score cannot be negative.", "Out of
Score", MessageBoxButtons.OK, myConnection1.Close();
MessageBoxIcon.Error); }
} }
#endregion
else }
{ }
string myQuery1 = #endregion
"UPDATE tbl_playersgame SET
Overtime_Score = Overtime_Score - 2 #region Team B -3 Score
WHERE Last_Name || ', ' || First_Name private void
|| ' ' || Middle_Initial = '" + btnM3B_Click(object sender, EventArgs
txtPlayerB.Text + "' " e)
+ "AND {
Jersey_Number = '" + sJerseyB + "' if (sInB == "Out")
AND Team_Name = '" + cmbTeamB.Text + {
"';"; MessageBox.Show("You
SQLiteConnection are trying to score an out playing
myConnection1 = new player.", "Out of Score",
SQLiteConnection(Conn.ConnString); MessageBoxButtons.OK,
SQLiteCommand MessageBoxIcon.Error);
myCommand1 = new }
SQLiteCommand(myQuery1,
myConnection1); else if (txtScoreB.Text
SQLiteDataReader == "000")
myReader1; {
MessageBox.Show("Team
try score is already 0.", "Out of Score",
{ MessageBoxButtons.OK,
MessageBoxIcon.Error);
myConnection1.Open(); }
myReader1 =
myCommand1.ExecuteReader(); else if (rdb1stP.Checked)
while {
(myReader1.Read()) { } #region 1st
string q;
sSNotif = "- int s = 0;
2";
string myQuery =
ScoreNotifB(); "SELECT FirstP_Score FROM
tbl_playersgame WHERE Last_Name || ',
TeamBScore(); ' || First_Name || ' ' ||
LoadTeamB(); Middle_Initial = '" + txtPlayerB.Text
} + "' "

250
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "AND Jersey_Number score cannot be negative.", "Out of
= '" + sJerseyB + "' AND Team_Name = Score", MessageBoxButtons.OK,
'" + cmbTeamB.Text + "';"; MessageBoxIcon.Error);
SQLiteConnection }
myConnection = new
SQLiteConnection(Conn.ConnString); else
SQLiteCommand {
myCommand = new string myQuery1 =
SQLiteCommand(myQuery, myConnection); "UPDATE tbl_playersgame SET
SQLiteDataReader FirstP_Score = FirstP_Score - 3 WHERE
myReader; Last_Name || ', ' || First_Name || '
' || Middle_Initial = '" +
try txtPlayerB.Text + "' "
{ + "AND
Jersey_Number = '" + sJerseyB + "'
myConnection.Open(); AND Team_Name = '" + cmbTeamB.Text +
myReader = "';";
myCommand.ExecuteReader(); SQLiteConnection
while myConnection1 = new
(myReader.Read()) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
q = myCommand1 = new
myReader.GetValue(0).ToString(); SQLiteCommand(myQuery1,
s = myConnection1);
Convert.ToInt32(q); SQLiteDataReader
} myReader1;
}
try
catch {
(SQLiteException ex)
{ myConnection1.Open();
myReader1 =
MessageBox.Show(ex.Message, "Error", myCommand1.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader1.Read()) { }
}
sSNotif = "-
finally 3";
{
ScoreNotifB();
myConnection.Close();
} TeamBScore();
LoadTeamB();
if (s == 0) }
{
catch
MessageBox.Show(txtPlayerB.Text + " (SQLiteException ex)
score is already 0.", "Out of Score", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
else if (s < 3) }
{
finally
MessageBox.Show(txtPlayerB.Text + " {

251
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
finally
myConnection1.Close(); {
}
} myConnection.Close();
#endregion }
}
if (s == 0)
else if (rdb2ndP.Checked) {
{
#region 2nd MessageBox.Show(txtPlayerB.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT SecondP_Score FROM
tbl_playersgame WHERE Last_Name || ', else if (s < 3)
' || First_Name || ' ' || {
Middle_Initial = '" + txtPlayerB.Text
+ "' " MessageBox.Show(txtPlayerB.Text + "
+ "AND Jersey_Number score cannot be negative.", "Out of
= '" + sJerseyB + "' AND Team_Name = Score", MessageBoxButtons.OK,
'" + cmbTeamB.Text + "';"; MessageBoxIcon.Error);
SQLiteConnection }
myConnection = new
SQLiteConnection(Conn.ConnString); else
SQLiteCommand {
myCommand = new string myQuery1 =
SQLiteCommand(myQuery, myConnection); "UPDATE tbl_playersgame SET
SQLiteDataReader SecondP_Score = SecondP_Score - 3
myReader; WHERE Last_Name || ', ' || First_Name
|| ' ' || Middle_Initial = '" +
try txtPlayerB.Text + "' "
{ + "AND
Jersey_Number = '" + sJerseyB + "'
myConnection.Open(); AND Team_Name = '" + cmbTeamB.Text +
myReader = "';";
myCommand.ExecuteReader(); SQLiteConnection
while myConnection1 = new
(myReader.Read()) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
q = myCommand1 = new
myReader.GetValue(0).ToString(); SQLiteCommand(myQuery1,
s = myConnection1);
Convert.ToInt32(q); SQLiteDataReader
} myReader1;
}
try
catch {
(SQLiteException ex)
{ myConnection1.Open();
myReader1 =
MessageBox.Show(ex.Message, "Error", myCommand1.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader1.Read()) { }
}

252
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
sSNotif = "- myReader =
3"; myCommand.ExecuteReader();
while
ScoreNotifB(); (myReader.Read())
{
TeamBScore(); q =
LoadTeamB(); myReader.GetValue(0).ToString();
} s =
Convert.ToInt32(q);
catch }
(SQLiteException ex) }
{
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
finally MessageBoxIcon.Error);
{ }

myConnection1.Close(); finally
} {
}
#endregion myConnection.Close();
} }

else if (rdb3rdP.Checked) if (s == 0)
{ {
#region 3rd
string q; MessageBox.Show(txtPlayerB.Text + "
int s = 0; score is already 0.", "Out of Score",
MessageBoxButtons.OK,
string myQuery = MessageBoxIcon.Error);
"SELECT ThirdP_Score FROM }
tbl_playersgame WHERE Last_Name || ',
' || First_Name || ' ' || else if (s < 3)
Middle_Initial = '" + txtPlayerB.Text {
+ "' "
+ "AND Jersey_Number MessageBox.Show(txtPlayerB.Text + "
= '" + sJerseyB + "' AND Team_Name = score cannot be negative.", "Out of
'" + cmbTeamB.Text + "';"; Score", MessageBoxButtons.OK,
SQLiteConnection MessageBoxIcon.Error);
myConnection = new }
SQLiteConnection(Conn.ConnString);
SQLiteCommand else
myCommand = new {
SQLiteCommand(myQuery, myConnection); string myQuery1 =
SQLiteDataReader "UPDATE tbl_playersgame SET
myReader; ThirdP_Score = ThirdP_Score - 3 WHERE
Last_Name || ', ' || First_Name || '
try ' || Middle_Initial = '" +
{ txtPlayerB.Text + "' "
+ "AND
myConnection.Open(); Jersey_Number = '" + sJerseyB + "'

253
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
AND Team_Name = '" + cmbTeamB.Text + tbl_playersgame WHERE Last_Name || ',
"';"; ' || First_Name || ' ' ||
SQLiteConnection Middle_Initial = '" + txtPlayerB.Text
myConnection1 = new + "' "
SQLiteConnection(Conn.ConnString); + "AND Jersey_Number
SQLiteCommand = '" + sJerseyB + "' AND Team_Name =
myCommand1 = new '" + cmbTeamB.Text + "';";
SQLiteCommand(myQuery1, SQLiteConnection
myConnection1); myConnection = new
SQLiteDataReader SQLiteConnection(Conn.ConnString);
myReader1; SQLiteCommand
myCommand = new
try SQLiteCommand(myQuery, myConnection);
{ SQLiteDataReader
myReader;
myConnection1.Open();
myReader1 = try
myCommand1.ExecuteReader(); {
while
(myReader1.Read()) { } myConnection.Open();
myReader =
sSNotif = "- myCommand.ExecuteReader();
3"; while
(myReader.Read())
ScoreNotifB(); {
q =
TeamBScore(); myReader.GetValue(0).ToString();
LoadTeamB(); s =
} Convert.ToInt32(q);
}
catch }
(SQLiteException ex)
{ catch
(SQLiteException ex)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
finally }
{
finally
myConnection1.Close(); {
}
} myConnection.Close();
#endregion }
}
if (s == 0)
else if (rdb4thP.Checked) {
{
#region 4th MessageBox.Show(txtPlayerB.Text + "
string q; score is already 0.", "Out of Score",
int s = 0; MessageBoxButtons.OK,
MessageBoxIcon.Error);
string myQuery = }
"SELECT FourthP_Score FROM

254
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
else if (s < 3) }
{
finally
MessageBox.Show(txtPlayerB.Text + " {
score cannot be negative.", "Out of
Score", MessageBoxButtons.OK, myConnection1.Close();
MessageBoxIcon.Error); }
} }
#endregion
else }
{
string myQuery1 = else if
"UPDATE tbl_playersgame SET (rdbOTime.Checked)
FourthP_Score = FourthP_Score - 3 {
WHERE Last_Name || ', ' || First_Name #region Overtime
|| ' ' || Middle_Initial = '" + string q;
txtPlayerB.Text + "' " int s = 0;
+ "AND
Jersey_Number = '" + sJerseyB + "' string myQuery =
AND Team_Name = '" + cmbTeamB.Text + "SELECT Overtime_Score FROM
"';"; tbl_playersgame WHERE Last_Name || ',
SQLiteConnection ' || First_Name || ' ' ||
myConnection1 = new Middle_Initial = '" + txtPlayerB.Text
SQLiteConnection(Conn.ConnString); + "' "
SQLiteCommand + "AND Jersey_Number
myCommand1 = new = '" + sJerseyB + "' AND Team_Name =
SQLiteCommand(myQuery1, '" + cmbTeamB.Text + "';";
myConnection1); SQLiteConnection
SQLiteDataReader myConnection = new
myReader1; SQLiteConnection(Conn.ConnString);
SQLiteCommand
try myCommand = new
{ SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
myConnection1.Open(); myReader;
myReader1 =
myCommand1.ExecuteReader(); try
while {
(myReader1.Read()) { }
myConnection.Open();
sSNotif = "- myReader =
3"; myCommand.ExecuteReader();
while
ScoreNotifB(); (myReader.Read())
{
TeamBScore(); q =
LoadTeamB(); myReader.GetValue(0).ToString();
} s =
Convert.ToInt32(q);
catch }
(SQLiteException ex) }
{
catch
MessageBox.Show(ex.Message, "Error", (SQLiteException ex)
MessageBoxButtons.OK, {
MessageBoxIcon.Error);

255
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
myReader1 =
MessageBox.Show(ex.Message, "Error", myCommand1.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader1.Read()) { }
}
sSNotif = "-
finally 3";
{
ScoreNotifB();
myConnection.Close();
} TeamBScore();
LoadTeamB();
if (s == 0) }
{
catch
MessageBox.Show(txtPlayerB.Text + " (SQLiteException ex)
score is already 0.", "Out of Score", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
else if (s < 3) }
{
finally
MessageBox.Show(txtPlayerB.Text + " {
score cannot be negative.", "Out of
Score", MessageBoxButtons.OK, myConnection1.Close();
MessageBoxIcon.Error); }
} }
#endregion
else }
{ }
string myQuery1 = #endregion
"UPDATE tbl_playersgame SET
Overtime_Score = Overtime_Score - 3 //------------------------//
WHERE Last_Name || ', ' || First_Name Team A Foul
|| ' ' || Middle_Initial = '" +
txtPlayerB.Text + "' " #region Count Foul A
+ "AND void CountFoulA()
Jersey_Number = '" + sJerseyB + "' {
AND Team_Name = '" + cmbTeamB.Text + string myQuery = "SELECT
"';"; SUM(CASE WHEN Foul_1 != 0 THEN 1 ELSE
SQLiteConnection Foul_1 END) + SUM(CASE WHEN Foul_2 !=
myConnection1 = new 0 THEN 1 ELSE Foul_2 END) "
SQLiteConnection(Conn.ConnString); + "+ SUM(CASE WHEN Foul_3
SQLiteCommand != 0 THEN 1 ELSE Foul_3 END)+
myCommand1 = new SUM(CASE WHEN Foul_4 != 0 THEN 1 ELSE
SQLiteCommand(myQuery1, Foul_4 END) "
myConnection1); + "+ SUM(CASE WHEN Foul_5
SQLiteDataReader != 0 THEN 1 ELSE Foul_5 END) FROM
myReader1; tbl_playersgame "
+ "WHERE Last_Name || ',
try ' || First_Name || ' ' ||
{ Middle_Initial = '" + txtPlayerA.Text
+ "' "
myConnection1.Open();

256
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "AND Jersey_Number = '" sQValueA = "3";
+ sJerseyA + "' AND Team_Name = '" + }
cmbTeamA.Text + "';";
SQLiteConnection else if (rdb4thP.Checked)
myConnection = new {
SQLiteConnection(Conn.ConnString); sQValueA = "4";
SQLiteCommand myCommand = }
new SQLiteCommand(myQuery,
myConnection); else if
SQLiteDataReader (rdbOTime.Checked)
myReader; {
sQValueA = "5";
try }
{ }
myConnection.Open(); #endregion
myReader =
myCommand.ExecuteReader(); #region Count Team Foul per
while Quarter A
(myReader.Read()) void CountFoulQuarterA()
{ {
sFoulA = string myQuery = "SELECT
myReader.GetValue(0).ToString(); SUM(CASE WHEN Foul_1 = " + sQValueA +
} " THEN 1 ELSE 0 END) + SUM(CASE WHEN
} Foul_2 = " + sQValueA + " THEN 1 ELSE
0 END) + "
catch (SQLiteException + "SUM(CASE WHEN Foul_3 =
ex) " + sQValueA + " THEN 1 ELSE 0 END) +
{ SUM(CASE WHEN Foul_4 = " + sQValueA +
" THEN 1 ELSE 0 END) + "
MessageBox.Show(ex.Message, "Error", + "SUM(CASE WHEN Foul_5 =
MessageBoxButtons.OK, " + sQValueA + " THEN 1 ELSE 0 END)
MessageBoxIcon.Error); FROM tbl_playersgame WHERE Team_Name
} = '" + cmbTeamA.Text + "';";
SQLiteConnection
finally myConnection = new
{ SQLiteConnection(Conn.ConnString);
myConnection.Close(); SQLiteCommand myCommand =
} new SQLiteCommand(myQuery,
} myConnection);
#endregion SQLiteDataReader
myReader;
#region Quarter Value A
void QuarterValueA() try
{ {
if (rdb1stP.Checked) myConnection.Open();
{ myReader =
sQValueA = "1"; myCommand.ExecuteReader();
} while
(myReader.Read())
else if (rdb2ndP.Checked) {
{ sTeamFoulA =
sQValueA = "2"; myReader.GetValue(0).ToString();
} }
}
else if (rdb3rdP.Checked)
{

257
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
catch (SQLiteException o) && Int32.TryParse(txt4TFA.Text,
ex) out f) && (f + o) >= 5)
{ {
txtPenaltyA.Visible =
MessageBox.Show(ex.Message, "Error", true;
MessageBoxButtons.OK, }
MessageBoxIcon.Error);
} else
{
finally txtPenaltyA.Visible =
{ false;
myConnection.Close(); }
} }
}
#endregion private void
rdb2ndP_Click(object sender,
#region Penalty A EventArgs e)
void PenaltyA() {
{ if (sTQuarter != "2")
int f = 0, o = 0; ; {
dynamic dialog =
if (rdb1stP.Checked && MessageBox.Show("Do you want to
Int32.TryParse(txt1TFA.Text, out f) proceed to 2nd Period?", "Period
&& f >= 5) Change", MessageBoxButtons.YesNo,
{ MessageBoxIcon.Question);
txtPenaltyA.Visible = if (dialog ==
true; DialogResult.No)
} {
rdb1stP.Checked =
else if (rdb2ndP.Checked true;
&& Int32.TryParse(txt2TFA.Text, out }
f) && f >= 5)
{ else if (dialog ==
txtPenaltyA.Visible = DialogResult.Yes)
true; {
} PenaltyA();
PenaltyB();
else if (rdb3rdP.Checked sTQuarter = "2";
&& Int32.TryParse(txt3TFA.Text, out rdb2ndP.Checked =
f) && f >= 5) true;
{ rdb1stP.Enabled =
txtPenaltyA.Visible = false;
true;
} ScoreFoulAPA();
ScoreFoulAPB();
else if (rdb4thP.Checked }
&& Int32.TryParse(txt4TFA.Text, out }
f) && f >= 5) }
{
txtPenaltyA.Visible = private void
true; rdb3rdP_Click(object sender,
} EventArgs e)
{
else if (rdbOTime.Checked if (sTQuarter != "3")
&& Int32.TryParse(txtOTFA.Text, out {

258
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
dynamic dialog = if (sTQuarter ==
MessageBox.Show("Do you want to "")
proceed to 3rd Period?", "Period {
Change", MessageBoxButtons.YesNo,
MessageBoxIcon.Question); rdb1stP.Checked = true;
if (dialog == }
DialogResult.No)
{ else if
if (sTQuarter == (sTQuarter == "2")
"") {
{
rdb2ndP.Checked = true;
rdb1stP.Checked = true; }
}
else if
else if (sTQuarter == "3")
(sTQuarter == "2") {
{
rdb3rdP.Checked = true;
rdb2ndP.Checked = true; }
} }
}
else if (dialog ==
else if (dialog == DialogResult.Yes)
DialogResult.Yes) {
{ PenaltyA();
PenaltyA(); PenaltyB();
PenaltyB(); sTQuarter = "4";
sTQuarter = "3"; rdb4thP.Checked =
rdb3rdP.Checked = true;
true; rdb1stP.Enabled =
rdb1stP.Enabled = false;
false; rdb2ndP.Enabled =
rdb2ndP.Enabled = false;
false; rdb3rdP.Enabled =
false;
ScoreFoulAPA();
ScoreFoulAPB(); ScoreFoulAPA();
} ScoreFoulAPB();
} }
} }
}
private void
rdb4thP_Click(object sender, private void
EventArgs e) rdbOtime_Click(object sender,
{ EventArgs e)
if (sTQuarter != "4") {
{ dynamic dialog =
dynamic dialog = MessageBox.Show("Do you want to
MessageBox.Show("Do you want to proceed to Overtime " + (iTO + 1) +
proceed to 4th Period?", "Period "?", "Period Change",
Change", MessageBoxButtons.YesNo, MessageBoxButtons.YesNo,
MessageBoxIcon.Question); MessageBoxIcon.Question);
if (dialog == if (dialog ==
DialogResult.No) DialogResult.No)
{ {

259
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
if (sTQuarter == "") }
{ #endregion
rdb1stP.Checked =
true; #region Team Foul A
} void TeamFoulA()
{
else if (sTQuarter == if (rdb1stP.Checked)
"2") {
{ string myQuery =
rdb2ndP.Checked = "UPDATE tbl_teamsgame SET
true; FirstP_Team_Foul = '" + txt1TFA.Text
} + "' WHERE Team_Name = '" +
cmbTeamA.Text + "';";
else if (sTQuarter == SQLiteConnection
"3") myConnection = new
{ SQLiteConnection(Conn.ConnString);
rdb3rdP.Checked = SQLiteCommand
true; myCommand = new
} SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
else if (sTQuarter == myReader;
"4")
{ try
rdb4thP.Checked = {
true;
} myConnection.Open();
} myReader =
myCommand.ExecuteReader();
else if (dialog == while
DialogResult.Yes) (myReader.Read()) { }
{ }
PenaltyA();
PenaltyB(); catch
sTQuarter = "0"; (SQLiteException ex)
rdbOTime.Checked = {
true;
rdb1stP.Enabled = MessageBox.Show(ex.Message, "Error",
false; MessageBoxButtons.OK,
rdb2ndP.Enabled = MessageBoxIcon.Error);
false; }
rdb3rdP.Enabled =
false; finally
rdb4thP.Enabled = {
false;
myConnection.Close();
iTO = iTO + 1; }
}
rdbOTime.Text =
"Overtime " + iTO; else if (rdb2ndP.Checked)
{
iTimeoutA = 0; string myQuery =
iTimeoutB = 0; "UPDATE tbl_teamsgame SET
SecondP_Team_Foul = '" + txt2TFA.Text
ScoreFoulAPA(); + "' WHERE Team_Name = '" +
ScoreFoulAPB(); cmbTeamA.Text + "';";
}

260
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteConnection myReader =
myConnection = new myCommand.ExecuteReader();
SQLiteConnection(Conn.ConnString); while
SQLiteCommand (myReader.Read()) { }
myCommand = new }
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader catch
myReader; (SQLiteException ex)
{
try
{ MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
myConnection.Open(); MessageBoxIcon.Error);
myReader = }
myCommand.ExecuteReader();
while finally
(myReader.Read()) { } {
}
myConnection.Close();
catch }
(SQLiteException ex) }
{
else if (rdb4thP.Checked)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK, string myQuery =
MessageBoxIcon.Error); "UPDATE tbl_teamsgame SET
} FourthP_Team_Foul = '" + txt4TFA.Text
+ "' WHERE Team_Name = '" +
finally cmbTeamA.Text + "';";
{ SQLiteConnection
myConnection = new
myConnection.Close(); SQLiteConnection(Conn.ConnString);
} SQLiteCommand
} myCommand = new
SQLiteCommand(myQuery, myConnection);
else if (rdb3rdP.Checked) SQLiteDataReader
{ myReader;
string myQuery =
"UPDATE tbl_teamsgame SET try
ThirdP_Team_Foul = '" + txt3TFA.Text {
+ "' WHERE Team_Name = '" +
cmbTeamA.Text + "';"; myConnection.Open();
SQLiteConnection myReader =
myConnection = new myCommand.ExecuteReader();
SQLiteConnection(Conn.ConnString); while
SQLiteCommand (myReader.Read()) { }
myCommand = new }
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader catch
myReader; (SQLiteException ex)
{
try
{ MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
myConnection.Open(); MessageBoxIcon.Error);
}

261
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
string ext = "";
finally
{ if (sFoulA == "1")
{
myConnection.Close(); ext = "st";
} }
}
else if (sFoulA == "2")
else if {
(rdbOTime.Checked) ext = "nd";
{ }
string myQuery =
"UPDATE tbl_teamsgame SET else if (sFoulA == "3")
Overtime_Team_Foul = '" + {
txtOTFA.Text + "' WHERE Team_Name = ext = "rd";
'" + cmbTeamA.Text + "';"; }
SQLiteConnection
myConnection = new else if (sFoulA == "4" ||
SQLiteConnection(Conn.ConnString); sFoulA == "5")
SQLiteCommand {
myCommand = new ext = "th";
SQLiteCommand(myQuery, myConnection); }
SQLiteDataReader
myReader; lblNotif.Text = "Team A :
" + txtPlayerA.Text + " got " +
try sFoulA + ext + " personal foul.";
{ lblNotif.Visible = true;
iDT = 4;
myConnection.Open(); tmrNotif.Start();
myReader = }
myCommand.ExecuteReader();
while private void
(myReader.Read()) { } btnPFoulA_Click(object sender,
} EventArgs e)
{
catch QuarterValueA();
(SQLiteException ex)
{ if (sInA == "Out")
{
MessageBox.Show(ex.Message, "Error", MessageBox.Show("You
MessageBoxButtons.OK, are trying to foul an out playing
MessageBoxIcon.Error); player.", "Foul",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
finally }
{
else if (sFoulA == "5")
myConnection.Close(); {
}
} MessageBox.Show(txtPlayerA.Text + "
} is already fouled out.", "Foul",
#endregion MessageBoxButtons.OK,
MessageBoxIcon.Error);
#region Foul A }
void FoulNotifA()
{ else if (rdb1stP.Checked)

262
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{
string myQuery = FoulNotifA();
"UPDATE tbl_playersgame SET Foul_1 =
CASE WHEN Foul_1 = 0 THEN 1 ELSE if (sFoulA ==
Foul_1 END, " "5")
+ "Foul_2 = CASE WHEN {
Foul_1 != 0 AND Foul_2 = 0 THEN 1
ELSE Foul_2 END, " btnOutA_Click(sender, e);
+ "Foul_3 = CASE WHEN
Foul_1 != 0 AND Foul_2 != 0 AND lblNotif.Visible = false;
Foul_3 = 0 THEN 1 ELSE Foul_3 END, " lblNotif.Text
+ "Foul_4 = CASE WHEN = "Team A : " + txtPlayerA.Text + "
Foul_1 != 0 AND Foul_2 != 0 AND has been set out due of having 5
Foul_3 != 0 AND Foul_4 = 0 THEN 1 fouls.";
ELSE Foul_4 END, "
+ "Foul_5 = CASE WHEN lblNotif.Visible = true;
Foul_1 != 0 AND Foul_2 != 0 AND iDT = 4;
Foul_3 != 0 AND Foul_4 != 0 AND
Foul_5 = 0 THEN 1 ELSE Foul_5 END " tmrNotif.Start();
+ "WHERE Last_Name || }
', ' || First_Name || ' ' ||
Middle_Initial = '" + txtPlayerA.Text LoadTeamA();
+ "' " }
+ "AND Jersey_Number
= '" + sJerseyA + "' AND Team_Name = catch
'" + cmbTeamA.Text + "';"; (SQLiteException ex)
SQLiteConnection {
myConnection = new
SQLiteConnection(Conn.ConnString); MessageBox.Show(ex.Message, "Error",
SQLiteCommand MessageBoxButtons.OK,
myCommand = new MessageBoxIcon.Error);
SQLiteCommand(myQuery, myConnection); }
SQLiteDataReader
myReader; finally
{
try
{ myConnection.Close();
}
myConnection.Open(); }
myReader =
myCommand.ExecuteReader(); else if (rdb2ndP.Checked)
while {
(myReader.Read()) { } string myQuery =
"UPDATE tbl_playersgame SET Foul_1 =
int foul = 0; CASE WHEN Foul_1 = 0 THEN 2 ELSE
Foul_1 END, "
foul = + "Foul_2 = CASE WHEN
Convert.ToInt32(sFoulA) + 1; Foul_1 != 0 AND Foul_2 = 0 THEN 2
ELSE Foul_2 END, "
sFoulA = + "Foul_3 = CASE WHEN
Convert.ToString(foul); Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 = 0 THEN 2 ELSE Foul_3 END, "
+ "Foul_4 = CASE WHEN
CountFoulQuarterA(); Foul_1 != 0 AND Foul_2 != 0 AND
txt1TFA.Text = Foul_3 != 0 AND Foul_4 = 0 THEN 2
sTeamFoulA; ELSE Foul_4 END, "

263
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "Foul_5 = CASE WHEN
Foul_1 != 0 AND Foul_2 != 0 AND lblNotif.Visible = true;
Foul_3 != 0 AND Foul_4 != 0 AND iDT = 4;
Foul_5 = 0 THEN 2 ELSE Foul_5 END "
+ "WHERE Last_Name || tmrNotif.Start();
', ' || First_Name || ' ' || }
Middle_Initial = '" + txtPlayerA.Text
+ "' " LoadTeamA();
+ "AND Jersey_Number }
= '" + sJerseyA + "' AND Team_Name =
'" + cmbTeamA.Text + "';"; catch
SQLiteConnection (SQLiteException ex)
myConnection = new {
SQLiteConnection(Conn.ConnString);
SQLiteCommand MessageBox.Show(ex.Message, "Error",
myCommand = new MessageBoxButtons.OK,
SQLiteCommand(myQuery, myConnection); MessageBoxIcon.Error);
SQLiteDataReader }
myReader;
finally
try {
{
myConnection.Close();
myConnection.Open(); }
myReader = }
myCommand.ExecuteReader();
while else if (rdb3rdP.Checked)
(myReader.Read()) { } {
string myQuery =
int foul = 0; "UPDATE tbl_playersgame SET Foul_1 =
CASE WHEN Foul_1 = 0 THEN 3 ELSE
foul = Foul_1 END, "
Convert.ToInt32(sFoulA) + 1; + "Foul_2 = CASE WHEN
Foul_1 != 0 AND Foul_2 = 0 THEN 3
sFoulA = ELSE Foul_2 END, "
Convert.ToString(foul); + "Foul_3 = CASE WHEN
Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 = 0 THEN 3 ELSE Foul_3 END, "
CountFoulQuarterA(); + "Foul_4 = CASE WHEN
txt2TFA.Text = Foul_1 != 0 AND Foul_2 != 0 AND
sTeamFoulA; Foul_3 != 0 AND Foul_4 = 0 THEN 3
ELSE Foul_4 END, "
FoulNotifA(); + "Foul_5 = CASE WHEN
Foul_1 != 0 AND Foul_2 != 0 AND
if (sFoulA == Foul_3 != 0 AND Foul_4 != 0 AND
"5") Foul_5 = 0 THEN 3 ELSE Foul_5 END "
{ + "WHERE Last_Name ||
', ' || First_Name || ' ' ||
btnOutA_Click(sender, e); Middle_Initial = '" + txtPlayerA.Text
+ "' "
lblNotif.Visible = false; + "AND Jersey_Number
lblNotif.Text = '" + sJerseyA + "' AND Team_Name =
= "Team A : " + txtPlayerA.Text + " '" + cmbTeamA.Text + "';";
has been set out due of having 5 SQLiteConnection
fouls."; myConnection = new
SQLiteConnection(Conn.ConnString);

264
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteCommand MessageBoxButtons.OK,
myCommand = new MessageBoxIcon.Error);
SQLiteCommand(myQuery, myConnection); }
SQLiteDataReader
myReader; finally
{
try
{ myConnection.Close();
}
myConnection.Open(); }
myReader =
myCommand.ExecuteReader(); else if (rdb4thP.Checked)
while {
(myReader.Read()) { } string myQuery =
"UPDATE tbl_playersgame SET Foul_1 =
int foul = 0; CASE WHEN Foul_1 = 0 THEN 4 ELSE
Foul_1 END, "
foul = + "Foul_2 = CASE WHEN
Convert.ToInt32(sFoulA) + 1; Foul_1 != 0 AND Foul_2 = 0 THEN 4
ELSE Foul_2 END, "
sFoulA = + "Foul_3 = CASE WHEN
Convert.ToString(foul); Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 = 0 THEN 4 ELSE Foul_3 END, "
+ "Foul_4 = CASE WHEN
CountFoulQuarterA(); Foul_1 != 0 AND Foul_2 != 0 AND
txt3TFA.Text = Foul_3 != 0 AND Foul_4 = 0 THEN 4
sTeamFoulA; ELSE Foul_4 END, "
+ "Foul_5 = CASE WHEN
FoulNotifA(); Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 != 0 AND Foul_4 != 0 AND
if (sFoulA == Foul_5 = 0 THEN 4 ELSE Foul_5 END "
"5") + "WHERE Last_Name ||
{ ', ' || First_Name || ' ' ||
Middle_Initial = '" + txtPlayerA.Text
btnOutA_Click(sender, e); + "' "
+ "AND Jersey_Number
lblNotif.Visible = false; = '" + sJerseyA + "' AND Team_Name =
lblNotif.Text '" + cmbTeamA.Text + "';";
= "Team A : " + txtPlayerA.Text + " SQLiteConnection
has been set out due of having 5 myConnection = new
fouls."; SQLiteConnection(Conn.ConnString);
SQLiteCommand
lblNotif.Visible = true; myCommand = new
iDT = 4; SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
tmrNotif.Start(); myReader;
}
try
LoadTeamA(); {
}
myConnection.Open();
catch myReader =
(SQLiteException ex) myCommand.ExecuteReader();
{ while
(myReader.Read()) { }
MessageBox.Show(ex.Message, "Error",

265
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
int foul = 0; string myQuery =
"UPDATE tbl_playersgame SET Foul_1 =
foul = CASE WHEN Foul_1 = 0 THEN 5 ELSE
Convert.ToInt32(sFoulA) + 1; Foul_1 END, "
+ "Foul_2 = CASE WHEN
sFoulA = Foul_1 != 0 AND Foul_2 = 0 THEN 5
Convert.ToString(foul); ELSE Foul_2 END, "
+ "Foul_3 = CASE WHEN
Foul_1 != 0 AND Foul_2 != 0 AND
CountFoulQuarterA(); Foul_3 = 0 THEN 5 ELSE Foul_3 END, "
txt4TFA.Text = + "Foul_4 = CASE WHEN
sTeamFoulA; Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 != 0 AND Foul_4 = 0 THEN 5
FoulNotifA(); ELSE Foul_4 END, "
+ "Foul_5 = CASE WHEN
if (sFoulA == Foul_1 != 0 AND Foul_2 != 0 AND
"5") Foul_3 != 0 AND Foul_4 != 0 AND
{ Foul_5 = 0 THEN 5 ELSE Foul_5 END "
+ "WHERE Last_Name ||
btnOutA_Click(sender, e); ', ' || First_Name || ' ' ||
Middle_Initial = '" + txtPlayerA.Text
lblNotif.Visible = false; + "' "
lblNotif.Text + "AND Jersey_Number
= "Team A : " + txtPlayerA.Text + " = '" + sJerseyA + "' AND Team_Name =
has been set out due of having 5 '" + cmbTeamA.Text + "';";
fouls."; SQLiteConnection
myConnection = new
lblNotif.Visible = true; SQLiteConnection(Conn.ConnString);
iDT = 4; SQLiteCommand
myCommand = new
tmrNotif.Start(); SQLiteCommand(myQuery, myConnection);
} SQLiteDataReader
myReader;
LoadTeamA();
} try
{
catch
(SQLiteException ex) myConnection.Open();
{ myReader =
myCommand.ExecuteReader();
MessageBox.Show(ex.Message, "Error", while
MessageBoxButtons.OK, (myReader.Read()) { }
MessageBoxIcon.Error);
} int foul = 0;

finally foul =
{ Convert.ToInt32(sFoulA) + 1;

myConnection.Close(); sFoulA =
} Convert.ToString(foul);
}

else if CountFoulQuarterA();
(rdbOTime.Checked) txtOTFA.Text =
{ sTeamFoulA;

266
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
FoulNotifA(); }

if (sFoulA == else
"5") {
{ string myQuery =
"UPDATE tbl_playersgame SET Foul_5 =
btnOutA_Click(sender, e); CASE WHEN Foul_5 != 0 THEN 0 ELSE
Foul_5 END, "
lblNotif.Visible = false; + "Foul_4 = CASE WHEN
lblNotif.Text Foul_5 = 0 AND Foul_4 != 0 THEN 0
= "Team A : " + txtPlayerA.Text + " ELSE Foul_4 END, "
has been set out due of having 5 + "Foul_3 = CASE WHEN
fouls."; Foul_5 = 0 AND Foul_4 = 0 AND Foul_3
!= 0 THEN 0 ELSE Foul_3 END, "
lblNotif.Visible = true; + "Foul_2 = CASE WHEN
iDT = 4; Foul_5 = 0 AND Foul_4 = 0 AND Foul_3
= 0 AND Foul_2 != 0 THEN 0 ELSE
tmrNotif.Start(); Foul_2 END, "
} + "Foul_1 = CASE WHEN
Foul_5 = 0 AND Foul_4 = 0 AND Foul_3
LoadTeamA(); = 0 AND Foul_2 = 0 AND Foul_1 != 0
} THEN 0 ELSE Foul_1 END "
+ "WHERE Last_Name ||
catch ', ' || First_Name || ' ' ||
(SQLiteException ex) Middle_Initial = '" + txtPlayerA.Text
{ + "' "
+ "AND Jersey_Number
MessageBox.Show(ex.Message, "Error", = '" + sJerseyA + "' AND Team_Name =
MessageBoxButtons.OK, '" + cmbTeamA.Text + "';";
MessageBoxIcon.Error); SQLiteConnection
} myConnection = new
SQLiteConnection(Conn.ConnString);
finally SQLiteCommand
{ myCommand = new
SQLiteCommand(myQuery, myConnection);
myConnection.Close(); SQLiteDataReader
} myReader;
}
try
PenaltyA(); {
TeamFoulA();
} myConnection.Open();
#endregion myReader =
myCommand.ExecuteReader();
#region -Foul A while
private void (myReader.Read()) { }
btnMFoulA_Click(object sender,
EventArgs e) int foul = 0;
{
if (sFoulA == "0") foul =
{ Convert.ToInt32(sFoulA) - 1;

MessageBox.Show(txtPlayerA.Text + " sFoulA =


have no foul to deduct.", "Foul", Convert.ToString(foul);
MessageBoxButtons.OK,
MessageBoxIcon.Error); QuarterValueA();

267
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
}
CountFoulQuarterA();
finally
lblNotif.Text = {
"Team A : " + txtPlayerA.Text + " got
foul deduction."; myConnection.Close();
lblNotif.Visible }
= true; }
iDT = 4;
tmrNotif.Start(); PenaltyA();
TeamFoulA();
if }
(rdb1stP.Checked) #endregion
{
txt1TFA.Text //------------------------//
= sTeamFoulA; Team B Foul
}
#region Count Foul B
else if void CountFoulB()
(rdb2ndP.Checked) {
{ string myQuery = "SELECT
txt2TFA.Text SUM(CASE WHEN Foul_1 != 0 THEN 1 ELSE
= sTeamFoulA; Foul_1 END) + SUM(CASE WHEN Foul_2 !=
} 0 THEN 1 ELSE Foul_2 END) "
+ "+ SUM(CASE WHEN Foul_3
else if != 0 THEN 1 ELSE Foul_3 END)+
(rdb3rdP.Checked) SUM(CASE WHEN Foul_4 != 0 THEN 1 ELSE
{ Foul_4 END) "
txt3TFA.Text + "+ SUM(CASE WHEN Foul_5
= sTeamFoulA; != 0 THEN 1 ELSE Foul_5 END) FROM
} tbl_playersgame "
+ "WHERE Last_Name || ',
else if ' || First_Name || ' ' ||
(rdb4thP.Checked) Middle_Initial = '" + txtPlayerB.Text
{ + "' "
txt4TFA.Text + "AND Jersey_Number = '"
= sTeamFoulA; + sJerseyB + "' AND Team_Name = '" +
} cmbTeamB.Text + "';";
SQLiteConnection
else if myConnection = new
(rdbOTime.Checked) SQLiteConnection(Conn.ConnString);
{ SQLiteCommand myCommand =
txtOTFA.Text new SQLiteCommand(myQuery,
= sTeamFoulA; myConnection);
} SQLiteDataReader
myReader;
LoadTeamA();
} try
{
catch myConnection.Open();
(SQLiteException ex) myReader =
{ myCommand.ExecuteReader();
while
MessageBox.Show(ex.Message, "Error", (myReader.Read())
MessageBoxButtons.OK, {
MessageBoxIcon.Error);

268
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
sFoulB = string myQuery = "SELECT
myReader.GetValue(0).ToString(); SUM(CASE WHEN Foul_1 = " + sQValueB +
} " THEN 1 ELSE 0 END) + SUM(CASE WHEN
} Foul_2 = " + sQValueB + " THEN 1 ELSE
0 END) + "
catch (SQLiteException + "SUM(CASE WHEN Foul_3 =
ex) " + sQValueB + " THEN 1 ELSE 0 END) +
{ SUM(CASE WHEN Foul_4 = " + sQValueB +
" THEN 1 ELSE 0 END) + "
MessageBox.Show(ex.Message, "Error", + "SUM(CASE WHEN Foul_5 =
MessageBoxButtons.OK, " + sQValueB + " THEN 1 ELSE 0 END)
MessageBoxIcon.Error); FROM tbl_playersgame WHERE Team_Name
} = '" + cmbTeamB.Text + "';";
SQLiteConnection
finally myConnection = new
{ SQLiteConnection(Conn.ConnString);
myConnection.Close(); SQLiteCommand myCommand =
} new SQLiteCommand(myQuery,
} myConnection);
#endregion SQLiteDataReader
myReader;
#region Quarter Value B
void QuarterValueB() try
{ {
if (rdb1stP.Checked) myConnection.Open();
{ myReader =
sQValueB = "1"; myCommand.ExecuteReader();
} while
(myReader.Read())
else if (rdb2ndP.Checked) {
{ sTeamFoulB =
sQValueB = "2"; myReader.GetValue(0).ToString();
} }
}
else if (rdb3rdP.Checked)
{ catch (SQLiteException
sQValueB = "3"; ex)
} {

else if (rdb4thP.Checked) MessageBox.Show(ex.Message, "Error",


{ MessageBoxButtons.OK,
sQValueB = "4"; MessageBoxIcon.Error);
} }

else if finally
(rdbOTime.Checked) {
{ myConnection.Close();
sQValueB = "5"; }
} }
} #endregion
#endregion
#region Penalty B
#region Count Team Foul per void PenaltyB()
Quarter B {
void CountFoulQuarterB() int f = 0, o = 0;
{

269
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
if (rdb1stP.Checked && string myQuery =
Int32.TryParse(txt1TFB.Text, out f) "UPDATE tbl_teamsgame SET
&& f >= 5) FirstP_Team_Foul = '" + txt1TFB.Text
{ + "' WHERE Team_Name = '" +
txtPenaltyB.Visible = cmbTeamB.Text + "';";
true; SQLiteConnection
} myConnection = new
SQLiteConnection(Conn.ConnString);
else if (rdb2ndP.Checked SQLiteCommand
&& Int32.TryParse(txt2TFB.Text, out myCommand = new
f) && f >= 5) SQLiteCommand(myQuery, myConnection);
{ SQLiteDataReader
txtPenaltyB.Visible = myReader;
true;
} try
{
else if (rdb3rdP.Checked
&& Int32.TryParse(txt3TFB.Text, out myConnection.Open();
f) && f >= 5) myReader =
{ myCommand.ExecuteReader();
txtPenaltyB.Visible = while
true; (myReader.Read()) { }
} }

else if catch
((rdb4thP.Checked) && (SQLiteException ex)
Int32.TryParse(txt4TFB.Text, out f) {
&& f >= 5)
{ MessageBox.Show(ex.Message, "Error",
txtPenaltyB.Visible = MessageBoxButtons.OK,
true; MessageBoxIcon.Error);
} }

else if (rdbOTime.Checked finally


&& Int32.TryParse(txtOTFB.Text, out {
o) && Int32.TryParse(txt4TFB.Text,
out f) && (f + o) >= 5) myConnection.Close();
{ }
txtPenaltyB.Visible = }
true;
} else if (rdb2ndP.Checked)
{
else string myQuery =
{ "UPDATE tbl_teamsgame SET
txtPenaltyB.Visible = SecondP_Team_Foul = '" + txt2TFB.Text
false; + "' WHERE Team_Name = '" +
} cmbTeamB.Text + "';";
} SQLiteConnection
#endregion myConnection = new
SQLiteConnection(Conn.ConnString);
#region Team Foul B SQLiteCommand
void TeamFoulB() myCommand = new
{ SQLiteCommand(myQuery, myConnection);
if (rdb1stP.Checked) SQLiteDataReader
{ myReader;

270
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
try
{ MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
myConnection.Open(); MessageBoxIcon.Error);
myReader = }
myCommand.ExecuteReader();
while finally
(myReader.Read()) { } {
}
myConnection.Close();
catch }
(SQLiteException ex) }
{
else if (rdb4thP.Checked)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK, string myQuery =
MessageBoxIcon.Error); "UPDATE tbl_teamsgame SET
} FourthP_Team_Foul = '" + txt4TFB.Text
+ "' WHERE Team_Name = '" +
finally cmbTeamB.Text + "';";
{ SQLiteConnection
myConnection = new
myConnection.Close(); SQLiteConnection(Conn.ConnString);
} SQLiteCommand
} myCommand = new
SQLiteCommand(myQuery, myConnection);
else if (rdb3rdP.Checked) SQLiteDataReader
{ myReader;
string myQuery =
"UPDATE tbl_teamsgame SET try
ThirdP_Team_Foul = '" + txt3TFB.Text {
+ "' WHERE Team_Name = '" +
cmbTeamB.Text + "';"; myConnection.Open();
SQLiteConnection myReader =
myConnection = new myCommand.ExecuteReader();
SQLiteConnection(Conn.ConnString); while
SQLiteCommand (myReader.Read()) { }
myCommand = new }
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader catch
myReader; (SQLiteException ex)
{
try
{ MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
myConnection.Open(); MessageBoxIcon.Error);
myReader = }
myCommand.ExecuteReader();
while finally
(myReader.Read()) { } {
}
myConnection.Close();
catch }
(SQLiteException ex) }
{

271
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
else if {
(rdbOTime.Checked) ext = "nd";
{ }
string myQuery =
"UPDATE tbl_teamsgame SET else if (sFoulB == "3")
Overtime_Team_Foul = '" + {
txtOTFB.Text + "' WHERE Team_Name = ext = "rd";
'" + cmbTeamB.Text + "';"; }
SQLiteConnection
myConnection = new else if (sFoulB == "4" ||
SQLiteConnection(Conn.ConnString); sFoulB == "5")
SQLiteCommand {
myCommand = new ext = "th";
SQLiteCommand(myQuery, myConnection); }
SQLiteDataReader
myReader; lblNotif.Text = "Team B :
" + txtPlayerB.Text + " got " +
try sFoulB + ext + " personal foul.";
{ lblNotif.Visible = true;
iDT = 4;
myConnection.Open(); tmrNotif.Start();
myReader = }
myCommand.ExecuteReader();
while private void
(myReader.Read()) { } btnPFoulB_Click(object sender,
} EventArgs e)
{
catch QuarterValueB();
(SQLiteException ex)
{ if (sInB == "Out")
{
MessageBox.Show(ex.Message, "Error", MessageBox.Show("You
MessageBoxButtons.OK, are trying to foul an out playing
MessageBoxIcon.Error); player.", "Foul",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
finally }
{
else if (sFoulB == "5")
myConnection.Close(); {
}
} MessageBox.Show(txtPlayerB.Text + "
} is already fouled out.", "Foul",
#endregion MessageBoxButtons.OK,
MessageBoxIcon.Error);
#region Foul B }
void FoulNotifB()
{ else if (rdb1stP.Checked)
string ext = ""; {
string myQuery =
if (sFoulB == "1") "UPDATE tbl_playersgame SET Foul_1 =
{ CASE WHEN Foul_1 = 0 THEN 1 ELSE
ext = "st"; Foul_1 END, "
} + "Foul_2 = CASE WHEN
Foul_1 != 0 AND Foul_2 = 0 THEN 1
else if (sFoulB == "2") ELSE Foul_2 END, "

272
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "Foul_3 = CASE WHEN
Foul_1 != 0 AND Foul_2 != 0 AND lblNotif.Visible = false;
Foul_3 = 0 THEN 1 ELSE Foul_3 END, " lblNotif.Text
+ "Foul_4 = CASE WHEN = "Team B : " + txtPlayerB.Text + "
Foul_1 != 0 AND Foul_2 != 0 AND has been set out due of having 5
Foul_3 != 0 AND Foul_4 = 0 THEN 1 fouls.";
ELSE Foul_4 END, "
+ "Foul_5 = CASE WHEN lblNotif.Visible = true;
Foul_1 != 0 AND Foul_2 != 0 AND iDT = 4;
Foul_3 != 0 AND Foul_4 != 0 AND
Foul_5 = 0 THEN 1 ELSE Foul_5 END " tmrNotif.Start();
+ "WHERE Last_Name || }
', ' || First_Name || ' ' ||
Middle_Initial = '" + txtPlayerB.Text LoadTeamB();
+ "' " }
+ "AND Jersey_Number
= '" + sJerseyB + "' AND Team_Name = catch
'" + cmbTeamB.Text + "';"; (SQLiteException ex)
SQLiteConnection {
myConnection = new
SQLiteConnection(Conn.ConnString); MessageBox.Show(ex.Message, "Error",
SQLiteCommand MessageBoxButtons.OK,
myCommand = new MessageBoxIcon.Error);
SQLiteCommand(myQuery, myConnection); }
SQLiteDataReader
myReader; finally
{
try
{ myConnection.Close();
}
myConnection.Open(); }
myReader =
myCommand.ExecuteReader(); else if (rdb2ndP.Checked)
while {
(myReader.Read()) { } string myQuery =
"UPDATE tbl_playersgame SET Foul_1 =
int foul = 0; CASE WHEN Foul_1 = 0 THEN 2 ELSE
Foul_1 END, "
foul = + "Foul_2 = CASE WHEN
Convert.ToInt32(sFoulB) + 1; Foul_1 != 0 AND Foul_2 = 0 THEN 2
ELSE Foul_2 END, "
sFoulB = + "Foul_3 = CASE WHEN
Convert.ToString(foul); Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 = 0 THEN 2 ELSE Foul_3 END, "
+ "Foul_4 = CASE WHEN
CountFoulQuarterB(); Foul_1 != 0 AND Foul_2 != 0 AND
txt1TFB.Text = Foul_3 != 0 AND Foul_4 = 0 THEN 2
sTeamFoulB; ELSE Foul_4 END, "
+ "Foul_5 = CASE WHEN
FoulNotifB(); Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 != 0 AND Foul_4 != 0 AND
if (sFoulB == Foul_5 = 0 THEN 2 ELSE Foul_5 END "
"5") + "WHERE Last_Name ||
{ ', ' || First_Name || ' ' ||
Middle_Initial = '" + txtPlayerB.Text
btnOutB_Click(sender, e); + "' "

273
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "AND Jersey_Number
= '" + sJerseyB + "' AND Team_Name = catch
'" + cmbTeamB.Text + "';"; (SQLiteException ex)
SQLiteConnection {
myConnection = new
SQLiteConnection(Conn.ConnString); MessageBox.Show(ex.Message, "Error",
SQLiteCommand MessageBoxButtons.OK,
myCommand = new MessageBoxIcon.Error);
SQLiteCommand(myQuery, myConnection); }
SQLiteDataReader
myReader; finally
{
try
{ myConnection.Close();
}
myConnection.Open(); }
myReader =
myCommand.ExecuteReader(); else if (rdb3rdP.Checked)
while {
(myReader.Read()) { } string myQuery =
"UPDATE tbl_playersgame SET Foul_1 =
int foul = 0; CASE WHEN Foul_1 = 0 THEN 3 ELSE
Foul_1 END, "
foul = + "Foul_2 = CASE WHEN
Convert.ToInt32(sFoulB) + 1; Foul_1 != 0 AND Foul_2 = 0 THEN 3
ELSE Foul_2 END, "
sFoulB = + "Foul_3 = CASE WHEN
Convert.ToString(foul); Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 = 0 THEN 3 ELSE Foul_3 END, "
+ "Foul_4 = CASE WHEN
CountFoulQuarterB(); Foul_1 != 0 AND Foul_2 != 0 AND
txt2TFB.Text = Foul_3 != 0 AND Foul_4 = 0 THEN 3
sTeamFoulB; ELSE Foul_4 END, "
+ "Foul_5 = CASE WHEN
FoulNotifB(); Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 != 0 AND Foul_4 != 0 AND
if (sFoulB == Foul_5 = 0 THEN 3 ELSE Foul_5 END "
"5") + "WHERE Last_Name ||
{ ', ' || First_Name || ' ' ||
Middle_Initial = '" + txtPlayerB.Text
btnOutB_Click(sender, e); + "' "
+ "AND Jersey_Number
lblNotif.Visible = false; = '" + sJerseyB + "' AND Team_Name =
lblNotif.Text '" + cmbTeamB.Text + "';";
= "Team B : " + txtPlayerB.Text + " SQLiteConnection
has been set out due of having 5 myConnection = new
fouls."; SQLiteConnection(Conn.ConnString);
SQLiteCommand
lblNotif.Visible = true; myCommand = new
iDT = 4; SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
tmrNotif.Start(); myReader;
}
try
LoadTeamB(); {
}

274
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
}
myConnection.Open(); }
myReader =
myCommand.ExecuteReader(); else if (rdb4thP.Checked)
while {
(myReader.Read()) { } string myQuery =
"UPDATE tbl_playersgame SET Foul_1 =
int foul = 0; CASE WHEN Foul_1 = 0 THEN 4 ELSE
Foul_1 END, "
foul = + "Foul_2 = CASE WHEN
Convert.ToInt32(sFoulB) + 1; Foul_1 != 0 AND Foul_2 = 0 THEN 4
ELSE Foul_2 END, "
sFoulB = + "Foul_3 = CASE WHEN
Convert.ToString(foul); Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 = 0 THEN 4 ELSE Foul_3 END, "
+ "Foul_4 = CASE WHEN
CountFoulQuarterB(); Foul_1 != 0 AND Foul_2 != 0 AND
txt3TFB.Text = Foul_3 != 0 AND Foul_4 = 0 THEN 4
sTeamFoulB; ELSE Foul_4 END, "
+ "Foul_5 = CASE WHEN
FoulNotifB(); Foul_1 != 0 AND Foul_2 != 0 AND
Foul_3 != 0 AND Foul_4 != 0 AND
if (sFoulB == Foul_5 = 0 THEN 4 ELSE Foul_5 END "
"5") + "WHERE Last_Name ||
{ ', ' || First_Name || ' ' ||
Middle_Initial = '" + txtPlayerB.Text
btnOutB_Click(sender, e); + "' "
+ "AND Jersey_Number
lblNotif.Visible = false; = '" + sJerseyB + "' AND Team_Name =
lblNotif.Text '" + cmbTeamB.Text + "';";
= "Team B : " + txtPlayerB.Text + " SQLiteConnection
has been set out due of having 5 myConnection = new
fouls."; SQLiteConnection(Conn.ConnString);
SQLiteCommand
lblNotif.Visible = true; myCommand = new
iDT = 4; SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
tmrNotif.Start(); myReader;
}
try
LoadTeamB(); {
}
myConnection.Open();
catch myReader =
(SQLiteException ex) myCommand.ExecuteReader();
{ while
(myReader.Read()) { }
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, int foul = 0;
MessageBoxIcon.Error);
} foul =
Convert.ToInt32(sFoulB) + 1;
finally
{ sFoulB =
Convert.ToString(foul);
myConnection.Close();

275
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
+ "Foul_3 = CASE WHEN
CountFoulQuarterB(); Foul_1 != 0 AND Foul_2 != 0 AND
txt4TFB.Text = Foul_3 = 0 THEN 5 ELSE Foul_3 END, "
sTeamFoulB; + "Foul_4 = CASE WHEN
Foul_1 != 0 AND Foul_2 != 0 AND
FoulNotifB(); Foul_3 != 0 AND Foul_4 = 0 THEN 5
ELSE Foul_4 END, "
if (sFoulB == + "Foul_5 = CASE WHEN
"5") Foul_1 != 0 AND Foul_2 != 0 AND
{ Foul_3 != 0 AND Foul_4 != 0 AND
Foul_5 = 0 THEN 5 ELSE Foul_5 END "
btnOutB_Click(sender, e); + "WHERE Last_Name ||
', ' || First_Name || ' ' ||
lblNotif.Visible = false; Middle_Initial = '" + txtPlayerB.Text
lblNotif.Text + "' "
= "Team B : " + txtPlayerB.Text + " + "AND Jersey_Number
has been set out due of having 5 = '" + sJerseyB + "' AND Team_Name =
fouls."; '" + cmbTeamB.Text + "';";
SQLiteConnection
lblNotif.Visible = true; myConnection = new
iDT = 4; SQLiteConnection(Conn.ConnString);
SQLiteCommand
tmrNotif.Start(); myCommand = new
} SQLiteCommand(myQuery, myConnection);
SQLiteDataReader
LoadTeamB(); myReader;
}
try
catch {
(SQLiteException ex)
{ myConnection.Open();
myReader =
MessageBox.Show(ex.Message, "Error", myCommand.ExecuteReader();
MessageBoxButtons.OK, while
MessageBoxIcon.Error); (myReader.Read()) { }
}
int foul = 0;
finally
{ foul =
Convert.ToInt32(sFoulB) + 1;
myConnection.Close();
} sFoulB =
} Convert.ToString(foul);

else if
(rdbOTime.Checked) CountFoulQuarterB();
{ txtOTFB.Text =
string myQuery = sTeamFoulB;
"UPDATE tbl_playersgame SET Foul_1 =
CASE WHEN Foul_1 = 0 THEN 5 ELSE FoulNotifB();
Foul_1 END, "
+ "Foul_2 = CASE WHEN if (sFoulB ==
Foul_1 != 0 AND Foul_2 = 0 THEN 5 "5")
ELSE Foul_2 END, " {

btnOutB_Click(sender, e);

276
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
CASE WHEN Foul_5 != 0 THEN 0 ELSE
lblNotif.Visible = false; Foul_5 END, "
lblNotif.Text + "Foul_4 = CASE WHEN
= "Team B : " + txtPlayerB.Text + " Foul_5 = 0 AND Foul_4 != 0 THEN 0
has been set out due of having 5 ELSE Foul_4 END, "
fouls."; + "Foul_3 = CASE WHEN
Foul_5 = 0 AND Foul_4 = 0 AND Foul_3
lblNotif.Visible = true; != 0 THEN 0 ELSE Foul_3 END, "
iDT = 4; + "Foul_2 = CASE WHEN
Foul_5 = 0 AND Foul_4 = 0 AND Foul_3
tmrNotif.Start(); = 0 AND Foul_2 != 0 THEN 0 ELSE
} Foul_2 END, "
+ "Foul_1 = CASE WHEN
LoadTeamB(); Foul_5 = 0 AND Foul_4 = 0 AND Foul_3
} = 0 AND Foul_2 = 0 AND Foul_1 != 0
THEN 0 ELSE Foul_1 END "
catch + "WHERE Last_Name ||
(SQLiteException ex) ', ' || First_Name || ' ' ||
{ Middle_Initial = '" + txtPlayerB.Text
+ "' "
MessageBox.Show(ex.Message, "Error", + "AND Jersey_Number
MessageBoxButtons.OK, = '" + sJerseyB + "' AND Team_Name =
MessageBoxIcon.Error); '" + cmbTeamB.Text + "';";
} SQLiteConnection
myConnection = new
finally SQLiteConnection(Conn.ConnString);
{ SQLiteCommand
myCommand = new
myConnection.Close(); SQLiteCommand(myQuery, myConnection);
} SQLiteDataReader
} myReader;

PenaltyB(); try
TeamFoulB(); {
}
#endregion myConnection.Open();
myReader =
#region -Foul B myCommand.ExecuteReader();
private void while
btnMFoulB_Click(object sender, (myReader.Read()) { }
EventArgs e)
{ int foul = 0;
if (sFoulB == "0")
{ foul =
Convert.ToInt32(sFoulB) - 1;
MessageBox.Show(txtPlayerB.Text + "
have no foul to deduct.", "Foul", sFoulB =
MessageBoxButtons.OK, Convert.ToString(foul);
MessageBoxIcon.Error);
} QuarterValueB();

else CountFoulQuarterB();
{
string myQuery = lblNotif.Text =
"UPDATE tbl_playersgame SET Foul_5 = "Team B : " + txtPlayerB.Text + " got
foul deduction.";

277
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
lblNotif.Visible }
= true; }
iDT = 4;
tmrNotif.Start(); PenaltyB();
TeamFoulB();
if }
(rdb1stP.Checked) #endregion
{
txt1TFB.Text //------------------------//
= sTeamFoulB; Officials
}
#region Add Officials
else if private void
(rdb2ndP.Checked) btnOAdd_Click(object sender,
{ EventArgs e)
txt2TFB.Text {
= sTeamFoulB; pnlSOfficials.Enabled =
} true;
btnOEdit.Enabled = false;
else if btnOCancel.Enabled =
(rdb3rdP.Checked) true;
{ btnOSave.Enabled = true;
txt3TFB.Text btnOAdd.Enabled = false;
= sTeamFoulB; sTOfficials = "Add";
} }
#endregion
else if
(rdb4thP.Checked) #region Edit Officials
{ private void
txt4TFB.Text btnOEdit_Click(object sender,
= sTeamFoulB; EventArgs e)
} {
pnlSOfficials.Enabled =
else if true;
(rdbOTime.Checked) btnOEdit.Enabled = false;
{ btnOCancel.Enabled =
txtOTFB.Text true;
= sTeamFoulB; btnOSave.Enabled = true;
} btnOAdd.Enabled = false;
sTOfficials = "Edit";
LoadTeamB(); }
} #endregion

catch #region Cancel Officials


(SQLiteException ex) private void
{ btnOCancel_Click(object sender,
EventArgs e)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK, if (sTOfficials == "Add")
MessageBoxIcon.Error); {
}
txtCSCoordinator.Clear();
finally txtBScorer.Clear();
{ txtCScorer.Clear();
txtTimer.Clear();
myConnection.Close(); txtAnnouncer.Clear();

278
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

txt24COperator.Clear(); txtAnnouncer.Text =
txtUtility.Clear(); myReader.GetValue(6).ToString();

txtHTechnical.Clear(); txt24COperator.Text =
txtReferee.Clear(); myReader.GetValue(7).ToString();
txtUmpire1.Clear();
txtUmpire2.Clear(); txtUtility.Text =
myReader.GetValue(8).ToString();
pnlSOfficials.Enabled
= false; txtHTechnical.Text =
btnOCancel.Enabled = myReader.GetValue(9).ToString();
false;
btnOSave.Enabled = txtReferee.Text =
false; myReader.GetValue(10).ToString();
btnOAdd.Enabled =
true; txtUmpire1.Text =
sTOfficials = ""; myReader.GetValue(11).ToString();
}
txtUmpire2.Text =
else if (sTOfficials == myReader.GetValue(12).ToString();
"Edit") }
{ }
string myQuery =
"SELECT * FROM tbl_gameofficials"; catch
SQLiteConnection (SQLiteException ex)
myConnection = new {
SQLiteConnection(Conn.ConnString);
SQLiteCommand MessageBox.Show(ex.Message, "Error",
myCommand = new MessageBoxButtons.OK,
SQLiteCommand(myQuery, myConnection); MessageBoxIcon.Error);
SQLiteDataReader }
myReader;
finally
try {
{
myConnection.Close();
myConnection.Open(); }
myReader =
myCommand.ExecuteReader(); pnlSOfficials.Enabled
while = false;
(myReader.Read()) btnOCancel.Enabled =
{ false;
btnOSave.Enabled =
txtCSCoordinator.Text = false;
myReader.GetValue(2).ToString(); btnOEdit.Enabled =
true;
txtBScorer.Text = sTOfficials = "";
myReader.GetValue(3).ToString(); }
}
txtCScorer.Text = #endregion
myReader.GetValue(4).ToString();
txtTimer.Text #region Save Officials
= myReader.GetValue(5).ToString(); private void
btnOSave_Click(object sender,
EventArgs e)

279
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{ clock operator.", "Officials",
if (txtCSCoordinator.Text MessageBoxButtons.OK,
== "") MessageBoxIcon.Error);
{ }

MessageBox.Show("Please input city else if (txtUtility.Text


sports coordinator.", "Officials", == "")
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show("Please input
utility.", "Officials",
else if (txtBScorer.Text MessageBoxButtons.OK,
== "") MessageBoxIcon.Error);
{ }

MessageBox.Show("Please input board else if


scorer.", "Officials", (txtHTechnical.Text == "")
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show("Please input Head
Technical.", "Officials",
else if (txtCScorer.Text MessageBoxButtons.OK,
== "") MessageBoxIcon.Error);
{ }

MessageBox.Show("Please input else if (txtReferee.Text


computer scorer.", "Officials", == "")
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show("Please input
Referee.", "Officials",
else if (txtTimer.Text == MessageBoxButtons.OK,
"") MessageBoxIcon.Error);
{ }

MessageBox.Show("Please input else if (txtUmpire1.Text


timer.", "Officials", == "")
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show("Please input Umpire
1.", "Officials",
else if MessageBoxButtons.OK,
(txtAnnouncer.Text == "") MessageBoxIcon.Error);
{ }

MessageBox.Show("Please input else if (txtUmpire2.Text


announcer.", "Officials", == "")
MessageBoxButtons.OK, {
MessageBoxIcon.Error);
} MessageBox.Show("Please input Umpire
2.", "Officials",
else if MessageBoxButtons.OK,
(txt24COperator.Text == "") MessageBoxIcon.Error);
{ }

MessageBox.Show("Please input 24

280
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
else if (sTOfficials == + "Head_Technical =
"Add" || sTOfficials == "Edit") '" + txtHTechnical.Text + "', Referee
{ = '" + txtReferee.Text + "', "
string myQuery = + "Umpire_1 = '" +
"INSERT INTO txtUmpire1.Text + "', Umpire_2 = '" +
tbl_gameofficials(Game_Number) txtUmpire2.Text + "';";
VALUES('" + txtGGNumber.Text + "');"; SQLiteConnection
SQLiteConnection myConnection1 = new
myConnection = new SQLiteConnection(Conn.ConnString);
SQLiteConnection(Conn.ConnString); SQLiteCommand
SQLiteCommand myCommand1 = new
myCommand = new SQLiteCommand(myQuery1,
SQLiteCommand(myQuery, myConnection); myConnection1);
SQLiteDataReader SQLiteDataReader
myReader; myReader1;

try try
{ {

myConnection.Open(); myConnection1.Open();
myReader = myReader1 =
myCommand.ExecuteReader(); myCommand1.ExecuteReader();
while while
(myReader.Read()) { } (myReader1.Read()) { }
}
if (sTOfficials
catch == "Add")
(SQLiteException ex) {
{
MessageBox.Show("Officials has been
MessageBox.Show(ex.Message, "Error", saved.", "Officials",
MessageBoxButtons.OK, MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBoxIcon.Information);
} pnlG.Visible
= false;
finally
{ tsGame.Enabled = true;

myConnection.Close();
} tsGame.ForeColor =
Color.FromArgb(236, 189, 0);
string myQuery1 =
"UPDATE tbl_gameofficials SET tsOfficials.ForeColor = Color.White;
City_Sports_Coordinator = '" +
txtCSCoordinator.Text + "', " pnlMOfficials.Visible = false;
+ "Board_Scorer = '"
+ txtBScorer.Text + "', pnlMGame.Visible = true;
Computer_Scorer = '" + }
txtCScorer.Text + "', "
+ "Timer = '" + else if
txtTimer.Text + "', Announcer = '" + (sTOfficials == "Edit")
txtAnnouncer.Text + "', " {
+
"Twentyfour_Clock_Operator = '" + MessageBox.Show("Officials has been
txt24COperator.Text + "', Utility = edited.", "Officials",
'" + txtUtility.Text + "', "

281
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
MessageBoxButtons.OK,
MessageBoxIcon.Information); Login w = new
} Login();
this.Hide();
w.Show();
pnlSOfficials.Enabled = false; }
}
btnOCancel.Enabled = false;
btnOSave.Enabled private void
= false; Game_FormClosing(object sender,
btnOEdit.Enabled FormClosingEventArgs e)
= true; {
sTOfficials = ""; if (e.CloseReason ==
} CloseReason.UserClosing)
{
catch dynamic dialog =
(SQLiteException ex) MessageBox.Show("Are you sure you
{ want to exit the program?", "Exit",
MessageBoxButtons.YesNo,
MessageBox.Show(ex.Message, "Error", MessageBoxIcon.Question);
MessageBoxButtons.OK, if (dialog ==
MessageBoxIcon.Error); DialogResult.No)
} {
e.Cancel = true;
finally }
{
else if (dialog ==
myConnection1.Close(); DialogResult.Yes)
} {
} e.Cancel = false;
}
#endregion Application.Exit();
}
//------------------------// }
Logout, Exit and Shortcuts }
#endregion
#region Logout and Exit
private void #region Shortcuts
tsLogout_Click(object sender, private void
EventArgs e) Game_KeyDown(object sender,
{ KeyEventArgs e)
dynamic dialog = {
MessageBox.Show("Are you sure you if (pnlMGame.Visible ==
want to logout?", "Logout", true && btnEGame.Visible == true)
MessageBoxButtons.YesNo, {
MessageBoxIcon.Question); if (!e.Shift &&
if (dialog == !e.Control && !e.Alt)
DialogResult.No) {
{ } #region Lock A
if
else if (dialog == (chkLockA.Enabled == true)
DialogResult.Yes) {
{ if
ClearAllTeams(); (!chkLockA.Checked)
ClearAllPlayers(); {
ClearOfficials();

282
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
if {
(e.KeyCode == Keys.Z) if
{ (e.KeyCode == Keys.A)
{
chkLockA.Checked = true;
} btnTOutA_Click(sender, e);
} }
}
else if #endregion
(chkLockA.Checked) }
{
if if
(e.KeyCode == Keys.X) (rdbFSB.Checked)
{ {
#region Time-
chkLockA.Checked = false; out B
} if
} (btnTOutB.Enabled == true)
} {
#endregion if
(e.KeyCode == Keys.K)
#region Lock B {
if
(chkLockB.Enabled == true) btnTOutB_Click(sender, e);
{ }
if }
(!chkLockB.Checked) #endregion
{ }
if
(e.KeyCode == Keys.Oemcomma) if
{ (rdbAPA.Checked)
{
chkLockB.Checked = true; #region In A
} if
} (btnInA.Enabled == true)
{
else if if
(chkLockB.Checked) (e.KeyCode == Keys.E)
{ {
if
(e.KeyCode == Keys.OemPeriod) btnInA_Click(sender, e);
{ }
}
chkLockB.Checked = false; #endregion
}
} #region Out A
} if
#endregion (btnOutA.Enabled == true)
{
if if
(rdbFSA.Checked) (e.KeyCode == Keys.R)
{ {
#region Time-
out A btnOutA_Click(sender, e);
if }
(btnTOutA.Enabled == true) }

283
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
#endregion {
}
rdbFSA.Checked = false;
if
(rdbAPB.Checked) rdbAPA.Checked = true;
{
#region In B
if ScoreFoulAPA();
(btnInB.Enabled == true) }
{ }
if #endregion
(e.KeyCode == Keys.P)
{ #region Score-
Foul-AP B
btnInB_Click(sender, e); if
} (rdbFSB.Enabled == true)
} {
#endregion if (e.KeyCode
== Keys.L)
#region Out B {
if
(btnOutB.Enabled == true) rdbFSB.Checked = true;
{
if rdbAPB.Checked = false;
(e.KeyCode == Keys.OemOpenBrackets)
{
ScoreFoulAPB();
btnOutB_Click(sender, e); }
} }
}
#endregion if
} (rdbAPB.Enabled == true)
{
#region Score- if (e.KeyCode
Foul-AP A == Keys.OemSemicolon)
if {
(rdbFSA.Enabled == true)
{ rdbFSB.Checked = false;
if (e.KeyCode
== Keys.S) rdbAPB.Checked = true;
{

rdbFSA.Checked = true; ScoreFoulAPB();


}
rdbAPA.Checked = false; }
#endregion

ScoreFoulAPA(); if
} (rdbFSA.Checked)
} {
#region
if Scoring and Foul A
(rdbAPA.Enabled == true) if
{ (pnlTeamSSA.Enabled == true &&
if (e.KeyCode btnP1A.Visible == true)
== Keys.D) {

284
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
if #endregion
(e.KeyCode == Keys.D1) }
{
if
btnP1A_Click(sender, e); (rdbFSB.Checked)
} {
#region
if Scoring and Foul B
(e.KeyCode == Keys.D2) if
{ (pnlTeamSSB.Enabled == true &&
btnP1B.Visible == true)
btnP2A_Click(sender, e); {
} if
(e.KeyCode == Keys.D7)
if {
(e.KeyCode == Keys.D3)
{ btnP1B_Click(sender, e);
}
btnP3A_Click(sender, e);
} if
(e.KeyCode == Keys.D8)
if {
(e.KeyCode == Keys.D4)
{ btnP2B_Click(sender, e);
}
btnM1A_Click(sender, e);
} if
(e.KeyCode == Keys.D9)
if {
(e.KeyCode == Keys.D5)
{ btnP3B_Click(sender, e);
}
btnM2A_Click(sender, e);
} if
(e.KeyCode == Keys.D0)
if {
(e.KeyCode == Keys.D6)
{ btnM1B_Click(sender, e);
}
btnM3A_Click(sender, e);
} if
(e.KeyCode == Keys.OemMinus)
if {
(e.KeyCode == Keys.Q)
{ btnM2B_Click(sender, e);
}
btnPFoulA_Click(sender, e);
} if
(e.KeyCode == Keys.Oemplus)
if {
(e.KeyCode == Keys.W)
{ btnM3B_Click(sender, e);
}
btnMFoulA_Click(sender, e);
} if
} (e.KeyCode == Keys.I)

285
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{
btnEGame_Click(sender, e);
btnPFoulB_Click(sender, e); }
} }
#endregion
if
(e.KeyCode == Keys.O) #region Clear
{ Game
if
btnMFoulB_Click(sender, e); (btnCGame.Enabled == true)
} {
} if (e.KeyCode
#endregion == Keys.F11)
} {

#region Periods btnCGame_Click(sender, e);


if }
(pnlPeriods.Enabled == true) }
{ #endregion
if (e.KeyCode }
== Keys.F2) }
{ }
#endregion
rdb2ndP_Click(sender, e);
} //------------------------//
End Game & Clear Game
if (e.KeyCode
== Keys.F3) #region End Game
{ private void
btnEGame_Click(object sender,
rdb3rdP_Click(sender, e); EventArgs e)
} {
if (txtCSCoordinator.Text
if (e.KeyCode == "")
== Keys.F4) {
{
MessageBox.Show("Please fill up first
rdb4thP_Click(sender, e); the set of officials.", "End Game",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
if (e.KeyCode }
== Keys.F5)
{ else
{
rdbOtime_Click(sender, e); if (rdb1stP.Checked
} == true || rdb3rdP.Checked == true ||
} rdb4thP.Checked == true)
#endregion {
sEGame = "def";
#region End Game }
if
(btnEGame.Enabled == true) else
{ {
if (e.KeyCode sEGame = "gf";
== Keys.F10) }
{

286
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
sTNameA =
cmbTeamA.Text; MessageBox.Show(ex.Message, "Error",
sTNameB = MessageBoxButtons.OK,
cmbTeamB.Text; MessageBoxIcon.Error);
}
End_Game w = new
End_Game(); finally
w.ShowDialog(); {
} myConnection.Close();
} }
#endregion }
#endregion
#region Move to Player Logs
void MovePlayer() #region Move to Team Logs
{ void MoveTeam()
string myQuery = "INSERT {
INTO tbl_playersgamelogs(Game_Date, string myQuery = "INSERT
Game_Number, Team_Name, Division, INTO tbl_teamsgamelogs(Game_Date,
Last_Name, " Game_Number, Team_Name, Division,
+ "First_Name, First_Half_Time_Out, "
Middle_Initial, Jersey_Number, + "Second_Half_Time_Out,
FirstP_Score, SecondP_Score, Extra_Time_Out, FirstP_Team_Foul,
ThirdP_Score, FourthP_Score, " SecondP_Team_Foul, ThirdP_Team_Foul,
+ "Overtime_Score, FourthP_Team_Foul, "
Foul_1, Foul_2, Foul_3, Foul_4, + "Overtime_Team_Foul,
Foul_5) SELECT Game_Date, Opponent, Game_Score, Game_Status,
Game_Number, Team_Name, Division, A_or_B) SELECT Game_Date,
Last_Name, " Game_Number, Team_Name, Division,
+ "First_Name, First_Half_Time_Out, "
Middle_Initial, Jersey_Number, + "Second_Half_Time_Out,
FirstP_Score, SecondP_Score, Extra_Time_Out, FirstP_Team_Foul,
ThirdP_Score, FourthP_Score, " SecondP_Team_Foul, ThirdP_Team_Foul,
+ "Overtime_Score, FourthP_Team_Foul, "
Foul_1, Foul_2, Foul_3, Foul_4, + "Overtime_Team_Foul,
Foul_5 FROM tbl_playersgame;"; Opponent, Game_Score, Game_Status,
SQLiteConnection A_or_B FROM tbl_teamsgame;";
myConnection = new SQLiteConnection
SQLiteConnection(Conn.ConnString); myConnection = new
SQLiteCommand myCommand = SQLiteConnection(Conn.ConnString);
new SQLiteCommand(myQuery, SQLiteCommand myCommand =
myConnection); new SQLiteCommand(myQuery,
SQLiteDataReader myConnection);
myReader; SQLiteDataReader
myReader;
try
{ try
myConnection.Open(); {
myReader = myConnection.Open();
myCommand.ExecuteReader(); myReader =
while myCommand.ExecuteReader();
(myReader.Read()) { } while
} (myReader.Read()) { }
}
catch (SQLiteException
ex) catch (SQLiteException
{ ex)

287
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
{ catch (SQLiteException
ex)
MessageBox.Show(ex.Message, "Error", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
finally }
{
myConnection.Close(); finally
} {
} myConnection.Close();
#endregion }
}
#region Move to Officials #endregion
Logs
void MoveOfficials() #region Win or Lose
{ void WinLose()
string myQuery = "INSERT {
INTO int a, b;
tbl_gameofficialslogs(Game_Number, a =
City_Sports_Coordinator, Convert.ToInt32(txtScoreA.Text);
Board_Scorer, " b =
+ "Computer_Scorer, Convert.ToInt32(txtScoreB.Text);
Timer, Announcer,
Twentyfour_Clock_Operator, Utility, if (a > b)
Head_Technical, Referee, " {
+ "Umpire_1, Umpire_2) #region Team A Win -
SELECT Game_Number, Team B Lose
City_Sports_Coordinator, string myQuery =
Board_Scorer, " "UPDATE tbl_teamsgame SET Game_Status
+ "Computer_Scorer, = 'Win' WHERE Team_Name = '" +
Timer, Announcer, cmbTeamA.Text + "';";
Twentyfour_Clock_Operator, Utility, SQLiteConnection
Head_Technical, Referee, " myConnection = new
+ "Umpire_1, Umpire_2 SQLiteConnection(Conn.ConnString);
FROM tbl_gameofficials;"; SQLiteCommand
SQLiteConnection myCommand = new
myConnection = new SQLiteCommand(myQuery, myConnection);
SQLiteConnection(Conn.ConnString); SQLiteDataReader
SQLiteCommand myCommand = myReader;
new SQLiteCommand(myQuery,
myConnection); try
SQLiteDataReader {
myReader;
myConnection.Open();
try myReader =
{ myCommand.ExecuteReader();
myConnection.Open(); while
myReader = (myReader.Read()) { }
myCommand.ExecuteReader(); }
while
(myReader.Read()) { } catch
} (SQLiteException ex)
{

288
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
#region Team B Win -
MessageBox.Show(ex.Message, "Error", Team A Lose
MessageBoxButtons.OK, string myQuery =
MessageBoxIcon.Error); "UPDATE tbl_teamsgame SET Game_Status
} = 'Win' WHERE Team_Name = '" +
cmbTeamB.Text + "';";
finally SQLiteConnection
{ myConnection = new
SQLiteConnection(Conn.ConnString);
myConnection.Close(); SQLiteCommand
} myCommand = new
SQLiteCommand(myQuery, myConnection);
string myQuery1 = SQLiteDataReader
"UPDATE tbl_teamsgame SET Game_Status myReader;
= 'Lose' WHERE Team_Name = '" +
cmbTeamB.Text + "';"; try
SQLiteConnection {
myConnection1 = new
SQLiteConnection(Conn.ConnString); myConnection.Open();
SQLiteCommand myReader =
myCommand1 = new myCommand.ExecuteReader();
SQLiteCommand(myQuery1, while
myConnection1); (myReader.Read()) { }
SQLiteDataReader }
myReader1;
catch
try (SQLiteException ex)
{ {

myConnection1.Open(); MessageBox.Show(ex.Message, "Error",


myReader1 = MessageBoxButtons.OK,
myCommand1.ExecuteReader(); MessageBoxIcon.Error);
while }
(myReader1.Read()) { }
} finally
{
catch
(SQLiteException ex) myConnection.Close();
{ }

MessageBox.Show(ex.Message, "Error", string myQuery1 =


MessageBoxButtons.OK, "UPDATE tbl_teamsgame SET Game_Status
MessageBoxIcon.Error); = 'Lose' WHERE Team_Name = '" +
} cmbTeamA.Text + "';";
SQLiteConnection
finally myConnection1 = new
{ SQLiteConnection(Conn.ConnString);
SQLiteCommand
myConnection1.Close(); myCommand1 = new
} SQLiteCommand(myQuery1,
#endregion myConnection1);
} SQLiteDataReader
myReader1;
else if (b > a)
{ try
{

289
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
while
myConnection1.Open(); (myReader.Read()) { }
myReader1 = }
myCommand1.ExecuteReader();
while catch
(myReader1.Read()) { } (SQLiteException ex)
} {

catch MessageBox.Show(ex.Message, "Error",


(SQLiteException ex) MessageBoxButtons.OK,
{ MessageBoxIcon.Error);
}
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, finally
MessageBoxIcon.Error); {
}
myConnection.Close();
finally }
{
string myQuery1 =
myConnection1.Close(); "UPDATE tbl_teamsgame SET Game_Status
} = 'Default' WHERE Team_Name = '" +
#endregion cmbTeamA.Text + "';";
} SQLiteConnection
myConnection1 = new
} SQLiteConnection(Conn.ConnString);
#endregion SQLiteCommand
myCommand1 = new
#region Win or Default SQLiteCommand(myQuery1,
void WinDefault() myConnection1);
{ SQLiteDataReader
if (End_Game.sDTeam == myReader1;
cmbTeamA.Text)
{ try
#region Team B Win - {
Team A Default
string myQuery = myConnection1.Open();
"UPDATE tbl_teamsgame SET Game_Status myReader1 =
= 'Win' WHERE Team_Name = '" + myCommand1.ExecuteReader();
cmbTeamB.Text + "';"; while
SQLiteConnection (myReader1.Read()) { }
myConnection = new }
SQLiteConnection(Conn.ConnString);
SQLiteCommand catch
myCommand = new (SQLiteException ex)
SQLiteCommand(myQuery, myConnection); {
SQLiteDataReader
myReader; MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK,
try MessageBoxIcon.Error);
{ }

myConnection.Open(); finally
myReader = {
myCommand.ExecuteReader();
myConnection1.Close();

290
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} SQLiteCommand(myQuery1,
#endregion myConnection1);
} SQLiteDataReader
myReader1;
else if (End_Game.sDTeam
== cmbTeamB.Text) try
{ {
#region Team A Win -
Team B Default myConnection1.Open();
string myQuery = myReader1 =
"UPDATE tbl_teamsgame SET Game_Status myCommand1.ExecuteReader();
= 'Win' WHERE Team_Name = '" + while
cmbTeamA.Text + "';"; (myReader1.Read()) { }
SQLiteConnection }
myConnection = new
SQLiteConnection(Conn.ConnString); catch
SQLiteCommand (SQLiteException ex)
myCommand = new {
SQLiteCommand(myQuery, myConnection);
SQLiteDataReader MessageBox.Show(ex.Message, "Error",
myReader; MessageBoxButtons.OK,
MessageBoxIcon.Error);
try }
{
finally
myConnection.Open(); {
myReader =
myCommand.ExecuteReader(); myConnection1.Close();
while }
(myReader.Read()) { } #endregion
} }

catch }
(SQLiteException ex) #endregion
{
#region Sure Deafult or Game
MessageBox.Show(ex.Message, "Error", Finished
MessageBoxButtons.OK, void SureDG()
MessageBoxIcon.Error); {
} if (sEGame == "sdef")
{
finally if (End_Game.sDTeam
{ == "-Select-")
{
myConnection.Close(); End_Game.sDTeam =
} "";
sEGame = "def";
string myQuery1 =
"UPDATE tbl_teamsgame SET Game_Status MessageBox.Show("Please select
= 'Default' WHERE Team_Name = '" + default team.", "End Game",
cmbTeamB.Text + "';"; MessageBoxButtons.OK,
SQLiteConnection MessageBoxIcon.Error);
myConnection1 = new End_Game w = new
SQLiteConnection(Conn.ConnString); End_Game();
SQLiteCommand w.ShowDialog();
myCommand1 = new }

291
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
DisableAll();
else if
(End_Game.sDTeam != "" && sEGame != GameReport();
"") pnlMGame.Visible
{ = false;
sEGame = "";
pnlMGReport.Visible = true;
dynamic dialog = }
MessageBox.Show("Are you sure you
want to default the game?", "End End_Game.sDTeam = "";
Game", MessageBoxButtons.YesNo, }
MessageBoxIcon.Question); }
if (dialog == #endregion
DialogResult.No) { }
#region Disable All
else if (dialog void DisableAll()
== DialogResult.Yes) {
{ pnlDDTG.Enabled = false;
WinDefault(); pnlTeamSSA.Enabled =
MoveTeam(); false;
MovePlayer(); pnlTeamSSB.Enabled =
false;
MoveOfficials(); pnlFSA.Enabled = false;
DisableAll(); pnlFSB.Enabled = false;
rdb1stP.Enabled = false;
GameReport(); rdb2ndP.Enabled = false;
rdb3rdP.Enabled = false;
pnlMGame.Visible = false; rdb4thP.Enabled = false;
rdbOTime.Enabled = false;
pnlMGReport.Visible = true;
} lblTeamA.Enabled = false;
lblTeamB.Enabled = false;
End_Game.sDTeam = cmbTeamA.Enabled = false;
""; cmbTeamB.Enabled = false;
} chkLockA.Enabled = false;
} chkLockB.Enabled = false;
lblCPlayersA.Enabled =
else if (sEGame == "sgf") false;
{ lblCPlayersB.Enabled =
sEGame = ""; false;
txtCPlayersA.Enabled =
dynamic dialog = false;
MessageBox.Show("Are you sure you txtCPlayersB.Enabled =
want to finish the game?", "End false;
Game", MessageBoxButtons.YesNo, txtCPlayersA.Text = "0";
MessageBoxIcon.Question); txtCPlayersB.Text = "0";
if (dialog == txtPenaltyA.Visible =
DialogResult.No) { } false;
txtPenaltyB.Visible =
else if (dialog == false;
DialogResult.Yes)
{ btnEGame.Visible = false;
WinLose(); btnCGame.Visible = true;
MoveTeam();
MovePlayer(); pnlDGR.Visible = false;
MoveOfficials();

292
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
tsGReport.Enabled = true; lblTeamB.Enabled = true;
tsGame.ForeColor = lblCPlayersA.Enabled =
Color.White; true;
tsOfficials.ForeColor = lblCPlayersB.Enabled =
Color.White; true;
tsGReport.ForeColor = txtCPlayersA.Enabled =
Color.FromArgb(236, 189, 0); true;
txtCPlayersB.Enabled =
btnOEdit.Enabled = false; true;
sLock = ""; pnlDDTG.Enabled = true;
pnlTeamA.Enabled = false;
string myQuery = "UPDATE pnlTeamB.Enabled = false;
tbl_playersgame SET In_or_Out =
'Out';"; if
SQLiteConnection (!cmbDivision.Items.Contains("-
myConnection = new Select-"))
SQLiteConnection(Conn.ConnString); {
SQLiteCommand myCommand =
new SQLiteCommand(myQuery, cmbDivision.Items.Insert(0, "-Select-
myConnection); ");
SQLiteDataReader }
myReader;
cmbDivision.Text = "-
try Select-";
{ tmrDTime.Start();
myConnection.Open();
myReader = if
myCommand.ExecuteReader(); (!cmbTeamA.Items.Contains("-Select-
while "))
(myReader.Read()) { } {
}
cmbTeamA.Items.Insert(0, "-Select-");
catch (SQLiteException }
ex)
{ cmbTeamA.Text = "-Select-
";
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, if
MessageBoxIcon.Error); (!cmbTeamB.Items.Contains("-Select-
} "))
{
finally
{ cmbTeamB.Items.Insert(0, "-Select-");
myConnection.Close(); }
}
} cmbTeamB.Text = "-Select-
#endregion ";

#region Clear Game chkLockA.Checked = false;


private void chkLockB.Checked = false;
btnCGame_Click(object sender, txtPlayerA.Text = "None";
EventArgs e) txtPlayerB.Text = "None";
{ txt1HTOA.Text = "0";
pnlFSA.Enabled = true; txt1HTOB.Text = "0";
pnlFSB.Enabled = true; txt2HTOA.Text = "0";
lblTeamA.Enabled = true; txt2HTOB.Text = "0";

293
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
txtETOA.Text = "0"; pnlMOfficials.Visible =
txtETOB.Text = "0"; true;
txt1TFA.Text = "0"; pnlMGame.Visible = false;
txt1TFB.Text = "0";
txt2TFA.Text = "0"; ClearGVar();
txt2TFB.Text = "0"; }
txt3TFA.Text = "0"; #endregion
txt3TFB.Text = "0";
txt4TFA.Text = "0"; #region Clear Global
txt4TFB.Text = "0"; Variables
txtOTFA.Text = "0"; void ClearGVar()
txtOTFB.Text = "0"; {
sDateTime = ""; sTeamA =
rdbFSA.Checked = true; ""; sTeamB = ""; sJerseyA = "";
rdbFSB.Checked = true; sJerseyB = ""; sInA = ""; sInB = "";
sTOfficials = "";
rdb1stP.Checked = true; sTQuarter = ""; sOLogin = ""; sSNotif
rdb2ndP.Checked = false; = ""; sEGame = ""; sTNameA = "";
rdb3rdP.Checked = false; sTNameB = ""; sLock = "";
rdb4thP.Checked = false; sFoulA = ""; sQValueA = "";
rdbOTime.Checked = false; sTeamFoulA = ""; sFoulB = "";
sQValueB = ""; sTeamFoulB
btnCGame.Visible = false; = "";
btnEGame.Visible = true;
iTimeoutA = 0; iTimeoutB
pnlDGR.Visible = true; = 0; iTO = 0; iDT = 4;
tsGReport.Enabled = }
false; #endregion

ClearAllPlayers(); //------------------------//
ClearAllTeams(); Game Report
ClearOfficials();
#region Game Report
GameNumber(); void GameReport()
{
txtCSCoordinator.Clear(); string wteam = "", ldteam
txtBScorer.Clear(); = "", wstatus = "", ldstatus = "";
txtCScorer.Clear();
txtTimer.Clear(); string myQuery = "SELECT
txtAnnouncer.Clear(); Team_Name, Game_Status FROM
txt24COperator.Clear(); tbl_teamsgamelogs WHERE Game_Status =
txtUtility.Clear(); 'Win' AND Game_Number = '" +
txtHTechnical.Clear(); txtGGNumber.Text + "';";
txtReferee.Clear(); SQLiteConnection
txtUmpire1.Clear(); myConnection = new
txtUmpire2.Clear(); SQLiteConnection(Conn.ConnString);
SQLiteCommand myCommand =
btnOAdd.Enabled = true; new SQLiteCommand(myQuery,
myConnection);
pnlG.Visible = true; SQLiteDataReader
tsGame.Enabled = false; myReader;

tsGame.ForeColor = try
Color.White; {
tsOfficials.ForeColor = myConnection.Open();
Color.FromArgb(236, 189, 0);

294
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
myReader = catch (SQLiteException
myCommand.ExecuteReader(); ex)
while {
(myReader.Read())
{ MessageBox.Show(ex.Message, "Error",
wteam = MessageBoxButtons.OK,
myReader.GetValue(0).ToString(); MessageBoxIcon.Error);
wstatus = }
myReader.GetValue(1).ToString();
} finally
} {

catch (SQLiteException myConnection1.Close();


ex) }
{
ReportDocument game = new
MessageBox.Show(ex.Message, "Error", ReportDocument();
MessageBoxButtons.OK,
MessageBoxIcon.Error); game.Load(Application.StartupPath +
} "\\Game_Report.rpt");

finally string mr =
{ "{Officials.Game Number} = '" +
myConnection.Close(); txtGGNumber.Text + "';";
}
string tar =
string myQuery1 = "SELECT "{TeamGameA.Team Name} = '" +
Team_Name, Game_Status FROM cmbTeamA.Text + "' AND {TeamA.Game
tbl_teamsgamelogs WHERE Game_Status Number} = '" + txtGGNumber.Text +
!= 'Win' AND Game_Number = '" + "';";
txtGGNumber.Text + "';"; string tbr =
SQLiteConnection "{TeamGameB.Team Name} = '" +
myConnection1 = new cmbTeamB.Text + "' AND {TeamB.Game
SQLiteConnection(Conn.ConnString); Number} = '" + txtGGNumber.Text +
SQLiteCommand myCommand1 "';";
= new SQLiteCommand(myQuery1,
myConnection1);
SQLiteDataReader crGViewer.SelectionFormula = mr;
myReader1;
game.Subreports[0].RecordSelectionFor
try mula = tar;
{
myConnection1.Open(); game.Subreports[1].RecordSelectionFor
myReader1 = mula = tbr;
myCommand1.ExecuteReader();
while TextObject win =
(myReader1.Read()) (TextObject)game.ReportDefinition.Sec
{ tions["ReportHeaderSection2"].ReportO
ldteam = bjects["txtTWin"];
myReader1.GetValue(0).ToString(); win.Text = wteam;
ldstatus = TextObject ws =
myReader1.GetValue(1).ToString(); (TextObject)game.ReportDefinition.Sec
} tions["ReportHeaderSection2"].ReportO
} bjects["txtGSWin"];
ws.Text = wstatus;

295
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
TextObject ld = cmbUType.Items.Remove("-
(TextObject)game.ReportDefinition.Sec Select-");
tions["ReportHeaderSection2"].ReportO }
bjects["txtTLD"];
ld.Text = ldteam; private void
TextObject lds = cmbUType_DropDownClosed(object
(TextObject)game.ReportDefinition.Sec sender, EventArgs e)
tions["ReportHeaderSection2"].ReportO {
bjects["txtGSLD"]; if (cmbUType.SelectedItem
lds.Text = ldstatus; == null)
{
Game_Report r = new if
Game_Report(); (!cmbUType.Items.Contains("-Select-
r.Refresh(); "))
crGViewer.ReportSource = {
game;
crGViewer.Refresh(); cmbUType.Items.Add("-Select-");
} }
#endregion
cmbUType.Text = "-
} Select-";
} }
}
#endregion

#region Login
Login.cs private void
btnLogin_Click(object sender,
using System; EventArgs e)
using System.Collections.Generic; {
using System.ComponentModel; if (cmbUType.Text == "-
using System.Data; Select-")
using System.Drawing; {
using System.Linq;
using System.Text; MessageBox.Show("Please select user
using System.Windows.Forms; type.", "Login Failed",
using System.Data.SQLite; MessageBoxButtons.OK,
MessageBoxIcon.Error);
namespace }
Lucena_Sports_Office_BSSE_System
{ else if (cmbUType.Text ==
public partial class Login : Form "Administrator")
{ {
public Login() string myQuery =
{ "SELECT * FROM tbl_users WHERE
InitializeComponent(); User_Type = '" + cmbUType.Text + "'
AND Username = '" + txtUsername.Text
cmbUType.SelectedIndex = + "' AND Password = '" +
0; txtPassword.Text + "';";
} SQLiteConnection
myConnection = new
#region User Type Default - SQLiteConnection(Conn.ConnString);
Select- SQLiteCommand
private void myCommand = new
cmbUType_DropDown(object sender, SQLiteCommand(myQuery, myConnection);
EventArgs e)
{

296
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
SQLiteDataReader AND Username = '" + txtUsername.Text
myReader; + "' AND Password = '" +
txtPassword.Text + "';";
try SQLiteConnection
{ myConnection = new
SQLiteConnection(Conn.ConnString);
myConnection.Open(); SQLiteCommand
myReader = myCommand = new
myCommand.ExecuteReader(); SQLiteCommand(myQuery, myConnection);
int count = 0; SQLiteDataReader
while myReader;
(myReader.Read())
{ try
count = count {
+ 1;
} myConnection.Open();
myReader =
if (count == 1) myCommand.ExecuteReader();
{ int count = 0;
Administrator while
w = new Administrator(); (myReader.Read())
this.Hide(); {
w.Show(); count = count
} + 1;
}
else
{ if (count == 1)
{
MessageBox.Show("Administrator : Game w = new
Username or password incorrect.", Game();
"Login Failed", MessageBoxButtons.OK, this.Hide();
MessageBoxIcon.Error); w.Show();
} }
}
else
catch (Exception ex) {
{
MessageBox.Show("Staff : Username or
MessageBox.Show(ex.Message, "Error", password incorrect.", "Login Failed",
MessageBoxButtons.OK, MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBoxIcon.Error);
} }
}
finally
{ catch (Exception ex)
{
myConnection.Close();
} MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
else if (cmbUType.Text == }
"Staff")
{ finally
string myQuery = {
"SELECT * FROM tbl_users WHERE
User_Type = '" + cmbUType.Text + "' myConnection.Close();

297
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} }
} #endregion
}
#endregion }
}
#region Cancel
private void
btnCancel_Click(object sender,
EventArgs e)
{
Officials_Login.cs
dynamic dialog =
MessageBox.Show("Are you sure you using System;
want to cancel to exit the program?", using System.Collections.Generic;
"Login Cancel", using System.ComponentModel;
MessageBoxButtons.YesNo, using System.Data;
MessageBoxIcon.Question); using System.Drawing;
if (dialog == using System.Linq;
DialogResult.No) using System.Text;
{ } using System.Windows.Forms;
using System.Data.SQLite;
else if (dialog ==
DialogResult.Yes) namespace
{ Lucena_Sports_Office_BSSE_System
Application.Exit(); {
} public partial class Login : Form
} {
#endregion public Login()
{
#region Exit InitializeComponent();
private void
BSSE_Login_FormClosing(object sender, cmbUType.SelectedIndex =
FormClosingEventArgs e) 0;
{ }
if (e.CloseReason ==
CloseReason.UserClosing) #region User Type Default -
{ Select-
dynamic dialog = private void
MessageBox.Show("Are you sure you cmbUType_DropDown(object sender,
want to exit the program?", "Exit", EventArgs e)
MessageBoxButtons.YesNo, {
MessageBoxIcon.Question, cmbUType.Items.Remove("-
MessageBoxDefaultButton.Button2); Select-");
if (dialog == }
DialogResult.No)
{ private void
e.Cancel = true; cmbUType_DropDownClosed(object
} sender, EventArgs e)
{
else if (dialog == if (cmbUType.SelectedItem
DialogResult.Yes) == null)
{ {
e.Cancel = false; if
(!cmbUType.Items.Contains("-Select-
Application.Exit(); "))
} {
}
cmbUType.Items.Add("-Select-");

298
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
} {
Administrator
cmbUType.Text = "- w = new Administrator();
Select-"; this.Hide();
} w.Show();
} }
#endregion
else
#region Login {
private void
btnLogin_Click(object sender, MessageBox.Show("Administrator :
EventArgs e) Username or password incorrect.",
{ "Login Failed", MessageBoxButtons.OK,
if (cmbUType.Text == "- MessageBoxIcon.Error);
Select-") }
{ }

MessageBox.Show("Please select user catch (Exception ex)


type.", "Login Failed", {
MessageBoxButtons.OK,
MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Error",
} MessageBoxButtons.OK,
MessageBoxIcon.Error);
else if (cmbUType.Text == }
"Administrator")
{ finally
string myQuery = {
"SELECT * FROM tbl_users WHERE
User_Type = '" + cmbUType.Text + "' myConnection.Close();
AND Username = '" + txtUsername.Text }
+ "' AND Password = '" + }
txtPassword.Text + "';";
SQLiteConnection else if (cmbUType.Text ==
myConnection = new "Staff")
SQLiteConnection(Conn.ConnString); {
SQLiteCommand string myQuery =
myCommand = new "SELECT * FROM tbl_users WHERE
SQLiteCommand(myQuery, myConnection); User_Type = '" + cmbUType.Text + "'
SQLiteDataReader AND Username = '" + txtUsername.Text
myReader; + "' AND Password = '" +
txtPassword.Text + "';";
try SQLiteConnection
{ myConnection = new
SQLiteConnection(Conn.ConnString);
myConnection.Open(); SQLiteCommand
myReader = myCommand = new
myCommand.ExecuteReader(); SQLiteCommand(myQuery, myConnection);
int count = 0; SQLiteDataReader
while myReader;
(myReader.Read())
{ try
count = count {
+ 1;
} myConnection.Open();
myReader =
if (count == 1) myCommand.ExecuteReader();

299
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
int count = 0; { }
while
(myReader.Read()) else if (dialog ==
{ DialogResult.Yes)
count = count {
+ 1; Application.Exit();
} }
}
if (count == 1) #endregion
{
Game w = new #region Exit
Game(); private void
this.Hide(); BSSE_Login_FormClosing(object sender,
w.Show(); FormClosingEventArgs e)
} {
if (e.CloseReason ==
else CloseReason.UserClosing)
{ {
dynamic dialog =
MessageBox.Show("Staff : Username or MessageBox.Show("Are you sure you
password incorrect.", "Login Failed", want to exit the program?", "Exit",
MessageBoxButtons.OK, MessageBoxButtons.YesNo,
MessageBoxIcon.Error); MessageBoxIcon.Question,
} MessageBoxDefaultButton.Button2);
} if (dialog ==
DialogResult.No)
catch (Exception ex) {
{ e.Cancel = true;
}
MessageBox.Show(ex.Message, "Error",
MessageBoxButtons.OK, else if (dialog ==
MessageBoxIcon.Error); DialogResult.Yes)
} {
e.Cancel = false;
finally
{ Application.Exit();
}
myConnection.Close(); }
} }
} #endregion
}
#endregion }
}
#region Cancel
private void
btnCancel_Click(object sender,
EventArgs e)
{
Program.cs
dynamic dialog =
MessageBox.Show("Are you sure you using System;
want to cancel to exit the program?", using System.Collections.Generic;
"Login Cancel", using System.Linq;
MessageBoxButtons.YesNo, using System.Windows.Forms;
MessageBoxIcon.Question);
if (dialog == namespace
DialogResult.No) Lucena_Sports_Office_BSSE_System
{

300
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
static class Program
{ Application.SetCompatibleTextRenderin
/// <summary> gDefault(false);
/// The main entry point for Application.Run(new
the application. Login());
/// </summary> }
[STAThread] }
static void Main() }
{

Application.EnableVisualStyles();

301
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

QUESTIONNAIRE

302
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
“COMPUTER-BASED BASKETBALL SCORING AND STATISTICAL EVALUATION

SYSTEM FOR LUCENA CITY SPORTS OFFICE”

Name: Position:

Dear Respondents,

We are BSIT students from Dalubhasaan ng Lungsod ng Lucena (formerly City College of

Lucena) and currently conducting our research project entitled “Computer-based Basketball Scoring

and Statistical Evaluation System for Lucena City Sports Office”. In connection with this, we kindly

ask a little of time of the staffs, officials, and players of Lucena City Sports Office to test, evaluate and

get feedbacks regarding your personal point of view for our system for further development and analysis?

Thank you very much.

Instruction: Please provide your honest opinion by putting a check mark (√) to indicate the level of your

agreement and disagreement for the following, (1) being the lowest or Strong Disagree and (4) being the

highest or Strongly Agree.

Software Acceptability and Features Rating


Strongly Agree Disagree Strongly
Questions Agree (3) (2) Disagree
(4) (1)
USABILITY OF THE PROPOSED SYSTEM

1. The system functions as the way it must.


2. The system design/interface is user-friendly and
guides the user throughout software operation.
3. The system is easy to understand as it was
explained to the staffs of Lucena City Sports
Office.
4. The system can be navigated easily without much
effort.
5. The system can be used even if the users do not
have technical proficiency.

303
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

EFFICIENCY OF THE PROPOSED SYSTEM

1. The system saves time and money.


2. The system has the fastest ways of locating
records.
3. The scoring and statistical evaluation
functionality of the system process efficiently
4. The system responds quickly.
5. The system operates in real time.

FUNCTIONALITY OF THE PROPOSED SYSTEM

1. The system prevents unauthorized users to utilize


the system
2. The system records correct scores and other stats.
3. The system produces an accurate statistical result.
4. The system can secure data and information.
5. The system can print the records correctly.

RELIABILITY OF THE PROPOSED SYSTEM

6. All records are included in the system and serve


as a reliable source of information.
7. The system provides a reliable way of securing
records.
8. The system has the ability to withstand (fault
tolerance) from component or environmental
failure.
9. The system is able to recover a failed operation.
10. The system provides consistent and trustworthy
behavior and processes.

304
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

LETTER

305
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

306
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

GANTT
CHART OF
ACTIVITIES

307
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

308
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

CURRICULUM
VITAE

309
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

310
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

311
DALUBHASAAN NG LUNGSOD NG LUCENA
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY

312
DALUBHASAAN NG LUNGSOD NG LUCENA

S-ar putea să vă placă și