You are on page 1of 47

PROJECT REPORT

ON

WEB CONTENT MANAGEMENT SYSTEM


SUBMITTED AS A PART OF COURSE CURRICULUM FOR
DEGREE OF BECHELOR OF TECHNOLOGY

IN

INFORMATION TECHNOLOGY

UNDER THE GUIDENCE OF:BY:-

SUBMITTED

Er. CHHOTU SHARMA

ANIMESH GULATI
Roll No. 2209604

Date: September 20 2011

B.Tech 5TH SEM.


animeshgulati25@gmail.com

DEPARTMENT OF INFORMATION TECHNOLOGY


SWAMI DEVI DYAL INSTITUTE OF ENGINEERING & TECHNOLOGY
DISTT.- PANCHKULA (BARWALA)
HARYANA- 134118

ACKNOWLEDGEMENT
Apart from the efforts of me, the success of my project depends largely
on the encouragement and guidelines of many others. I take this
opportunity to express my gratitude to the people who have been
instrumental in the successful completion of this project.
I would like to show my greatest appreciation to my project in-charge,
Mrs. Shalini Sharma. I cant say thank you enough for the tremendous
support and help. I feel motivated and encouraged every time I attend
her meeting. Without her encouragement and guidance this project work
would not have materialized.
Im highly grateful to Mr. Chhotu Sharma, chief instructor at
CS-InfoTech, for his thorough guidance right from day 1 till the end of
training. He actually laid the ground for conceptual understanding of
technologies used in project.

TABLE OF CONTENTS
S. NO.

TOPIC

Training Certificates

II

Acknowledgement

1.

Introduction

1-11

(i) Statement about the problemExisting system

(ii) Objectives of Project

(iii) Working Environment


2.

PAGE NO.

System Design

2-11
18

(i) Entity Relationship Model

19

(ii) Data Flow Diagram

19

(iii) Database Files

20

(iv) Relations in the Databases


3.

Coding

4.

Screen Shots

21-24
29-42

INTRODUCTION

Project Title

WEB CONTENT
MANAGEMENT SYSTEM

Project Duration:
Project category:

6 Weeks
Web Based Application

The project named WEB CONTENT MANAGEMENT SYSTEM is


developed using ASP.NET during the industrial training. This project has
been developed in partial fulfilment of Requirements for the degree of
BE. (IT), from
Kurukshetra University (Kurukshetra)

A web content management system (WCMS) is a software system that


provides website authoring, collaboration, and administration tools
designed to allow users with little knowledge of web programming
languages or mark-up languages to create and manage website content
with relative ease. A robust WCMS provides the foundation for
collaboration, offering users the ability to manage documents and output
for multiple author editing and participation. It uses a database to store
page content, metadata, and other information assets that might be
needed by the system.

STATEMENT ABOUT PROBLEM

A WCMS allows non-technical users to make changes to a website with


little training. A WCMS typically requires a systems administrator
and/or a web developer to set up and add features, but it is primarily a
website maintenance tool for non-technical staff.

OBJECTIVE
OF
PROJECT

OBJECTIVES OF PROJECT
Whether you are using a WCMS to manage an Internet, Extranet or
Intranet - the business benefits that can be derived from such a solution
do of course vary. The suggestions below are by no means an exhaustive
list of all the benefits and it would be worth reading the documentation
on personalization, collaboration and portals in combination with the
documentation on WCMS as increasingly business benefits can be
derived indirectly for these capabilities with the WCMS underpinning
them to provide a single solution.
The website is easy to use and understand by anyone
A WCMS enables information to be fresh, consistent & high quality.
Reduced customer (internal and external) dissatisfaction created by
having incorrect information.
Reduction in legal issues created by displaying incorrect information.
Increased value perception of the information provided.
There is a higher likelihood of a customer re-visiting the site.

Some search engines rank pages that change frequently higher in


search results.

A WCMS facilitates the re-use of content.


The re-use of content across multiple web sites or pages creates an
enhanced productivity value.
A WCMS enhances productivity and job satisfaction of the web team.
Webmasters can focus on technology and areas such as redesign and
functionality.

