You are on page 1of 113

NewsMate

Thesis/Report submitted in partial fulfillment of the


requirement for the degree of

B.Tech.

In
Information Technology

Under the Supervision of

Mr. Nitesh Wadhera

By

Rajesh, 00714807713

Maharaja Agrasen Institute of Technology

April 2016
DECLARATION
This is to certify that the report entitled NEWSMATE which is submitted by me in
partial fulfillment of the requirement for the award of degree B.Tech in Information
Technology to Maharaja Agrasen Institute of Technology, Sec-22 Rohini, comprises
only my original work and due acknowledgement has been made in the text to all
other material used.

Date: Rajesh
00714807713

 
 

 
 
CERTIFICATE
 

This is to certify that report entitled NEWSMATE which is submitted by RAJESH


in partial fulfillment of the requirement for the award of degree B.Tech in Information
Technology to Maharaja Agrasen Institute of Technology, Sec-22 Rohini, is a record
of the candidate’s own work carried out by him under my supervision. The matter
embodied in this thesis is original and has not been submitted for the award of any
other degree.

Date:

Supervisor

Dr. M. L. Sharma
(Head of Department)
ACKNOWLEDGEMENT

I take this occasion to thank God, almighty for blessing us with his grace
and taking out endeavor to successful culmination. I extend my sincere and
heartfelt thanks to our esteemed guide, Mr. Nitesh Wadhera, for providing me the
right guidance and advice at the crucial junctures and for showing me the right
way. I extend my sincere thanks to my respected Head of Department Dr. ML
Sharma, for allowing me to use facilities available. I would like to thank the other
faculty members also, at this occasion. Last but not the least, I would like to thank
my friends and family for the support and encouragement they have given me
during the course of my work.
CONTENTS

S.No. Topic Page No.


1 Introduction 1
2 System Analysis 2
3 System Design 13
4 System Implementation 16
5 System Testing 27
6 References 30
FIGURES

S. No. Figure Title Page No.


1 Registration form 16
2 Reporter Login 17
3 Post Report by Reporter 18
4 Article Submission 19
5 Home 20
6 Admin Login 21
7 List of Reporters 22
8 Add country 23
9 Add News category 24
10 Add Region 25
11 Add Report 26
TABLES

S. No. Figure Title Page No.


1 Reporter table 7
2 Country table 7
3 Region table 7
4 Category table 7
5 Multimedia table 8
6 Report table 8
7 Article table 9
8 Feedback table 9
9 Admin table 9
ABSTRACT
First of all I would like to say something about use of computers. Today in every area
computer makes its on image, without it we can’t imagine our life because today it is
essential component of our life. Actually computers have so many components like
hardware, software etc. Among them software is very essential components. Software
is a collection of program, which is made for doing a specific task. Software
development is not a easy task. It is developed through a big team, Project have seven
letters & each character has its on technical meaning. The full form of project is given
below.
Planning :-This deal with the idea at thinking and which are required for the project.
Resource :-The money problem will be solved and resources from which collected.
Operating :- The procedure from which the getting job is prepared in a systematic
way is known as operation.
Joint effort :- This is directly proper to a operation output is made of several person
working sincerely is known as JOINT EFFORT.
Engineering :- A well-educated engineer can do this work in a better way to find out
better result. Hence the project is as engineering function.
Co-operation:- To make the project successfully, it is necessary for its success and
completion of project.
Technique: - It must have a better shape. It is not possible to complete the project
without technique.
CHAPTER 1

INTRODUCTION

This gives an overview about the aim, objectives, background and operation
environment of the system.

1.1 PROJECT AIM AND OBJECTIVES


The project aim and objectives that will be achieved after completion of
this project are discussed in this sub-chapter. The aims and objectives are as
follow:

 News reading with a good interface.


 Reporter Login where a reporter can login to use services and post
reports and articles.
 An Admin login page, where admin can login and manage reports,
reporters and their accounts.

1.2 BACKGROUND OF PROJECT


This web based application refers to a news portal generally small or medium
in size. It is used by internet users to read time prompted news in various categories.
Reports module is also included in this portal which would keep track of the reports.
In addition, Reporter module is also included in application.
These modules are able to help users and reporters to read and edit
news with more convenience and in a more efficient way.

1.3 OPERATION ENVIRONMENT

PROCESSOR INTEL CORE PROCESSOR OR ABOVE


OPERATION SYSTEM WINDOWS 7, 8, 10, VISTA, UBUNTU
MEMORY 1GB RAM OR MORE
HARD DISK MINIMUM 20GB
DATABASE MY SQL
CHAPTER 2

SYSTEM ANALYSIS

In this chapter, we will discuss and analyze about the developing process of
NewsMate including software requirement specification(SRS).
The functional and non-functional requirements before the developing process
is carried out. This provides a view of how this portal works and what features is it
having.

2.1 SOFTWARE REQUIREMENT SPECIFICATION

2.1.1 GENERAL DESCRIPTION

NewsMate is an online news portal which gives time prompted news to the
users. It reduces the use of paper work and gives an interesting interface to use.

2.1.2 SYSTEM OBJECTIVES


 Improvement in control and performance.
 Saves cost, after computerized system is implemented, less human
efforts will be required to maintain and deliver the news to the public.
 Saves time, provides filtered news categorized on the basis of region
and category.

2.1.3 SYSTEM REQUIREMENTS

2.1.3.1 NON-FUNCTIONAL REQUIREMENTS


EFFICIENCY REQUIREMENTS
When a news portal is implemented, user will have ease of
access to the news and faster availability to the information.

RELIABILITY REQUIREMENTS
The system should provide accurate news with a good
interface. It should work properly, all modules and functionalities.

USABILITY REQUIREMENTS
The system is designed for a user friendly environment so that
user and reporter can perform the various tasks easily and in an effective way.

IMPLEMENTATION REQUIREMENTS
In implementing whole portal, it uses html as front end with C#
which is used for database connectivity and the backend i.e. the database part is
developed using MySQL.
DELIVERY REQUIREMENTS
The whole system is expected to be delivered in six months of
time with a weekly evaluation by the project guide.

2.1.3.2 FUNCTIONAL REQUIREMENTS


1. REPORTER
1.1 Reporter Log In
Description of the Feature: This feature is used by the reporter to login
into the system. They are required to enter user id and password to login successfully.
The user id and password will be verified and if an invalid user id or password is
entered, the user will not be allowed to enter into the system.
Functional Requirements: The user id is provided on registration time.
The system must only allow user with a valid id and password to enter into the
system. The system performs authorization process which decided what user level can
access to. The user must be able to logout after they finished using system.

1.2 Register New Reporter


Description of the Feature: This feature can be performed by all users
that are using this portal by clicking on SignUp option given on the top right corner.
By signing up they can register as reporter and will be authorized to post reports.
Functional Requirements: System must be able to verify information
given by the user. System must be able to delete information if information is wrong.

2. REPORT
2.1 Add Report
Description of the Feature: This feature is provided to add new reports
by the reporters. A report could consist of multimedia elements like pictures, videos
and audios.
Functional Requirements: System must be able to add multimedia
along with text report. System must be able to block report in case of no need or other
reasons.
2.2 SOFTWARE AND HARDWARE REQUIREMENTS
This section describes the software and hardware requirements of the system.
2.2.1 SOFTWARE REQUIREMENTS

 Operation System
-Windows 8 is used as the operating system as it is stable and supports more
features and is more user friendly.
 Database
-MySQL is used as database as it is easy to maintain and retrieve records by
simple queries
 Development Tools and Programming Language\
-HTML is used to write the whole front end and web pages designing is done
by using CSS and JavaScript.

2.2.2 HARDWARE REQUIREMENTS


 Processor
- Intel I5 2nd generation is used as processor. It is fast, reliable and stable.
 RAM
- 8GB RAM is used. It has fast access to applications and improves processing
speed.
2.3 SOFTWARE TOOLS USED
The whole Project is divided in two parts the front end and the back end.
2.3.1 Front end
The front end is designed using of HTML, ASP .Net, CSS, Java script
 HTML
HTML or Hyper Text Markup Language is the main markup language for
creating web pages and other information that can be displayed in a web
browser .HTML is written in the form of HTML elements consisting of tags enclosed
in angle brackets(like <html>), within the web page content. HTML tags most
commonly ome in pairs like <h1> and </h1>, although some tags represent empty
elements and so are unpaired, for example <img>. The first tag in a pair is the start
tag, and the second tag s the end tag(they are also called opening tags and closing
tags). In between these tags web designers can add text, further tags, comments and
other types of text-based content. The purpose of a web browser is to read HTML
documents and compose them into visible or audible web pages. The browser does
not display the HTML tags, but uses the tags to interpret the content of the
page.HTML elements form the building blocks of all websites. HTML allows images
and objects to be embedded and can be used to create interactive forms. It provides a
means to create structured documents by denoting structural semantics for text such as
headings, paragraphs, lists, links, quotes and other items. It can embed scripts written
in languages such as JavaScript which affect the behavior of HTML web pages.

 CSS
-Cascading Style Sheet(CSS) is a style sheet language used for describing the
look and formatting of a document written in a markup language. While most often
used to style web pages and interfaces written in HTML and XHTML, the language
can be applied to any kind of XML document, including plain XML, SVG and XUL.
CSS is a cornerstone specification of the web and almost all web pages use CSS style
sheets to describe their presentation.CSS is designed primarily to enable the
separation of document content from document presentation, including elements such
as the layout, colors, and fonts. This separation can improve content accessibility,
provide more flexibility and control in the specification of presentation
characteristics, enable multiple pages to share formatting, and reduce complexity and
repetition in the structural content (such as by allowing for table less web design).CSS
can also allow the same markup page to be presented in different styles for different
rendering methods, such as on-screen, in print, by voice (when read out by a speech-
based browser or screen reader) and on Braille-based, tactile devices. It can also be
used to allow the web page to display differently depending on the screen size or
device on which it is being viewed. While the author of a document typically links
that document to a CSS file, readers can use a different style sheet, perhaps one on
their own computer, to override the one the author has specified. However if the
author or the reader did not link the document to a specific style sheet the default style
of the browser will be applied.CSS specifies a priority scheme to determine which
style rules apply if more than one rule matches against a particular element. In this so-
called cascade, priorities or weights are calculated and assigned to rules, so that the
results are predictable.
 JAVA SCRIPT
- JavaScript(JS) is a dynamic computer programming language. It is most
commonly used as part of web browsers, whose implementations allow client-side
scripts to interact with the user, control the browser, communicate asynchronously,
and alter the document content that is displayed. It is also being used in server-side
programming, game development and the creation of desktop and mobile
applications. JavaScript is a prototype-based scripting language with dynamic typing
and has first-class functions. Its syntax was influenced by C. JavaScript copies many
names and naming conventions from Java, but the two languages are otherwise
unrelated and have very different semantics. The key design principles within
JavaScript are taken from the Self and Scheme programming languages. It is a multi-
paradigm language, supporting object-oriented, imperative, and functional
programming styles. The application of JavaScript to use outside of web pages—for
example, in PDF documents, site-specific browsers, and desktop widgets—is also
significant. Newer and faster JavaScript VMs and platforms built upon them
(notablyNode.js) have also increased the popularity of JavaScript for server-side web
applications. On the client side, JavaScript was traditionally implemented as an
interpreted language but just-in-time compilation is now performed by recent (post-
2012) browsers.
 PHP
- PHP development began in 1994 when Rasmus Lerdorf wrote a series of
Common Gateway Interface (CGI) binaries in C, which he used to maintain his
personal homepage. He extended them to add the ability to work with web formsand
to communicate with databases, and called this implementation "Personal Home
Page/Forms Interpreter" or PHP/FI.
PHP/FI could be used to build simple, dynamic web applications. Lerdorf initially
announced the release of PHP/FI as "Personal Home Page Tools (PHP Tools) version
1.0" publicly to accelerate bug location and improve the code, on theUsenet
discussion group comp.infosystems.www.authoring.cgi on June 8, 1995. This release
already had the basic functionality that PHP has as of 2013. This included Perl-like
variables, form handling, and the ability to embed HTML. The syntax resembled that
of Perl but was simpler, more limited and less consistent.[5]
Early PHP was not intended to be a new programming language, and grew
organically, with Lerdorf noting in retrospect: "I don’t know how to stop it, there was
never any intent to write a programming language […] I have absolutely no idea how
to write a programming language, I just kept adding the next logical step on the way."
A development team began to form and, after months of work and beta testing,
officially released PHP/FI 2 in November 1997.
One criticism of PHP is that it was not originally designed, but instead it was
developed organically; among other things, this has led to inconsistent naming of
functions and inconsistent ordering of their parameters. In some cases, the function
names were chosen to match the lower-level libraries which PHP was "wrapping",
while in some very early versions of PHP the length of the function names was used
internally as a hash function, so names were chosen to improve the distribution of
hash values.
2.3.2 BACK END
-The back end is designed using mysql which is used to design the databases
 MySQL
-MySQL("My S-Q-L", officially, but also called "My Sequel") is (as of July
2013) the world's second most widely used open-source relational database
management system(RDBMS). It is named after co-founder Michael Widenius
daughter, My. The SQL phrase stands for Structured Query Language. The MySQL
development project has made its source code available under the terms of the GNU
General Public License, as well as under a variety of proprietary agreements. MySQL
was owned and sponsored by a single for-profit firm, the Swedish company MySQL
AB, now owned by Oracle Corporation. MySQL is a popular choice of database for
use in web applications, and is a central component of the widely used LAMP open
source web application software stack (and other 'AMP' stacks). LAMP is an acronym
for "Linux, Apache, MySQL, Perl/PHP/Python." Free-software-open source projects
that require a full-featured database management system often use MySQL. For
commercial use, several paid editions are available, and offer additional functionality.
Applications which use MySQL databases include:TYPO3, MODx, Joomla,
WordPress, phpBB, MyBB, Drupal and other software. MySQL is also used in many
high-profile, large-scale websites, including Wikipedia, Google(though not for
searches), Facebook, Twitter, Flickr, and YouTube.
CHAPTER 3

SYSTEM DESIGN

3.1 TABLE DESIGN


VARIOUS TABLES TO MAITAIN INFORMATION

REPORTER TABLE to keep track of Reporters and their profiles

Field Data Type Default Key Extra


Reporter_id Int Identity Unique

Reporter_firstname Varchar(20)
Reporter_middlename Varchar(20)
Reporter_lastname Varchar(20)
Reporter_gender Varchar(1)
Reporter_contact Bigint
Reporter_address Varchar(100)
Reporter_emailid Varchar(50) Not Null Primary
Reporter_password Varchar(50)
Reporter_country Varchar(50)
Reporter_language Varchar(50)
Reporter_securityquestion Varchar(max)
Reporter_securityanswer Varchar(max)
Reporter_registrationdate Datetime
Reporter_isblocked Bit

COUNTRY TABLE

Field Data Type Defalut Key Extra


Country_id Int Primary Identity
Country_name Varchar(100)

REGION TABLE

Field Data Type Defalut Key Extra


Region_id Int Primary Identity
Region_name Varchar(100)

CATEGORY TABLE

Field Data Type Defalut Key Extra


Category_id Int Primary Identity
Category_name Varchar(100)
MULTIMEDIA TABLE

Field Data Type Defalut Key Extra


Multimedia_id Int Primary Identity
Multimedia_type Varchar(30)
Multimedia_size Varchar(20)
Multimedia_description Varchar(max)
Dateofgathering Datetime
Dateofsubmission Datetime
Multimedia_path Varchar(max)

REPORT TABLE

Field Data Type Defalut Key Extra


Reprot_id Int Primary Identity
Headline Varchar(max)
Headline_thumbnail Varchar(max)
Report_description Varchar(max)
Report_detail Varchar(max)
Feededby Varchar(max)
Dateofsubmission Datetime
Region_id Int Foreign
Category_id Int Foreign
Reprot_ispublished Bit

ARTICLE TABLE

Field Data Type Defalut Key Extra


Article_id Int Primary Identity
Article_title Varchar(max)
Article_description Varchar(max)
Article_writtenby Varchar(50)
Category_id Int
Posteddate Datetime
Article_ispublishe Bit
d

FEEDBACK TABLE

Field Data Type Defalut Key Extra


feedback_id Int Primary Identity
Username Varchar(max)
Contactn Bigint
Emailid Varchar(50)
Feedback_descriptio Varchar(max)
n
Feedback_date Datetime
ADMIN TABLE

Field Data Type Defalut Key Extra


admin_id Int Primary Identity
Admin_loginid Varchar(30)
Admin_password Varchar(50)
CHAPTER 4

SYSTEM IMPLEMENTATION

4.1.1 Codes

4.1.1.1 User.master
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="User.master.cs"
Inherits="User" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>News Mate</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<div id="wrapper">
<form id="form1" runat="server">
<div>

<!-- BEGIN header -->


<div id="header">
<p class="links">
<asp:LinkButton ID="Linkbutton_register" CausesValidation="false"
runat="server" Visible="false"
Text="Register" OnClick="Linkbutton_register_Click" />
<asp:LinkButton ID="Linkbutton_Login" CausesValidation="false"
Visible="false" runat="server" Text="LogIn"
OnClick="Linkbutton_Login_Click" />

<asp:LinkButton ID="Linkbutton_logout" Visible="false"


CausesValidation="false" runat="server"
Text="Log Out" OnClick="Linkbutton_logout_Click" />
</p>
<div class="break"></div>
<div class="logo">
<h1>
<a href="Home.aspx">NewsMate</a></h1>
</div>
<div class="ad468x60">
<a href="Home.aspx">
<img src="images/ad468x60.gif" alt="" /></a>
</div>
<div class="break"></div>
<asp:Menu ID="Menu1" runat="server" Font-Size="Large"
Orientation="Horizontal">
<Items>
<asp:MenuItem ToolTip="Home" Value="Home"
NavigateUrl="~/Home.aspx"></asp:MenuItem>
<asp:MenuItem Text="Country" ToolTip="Country"
Value="Country" NavigateUrl="~/Country.aspx"></asp:MenuItem>
<asp:MenuItem Text="World" ToolTip="World" Value="World"
NavigateUrl="~/World.aspx"></asp:MenuItem>
<asp:MenuItem Text="Politics" ToolTip="Politics"
Value="Politics" NavigateUrl="~/Politics.aspx"></asp:MenuItem>
<asp:MenuItem Text="Entertainment" ToolTip="Entertainment"
Value="Entertainment"
NavigateUrl="~/Entertainment.aspx"></asp:MenuItem>
<asp:MenuItem Text="Business" ToolTip="Business"
Value="Business" NavigateUrl="~/Business.aspx"></asp:MenuItem>
<asp:MenuItem Text="Sports" ToolTip="Sports" Value="Sports"
NavigateUrl="~/Sports.aspx"></asp:MenuItem>
</Items>
</asp:Menu>

<div class="break"></div>

<!-- Reporter Menu -->


<asp:Menu ID="Menu2" Visible="False" runat="server"
Orientation="Horizontal"
StaticSubMenuIndent="16px">
<Items>
<asp:MenuItem Text="Add Report" Value="Add Report"
NavigateUrl="~/Reporter_Pages/Reporter_Post_Report.aspx"></asp:MenuItem>
<asp:MenuItem Text="Post FeedBack" Value="Post FeedBack"
NavigateUrl="~/Reporter_Pages/Reporter_Feedback.aspx"></asp:MenuItem>
<asp:MenuItem Text="Post Article" Value="Post Article"
NavigateUrl="~/Article.aspx"></asp:MenuItem>
</Items>

</asp:Menu>
</div>
<!-- Content-->
<div id="content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>

<!-- BEGIN sidebar -->


<div id="sidebar">
<!-- begin ads -->
<div class="ads">
<a href="home.aspx">
<img src="images/ad125x125.jpg" alt="" /></a>
<a href="home.aspx">
<img src="images/ad125x125.jpg" alt="" /></a>
<a href="home.aspx">
<img src="images/ad125x125.jpg" alt="" /></a>
<a href="home.aspx">
<img src="images/ad125x125.jpg" alt="" /></a>

</div>
<!-- end ads -->
<div class="wrapper">
<!-- begin popular posts -->
<h2>Popular Posts</h2>
<ul>
<li><a href="home.aspx">Make Money Online Creating
Websites</a></li>
<li><a href="home.aspx">Top 100 Internet Marketing
Tips</a></li>
<li><a href="home.aspx">Tutorial: How to add Videos in your
Post</a></li>
<li><a href="home.aspx">Sample Post Unordered List</a></li>
<li><a href="home.aspx">Sample Post Blockquote</a></li>
</ul>
<!-- end popular posts -->
<!-- begin flickr photos -->
<h2>Flickr Photos</h2>
<div class="flickr">
<a href="home.aspx">
<img src="images/_thumb3.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb4.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb5.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb6.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb7.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb8.jpg" alt="" /></a> <a
href="home.aspx">
</div>
<!-- end flickr photos -->
<!-- begin featured video -->
<h2>Featured Video</h2>
<div class="video">
<img src="images/_video.jpg" alt="" />
</div>
<!-- end featured video -->
<!-- begin tags -->
<h2>Tags</h2>
<div class="tags"></div>
<!-- end tags -->
<!-- BEGIN left -->
<div class="l sbar">
<!-- begin categories -->
<h2>Categories</h2>
<ul>
<li><a href="home.aspx">Entertainment</a></li>
<li><a href="home.aspx">Fashion</a></li>
<li><a href="home.aspx">Internet</a></li>
<li><a href="home.aspx">Marketing</a></li>
<li><a href="home.aspx">Lifestyle</a></li>
<li><a href="home.aspx">Make Money</a></li>
<li><a href="home.aspx">Online</a></li>
<li><a href="home.aspx">Parenting</a></li>
</ul>
<!-- end categories -->
<!-- begin pages -->
<h2>Pages</h2>
<ul>
<li><a href="home.aspx">Home</a></li>
<li><a href="home.aspx">About</a></li>
<li><a href="home.aspx">Archives</a></li>
<li><a href="home.aspx">Links</a></li>
<li><a href="home.aspx">Contact</a></li>
<li><a href="home.aspx">Sitemap</a></li>
</ul>
<!-- end pages -->
</div>
<!-- END left -->
<!-- BEGIN right -->
<div class="r sbar">
<!-- begin archives -->
<h2>Archives</h2>
<ul>
<li><a href="home.aspx">August 2008</a></li>
<li><a href="home.aspx">July 2008</a></li>
<li><a href="home.aspx">June 2008</a></li>
<li><a href="home.aspx">May 2008</a></li>
<li><a href="home.aspx">April 2008</a></li>
<li><a href="home.aspx">March 2008</a></li>
</ul>
<!-- end archives -->
<!-- begin blogroll -->
<h2>Blogroll</h2>
<ul>
<li><a href="home.aspx">Carlos</a></li>
<li><a href="home.aspx">Digital Point Forum</a></li>
<li><a href="home.aspx">Eric's Photo Gallery</a></li>
<li><a href="home.aspx">Fashion Trends</a></li>
<li><a href="home.aspx">Google Scoreboard</a></li>
<li><a href="home.aspx">Marketing Forum</a></li>
</ul>
<!-- end blogroll -->
<!-- begin meta -->