A more appropriate use of the web team results in lowered production


costs.
Enables a quick response to changes on competitors web sites.
There is no specific web browser that you must have or install before
using

PLATFORM
DISCRIPTION

WORKING ENVIRONMENT
Understanding .Net Frame Work
DEFINITION:
The .Net framework can be defined as a language neutral platform designed to
provide a number of rich and powerful application development tools and
technologies. It has an extensive class library that provides wide-ranging support
for data access. .Net framework has an independent code execution and
management environment called the Common Language Runtime (CLR) which
ensures that code is safe to run, and provides an abstract layer on top of the
operating system, which allows the elements of the .Net framework to run on many
operating systems and devices.

THE .NET VISION:


The basic idea behind the development of the .Net framework is that a
global broadband network will someday globally connect all devices and
the software will become a service provided over this network. The .Net
framework provides the foundation and the plumbing on which the
Microsoft .Net vision is built. The vision is about having a global
network and open standards like XML to make it easier for parties to
exchange data and work together. Now devices will use common
languages like XML over standardized or shared protocols such as
HTTP and these devices will be running a multitude of software on

various operating systems. This is not limited to Microsoft but also to


other operating systems such as sun, IBM.
The .Net framework provides the tools and the technologies needed to
write applications that can seamlessly and easily communicate over the
Internet using open standards like XML and SOAP. It also aims at
solving the various problems that are faced by developers while working
on applications made using the windows DNA. It provides a solution to
problems such as registering of components and shutting down
applications in order to upgrade them.

WHY FRONT END - ASP.NET 4.0


1: ASP.NET is integrated with the .NET Framework
The .NET Framework is divided into an almost painstaking
collection of functional parts, with a staggering total of more than
10,000 types (the .NET term for classes, structures, interfaces, and
other core programming ingredients). The massive collection of
functionality that the .NET Framework provides is organized in a
way that traditional Windows programmers will see as a happy
improvement. Each one of the thousands of classes in the .NET
Framework is grouped into a logical, hierarchical container called
a namespace.
Different namespaces provide different features. Taken together,
the .NET namespaces offer functionality for nearly every aspect of
distributed development from message queuing to security. This
massive toolkit is called the class library.

2: ASP.NET Is Compiled, Not Interpreted


One of the major reasons for performance degradation in classic
ASP pages is its use of interpreted script code. Every time an ASP
page is executed, a scripting host on the web server needs to

interpret the script code and translate it to lower-level machine


code, line by line. ASP.NET applications are always compiledin
fact, its impossible to execute C# or Visual Basic code without it
being compiled first.

3: ASP.NET Is Multilanguage
IL is a stepping stone for every managed application. (A managed
application is any application thats written for .NET and executes inside
the managed environment of the CLR.) In a sense, IL is the language of
.NET, and its the only language that the CLR recognizes.

4: ASP.NET Is Hosted by the Common Language Runtime


The most important aspect of the ASP.NET engine is that it runs
inside the runtime environment of the CLR.
5: ASP.NET

Is Object-Oriented:

ASP provides a relatively feeble object model. It provides a small


set of objects; these objects are really just a thin layer over the
raw details of HTTP and HTML. On the other hand, ASP.NET is
truly object-oriented. Not only does your code have full access to
all objects in the .NET Framework, but you can also exploit all

the conventions of an OOP (object-oriented programming)


environment. For example, you can create reusable classes,
standardize code with interfaces, extend existing classes with
inheritance, and bundle useful functionality in a distributable,
compiled component.

6: ASP.NET Is Multi device and Multi browser:


One of the greatest challenges web developers face is the wide
variety of browsers they need to support. Different browsers,
versions, and configurations differ in their support of HTML. Web
developers need to choose whether they should render their content
according to HTML 3.2, HTML 4.0, or something else entirely
such as XHTML 1.0 or even WML (Wireless Mark-up Language)
for mobile devices. This problem, fuelled by the various browser
companies, has plagued developers since the World Wide Web
Consortium (W3C) proposed the first version of HTML. Life gets
even more complicated if you want to use an HTML extension
such as JavaScript to create a more dynamic page or provide
validation.