<!-- end meta -->


</div>
<!-- END right -->
</div>
</div>

</div>
<!-- BEGIN footer -->
<div id="footer">

<p>Copyright &copy; 2015 - <a href="home.aspx">NewsMate</a>


&middot; All Rights Reserved to Rajesh Bharat</p>
<asp:LinkButton ID="Linkbutton_AdminLogin" runat="server"
Text="Admin LogIn" CausesValidation="false"
OnClick="Linkbutton_AdminLogin_Click" />
</div>
</form>
</div>
</body>

</html>

4.1.1.2 User.master.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class User : System.Web.UI.MasterPage


{
protected void Page_Load(object sender, EventArgs e)
{
Linkbutton_register.Visible = true;
Linkbutton_Login.Visible = true;
Linkbutton_logout.Visible = false;
Menu2.Visible = false;
if(Session["Reporter_Loginid"]!=null)
{
Menu2.Visible = true;
Linkbutton_logout.Visible = true;
Linkbutton_Login.Visible = false;
Linkbutton_register.Visible = false;
}
}
protected void Linkbutton_Login_Click(object sender, EventArgs e)
{
Response.Redirect("~/Reporter_Pages/Reporter_LogIn.aspx");
}
protected void Linkbutton_AdminLogin_Click(object sender, EventArgs e)
{
Response.Redirect("~/Admin_Login.aspx");
}

protected void Linkbutton_register_Click(object sender, EventArgs e)


{
Response.Redirect("~/Reporter_Pages/Reporter_Registration.aspx");
}
protected void Linkbutton_logout_Click(object sender, EventArgs e)
{
Session.Abandon();
}
}

4.1.1.3 Home.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/User.master"


AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">

<asp:DataList ID="DataList_content" runat="server" CellPadding="15"


CellSpacing="15"
RepeatColumns="2" RepeatDirection="Horizontal" >
<ItemTemplate>
<table id="table_reports" border="0">
<tr>
<td colspan="2">
<asp:Label ID="Label1" runat="server" Text='<%#Bind("Headline")
%>' Font-Bold="True" Width="300px"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Image ID="Image1" runat="server" ImageUrl='<
%#Bind("Headline_Thumbnail") %>' Height="150" Width="150" />
</td>
<td>
<asp:Label ID="Label2" runat="server" Text='<
%#Bind("Report_Description") %>' Height="150" Width="150px"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2">
<asp:LinkButton ID="LinkButton1" runat="server"
CommandArgument="" CommandName="" OnClick="LinkButton1_Click">View
More..</asp:LinkButton>
</td>
</tr>
</table>

</ItemTemplate>
</asp:DataList>

<asp:DataList ID="datalist_reportdetail" runat="server">


<ItemTemplate>
<table id="report_detail" >
<tr>
<td>
<asp:Label ID="label_content" runat="server" Text='<
%#Bind("Report_Detail") %>' ></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:LinkButton ID="linkbutton_back" Text="Back"
runat="server"></asp:LinkButton>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</asp:Content>

4.1.1.4 Home.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;
using System.Data;

public partial class Home : System.Web.UI.Page


{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["MyString"].ConnectionStr
ing);
SqlDataAdapter da = new SqlDataAdapter();
SqlDataAdapter da1 = new SqlDataAdapter();
SqlCommand cmd;
SqlDataReader dr;

DataTable dt = new DataTable();


DataTable dt1 = new DataTable();
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
datalist_reportdetail.Visible = false;
if (!IsPostBack)
{
Bind();
}
if (!IsPostBack)
{
da1 = new SqlDataAdapter("select Report_Detail from Report_table", con);
da1.Fill(dt1);
datalist_reportdetail.DataSource = dt1;
datalist_reportdetail.DataBind();
}
}
void Bind()
{
da = new SqlDataAdapter("Select * from Report_table", con);
da.Fill(dt);
DataList_content.DataSource = dt;
DataList_content.DataBind();

protected void LinkButton1_Click(object sender, EventArgs e)


{

DataList_content.Visible = false;
datalist_reportdetail.Visible = true;
}
}

4.1.1.5 Article.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/User.master"
AutoEventWireup="true"
CodeFile="Article.aspx.cs" Inherits="Article" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">


<title></title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<center>
<div id="break"> </div>
<h1>
Submit Article</h1>
<div>
<table border="0" cellpadding="10" cellspacing="10">
<tr>
<td>
<asp:Label ID="Label_Category" runat="server"
Text="Category"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList_Category" Width="250"
runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label_title" runat="server"
Text="Heading"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<td>
<asp:TextBox ID="TextBox_title" runat="server" MaxLength="50"
Width="250"></asp:TextBox><br />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label_Description" runat="server"
Text="Article"></asp:Label>
</td>
<td valign="top">
<asp:TextBox ID="TextBox_description" runat="server"
TextMode="MultiLine" Width="250px"
Height="250px"></asp:TextBox>
</td>
</tr>
</table>
</div>
<div>
<table>
<tr>

<td colspan="2" align="center">


<asp:Button ID="Button_Submit" runat="server" Text="Submit"
onclick="Button_Submit_Click" />&nbsp;&nbsp;
<asp:Button ID="Button_Reset" runat="server" Text="Reset" />
</td>
</tr>
</table>
</div>
</center>
</asp:Content>

4.1.1.6 Article.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class Article : System.Web.UI.Page


{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Mystring"].ConnectionStri
ng);

protected void Page_Load(object sender, EventArgs e)


{
if (!IsPostBack)
{
DropDownlist_bind();
}
}
void DropDownlist_bind()
{
SqlDataAdapter da = new SqlDataAdapter("select category_name,category_id
from category_table", con);
DataTable dt = new DataTable();
da.Fill(dt);
DropDownList_Category.DataSource = dt;
DropDownList_Category.DataTextField = "category_name";
DropDownList_Category.DataValueField = "category_id";
DropDownList_Category.DataBind();
}
protected void Button_Submit_Click(object sender, EventArgs e)
{

string published = "0";


if (Session["adminloginid"] != null)
{
SqlDataAdapter daadmin = new SqlDataAdapter("select * from admin_table
where admin_Loginid='" + Session["adminloginid"] + "'", con);
DataTable dtadmin = new DataTable();
daadmin.Fill(dtadmin);
if (dtadmin.Rows.Count > 0)
{

ViewState["name"] = dtadmin.Rows[0]["admin_Loginid"].ToString();
}
}
else if (Session["reporter_loginid"] != null)
{
SqlDataAdapter dareporter = new SqlDataAdapter("select * from
Reporter_Table where reporter_loginid='" + Session["reporter_loginid"] + "'", con);
DataTable dtreporter = new DataTable();
dareporter.Fill(dtreporter);
if (dtreporter.Rows.Count > 0)
{
ViewState["name"] = dtreporter.Rows[0]["reporter_loginid"].ToString();
}
}
SqlCommand cmd = new SqlCommand("insert into article_table values('"
+ TextBox_title.Text + "','"
+ TextBox_description.Text + "','"
+ ViewState["name"] + "','"
+ DropDownList_Category.SelectedValue + "','"
+ DateTime.Now.ToShortDateString() + "','"
+ published + "')", con);

con.Open();
int check = cmd.ExecuteNonQuery();
con.Close();
if (check > 0)
{
Response.Write("<script>alert('Thanks! Your Article is submitted
successfully')</script>");
//Response.Redirect("~/Home.aspx");
if (Session["adminloginid"] != null && Session["reporter_loginid"] == null)
{
Response.Redirect("~/Admin_Pages/Admin_Home.aspx");
}
else
{
//Response.Redirect("~/reporter_pages/reporter_home.aspx");
ScriptManager.RegisterStartupScript(this, this.GetType(),
"MessageThenRedirect", "window.location='reporter_pages/reporter_home.aspx';",
true);

}
}
}

4.1.1.7 Admin.master
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="Admin.master.cs" Inherits="Admin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>News Mate</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../style.css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<%-- <div>
<asp:Image ID="Image_AdminPanel" runat="server"
ImageUrl="~/Images/AdminPanel.jpg" />
</div>
--%>
<!-- BEGIN header -->
<div id="header">
<%--<ul>
<li class="f"><a href="home.aspx">Home</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="page.html">Demo Page</a></li>
<li><a href="contact.html">Contact Page</a></li>
</ul>--%>
<p class="links">
<asp:LinkButton ID="Linkbutton_Login" Visible="false" runat="server"
Text="LogIn"
OnClick="Linkbutton_Login_Click" />
<asp:LinkButton ID="Linkbutton_logout" Visible="false"
CausesValidation="false" runat="server"
Text="Log Out" OnClick="Linkbutton_logout_Click" />
</p>
<div class="break"></div>
<div class="logo">
<h1><a href="../Home.aspx">NewsMate</a></h1>
</div>
<div>
<div class="ad468x60"><a href="home.aspx">
<img src="../Images/ad468x60.gif" alt="" /></a> </div>
<div class="break"></div>
<asp:Panel ID="panel_admin_menu" runat="server">
<ol>
<li><a href="Admin_ListofReporters.aspx">View Reporters</a></li>
<li><a href="Admin_Add_Country.aspx">Add Country</a></li>

<li><a href="Admin_Add_News_Category.aspx">Add News


Category</a></li>
<li><a href="Admin_Add_Region.aspx">Add Region</a></li>
<li><a href="Admin_Add_Report.aspx">Add Report</a></li>

</ol>
</asp:Panel>
<div class="break"></div>
</div>
</div>

<div>

</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
<div>
All Rights Are Reserved to Rajesh Bharat.

</div>
</form>
</body>
</html>

4.1.1.8 Admin.master.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;

public partial class Admin : System.Web.UI.MasterPage


{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["MyString"].ConnectionStr
ing);
SqlDataReader dr;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

if (Session["adminloginid"] != null)
{
//Menu1.Visible = true;
Linkbutton_logout.Visible = true;
panel_admin_menu.Visible = true;
}
else
{
//Menu1.Visible = false;
Linkbutton_Login.Visible = true;
panel_admin_menu.Visible = false;
}
}
protected void Linkbutton_logout_Click(object sender, EventArgs e)
{
Session.Abandon();
Response.Redirect("~/admin_pages/admin_home.aspx");
}
protected void Linkbutton_Login_Click(object sender, EventArgs e)
{
Response.Redirect("~/admin_login.aspx");
}
}

4.1.1.9 Admin_add_country.aspx

<%@ Page Title="" Language="C#"


MasterPageFile="~/Admin_Pages/Admin.master" AutoEventWireup="true"
CodeFile="Admin_Add_Country.aspx.cs" Inherits="Add_Country" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<center>
<h1>
Add Country</h1>
<table>
<tr>
<td>
<asp:Label ID="label_addcountry" Text="Add country" runat="server"
/><br />
<asp:TextBox ID="textbox_addcountry" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
ControlToValidate="textbox_addcountry" runat="server"
Display="None" ErrorMessage="Please Enter a conuntry's name." />
<asp:ValidationSummary ID="ValidationSummary1" runat="server"
ShowMessageBox="true" ShowSummary="false" />
</td>
</tr>
<tr>
<td>
<asp:Label Text="Existing Countries" ID="label_existingcountry"
runat="server" />
<asp:GridView ID="GridView_country" runat="server"
AutoGenerateColumns="False"
onrowediting="GridView_country_RowEditing"
onrowdeleting="GridView_country_RowDeleting"
onrowupdating="GridView_country_RowUpdating"
onselectedindexchanged="GridView_country_SelectedIndexChanged"
onrowcancelingedit="GridView_country_RowCancelingEdit">
<Columns>
<asp:TemplateField HeaderText="Country id"
SortExpression="country_id">

<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("country_id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Country Name"
SortExpression="Country_name">
<EditItemTemplate>
<asp:TextBox ID="TextBox_country" runat="server" Text='<
%# Bind("Country_name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label_country" runat="server" Text='<%#
Bind("Country_name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton_update" runat="server"
CausesValidation="false"
CommandName="Update"
Text="Update"></asp:LinkButton>
&nbsp;<asp:LinkButton ID="LinkButton_cancel"
runat="server" CausesValidation="False"
CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton_Edit" runat="server"
CausesValidation="False"
CommandName="Edit" Text="Edit"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton_delete" runat="server"
CausesValidation="False"
CommandName="Delete"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:Button ID="Button_Submit" runat="server" Text="Submit"
OnClick="Button_Submit_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button_Reset" runat="server" Text="Reset"
OnClick="Button_Reset_Click" />
</td>
</tr>
</table>
</center>
</asp:Content>

4.1.1.10 Admin_add_country.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class Add_Country : System.Web.UI.Page
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Mystring"].ConnectionStri
ng);

SqlDataAdapter da = new SqlDataAdapter();


DataTable dt = new DataTable();

protected void Page_Load(object sender, EventArgs e)


{
if (!IsPostBack)
bind();
}
void bind()
{
da = new SqlDataAdapter("select * from country_Table", con);
da.Fill(dt);
GridView_country.DataSource = dt;
GridView_country.DataBind();
}

protected void GridView_country_RowEditing(object sender,


GridViewEditEventArgs e)
{

protected void GridView_country_RowUpdating(object sender,


GridViewUpdateEventArgs e)
{
GridViewRow gvr=GridView_country.Rows[e.RowIndex];
string Sname = ((TextBox)gvr.FindControl("TextBox_country")).Text;
string SId=((Label)gvr.FindControl("Label1")).Text;
SqlCommand cmd = new SqlCommand("update Country_Table set
country_name='"
+ Sname + "' where country_ID ='"
+SId+"'", con);

con.Open();
cmd.ExecuteNonQuery();
con.Close();
GridView_country.EditIndex = -1;
bind();
}
protected void GridView_country_SelectedIndexChanged(object sender,
EventArgs e)
{

}
protected void GridView_country_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
GridViewRow gvr1 = GridView_country.Rows[e.RowIndex];
string name = ((Label)gvr1.FindControl("Label_country")).Text;
SqlCommand cmd1 = new SqlCommand("delete from country_table where
Country_name='"+name+"' ",con);

con.Open();
cmd1.ExecuteNonQuery();
con.Close();
GridView_country.EditIndex = -1;
bind();
}
protected void Button_Submit_Click(object sender, EventArgs e)
{
SqlDataAdapter da1 = new SqlDataAdapter("select * from country_table where
country_name='" + textbox_addcountry.Text + "'", con);
DataTable dt1 = new DataTable();
da1.Fill(dt1);
if (dt1.Rows.Count > 0)
{
}
else
{

SqlCommand cmd = new SqlCommand("insert into country_Table values('" +


textbox_addcountry.Text + "')", con);
con.Open();
int check = cmd.ExecuteNonQuery();
if (check > 0)
{
Response.Write("<script>alert('Country Added Successfully')</script>");
}
con.Close();
textbox_addcountry.Text = "";
}
bind();
}
protected void Button_Reset_Click(object sender, EventArgs e)
{

}
protected void GridView_country_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)
{
GridView_country.EditIndex = -1;
bind();
}
}

4.1.1.11 Admin_add_news_category.aspx

<%@ Page Title="" Language="C#"


MasterPageFile="~/Admin_Pages/Admin.master" AutoEventWireup="true"
CodeFile="Admin_Add_News_Category.aspx.cs" Inherits="Add_News_Category"
%>

<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="Server">


</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<center>
<h1>
Add News Category</h1>
<table>
<tr>
<td>
<asp:Label ID="label_addcategory" Text="Add Category"
runat="server" /><br />
<asp:TextBox ID="textbox_addcategory" runat="server" />
<asp:RequiredFieldValidator ID="rfv" runat="server"
ControlToValidate="textbox_addcategory"
Display="None" ErrorMessage="This field cannot be left blank." />
<asp:ValidationSummary ID="vs" runat="server"
ShowMessageBox="true" ShowSummary="false" />
</td>
</tr>
<tr>
<td>
<asp:Label Text="Existing Categories" ID="label_existingcategory"
runat="server" />
<asp:GridView ID="gridview_category" runat="server"
AutoGenerateColumns="False"
onrowediting="gridview1_RowEditing"
onrowupdating="gridview_category_RowUpdating"
onrowcancelingedit="gridview_category_RowCancelingEdit"
OnRowDeleting="gridview_category_RowDeleting" >
<Columns>
<asp:TemplateField HeaderText="Category ID"
SortExpression="category_id">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("category_id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Category Name"
SortExpression="Category_name">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("Category_name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#
Bind("Category_name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server"
CausesValidation="false"
CommandName="Update"
Text="Update"></asp:LinkButton>
&nbsp;<asp:LinkButton ID="LinkButton2" runat="server"
CausesValidation="False"
CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server"
CausesValidation="False"
CommandName="Edit" Text="Edit"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton_delete" runat="server"
CausesValidation="False"
CommandName="Delete"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:Button ID="Button1" runat="server" Text="Submit"
OnClick="Button_Submit_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="Reset"
OnClick="Button_Reset_Click" CausesValidation="false" />
</td>
</tr>
</table>
</center>
</asp:Content>

4.1.1.12 Admin_add_news_category.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class Add_News_Category : System.Web.UI.Page
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["MyString"].ConnectionStr
ing);
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}

}
void bind()
{
SqlDataAdapter da = new SqlDataAdapter("select * from category_table", con);
DataTable dt = new DataTable();
da.Fill(dt);
gridview_category.DataSource = dt;
gridview_category.DataBind();
}
protected void Button_Submit_Click(object sender, EventArgs e)
{
SqlDataAdapter da1 = new SqlDataAdapter("select * from Category_table where
category_name='"+textbox_addcategory.Text+"' ",con);
DataTable dt1 = new DataTable();
da1.Fill(dt1);
if (dt1.Rows.Count > 0)
{
}
else
{
cmd = new SqlCommand("insert into category_table values('" +
textbox_addcategory.Text + "')", con);
con.Open();
int check = cmd.ExecuteNonQuery();
if (check > 0)
{
Response.Write("<script>alert('New Category Added
successfully')</script>");
}
con.Close();
textbox_addcategory.Text = "";
bind();
}
}
protected void Button_Reset_Click(object sender, EventArgs e)
{
textbox_addcategory.Text = "";
}
protected void gridview1_RowEditing(object sender, GridViewEditEventArgs e)
{
gridview_category.EditIndex = e.NewEditIndex;
bind();
}
protected void gridview_category_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
GridViewRow gvr = gridview_category.Rows[e.RowIndex];

string Sid = ((Label)gvr.FindControl("Label1")).Text;


string Sname = ((TextBox)gvr.FindControl("TextBox1")).Text;

cmd = new SqlCommand("update category_table set category_name ='"


+ Sname + "' where category_ID='"
+ Sid + "'", con);

con.Open();
int k = cmd.ExecuteNonQuery();
con.Close();
if (k > 0)
{
Response.Write("<sript>alert('Record Updated Successfully')</script>");
gridview_category.EditIndex = -1;
bind();
}
}
protected void gridview_category_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)
{
gridview_category.EditIndex = -1;
bind();
}
protected void gridview_category_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
GridViewRow gvr1 = gridview_category.Rows[e.RowIndex];
string sname = ((Label)gvr1.FindControl("Label2")).Text;

SqlCommand cmd = new SqlCommand("delete from category_table where


category_name = '"+sname+"'", con);

con.Open();
cmd.ExecuteNonQuery();
con.Close();

bind();
}
}

4.1.1.13 Admin_add_region.aspx
<%@ Page Title="" Language="C#"
MasterPageFile="~/Admin_Pages/Admin.master" AutoEventWireup="true"
CodeFile="Admin_Add_Region.aspx.cs" Inherits="Add_Region" %>

<asp:Content ID="Content5" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center>
<h1>Add Region</h1>
<table>
<tr>
<td valign="top">
<asp:Label ID="Label_addRegion" runat="server" Text="Region" />
<asp:TextBox ID="textbox_addRegion" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="textbox_addRegion" Display="None" ErrorMessage="Please
Enter A Region"/>
<asp:ValidationSummary ID="ValidationSummary2" runat="server"
ShowMessageBox="true" ShowSummary="false" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="label_ExistingRegions" runat="server" Text="Existing
Regions" /><br />s
<asp:GridView ID="GridView_Regions" runat="server"
AutoGenerateColumns="False"
OnRowEditing="GridView_Regions_RowEditing"
OnRowUpdating="GridView_Regions_RowUpdating"
OnSelectedIndexChanged="GridView_Regions_SelectedIndexChanged"
OnRowDeleting="GridView_Regions_RowDeleting"
OnRowCancelingEdit="GridView_Regions_RowCancelingEdit"
>
<Columns>
<asp:TemplateField HeaderText="Region Id"
SortExpression="Region_id">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Eval("Region_id") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("Region_id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Region Name"
SortExpression="Region_name">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("Region_name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#
Bind("Region_name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server"
CausesValidation="false"
CommandName="Update" Text="Update"></asp:LinkButton>
&nbsp;<asp:LinkButton ID="LinkButton2" runat="server"
CausesValidation="False"
CommandName="Cancel" Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server"
CausesValidation="False"
CommandName="Edit" Text="Edit"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton_delete" runat="server"
CausesValidation="False"
CommandName="Delete" Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

</td>
</tr>
<tr>
<td>
<asp:Button ID="Button3" runat="server" Text="Submit"
onclick="Button_Submit_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button4" runat="server" Text="Reset"
onclick="Button_Reset_Click" />
</td>
</tr>
</table>
</center>
</asp:Content>

4.1.1.14 Admin_add_region.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class Add_Region : System.Web.UI.Page
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["MyString"].ConnectionStr
ing);
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
void bind()
{
SqlDataAdapter da = new SqlDataAdapter("select * from region_table", con);
DataTable dt = new DataTable();
da.Fill(dt);
GridView_Regions.DataSource = dt;
GridView_Regions.DataBind();
}
protected void Button_Submit_Click(object sender, EventArgs e)
{
SqlDataAdapter da1 = new SqlDataAdapter("select * from region_table where
region_name='" + textbox_addRegion.Text + "'", con);
DataTable dt1 = new DataTable();
da1.Fill(dt1);
if (dt1.Rows.Count > 0)
{
}
else
{

cmd = new SqlCommand("insert into Region_Table values('" +


textbox_addRegion.Text + "')", con);
con.Open();
int check = cmd.ExecuteNonQuery();
if (check > 0)
{
Response.Write("<script>alert('Region Added Successfully')</script>");
}
con.Close();
textbox_addRegion.Text = "";
}
bind();
}
protected void Button_Reset_Click(object sender, EventArgs e)
{
textbox_addRegion.Text = "";
}

protected void GridView_Regions_RowEditing(object sender,


GridViewEditEventArgs e)
{
GridView_Regions.EditIndex = e.NewEditIndex;
bind();
}
protected void GridView_Regions_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
GridViewRow gvr = GridView_Regions.Rows[e.RowIndex];
string Sname = ((TextBox)gvr.FindControl("TextBox1")).Text;
string SId = ((Label)gvr.FindControl("Label1")).Text;

SqlCommand cmd = new SqlCommand("update Region_Table set


Region_name='"
+ Sname + "' where Region_ID ='"
+ SId + "'", con);

con.Open();
cmd.ExecuteNonQuery();
con.Close();
GridView_Regions.EditIndex = -1;
bind();
}
protected void GridView_Regions_SelectedIndexChanged(object sender,
EventArgs e)
{

}
protected void GridView_Regions_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
GridViewRow gvr1 = GridView_Regions.Rows[e.RowIndex];
string sname1 = ((Label)gvr1.FindControl("Label2")).Text;

SqlCommand cmd = new SqlCommand("delete from Region_Table where


Region_name='"+sname1+"'", con);

con.Open();
cmd.ExecuteNonQuery();
con.Close();
GridView_Regions.EditIndex = -1;
bind();
}
protected void GridView_Regions_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)
{
GridView_Regions.EditIndex = -1;
bind();
}
}

4.1.1.15 Add_report.aspx
<%@ Page Title="" Language="C#"
MasterPageFile="~/Admin_Pages/Admin.master" AutoEventWireup="true"
CodeFile="Admin_Add_Report.aspx.cs" Inherits="Add_Report" %>

<asp:Content ID="Content7" ContentPlaceHolderID="head" runat="Server">


</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<center>
<table cellpadding="10" cellspacing="10">
<tr>
<td colspan="2" align="center">
<h1>
Post Report</h1>
</td>
</tr>
<tr>
<td>
<span>Region</span>
</td>
<td>
<asp:DropDownList ID="DropDownList_Region" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<span>Category</span>
</td>
<td>
<asp:DropDownList ID="DropDownList_Category" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<span>Headline</span>
</td>
<td>
<asp:TextBox ID="textbox_headline" runat="server"
TextMode="MultiLine" Width="400px" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
runat="server" ControlToValidate="textbox_headline" ErrorMessage="Please enter a
Headline"
Display="None" />
</td>
</tr>
<tr>
<td>
<span>Thumbnail</span>
</td>
<td>
<asp:FileUpload ID="FileUpload_thumbnail" runat="server" />
</td>
</tr>
<tr>
<td>
<span>Description</span>
</td>
<td>
<asp:TextBox ID="TextBox_Descripton" runat="server"
TextMode="MultiLine" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
runat="server" ControlToValidate="TextBox_Descripton"
ErrorMessage="Please enter a Description" Display="None" />
</td>
</tr>
<tr>
<td>
<span>Detailed Report</span>
</td>
<td>
<asp:TextBox ID="textbox_DetailedReport" runat="server"
TextMode="MultiLine" Height="200px"
Width="400px" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
runat="server" ControlToValidate="textbox_DetailedReport"
ErrorMessage="Please enter Detailed report" Display="None" />
</td>
</tr>
<tr>
<td>
<span>Upload Image</span>
</td>
<td>
<asp:FileUpload ID="FileUpload_Image" runat="server" />

</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Panel ID="panel_image" runat="server" Visible="true">
<table>
<tr>
<td>
<span>Image Description</span>
</td>
<td>
<asp:TextBox ID="textbox_imagedescription" runat="server"
/>
</td>
</tr>
<tr>
<td>
<span>Date of Gathering</span>
</td>
<td>
<asp:TextBox ID="textbox_image_dateofGathering"
runat="server" />
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
<tr>
<td>
<span>Upload Video</span>
</td>
<td>
<asp:FileUpload ID="FileUpload_Video" runat="server" />

</td>
<asp:ValidationSummary ID="ValidationSummary3" runat="server"
ShowMessageBox="true" ShowSummary="false" />
</tr>
<tr>
<td colspan="2" align="center">
<asp:Panel ID="Panel_video" runat="server" Visible="true">
<table>
<tr>
<td>
<span>Image Description</span>
</td>
<td>
<asp:TextBox ID="textbox_videodescription" runat="server"
/>
</td>
</tr>
<tr>
<td>
<span>Date of Gathering</span>
</td>
<td>
<asp:TextBox ID="textbox_video_dateofGatehring"
runat="server" />
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
<asp:Button Text="Submit" ID="Button5" runat="server"
OnClick="Button_Submit_Click" />
&nbsp;&nbsp;&nbsp;<asp:Button Text="Reset" ID="Button6" runat="server"
OnClick="Button_Reset_Click" />
</center>
</asp:Content>
4.1.1.16 Add_report.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class Add_Report : System.Web.UI.Page
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["MyString"].ConnectionStr
ing);
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}

}
string checks()
{
if (Session["adminloginid"] != null)
{
return "Admin";
}
if (Session["reporter_loginid"] != null)
{
return "Reporter";
}
else
{
return "0";
}
}
void bind()
{
SqlDataAdapter da_region = new SqlDataAdapter("select * from region_table ",
con);
DataTable dt_region = new DataTable();
da_region.Fill(dt_region);

if (dt_region.Rows.Count > 0)
{
DropDownList_Region.DataSource = dt_region;
DropDownList_Region.DataTextField = "region_name";
DropDownList_Region.DataValueField = "region_id";
DropDownList_Region.DataBind();

}
else
{
DropDownList_Region.DataSource = dt_region;

DropDownList_Region.DataTextField = "region_name";
DropDownList_Region.DataValueField = "region_id";
DropDownList_Region.DataBind();
}
SqlDataAdapter da_category = new SqlDataAdapter("select * from
category_table", con);
DataTable dt_category = new DataTable();
da_category.Fill(dt_category);
if (dt_category.Rows.Count > 0)
{
DropDownList_Category.DataSource = dt_category;

DropDownList_Category.DataTextField = "category_name";
DropDownList_Category.DataValueField = "category_id";
DropDownList_Category.DataBind();
}
else
{
DropDownList_Category.DataSource = dt_category;

DropDownList_Category.DataTextField = "category_name";
DropDownList_Category.DataValueField = "category_id";
DropDownList_Category.DataBind();
}

}
protected void Button_Submit_Click(object sender, EventArgs e)
{
string sFilePath;
if (FileUpload_thumbnail.HasFile)
{
FileUpload_thumbnail.SaveAs(Request.PhysicalApplicationPath + "\\
UploadedFiles\\" + FileUpload_thumbnail.FileName);
sFilePath = "~\\UploadedFiles\\" + FileUpload_thumbnail.FileName;
}
else
{
sFilePath = "";
}

string Post_Published = "0";


string s = checks();
if (s == "0")
{
Response.Write("<script>alert('Please Login First')</script>");
}
else
{
cmd = new SqlCommand("insert into Report_table values('"
+ textbox_headline.Text + "','"
+ sFilePath + "','"
+ TextBox_Descripton.Text + "','"
+ textbox_DetailedReport.Text + "','"
+ checks() + "','"
+ DateTime.Now.ToShortDateString() + "','"
+ DropDownList_Region.SelectedValue + "','"
+ DropDownList_Category.SelectedValue + "','"
+ Post_Published + "')", con);

con.Open();
int check = cmd.ExecuteNonQuery();
if (check > 0)
{
string sFilePath1;
string sFilepath2;
if (FileUpload_Image.HasFile)
{
FileUpload_Image.SaveAs(Request.PhysicalApplicationPath + "\\
UploadedFiles\\" + FileUpload_Image.FileName);
sFilePath1 = "~\\UploadedFiles\\" + FileUpload_Image.FileName;
string type = "image";
string image_file_size = "";
SqlCommand cmd1 = new SqlCommand("insert into Multimedia_table
values('"
+ type + "','"
+ image_file_size + "','"
+textbox_imagedescription.Text+"','"
+ textbox_image_dateofGathering.Text+ "','"
+ DateTime.Now.ToShortDateString() + "','"
+sFilePath1+"')", con);
}
else
{
sFilePath1 = "";
}

if (FileUpload_Video.HasFile)
{
string video_file_size = "";
FileUpload_Video.SaveAs(Request.PhysicalApplicationPath + "\\
UploadedFiles\\" + FileUpload_Video.FileName);
sFilepath2 = "~\\UploadedFiles\\" + FileUpload_Video.FileName;
string type = "video";
SqlCommand cmd2 = new SqlCommand("insert into Multimedia_table
values('"
+ type + "','"
+ video_file_size + "','"
+ textbox_imagedescription.Text + "','"
+ textbox_video_dateofGatehring.Text+ "','"
+ DateTime.Now.ToShortDateString() + "','"
+ sFilepath2 + "')", con);
}
else
{
sFilepath2 = "";
}

Response.Write("<script>alert('Report Added successfully')</script>");


}
con.Close();
}
reset();

}
protected void Button_Reset_Click(object sender, EventArgs e)
{
reset();
}
void reset()
{
textbox_headline.Text = "";
TextBox_Descripton.Text = "";
textbox_DetailedReport.Text = "";
textbox_image_dateofGathering.Text = "";
textbox_imagedescription.Text = "";
textbox_video_dateofGatehring.Text = "";
textbox_videodescription.Text = "";

4.1.1.17 Admin_home.aspx
<%@ Page Title="" Language="C#"
MasterPageFile="~/Admin_Pages/Admin.master" AutoEventWireup="true"
CodeFile="Admin_Home.aspx.cs" Inherits="Admin_Home" %>

<asp:Content ID="Content9" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content10" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
This is Admin Panel.
</asp:Content>

4.1.1.18 Admin_home.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Home : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
}

4.1.1.19 Admin_Listofreporters.aspx
<%@ Page Title="" Language="C#"
MasterPageFile="~/Admin_Pages/Admin.master" AutoEventWireup="true"
CodeFile="Admin_ListofReporters.aspx.cs"
Inherits="Admin_Pages_Admin_ListofReporters" %>

<asp:Content ID="Content11" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content12" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center>
<asp:GridView ID="GridView_ReporterDetail" runat="server"
AutoGenerateColumns="False"
onrowediting="GridView_ReporterDetail_RowEditing"
onrowupdating="GridView_ReporterDetail_RowUpdating"
AllowPaging="True"
onpageindexchanging="GridView_ReporterDetail_PageIndexChanging"
onrowcancelingedit="GridView_ReporterDetail_RowCancelingEdit"

onselectedindexchanging="GridView_ReporterDetail_SelectedIndexChanging"
PageIndex="5" PageSize="5"
onselectedindexchanged="GridView_ReporterDetail_SelectedIndexChanged"
RowHeaderColumn="3">
<Columns>
<asp:BoundField DataField="Reporter_id" HeaderText="ID"
ReadOnly="True" SortExpression="Reporter_id" />
<asp:TemplateField HeaderText="First Name">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("reporter_firstname") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Gender">
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%#
Bind("reporter_gender") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Contact No.">
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%#
Bind("reporter_contact") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date of Birth">
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%#
Bind("reporter_dob") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address">
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%#
Bind("reporter_address") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="E-Mail ID">
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%#
Bind("reporter_emailid") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Login ID">
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%#
Bind("reporter_loginid") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Password">
<ItemTemplate>
<asp:Label ID="Label10" runat="server" Text='<%#
Bind("reporter_password") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Country">
<ItemTemplate>
<asp:Label ID="Label11" runat="server" Text='<%#
Bind("reporter_country") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Language">
<ItemTemplate>
<asp:Label ID="Label12" runat="server"
Text='<%# Bind("[reporter_language ]") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Registration Date">
<ItemTemplate>
<asp:Label ID="Label15" runat="server"
Text='<%# Bind("reporter_registrationDate") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Blocked">

<ItemTemplate>
<asp:Label ID="Label16" runat="server"
Text='<%# Bind("[reporter_IsBlocked ]") %>'></asp:Label>
<asp:LinkButton ID="LinkButton_update" runat="server"
CausesValidation="false"
CommandName="Update"
Text="Change"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</center>
</asp:Content>
4.1.1.20 Admin_listofreporters.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class Admin_Pages_Admin_ListofReporters : System.Web.UI.Page
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["MyString"].ConnectionStr
ing);
SqlDataAdapter da_grid;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Grid_bind();
}

}
void Grid_bind()
{
da_grid = new SqlDataAdapter("select * from reporter_table", con);
DataTable dt_grid = new DataTable();
da_grid.Fill(dt_grid);
GridView_ReporterDetail.DataSource = dt_grid;
GridView_ReporterDetail.DataBind();
}
protected void GridView_ReporterDetail_RowEditing(object sender,
GridViewEditEventArgs e)
{
GridView_ReporterDetail.EditIndex = e.NewEditIndex;
Grid_bind();
}
protected void GridView_ReporterDetail_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
GridViewRow gvr = GridView_ReporterDetail.Rows[e.RowIndex];
string scurrent = ((Label)gvr.FindControl("Label16")).Text;
string sfirstname = ((Label)gvr.FindControl("Label1")).Text;

if (scurrent == "false") { scurrent ="1"; }


else { scurrent = "0"; }
SqlCommand cmd = new SqlCommand("update reporter_table set
reporter_IsBlocked='"
+ scurrent + "' where reporter_firstname = '"+sfirstname+"'", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
GridView_ReporterDetail.EditIndex = -1;
Grid_bind();

}
protected void GridView_ReporterDetail_SelectedIndexChanging(object sender,
GridViewSelectEventArgs e)
{

}
protected void GridView_ReporterDetail_PageIndexChanging(object sender,
GridViewPageEventArgs e)
{

}
protected void GridView_ReporterDetail_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)
{
GridView_ReporterDetail.EditIndex = -1;
Grid_bind();
}
protected void GridView_ReporterDetail_SelectedIndexChanged(object sender,
EventArgs e)
{

}
protected void button_block_Click(object sender, EventArgs e)
{

4.1.1.21 Admin_permission.aspx
<%@ Page Title="" Language="C#"
MasterPageFile="~/Admin_Pages/Admin.master" AutoEventWireup="true"
CodeFile="Admin_permissions.aspx.cs"
Inherits="Admin_Pages_Admin_permissions" %>

<asp:Content ID="Content13" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content14" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center>
<h1>
Give Permissions</h1>
<table>
<tr>
<td><asp:Label Text="Existing Reports" ID="label_existingreports"
runat="server"></asp:Label>
<asp:GridView ID="gridview_reports" runat="server"
AutoGenerateColumns="False"
>
<Columns>
<asp:TemplateField HeaderText="Report ID">
<ItemTemplate>
<asp:Label ID="label_report_id" Text='<%#
Bind("Report_ID") %>' runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Headline">
<ItemTemplate>
<asp:Label ID="Label_headline" runat="server" Text='<%#
Bind("Headline") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Report Block/Unblock">
<ItemTemplate>
<asp:Label ID="Label_Report_IsPublished" runat="server"
Text='<%# Bind("Report_IsPublished") %>'></asp:Label>
</ItemTemplate>

</asp:TemplateField>
<asp:TemplateField ShowHeader="False">

<ItemTemplate>
<asp:LinkButton ID="LinkButton_changepermission"
runat="server" CausesValidation="False"
CommandName="Edit" Text="Change"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</center>
</asp:Content>

4.1.1.22 Admin_permission.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;
using System.Data;

public partial class Admin_Pages_Admin_permissions : System.Web.UI.Page


{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Mystring"].ConnectionStri
ng);

SqlDataAdapter da = new SqlDataAdapter();


DataTable dt = new DataTable();

protected void Page_Load(object sender, EventArgs e)


{
if (!IsPostBack)
bind();

void bind()
{
da = new SqlDataAdapter("select * from Report_table", con);
da.Fill(dt);
gridview_reports.DataSource = dt;
gridview_reports.DataBind();
}

4.1.1.23 Reporter.master

<%@ Master Language="C#" AutoEventWireup="true"


CodeFile="Reporter.master.cs" Inherits="Reporter" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>News Mate</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../style.css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>

<body>
<div id="wrapper">
<form id="form1" runat="server">
<!-- BEGIN header -->
<div id="header">
<p class="links">
<asp:LinkButton ID="Linkbutton_register" runat="server" Visible="false"
Text="Register" CausesValidation="false"
OnClick="Linkbutton_register_Click" />
<asp:LinkButton ID="Linkbutton_Login" CausesValidation="false"
Visible="false" runat="server" Text="LogIn"
OnClick="Linkbutton_Login_Click" />

<asp:LinkButton ID="Linkbutton_logout" Visible="false"


CausesValidation="false" runat="server"
Text="Log Out" OnClick="Linkbutton_logout_Click" />
</p>
<div class="break"></div>
<div class="logo">
<h1>
<a href="../Home.aspx">NewsMate</a></h1>
</div>
<div class="ad468x60">
<a href="">
<img src="../Images/ad468x60.gif" alt="" /></a>
</div>
<div class="break"></div>
<asp:Panel ID="panel_reporter_menu" runat="server">
<asp:Menu ID="Menu1" runat="server" Font-Size="Large"
Orientation="Horizontal">
<DynamicHoverStyle BackColor="#284E98" ForeColor="White" />
<DynamicMenuItemStyle HorizontalPadding="5px"
VerticalPadding="2px" />
<DynamicMenuStyle BackColor="#B5C7DE" />
<DynamicSelectedStyle BackColor="#507CD1" />
<Items>
<asp:MenuItem ToolTip="Home" Value="Home"
NavigateUrl="~/Home.aspx"></asp:MenuItem>
<asp:MenuItem Text="Country" ToolTip="Country" Value="Country"
NavigateUrl="~/Country.aspx"></asp:MenuItem>
<asp:MenuItem Text="World" ToolTip="World" Value="World"
NavigateUrl="~/World.aspx"></asp:MenuItem>
<asp:MenuItem Text="Politics" ToolTip="Politics" Value="Politics"
NavigateUrl="~/Politics.aspx"></asp:MenuItem>
<asp:MenuItem Text="Entertainment" ToolTip="Entertainment"
Value="Entertainment"
NavigateUrl="~/Entertainment.aspx"></asp:MenuItem>
<asp:MenuItem Text="Business" ToolTip="Business"
Value="Business" NavigateUrl="~/Business.aspx"></asp:MenuItem>
<asp:MenuItem Text="Sports" ToolTip="Sports" Value="Sports"
NavigateUrl="~/Sports.aspx"></asp:MenuItem>
</Items>

</asp:Menu>
</asp:Panel>
<div class="break"></div>

<!-- Reporter Menu -->


<asp:Menu ID="Menu2" Visible="False" runat="server"
Orientation="Horizontal"
StaticSubMenuIndent="16px">
<Items>
<asp:MenuItem Text="Add Report" Value="Add Report"
NavigateUrl="~/Reporter_Pages/Reporter_Post_Report.aspx"></asp:MenuItem>
<asp:MenuItem Text="Post FeedBack" Value="Post FeedBack"
NavigateUrl="~/Reporter_Pages/Reporter_Feedback.aspx"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/Article.aspx" Text="Post Article"
Value="Post Article"></asp:MenuItem>
</Items>
</asp:Menu>
</div>

<!-- BEGIN Content -->


<div id="content">

<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">


</asp:ContentPlaceHolder>
</div>

<!-- Sidebar -->


<div id="sidebar">
<!-- begin ads -->
<div class="ads">
<a href="home.aspx">
<img src="images/ad125x125.jpg" alt="" /></a>
<a href="home.aspx">
<img src="images/ad125x125.jpg" alt="" /></a>
<a href="home.aspx">
<img src="images/ad125x125.jpg" alt="" /></a>
<a href="home.aspx">
<img src="images/ad125x125.jpg" alt="" /></a>

</div>
<!-- end ads -->
<!-- begin search -->
<form class="search" action="home.aspx">
<input type="text" name="s" id="s" />
<button type="submit">Search</button>
</form>
<!-- end search -->
<div class="wrapper">
<!-- begin popular posts -->
<h2>Popular Posts</h2>
<ul>
<li><a href="home.aspx">Make Money Online Creating
Websites</a></li>
<li><a href="home.aspx">Top 100 Internet Marketing Tips</a></li>
<li><a href="home.aspx">Tutorial: How to add Videos in your
Post</a></li>
<li><a href="home.aspx">Sample Post Unordered List</a></li>
<li><a href="home.aspx">Sample Post Blockquote</a></li>
</ul>
<!-- end popular posts -->
<!-- begin flickr photos -->
<h2>Flickr Photos</h2>
<div class="flickr">
<a href="home.aspx">
<img src="images/_thumb3.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb4.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb5.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb6.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb7.jpg" alt="" /></a> <a
href="home.aspx">
<img src="images/_thumb8.jpg" alt="" /></a>
</div>
<!-- end flickr photos -->
<!-- begin featured video -->
<h2>Featured Video</h2>
<div class="video">
<img src="images/_video.jpg" alt="" />
</div>
<!-- end featured video -->
<!-- begin tags -->
<h2>Tags</h2>
<div class="tags"></div>
<!-- end tags -->
<!-- BEGIN left -->
<div class="l sbar">
<!-- begin categories -->
<h2>Categories</h2>
<ul>
<li><a href="home.aspx">Entertainment</a></li>
<li><a href="home.aspx">Fashion</a></li>
<li><a href="home.aspx">Internet</a></li>
<li><a href="home.aspx">Marketing</a></li>
<li><a href="home.aspx">Lifestyle</a></li>
<li><a href="home.aspx">Make Money</a></li>
<li><a href="home.aspx">Online</a></li>
<li><a href="home.aspx">Parenting</a></li>
</ul>
<!-- end categories -->
<!-- begin pages -->
<h2>Pages</h2>
<ul>
<li><a href="home.aspx">Home</a></li>
<li><a href="home.aspx">About</a></li>
<li><a href="home.aspx">Archives</a></li>
<li><a href="home.aspx">Links</a></li>
<li><a href="home.aspx">Contact</a></li>
<li><a href="home.aspx">Sitemap</a></li>
</ul>
<!-- end pages -->
</div>
<!-- END left -->
<!-- BEGIN right -->
<div class="r sbar">
<!-- begin archives -->
<h2>Archives</h2>
<ul>
<li><a href="home.aspx">August 2008</a></li>
<li><a href="home.aspx">July 2008</a></li>
<li><a href="home.aspx">June 2008</a></li>
<li><a href="home.aspx">May 2008</a></li>
<li><a href="home.aspx">April 2008</a></li>
<li><a href="home.aspx">March 2008</a></li>
</ul>
<!-- end archives -->
<!-- begin blogroll -->
<h2>Blogroll</h2>
<ul>
<li><a href="home.aspx">Carlos</a></li>
<li><a href="home.aspx">Digital Point Forum</a></li>
<li><a href="home.aspx">Eric's Photo Gallery</a></li>
<li><a href="home.aspx">Fashion Trends</a></li>
<li><a href="home.aspx">Google Scoreboard</a></li>
<li><a href="home.aspx">Marketing Forum</a></li>
</ul>
<!-- end blogroll -->
<!-- begin meta -->
<h2>Meta</h2>
<ul>
<li><a href="home.aspx">Login</a></li>
</ul>
<!-- end meta -->
</div>
<!-- END right -->
</div>
</div>

<!-- BEGIN footer -->


<div id="footer">
<p>Copyright &copy; 2014 - <a href="home.aspx">NewsMate</a> &middot;
All Rights Reserved to Rajesh Bharat</p>
<asp:LinkButton ID="Linkbutton_AdminLogin" runat="server" Text="Admin
LogIn" CausesValidation="false" OnClick="Linkbutton_AdminLogin_Click" />
</div>

</form>
</div>
</body>
</html>

4.1.1.24 Reporter.master.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;
using System.Data;

public partial class Reporter : System.Web.UI.MasterPage


{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Mystring"].ConnectionStri
ng);
SqlDataReader dr;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["reporter_loginid"] != null)
{
Menu2.Visible = true;
Linkbutton_logout.Visible = true;
Linkbutton_Login.Visible = false;
Linkbutton_register.Visible = false;
}
else
{
Linkbutton_logout.Visible = false;
Linkbutton_Login.Visible = true;
Linkbutton_register.Visible = true;
}
}

protected void Linkbutton_Login_Click(object sender, EventArgs e)


{
Response.Redirect("reporter_login.aspx");
}

protected void Linkbutton_register_Click(object sender, EventArgs e)


{
Response.Redirect("reporter_Registration.aspx");
}
protected void Linkbutton_logout_Click(object sender, EventArgs e)
{
Menu2.Visible = false;
Linkbutton_logout.Visible = false;
Linkbutton_Login.Visible = true;
Linkbutton_register.Visible = true;
Session.Clear();
Session.Abandon();
Response.Redirect("reporter_home.aspx");
}
protected void Linkbutton_AdminLogin_Click(object sender, EventArgs e)
{
Response.Redirect("~/Admin_Login.aspx");
}
}

4.1.1.25 Reporter_feedback.aspx

<%@ Page Title="" Language="C#"


MasterPageFile="~/Reporter_Pages/Reporter.master" AutoEventWireup="true"
CodeFile="Reporter_Feedback.aspx.cs" Inherits="Reporter_Feedback" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center>
<h1>Give us your FeedBack</h1>
<table>

<tr>
<td>
<span>Name</span>
</td>
<td>
<asp:TextBox ID="TextBox_name" runat="server" />
<asp:RequiredFieldValidator runat="server"
ControlToValidate="TextBox_name" ErrorMessage="Please enter your name"
Display="None" />
</td>
</tr>
<tr>
<td>
<span>Contact No.</span>
</td>
<td>
<asp:TextBox ID="Textbox_Contact" runat="server" />
<asp:RequiredFieldValidator runat="server"
ControlToValidate="Textbox_Contact" Display="None" ErrorMessage="Please enter
your Contact No." />
</td>
</tr>
<tr>
<td>
<span>EmailID</span>
</td>
<td>
<asp:TextBox ID="textbox_emailid" runat="server" />
<asp:RequiredFieldValidator runat="server"
ControlToValidate="textbox_emailid" Display="None" ErrorMessage="Please enter
your Email ID" />
<asp:RegularExpressionValidator runat="server"
ControlToValidate="textbox_emailid" Display="None" ErrorMessage="Please Enter
a valid E-Mail ID" ValidationExpression="\w+@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
</td>
</tr>
<tr>
<td>
<span>FeedBack</span>
</td>

<td>
<asp:TextBox ID="TextBox_feedback" runat="server" />
<asp:RequiredFieldValidator runat="server"
ControlToValidate="TextBox_feedback" Display="None" ErrorMessage="Please
enter your feedback" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="button_submit" runat="server" Text="Submit"
onclick="button_submit_Click" />
<asp:Button ID="button_reset" runat="server" Text="Reset"
onclick="button_reset_Click" />
</td>
</tr>
<asp:ValidationSummary runat="server" ShowMessageBox="true"
ShowSummary="false" />

</table>
</center>

</asp:Content>

4.1.1.26 Reporter_feedback.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;
public partial class Reporter_Feedback : System.Web.UI.Page
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Mystring"].ConnectionStri
ng);
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["reporter_Loginid"] == null)
{
Response.Redirect("reporter_home.aspx");
}
}
protected void button_submit_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("insert into FeedBack_Table values('"
+TextBox_name.Text+"',"
+Textbox_Contact.Text+",'"
+textbox_emailid.Text+"','"
+TextBox_feedback.Text+"',"
+DateTime.Now.ToShortDateString()+")", con);
con.Open();
int check=cmd.ExecuteNonQuery();
if (check > 0)
{
Response.Write("<script>alert('Thanks For YOur FeedBack')</script>");
}
con.Close();
}
protected void button_reset_Click(object sender, EventArgs e)
{
textbox_emailid.Text = "";
Textbox_Contact.Text = "";
TextBox_name.Text = "";
TextBox_feedback.Text = "";
}
}