WHY BACK END SQL SERVER 2008


Back end a description
The back-end comprises the components that process the
output from the front-end. Back-end is hidden from the user.
A back-end database is a database that is accessed by users
indirectly through an external application rather than by
application programming stored within the database itself or by
low level manipulation of the data (e.g. through SQL
commands).
A back-end database stores data but does not include end-user
application elements such as stored queries, forms, macros or
reports.

SQL SERVER 2008


Microsoft SQL-Server 2008 is scalable, high-performance database
management with built-in replication capabilities, Internet integration.
Open system architecture, and powerful graphic-based management
tools that are designed specifically for distributed client/server
computing. SQL-Server 2008 extends to performance and reliability by
providing server-based job scheduling to give visual control multiple
servers and remote operations.
SQL-Server 2008 was designed with Internet and intranets in minds.
When it is used with Web Assistant, it can populate web server with
SQL data through a variety of methods and provide high-performance
access to information on companys web site.
SQL-Server 2008 includes new features and components for both the
server and the client. The new features can be grouped into several
categories: SQL Enterprise Manager, Transact-SQL, and SQL-DMO
and SQL server wizards.

DATABASE DESIGN CONSIDERATIONS


Designing a database requires an understanding of both the business
functions you want to model and the database concepts and features
used to represent those business functions.

CLIENT/SERVER ARCHITECTURE OF SQL SERVER


Microsoft SQL Server is designed to work effectively in a
number of environments:
As a two-tier or multi-tier client/server database system
As a desktop database system

CLIENT/SERVER DATABASE SYSTEMS


Client/server systems are constructed so that the database can reside on
a central computer, known as a server, and be shared among several
users. Users access the server through a client or server application.
In a two-tier client/server system, users run an application on their local
computer, known as a client that connects over a network to the server
running SQL Server. The client application runs both business logic
and the code to display output to the user, and is also known as a thick
client. In a multi-tier client/server system, the client application logic is
run in two locations. The thin client runs on the users local computer
and is focused on displaying results to the user. The business logic is
located in server applications running on a server. Thin client requests

functions from the server application that is a multithreaded application


capable of working with many concurrent users. The server application
opens connections to the database server and can run on the same
server as the database, or it can connect across the network to a
separate server operating as a database server.
This is a typical scenario for an Internet application. For example, a
server application can run on Microsoft Internet Information Services
(IIS) and service thousands of thin clients running on the Internet or an
intranet. The server application uses a pool of connections to
communicate with a copy of SQL Server. SQL Server can be installed
on the same computer as IIS, or it can be installed on a separate server
in the network.

Feature and Utilities


Transparent Data Encryption
Enable encryption of an entire database, data files, or log files, without
the need for application changes. Benefits of this include: Search
encrypted data using both range and fuzzy searches, search secure data
from unauthorized users, and data encryption without any required
changes in existing applications

Extensible Key Management


SQL Server 2008 provides a comprehensive solution for encryption and
key management. SQL Server 2008 delivers an excellent solution to this
growing need by supporting third-party key management and HSM
products.

Auditing
Create and manage auditing via DDL, while simplifying compliance by
providing more comprehensive data auditing. This enables organizations
to answer common questions, such as, "What data was retrieved?"

Enhanced Database Mirroring


SQL Server 2008 builds on SQL Server 2005 by providing a more
reliable platform that has enhanced database mirroring, including
automatic page repair, improved performance, and enhanced
supportability.

Automatic Recovery of Data Pages


SQL Server 2008 enables the principal and mirror machines to
transparently recover from 823/824 types of data page errors by
requesting a fresh copy of the suspect page from the mirroring partner
transparently to end users and applications.

Predictable Query Performance


Enable greater query performance stability and predictability by
providing functionality to lock down query plans, enabling organizations
to promote stable query plans across hardware server replacements,
server upgrades, and production deployments.

Data Compression
Enable data to be stored more effectively, and reduce the storage
requirements for your data. Data compression also provides significant
performance improvements for large I/O bound workloads, like data
warehousing.

SOFTWARE
&
HARDWARE
REQUIREMENTS

SOFTWARE AND HARDWARE REQUIREMENT