4.1.1.27 Reporter_home.aspx

<%@ Page Title="" Language="C#"


MasterPageFile="~/Reporter_Pages/Reporter.master" AutoEventWireup="true"
CodeFile="Reporter_Home.aspx.cs" Inherits="Reporter_Home" %>

<asp:Content ID="Content3" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
</asp:Content>

4.1.1.28 Reporter_home.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Reporter_Home : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
}
4.1.1.29 Reporter_postreport.aspx

<%@ Page Title="" Language="C#"


MasterPageFile="~/Reporter_Pages/Reporter.master"
AutoEventWireup="true" CodeFile="Reporter_Post_Report.aspx.cs"
Inherits="Reporter_Post_Report" %>
<%@ Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content5" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<ajaxToolkit:ToolkitScriptManager runat="Server" EnableScriptGlobalization="true"
EnableScriptLocalization="true" ID="ScriptManager1" />
<center>
<table>
<tr>
<td colspan="2" align="center">
<h1>
Post Report</h1>
</td>
</tr>
<tr>
<td>
<span>Region</span>
</td>
<td>
<asp:DropDownList ID="DropDownList_Region" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<span>Category</span>
</td>
<td>
<asp:DropDownList ID="DropDownList_Category" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<span>Headline</span>
</td>
<td>
<asp:TextBox ID="textbox_headline" runat="server"
TextMode="MultiLine" Width="400px" />
<asp:RequiredFieldValidator runat="server"
ControlToValidate="textbox_headline" Display="None"
ErrorMessage="Please enter a headline" />
</td>
</tr>
<tr>
<td>
<span>Thumbnail</span>
</td>
<td>
<asp:FileUpload ID="FileUpload_thumbnail" runat="server" />
</td>
</tr>
<tr>
<td>
<span>Description</span>
</td>
<td>
<asp:TextBox ID="TextBox_Descripton" runat="server"
TextMode="MultiLine" />
<asp:RequiredFieldValidator runat="server"
ControlToValidate="TextBox_Descripton"
ErrorMessage="Please enter a Description" Display="None" />
</td>
</tr>
<tr>
<td>
<span>Detailed Report</span>
</td>
<td>
<asp:TextBox ID="textbox_DetailedReport" runat="server"
TextMode="MultiLine" Height="200px"
Width="400px" />
<asp:RequiredFieldValidator runat="server"
ControlToValidate="textbox_DetailedReport"
ErrorMessage="Please enter Detailed report" Display="None" />
</td>
</tr>
<tr>
<td>
<span>Upload Image</span>
</td>
<td>
<asp:FileUpload ID="FileUpload_Image" runat="server" />
</td>
</tr>
<tr>
<td>
<span>Upload Video</span>
</td>
<td>
<asp:FileUpload ID="FileUpload_Video" runat="server" />
</td>
</tr>
</table>
<asp:Button Text="Submit" ID="Button1" runat="server"
OnClick="Button_Submit_Click" />&nbsp;&nbsp;&nbsp;
<asp:Button Text="Reset" ID="Button2" runat="server"
OnClick="Button_Reset_Click" />
<asp:ValidationSummary runat="server" ShowMessageBox="true"
ShowSummary="false" />
</center>
</asp:Content>