SPECIFICATIONS
This document shall provide the requirement specification for the
WEBCONTENT MANAGEMENT SYSTEM as per the scope
defined.
1.

Users:
This site can be used by 2 types of users:
1.1. The users who is likely to find the information of their classmates

through the website.


1.2. The administrator of the system who will be responsible for
maintaining the database of various schools and colleges so that each
and every user should be benefitted and also maintaining guestbook
entries.
2.

Assumptions:
2.1. The alerts will not be provided by the site, the user has to visit it to

get the information.

3.

Requirements:
3.1.Functional Requirements:
3.1.1. The portal will search for the details of the schools and colleges as
per details entered by user.
3.1.2. If the user is an admin, he has to login.
3.1.3. Admin can add, modify or delete records related to various
institutions and
also updates guestbook entries.
3.1.4. The concept of Master Pages and Content Pages is used.

SOFTWARE REQUIREMENTS
Visual studio 2010 can be installed on the following operating systems:

Windows Xp (x86) with service pack 3 - all editions except starter


edition
Windows Vista (x86 & x64) with service pack 2 - all editions
except starter edition
windows 7 (x86 & x64)
windows server 2003 (x86 & x64) with service pack 2

windows server 2003 r2 (x86 & x64)


windows server 2008 (x86 & x64) with service pack 2

windows server 2008 r2 (x64)

SUPPORTED ARCHITECTURES:
* 32-BIT (X86)
* 64-BIT (X64)

HARDWARE REQUIREMENTS
computer that has a 1.6ghz or faster processor
1 GB (32 bit) or 2 GB (64 bit) ram (add 512 MB if running in a
virtual machine)

3GB of available hard disk space


5400 rpm hard disk drive
Direct X 9 capable video card running at 1024 x 768 or higherresolution display
DVD-ROM drive

Tables
User
Temp
Menu

The various roles through which the data flows used in the project are:
1) Administrator
2) User

ENTITY RELATIONSHIP MODEL


As a database designer, one should use an Entity Relationship (ER)
diagram as a tool to build the logical database design of a system. An
ER diagram represents the following three elements:
Entities: An entity is an object with a distinct set of properties that is
easily identified.
Attributes: An attribute is a property of an entity that differentiates it
from other entities and provides information about the entity.
Relationships: A relationship is a crucial part of the design of
database.

Sr. No.

Table Name

1.

Tbusr

Description

Contain the username and


password
information for
registered users

2.

Tbpag

Contains a list of pages


created by the
Admin. Along
with title, met
keyword and
description

3.

Tbmnu

Contains a list of menus


created by the
Admin.

TABLES USED IN THE PROJECT

RELATIONS IN THE DATABASE FOR


WEB CONTENT MANAGEMENT SYSTEM
The following are the relations we have designed to manage the
database. Here we have followed a convention of having the table
names with tb as a prefix, and the remaining name of the table
represent the description of the data inside that table.

RELATIONS IN THE DATABASE FOR WEB


CONTENT MANAGEMENT SYSTEM

The following are the relations we have designed to manage the database. Here we
have followed a convention of having the table names with tb as a prefix, and
the remaining name of the table represent the description of the data inside that
table.

Tables
Tbusr
Column Name

Datatype

Key

Description

Usrcod
Usrnam

int
Varchar(50)

Primary key

Usrpwd
Usrfstnam
Usrlstnam
usrtyp
Usrcrtdat

Varchar(50)
Varchar(50)
Varchar(50)
char(1)
datetime

Unique

User code
Registration
User name
Email id
Password
Status U,A

Tbtmp
Column Name

Datatype

Key

Mnucod
mnunam
Mnuusrcod
Mnuparmnucod
Mnudspord
Mnuusrtyp

Int
Varchar(100)
Int
Int
Int
char(1)

Pk

Description

Tbpag
Column Name

Datatype

Key

Pagcod
pagnam
Pagcon
Pagbrwtit
Pagmettit
Pagmetkey
Pagmetdsc
Pagmnucod
Pagusrcod
Pagcrtdat

Int
Varchar(50)
ntext(max)
varchar(200)
varchar(200)
varchar(200)
varchar(200)
int
Int
Datetime

Pk

Description

CODING

CODING
Application class code file

using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Data;
System.Data.SqlClient;
System.Configuration;

namespace nswcmns
{
public interface intusr
{
Int32 p_usrcod
{
get;
set;
}
String p_usrnam
{
get;
set;
}
String p_usrpwd
{
get;
set;
}
Char p_usrsts
{
get;
set;
}
DateTime p_usrcrtdate
{
get;
set;
}
String p_usrfrstname
{
get;
set;
}
String p_usrlstname
{
get;
set;
}
String p_usrtyp
{

get;
set;
}
}
public class clsusrprp : intusr
{
private Int32 uc;
private String un, up, ufn, uln, ut;
private DateTime ucd;
private Char us;
public int p_usrcod
{
get
{
return uc;
}
set
{
uc = value;
}
}
public String p_usrnam
{
get
{
return un;
}
set
{
un = value;
}
}
public String p_usrpwd
{
get
{
return up;
}
set
{
up = value;
}
}
public Char p_usrsts
{
get
{
return us;
}
set
{
us = value;
}
}
public DateTime p_usrcrtdate
{

get
{
return ucd;
}
set
{
ucd = value;
}
}
public String p_usrfrstname
{
get
{
return ufn;
}
set
{
ufn = value;
}
}
public String p_usrlstname
{
get
{
return uln;
}
set
{
uln = value;
}
}
public String p_usrtyp
{
get
{
return ut;
}
set
{
ut = value;
}
}
}
public abstract class clscon
{
protected SqlConnection con = new SqlConnection();
public clscon()
{
con.ConnectionString = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
}
}
public class clsusr : clscon
{
public Char logincheck(String usrnam, String usrpwd)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}

SqlCommand cmd = new SqlCommand("logincheck", con);


cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@usrnam", SqlDbType.VarChar, 50).Value = usrnam;
cmd.Parameters.Add("@usrpwd", SqlDbType.VarChar, 50).Value = usrpwd;
cmd.Parameters.Add("@usrtyp", SqlDbType.Char, 1).Direction =
ParameterDirection.Output;
cmd.ExecuteNonQuery();
Char c = Convert.ToChar(cmd.Parameters["@usrtyp"].Value);
cmd.Dispose();
con.Close();
return c;
}
public void save_rec(clsusrprp p)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("insusr", con);
cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.Add("@uc", SqlDbType.Int).Value = p.p_usrcod;
cmd.Parameters.Add("@un", SqlDbType.VarChar, 50).Value = p.p_usrnam;
cmd.Parameters.Add("@up", SqlDbType.VarChar, 50).Value = p.p_usrpwd;
cmd.Parameters.Add("@us", SqlDbType.Char, 10).Value = p.p_usrsts;
cmd.Parameters.Add("@ucd", SqlDbType.DateTime).Value = p.p_usrcrtdate;
cmd.Parameters.Add("@ufn", SqlDbType.VarChar, 50).Value = p.p_usrfrstname;
cmd.Parameters.Add("@uln", SqlDbType.VarChar, 50).Value = p.p_usrlstname;
cmd.Parameters.Add("@ut", SqlDbType.VarChar, 50).Value = p.p_usrtyp;
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
public void update_rec(clsusrprp p)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}

SqlCommand cmd = new SqlCommand("updusr", con);


cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@uc", SqlDbType.Int).Value = p.p_usrcod;
cmd.Parameters.Add("@un", SqlDbType.VarChar, 50).Value = p.p_usrnam;
cmd.Parameters.Add("@up", SqlDbType.VarChar, 50).Value = p.p_usrpwd;
cmd.Parameters.Add("@us", SqlDbType.Char).Value = p.p_usrsts;
cmd.Parameters.Add("@ucd", SqlDbType.DateTime).Value = p.p_usrcrtdate;
cmd.Parameters.Add("@ufn", SqlDbType.VarChar, 50).Value = p.p_usrfrstname;
cmd.Parameters.Add("@uln", SqlDbType.VarChar, 50).Value = p.p_usrlstname;
cmd.Parameters.Add("@ut", SqlDbType.VarChar, 50).Value = p.p_usrtyp;
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();