4.1.1.30 Reporter_postreport.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.IO;
public partial class Reporter_Post_Report : System.Web.UI.Page
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Mystring"].ConnectionStri
ng);
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["reporter_Loginid"] == null)
{
Response.Redirect("reporter_home.aspx");
}
else
{
if (!IsPostBack)
{
Ddl_Region();
Ddl_Category();
}
}
}
void Ddl_Region()
{
SqlDataAdapter dar = new SqlDataAdapter("select Region_name,region_ID
from Region_table", con);
DataTable dtr = new DataTable();
dar.Fill(dtr);
if (dtr.Rows.Count > 0)
{
DropDownList_Region.DataSource = dtr;
DropDownList_Region.DataTextField = "Region_name";
DropDownList_Region.DataValueField = "region_ID";
DropDownList_Region.DataBind();
}
}
void Ddl_Category()
{
SqlDataAdapter dac = new SqlDataAdapter("Select * from Category_Table",
con);
DataTable dtc = new DataTable();
dac.Fill(dtc);
if (dtc.Rows.Count > 0)
{
DropDownList_Category.DataSource = dtc;
DropDownList_Category.DataTextField = "Category_name";
DropDownList_Category.DataValueField = "category_ID";
DropDownList_Category.DataBind();
}

}
protected void Button_Submit_Click(object sender, EventArgs e)
{

uploadfile();

}
protected void Button_Reset_Click(object sender, EventArgs e)
{
textbox_headline.Text = "";
TextBox_Descripton.Text = "";
textbox_DetailedReport.Text = "";

public void uploadfile()


{
string Post_Published = "0";
if (FileUpload_thumbnail.HasFile)
{
string ext = Path.GetExtension(FileUpload_thumbnail.FileName);
if (ext == ".jpg" && ext == ".jpeg")
{}
else
{
FileUpload_thumbnail.SaveAs(Request.PhysicalApplicationPath +
"/UploadedFiles" + FileUpload_thumbnail.FileName);
string spath = "~/uploadedfiles" + FileUpload_thumbnail.FileName;

SqlCommand cmdinsert = new SqlCommand("insert into Report_table


values('"
+ textbox_headline.Text + "','"
+ spath + "','"
+ TextBox_Descripton.Text + "','"
+ textbox_DetailedReport.Text + "','"
+ Session["Reporter_loginid"] + "','"
+ DateTime.Now.ToShortDateString() + "',"
+ DropDownList_Region.SelectedValue + ","
+ DropDownList_Category.SelectedValue + ",'"
+ Post_Published + "')", con);

con.Open();
int check = cmdinsert.ExecuteNonQuery();
if (check > 0)
{
Response.Write("<script>alert('Report Added successfully')</script>");
}
con.Close();

}
}
}
}

4.1.1.31 Reporter_registration.aspx

<%@ Page Title="" Language="C#"


MasterPageFile="~/Reporter_Pages/Reporter.master"
AutoEventWireup="true" CodeFile="Reporter_Registration.aspx.cs"
Inherits="Reporter_Registration" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content7" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<ajaxToolkit:ToolkitScriptManager runat="Server"
EnableScriptGlobalization="true"
EnableScriptLocalization="true" ID="ToolkitScriptManager1" />
<center>
<h1>
Registeration Form</h1>
<asp:Panel ID="Pnl_view" runat="server">
<table>
<%--Firstname,middlename,lastname--%>
<tr>
<td>
<table>
<tr>
<td>
<asp:Label ID="lblfirstname" runat="server" Text="First
Name" /><sup>*</sup>
</td>
<td>
<asp:Label ID="lblmiddlename" runat="server" Text="Middle
Name" />
</td>
<td>
<asp:Label ID="lbllastname" runat="server" Text="Last
Name" /><sup>*</sup>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtfirstname" runat="server"
CssClass="textbox" />
<asp:RequiredFieldValidator ID="rfvfirstname" runat="server"
ControlToValidate="txtfirstname"
Display="None" ErrorMessage="This field cannot be left
blank" />
</td>
<td>
<asp:TextBox ID="txtmiddlename" runat="server"
CssClass="textbox" />
</td>
<td>
<asp:TextBox ID="txtlastname" runat="server"
CssClass="textbox" />
<asp:RequiredFieldValidator Display="None"
ID="rfvlastname" runat="server" ControlToValidate="txtlastname"
ErrorMessage="This field cannot be left blank" />
</td>
</tr>
</table>
</td>
</tr>
<%--Gender--%>
<tr>
<td>
<asp:Label ID="lblgender" runat="server" Text="Gender" />
<sup>*</sup><br />
<asp:RadioButtonList ID="rblgender" runat="server"
CssClass="textbox" RepeatColumns="3"
RepeatDirection="Horizontal">
<asp:ListItem Value="M">Male</asp:ListItem>
<asp:ListItem Value="F">Female</asp:ListItem>
</asp:RadioButtonList>
<asp:RequiredFieldValidator ID="rfvrblgender" runat="server"
ControlToValidate="rblgender"
Display="None" ErrorMessage="Please select one of the options" />
</td>
</tr>
<%--Email--%>
<tr>
<td>
<asp:Label ID="lblemail" runat="server" Text="Email ID" />
<sup>*</sup><br />
<asp:TextBox ID="txtemail" runat="server" CssClass="textbox" />
<asp:RequiredFieldValidator ID="rfvemail" runat="server"
ControlToValidate="txtemail"
Display="None" ErrorMessage="This field cannot be left blank" />
<asp:RegularExpressionValidator ID="revemail" runat="server"
ControlToValidate="txtemail"
Display="None" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\
w+)*\.\w+([-.]\w+)*" />
</td>
</tr>
<%--DateofBirth--%>
<tr>
<td>
<asp:Label ID="lbldob" runat="server" Text="Date Of Birth" />
<sup>*</sup><br />
<asp:TextBox ID="txtdob" runat="server" CssClass="textbox" />
<ajaxToolkit:CalendarExtender ID="defaultCalendarExtender"
runat="server" TargetControlID="txtdob" />
<asp:RequiredFieldValidator ID="rfvdob" runat="server"
ControlToValidate="txtdob"
Display="None" ErrorMessage="This field cannot be left blank" />
</td>
</tr>
<%--Contactnumber--%>
<tr>
<td>
<asp:Label ID="lblcontact" runat="server" Text="Contact Number" />
<sup>*</sup><br />
<asp:TextBox ID="txtcontact" runat="server" CssClass="textbox" />
<asp:RequiredFieldValidator ID="rfvcontact2" runat="server"
ControlToValidate="txtcontact"
Display="None" ErrorMessage="This field cannot be left blank" />
</td>
</tr>
<%--Address--%>
<tr>
<td>
<asp:Label ID="lbladdress" runat="server" Text="Address" />
<sup>*</sup><br />
<asp:TextBox ID="txtaddress" runat="server" CssClass="textbox"
TextMode="MultiLine" />
<asp:RequiredFieldValidator ID="rfvaddress" runat="server"
ControlToValidate="txtaddress"
Display="None" />
</td>
</tr>
<%--LogIn ID--%>
<tr>
<td>
<asp:Label ID="lblLoginID" runat="server" Text="LogIn ID" />
<sup>*</sup><br />
<asp:TextBox ID="txtLoginID" runat="server" CssClass="textbox" />
</td>
</tr>
<%--Password--%>
<tr>
<td>
<asp:Label ID="lblpassword" runat="server" Text="Password" />
<sup>*</sup>
<br />
<asp:TextBox ID="txtpassword" runat="server" CssClass="textbox"
TextMode="password" />
<asp:RequiredFieldValidator ID="rfvpassword" runat="server"
ControlToValidate="txtpassword"
Display="None" ErrorMessage="This field cannot be left blank" />
</td>
</tr>
<%--Confirmpassword--%>
<tr>
<td>
<asp:Label ID="lblconpassword" runat="server" Text="Confirm
Password" />
<sup>*</sup><br />
<asp:TextBox ID="txtconpassword" runat="server"
CssClass="textbox" TextMode="Password" />
<asp:RequiredFieldValidator ID="rfvconpassword" runat="server"
ControlToValidate="txtconpassword"
Display="None" ErrorMessage="This field can not be left
blank"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="txtpassword"
ControlToValidate="txtconpassword" Display="None"
ErrorMessage="Password Does Not Match">
</asp:CompareValidator>
</td>
</tr>
<%--Country--%>
<tr>
<td>
<asp:Label ID="lblcountry" runat="server" Text="Country" />
<sup>*</sup><br />
<asp:DropDownList ID="ddlcountry" runat="server" CssClass="ddl">
<asp:ListItem>Please select a country</asp:ListItem>
<asp:ListItem>United States</asp:ListItem>
<asp:ListItem>INDIA</asp:ListItem>
<asp:ListItem>pakistan</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvddlcountry" runat="server"
ControlToValidate="ddlcountry"
Display="None" ErrorMessage="Please select one of the choices"
InitialValue="Please select a country" />
</td>
</tr>
<%--Language--%>
<tr>
<td>
<asp:Label ID="lbllanguage" runat="server" CssClass="textbox"
Text="Preferred Language" />
<sup>*</sup><br />
<asp:DropDownList ID="ddllanguage" runat="server"
CssClass="ddl">
<asp:ListItem>Please select a language</asp:ListItem>
<asp:ListItem>English</asp:ListItem>
<asp:ListItem>Hindi</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvddllanguage" runat="server"
ControlToValidate="ddllanguage"
Display="None" ErrorMessage="Please select one of the choices"
InitialValue="Please select a language" />
</td>
</tr>
<%--SecurityQuestion--%>
<tr>
<td>
<asp:Label ID="lblsecurityques" runat="server" Text="Security
Question" />
<sup>*</sup><br />
<asp:DropDownList ID="ddlsecurityques" runat="server"
CssClass="ddl">
<asp:ListItem>In What city did you meer your spouse/singificant
other?</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<%--SecurityAnswer--%>
<tr>
<td>
<asp:Label ID="lbsecurityans" runat="server" Text="Security
Answer" />
<sup>*</sup><br />
<asp:TextBox ID="txtsecurityans" runat="server" CssClass="textbox"
MaxLength="50" />
<br />
(max 50 characters)
<asp:RequiredFieldValidator ID="rfvsecurtiyans" runat="server"
ControlToValidate="txtsecurityans"
Display="None" ErrorMessage="This feild cannot be left blank" />
</td>
</tr>
<%--Qualifications--%>
<tr>
<td>
<asp:Label ID="lblqualifications" runat="server"
Text="Qualification(s)" />
<br />
<asp:TextBox ID="txtqualifications" runat="server"
CssClass="textbox" TextMode="MultiLine" />
</td>
</tr>
<%--Submit and Reset--%>
<tr>
<td>
<asp:Button ID="button3" runat="server"
OnClick="button_Submit_Click" Text="Submit" />
<asp:Button ID="button4" runat="server"
OnClick="button_Reset_Click" Text="Reset" CausesValidation="false"/>
</td>
</tr>
<asp:ValidationSummary runat="server" ShowMessageBox="true"
ShowSummary="false" />
</table>
</asp:Panel>
</center>
</asp:Content>

4.1.1.32 Reporter_registration.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class Reporter_Registration : System.Web.UI.Page


{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Mystring"].ConnectionStri
ng);
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
dropdownlist_country_bind();
}
}
protected void button_Submit_Click(object sender, EventArgs e)
{

cmd = new SqlCommand("insert into Reporter_Table values ('"


+txtfirstname.Text+"','"
+txtmiddlename.Text+"','"
+txtlastname.Text+"','"
+rblgender.SelectedValue+"','"
+txtcontact.Text+"','"
+txtdob.Text+"','"
+txtaddress.Text+"','"
+txtemail.Text+"','"
+txtLoginID.Text+"','"
+txtpassword.Text+"','"
+ddlcountry.SelectedIndex+"','"
+ddllanguage.SelectedIndex+"','"
+ddlsecurityques.SelectedIndex+"','"
+txtsecurityans.Text+"','"
+DateTime.Now.ToShortDateString()+"',0) ", con);
con.Open();
int check= cmd.ExecuteNonQuery();
con.Close();
if (check > 0)
{

Response.Write("<script>alert('Thanks For Registration')</script>");


Response.Redirect("reporter_home.aspx");
}

else if (check > 0)


{

Response.Redirect("Reporter_LogIn.aspx");
}
}

void dropdownlist_country_bind()
{
SqlDataAdapter da_country = new SqlDataAdapter("select
Country_name,country_id from country_table",con);
DataTable dt_country = new DataTable();
da_country.Fill(dt_country);
ddlcountry.DataSource=dt_country;
ddlcountry.DataTextField = "country_name";
ddlcountry.DataValueField = "country_id";
ddlcountry.DataBind();
}

protected void button_Reset_Click(object sender, EventArgs e)


{

txtaddress.Text = "";
txtconpassword.Text = "";
txtcontact.Text = "";
txtdob.Text = "";
txtemail.Text = "";
txtfirstname.Text = "";
txtlastname.Text = "";
txtLoginID.Text = "";
txtmiddlename.Text = "";
txtpassword.Text = "";
txtqualifications.Text = "";
txtsecurityans.Text = "";
rblgender.ClearSelection();
ddlcountry.ClearSelection();
ddllanguage.ClearSelection();
ddlsecurityques.ClearSelection();
}
}
CHAPTER 5
SYSTEM TESTING

The aim of the system testing process was to determine all defects in our
project .The program was subjected to a set of test inputs and various observations
were made and based on these observations it will be decided whether the program
behaves as expected or not. Our Project went through two levels of testing
1. Unit testing
2. Integration testing