public void delete_rec(clsusrprp p)


{
if (con.State == ConnectionState.Closed)
{

con.Open();
}
SqlCommand cmd = new SqlCommand("delusr", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@uc", SqlDbType.Int).Value = p.p_usrcod;
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
public List<clsusrprp> dsp_rec()
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("dspusr", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader dr = cmd.ExecuteReader();
List<clsusrprp> Obj = new List<clsusrprp>();
while (dr.Read())
{
clsusrprp k = new clsusrprp();
k.p_usrcod = Convert.ToInt32(dr[0]);
//k.p_usrnam = Convert.ToInt32(dr[0]);
k.p_usrnam = dr[1].ToString();
k.p_usrpwd = dr[2].ToString();
k.p_usrsts = Convert.ToChar(dr[3]);
k.p_usrcrtdate = Convert.ToDateTime(dr[4]);
k.p_usrfrstname = dr[5].ToString();
k.p_usrlstname = dr[6].ToString();
k.p_usrtyp = dr[7].ToString();
Obj.Add(k);
}
dr.Close();
cmd.Dispose();
con.Close();
return Obj;
}
public List<clsusrprp> find_rec(Int32 uc)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("fndusr", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@uc", SqlDbType.Int).Value = uc;
SqlDataReader dr = cmd.ExecuteReader();
List<clsusrprp> obj = new List<clsusrprp>();
if (dr.HasRows)
{
dr.Read();
clsusrprp k = new clsusrprp();
k.p_usrcod = Convert.ToInt32(dr[0]);

k.p_usrnam = dr[1].ToString();
k.p_usrpwd = dr[2].ToString();
k.p_usrsts = Convert.ToChar(dr[3]);
k.p_usrcrtdate = Convert.ToDateTime(dr[4]);
k.p_usrfrstname = dr[5].ToString();
k.p_usrlstname = dr[6].ToString();
k.p_usrtyp = dr[7].ToString();
obj.Add(k);

}
dr.Close();
cmd.Dispose();
con.Close();
return obj;

}
public interface intpag
{
Int32 p_pagcod
{
get;
set;
}
Int32 p_pagmnucod
{
get;
set;
}
String p_pagtitle
{
get;
set;
}
String p_pagcon
{
get;
set;
}
String p_pagmettkey
{
get;
set;
}
string p_pagmetdsc
{
get;
set;
}
DateTime p_pagcrtdat
{
get;
set;
}
}
public class clspagprp : intpag
{
private Int32 pd, pmc;
private String pt, pc, pmk, pmd;

private DateTime pcd;


public int p_pagcod
{
get
{
return pd;
}
set
{
pd = value;
}
}
public int p_pagmnucod
{
get
{
return pmc;
}
set
{
pmc = value;
}
}
public string p_pagtitle
{
get
{
return pt;
}
set
{
pt = value;
}
}
public string p_pagcon
{
get
{
return pc;
}
set
{
pc = value;
}
}
public string p_pagmettkey
{
get
{
return pmk;
}
set
{
pmk = value;

public string p_pagmetdsc


{
get
{
return pmd;
}
set
{
pmd = value;
}
}
public DateTime p_pagcrtdat
{
get
{
return pcd;
}
set
{
pcd = value;
}
}
}
public class clspag : clscon
{
public Int32 dsppagbymnu(Int32 mnucod)
{
SqlDataAdapter adp = new SqlDataAdapter("dsppagbymnu", con);
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
adp.SelectCommand.Parameters.Add("@mnucod", SqlDbType.Int).Value = mnucod;
DataSet ds = new DataSet();
adp.Fill(ds);
if (ds.Tables[0].Rows.Count == 0)
{
return -1;
}
else
return Convert.ToInt32(ds.Tables[0].Rows[0][0]);
}
public void save_rec(clspagprp p)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("inspag", con);
cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.Add("@pd", SqlDbType.Int).Value = p.p_pagcod;
cmd.Parameters.Add("@pmc", SqlDbType.Int).Value = p.p_pagmnucod;
cmd.Parameters.Add("@pt", SqlDbType.VarChar, 100).Value = p.p_pagtitle;
cmd.Parameters.Add("@pc", SqlDbType.VarChar, 50).Value = p.p_pagcon;
cmd.Parameters.Add("@pmk", SqlDbType.VarChar, 200).Value = p.p_pagmettkey;
cmd.Parameters.Add("@pmd", SqlDbType.VarChar, 500).Value = p.p_pagmetdsc;

cmd.Parameters.Add("@pcd", SqlDbType.DateTime).Value = p.p_pagcrtdat;


cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
public void update_rec(clspagprp p)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("updpag", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pd", SqlDbType.Int).Value = p.p_pagcod;
cmd.Parameters.Add("@pmc", SqlDbType.Int).Value = p.p_pagmnucod;
cmd.Parameters.Add("@pt", SqlDbType.VarChar, 100).Value = p.p_pagtitle;
cmd.Parameters.Add("@pc", SqlDbType.VarChar, 50).Value = p.p_pagcon;
cmd.Parameters.Add("@pmk", SqlDbType.VarChar, 200).Value = p.p_pagmettkey;
cmd.Parameters.Add("@pmd", SqlDbType.VarChar, 500).Value = p.p_pagmetdsc;
cmd.Parameters.Add("@pcd", SqlDbType.DateTime).Value = p.p_pagcrtdat;
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
public void delete_rec(clspagprp p)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("delpag", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pd", SqlDbType.Int).Value = p.p_pagcod;
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
public List<clspagprp> Disp_rec()
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("disppag", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader dr = cmd.ExecuteReader();
List<clspagprp> Obj = new List<clspagprp>();
while (dr.Read())
{
clspagprp k = new clspagprp();
k.p_pagcod = Convert.ToInt32(dr[0]);
//k.p-usrcod = Convert.ToInt32(dr[0]);
k.p_pagmnucod = Convert.ToInt32(dr[1]);
k.p_pagtitle = dr[2].ToString();
k.p_pagcon = dr[3].ToString();
k.p_pagmettkey = dr[4].ToString();
k.p_pagmetdsc = dr[5].ToString();
k.p_pagcrtdat = DateTime.Now;
Obj.Add(k);

}
dr.Close();
cmd.Dispose();
con.Close();
return Obj;

}
public List<clspagprp> fnd_rec(Int32 pd)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("findpag", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@pd", SqlDbType.Int).Value = pd;
SqlDataReader dr = cmd.ExecuteReader();
List<clspagprp> obj = new List<clspagprp>();
if (dr.HasRows)
{
dr.Read();
clspagprp k = new clspagprp();
k.p_pagcod = Convert.ToInt32(dr[0]);
k.p_pagmnucod = Convert.ToInt32(dr[1]);
k.p_pagtitle = dr[2].ToString();
k.p_pagcon = dr[3].ToString();
k.p_pagmettkey = dr[4].ToString();
k.p_pagmetdsc = dr[5].ToString();
k.p_pagcrtdat = DateTime.Now;
obj.Add(k);
}
dr.Close();
cmd.Dispose();
con.Close();
return obj;
}

}
public interface intmnu
{
Int32 p_mnucod
{
get;
set;
}
String p_mnunam
{
get;
set;
}
Int32 p_mnuparmnucode
{
get;
set;
}
Int32 p_mnudspord
{
get;
set;
}
String p_mnuusrtyp

get;
set;

}
}
public class clsmnuprp : intmnu
{
private Int32 mc, mpmc, mdp;
private String mn, mut;
public int p_mnucod
{
get
{
return mc;
}
set
{
mc = value;
}
}
public string p_mnunam
{
get
{
return mn;
}
set
{
mn = value;
}
}
public int p_mnuparmnucode
{
get
{
return mpmc;
}
set
{
mpmc = value;
}
}
public int p_mnudspord
{
get
{
return mdp;
}
set
{
mdp = value;
}
}
public string p_mnuusrtyp
{

get
{
return mut;
}
set
{
mut = value;
}
}

public class clsmnu : clscon


{
public DataSet dspmanmnu(char usrtyp, Int32 parmnucod)
{
SqlDataAdapter adp = new SqlDataAdapter("dspmanmnu", con);
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
adp.SelectCommand.Parameters.Add("@usrtyp", SqlDbType.Char, 1).Value = usrtyp;
adp.SelectCommand.Parameters.Add("@parmnucod", SqlDbType.Int).Value = parmnucod;
DataSet ds = new DataSet();
adp.Fill(ds);
return ds;
}
public void save_rec(clsmnuprp p)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("insmnu", con);
cmd.CommandType = CommandType.StoredProcedure;
// cmd.Parameters.Add("@mc", SqlDbType.Int).Value = p.p_mnucod;
cmd.Parameters.Add("@mn", SqlDbType.VarChar, 50).Value = p.p_mnunam;
// cmd.Parameters.Add("@mpc", SqlDbType.Int).Value = p.p_mnuparmnucode;
cmd.Parameters.Add("@mdp", SqlDbType.Int).Value = p.p_mnudspord;
cmd.Parameters.Add("@mut", SqlDbType.VarChar, 50).Value = p.p_mnuusrtyp;
cmd.Parameters.Add("@mpmc", SqlDbType.Int).Value = p.p_mnuparmnucode;
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
public DataSet dspmnu1(Int32 parmnucode, Char usrtyp)
{
SqlDataAdapter adp = new SqlDataAdapter("dspmnu1", con);
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
adp.SelectCommand.Parameters.Add("@parmnucode", SqlDbType.Int).Value =
parmnucode;
adp.SelectCommand.Parameters.Add("@usrtyp", SqlDbType.Char, 1).Value = usrtyp;
DataSet ds = new DataSet();
adp.Fill(ds);
return ds;
}
public void update_rec(clsmnuprp p)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}

SqlCommand cmd = new SqlCommand("updmnu", con);


cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@mc", SqlDbType.Int).Value = p.p_mnucod;
cmd.Parameters.Add("@mn", SqlDbType.VarChar, 50).Value = p.p_mnunam;
cmd.Parameters.Add("@mpmc", SqlDbType.Int).Value = p.p_mnuparmnucode;
cmd.Parameters.Add("@mdp", SqlDbType.Int).Value = p.p_mnudspord;
cmd.Parameters.Add("@mut", SqlDbType.VarChar, 50).Value = p.p_mnuusrtyp;
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
public void delete_rec(clsmnuprp p)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("delmnu", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@mc", SqlDbType.Int).Value = p.p_mnucod;
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
public List<clsmnuprp> Disp_rec()
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("dispmnu", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader dr = cmd.ExecuteReader();
List<clsmnuprp> Obj = new List<clsmnuprp>();
while (dr.Read())
{
clsmnuprp k = new clsmnuprp();
k.p_mnucod = Convert.ToInt32(dr[0]);
//k.p_mnucod = Convert.ToInt32(dr[0]);
k.p_mnunam = dr[1].ToString();
k.p_mnuparmnucode = Convert.ToInt32(dr[2]);
k.p_mnudspord = Convert.ToInt32(dr[3]);
k.p_mnuusrtyp = dr[4].ToString();
Obj.Add(k);
}
dr.Close();
cmd.Dispose();
con.Close();
return Obj;
}
public List<clsmnuprp> find_rec(Int32 mc)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("findmnu", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@mnu", SqlDbType.Int).Value = mc;

SqlDataReader dr = cmd.ExecuteReader();
List<clsmnuprp> obj = new List<clsmnuprp>();
if (dr.HasRows)
{
dr.Read();
clsmnuprp k = new clsmnuprp();
k.p_mnucod = Convert.ToInt32(dr[0]);
//k.p_mnucod = Convert.ToInt32(dr[0]);
k.p_mnunam = dr[1].ToString();
k.p_mnuparmnucode = Convert.ToInt32(dr[2]);
k.p_mnudspord = Convert.ToInt32(dr[3]);
k.p_mnuusrtyp = dr[4].ToString();
obj.Add(k);
}
dr.Close();
cmd.Dispose();
con.Close();
return obj;
}
}

You might also like