UNIT TESTING
Unit testing is undertaken when a module has been created and succesfully
reviewed .In order to test a single module we need to provide a complete environment
ie besides the module we would require
 The procedures belonging to other modules that the module under test calls
 Non local data structures that module accesses
 A procedure to call the functions of the module under test with appropriate
parameters Unit testing was done on each and every module that is described under
module description of chapter 4 .

1. Test for the admin module


 Testing admin login form- This form is used for log in of administrator of the
system. In this we enter the username and password if both are correct administration
page will open other wise if any of data is wrong it will get redirected back to the
login page and again ask for username and password.

 Reporter registration- In this section the admin can verify reporter details and then
only add reporter details to database it contains add and delete buttons if user click
add button data will be added to reporter database and if he clicks delete button the
reporter data will be deleted.

2. Test for Reporter login module

 Test for Reporter login Form-This form is used for log in of Reporter.In this we
enter the Reporter id, and password if all these are correct Reporter login page will
redirect to the reporter section.Other wise if any of data is wrong it will get redirected
back to the login page and again ask for Reporter id, and password.

 Test for account creation-This form is used for new account creation when Reporter
does not fill the form completely it asks again to fill the whole form when he fill the
form fully it gets redirected to page which show waiting for conformation message as
his data will be only added by administrator after verification.

INTEGRATION TESTING

In this type of testing we test various integration of the project module by providing
the input .The primary objective is to test the module interfaces in order to ensure that
no errors are occurring when one module invokes the other module.
CHAPTER 7
REFERENCES
 http://www.w3schools.com/html/html_intro.asp
 http://www.w3schools.com/css/css_background.asp
 http://www.w3schools.com/js/js_datatypes.asp
 http://www.w3schools.com/sql/sql_insert.asp
 http://www.w3schools.com/sql/sql_update.asp
 http://www.w3schools.com/php/php_forms.asp
 Fundamentals of software engineering by Rajib mall, PHIlearning
 Web development and application development by Ivan Byross BPB publications

You might also like