Professional Documents
Culture Documents
1 ORGANIZATION PROFILE
Grian tek focus on long term relationship with staff is reflected through
clear communication of expectation, performance based recognition and
advancement, and an environment that supports employee’s professional
development. Grian tek staff, comprised almost entirely of full time company
employees, is held to standards of accountability, integrity, creativity and
competence. The dedication, skills, and integrity of Grian tek staff are key to the
firm’s success.
1
1.2 PROJECT OVERVIEW
E-Mail tracking is the process of following the path and function performed
by the receiver on the received mail. It basically allows the sender to be aware of
where, when and how his mail reaches the client and what the receiver does with
the mail.
2
Modules
1. Registration
2. Login
3. Notification
4. Self destructible
5. Block back up
6. Retractable
7. Block forwarding
Modules Description
1. Registration
In this module a new user is made to register with a unique user name,
password and his custom mailed and mobile number for the service. A
confirmation message is sent to the mailed provided by that user.The purpose of
this module is to check whether the mail ID belongs to that particular user actually
or not as someone else can masquerade [3].
2. Login
In this module an existing user is directed to the home page from he can
login. The user needs to enter a valid username and password and then submit it.
TheLogin Page retrieves corresponding information from user info
andauthenticates the user. If valid a new session is started and the user is logged
in and redirected to the mail client else if there is a mismatch the user is notified
with an error message.
3. Notification
In this module the user is in the client where he can enter the message inside
a Rich-text box and also specify the address of the SMTP server he is going to
use and if a Proxy connection exists, then the host name and port number along
with the Destination address and subject [4].
3
Finally the user selects the features he wants to apply and then fires the
send button. This program stores the actual mail message into the database and
sends a hyperlink with some message to the destination. If destination address is
invalid or not reachable then a message is returned to the client. When the receiver
opens his inbox, he can view this message with the hyperlink stating that only if
he clicks on this link the message can be viewed. When the viewer clicks, his
system date, time, o/s, browser type, ip Address, referrer, mail program, etc.
4. Self Destructible
In this module the main aim is to prevent archiving of the actual mail
message into a Custom folder in the receiver’s mailbox. At the time of sending
the mail with this feature, the user is asked for expiry date. The message
automatically expires from the Server database on that date. The validity date
starts from the date of sending the mail.
5. Block Back Up
This module is similar to the above one except for the fact that it is used to
prevent the Receiver to take a backup locally to his hard drive, rather than
archiving it into the Mailbox folder. The receiver is literally handicapped from
printing, saving or copying the contents to his hard drive. This is again done by
Block-Backup’s JavaScript, applies certain properties to the page such that the
text cannot be selected to prevent copying. To prevent saving, the contents are
displayed in a new window which when saved only saves the original server page
that opened it.
6. Retractable
This module aims at deleting the mails even after sending it. This is
possible because the mail resides actually in the cipher mail server. The process
of retracting is to send a Command RETRACT followed by a space and the
message id of the message the user Wishes to delete, from the mail client to the
4
same address as he sent it originally. If found the request is forwarded. Which
then verifies the matching of the details provided with the use_storemail Table
and if matches then deletes the message and places a flag in one of the Fields.
7. Block Forwarding
This is the best and very important module of this project. When a user
intends to send this mail to only one person and doesn’t wish that no one else can
Access the Contents then he can choose this functionality. This is done by
a concept called Cross-Site-Scripting (Xss) or Cookie Hijacking. The Fact that
all mail servers store a cookie on the user's machine with the email in it either as
it is or encrypted.
5
2. SYSTEM STUDY
This project simulates the real time intranet mailing system with all the
necessary validations and modules. This project can be used in a small Local Area
Network like Organization for communication between the users working in the
network. All the features like mailing, checking mails, creating a new user id,
replying for the mails, retrieving the password if the user forgets the password,
changing the password, search option etc., has been added to the project so that it
looks similar to the internet mailing system. And all this has been done with a
database as the background for maintaining the database of the users and the mails
they receive and send to others users.
A new user is made to register with a unique user name, password and his
custom mailed and mobile number for the service. A confirmation message is
sent to the mailed provided by that user.The purpose of this module is to check
whether the mail ID belongs to that particular user actually or not as someone
else can masquerade.
An existing user is directed to the home page from he can login. The user
needs to enter a valid username and password and then submit it. TheLogin Page
retrieves corresponding information from user info and authenticates the user. If
valid a new session is started and the user is logged in and redirected to the mail
client else if there is a mismatch the user is notified with an error message.
The user is in the client where he can enter the message inside a Rich-text
box and also specify the address of the SMTP server he is going to use and if a
Proxy connection exists, then the host name and port number along with the
Destination address and subject [2].
Finally the user selects the features he wants to apply and then fires the
send button. This program stores the actual mail message into the database and
6
sends a hyperlink with some message to the destination. If destination address is
invalid or not reachable then a message is returned to the client. When the receiver
opens his inbox, he can view this message with the hyperlink stating that only if
he clicks on this link the message can be viewed. When the viewer clicks, his
system date, time, o/s, browser type, ip Address, referrer, mail program, etc.
The main aim is to prevent archiving of the actual mail message into a
Custom folder in the receiver’s mailbox. At the time of sending the mail with this
feature, the user is asked for expiry date. The message automatically expires from
the Server database on that date. The validity date starts from the date of sending
the mail.
This module is similar to the above one except for the fact that it is used to
prevent the Receiver to take a backup locally to his hard drive, rather than
archiving it into the Mailbox folder. The receiver is literally handicapped from
printing, saving or copying the contents to his hard drive. This is again done by
Block-Backup’s JavaScript, applies certain properties to the page such that the
text cannot be selected to prevent copying. To prevent saving, the contents are
displayed in a new window which when saved only saves the original server page
that opened it.
This module aims at deleting the mails even after sending it. This is
possible because the mail resides actually in the cipher mail server. The process
of retracting is to send a Command RETRACT followed by a space and the
message id of the message the user Wishes to delete, from the mail client to the
same address as he sent it originally. If found the request is forwarded. Which
then verifies the matching of the details provided with the use store mail Table
and if matches then deletes the message and places a flag in one of the Fields.
7
2.2 FEASIBILITY STUDY
The feasibility of the project is analyzed in this phase and business proposal is
put forth with a very general plan for the project and some cost estimates. During
system analysis the feasibility study of the proposed system is to be carried out.
This is to ensure that the proposed system is not a burden to the company. For
feasibility analysis, some understanding of the major requirements for the system
is essential.
Every organization wants to reduce their cost but at the same time quality
of the Service should also be maintained. The system is developed according the
estimation of the cost made by the concern. In this project, the proposed system
will definitely reduce the cost and also the manual work is reduced and speed of
work is also increased.
The Technical feasibility is the study of the software and how it is included
in the study of our project.
The technical issues are raised during the feasibility study of investigating
our System. Thus, the technical consideration evaluates the hardware
8
requirements, software etc. This system uses ASP as front end and SQL Server
as back end. They also provide sufficient memory to hold and process the data.
As the company is going to install all the process in the system it is the cheap and
efficient technique.
This system technique accepts the entire request made by the user and the
response is done without failure and delay. It is a study about the resources
available and how they are achieved as an acceptable system. It is an essential
process for analysis and definition of conducting a parallel assessment of
technical feasibility.
Proposed project will be beneficial only when they are turned into an
information system and to meet the organization operating requirements.
Issues that may be a minor problem will sometimes cause major problem
in the operation. It is the measure of how people can able to work with the system.
Finding out the minor issues that may be the initial problem of the system. It
should be a user-friendly environment. All these aspect should be kept in mind
and steps should be taken for developing the project carefully.
9
2.3 SYSTEM ANALYSIS
Disadvantage
10
2.3.2 Proposed System
Advantages
11
2.4 SYSTEM DEVELOPMENT
12
2.4.3 Software Description
13
5. Garbage Collection.
7. Web Services
Asp.Net
ASP.NET is a server side scripting technology that enables scripts (embedded
in web pages) to be executed by an Internet server.
The Option Pack can be downloaded from Microsoft PWS is a smaller - but
fully functional - version of IIS PWS can be found on your Windows 95/98
CD.
ASP.NET 3.0 is the latest version of ASP.NET, but there will never be an
ASP.NET 4.0 version.
ASP.NET is the next generation ASP.NET, but it's not an upgraded version of
ASP.NET. ASP.NET is an entirely new paradigm for server-side ASP.NET
script
14
ASP.NET is a part of the new .NET Framework. Microsoft spent three years
rewriting ASP.NET from the ground up, and ASP.NET is not fully backward
compatible with ASP.NET 3.0.
ASP.NET has better language support, a large set of new controls and
XML based components, and better user authentication.
New In Asp.Net
15
Web services are small units of code designed to handle a limited set of
tasks.
Xml Based Web Protocols
Web services use the standard web protocols HTTP, XML, SOAP, WSDL,
and UDDI.
HTTP
HTTP (Hypertext Transfer Protocol) is the World Wide Web standard for
communication over the Internet.
XML
SOAP
WSDL
UDDI
16
INDEPENDENT OF OPERATING SYSTEM
Since web services use XML based protocols to communicate with other
systems, web services are independent of both operating systems and
programming languages.
An application calling a web service will always send its requests using
XML, and get its answer returned as XML. The calling application will never
be concerned about the operating system or the programming language running
on the other computer.
Web Services
Database
A database is similar to a data file in that it is a storage place for data. Like
a data file, a database does not present information directly to a user; the user runs
an application that accesses data from the database and presents it to the user in
an understandable format.
17
The DBMS is responsible for enforcing the database structure, including:
Maintaining relationships between data in the database.
Ensuring that data is stored correctly, and that the rules defining data
relationships are not violated.
Recovering all data to a point of known consistency in case of system
failures.
Relational Database
Although there are different ways to organize data in a database, relational
databases are one of the most effective. Relational database systems are an
application of mathematical set theory to the problem of effectively organizing
data. In a relational database, data is collected into tables (called relations in
relational theory).
A table represents some class of objects that are important to an
organization. For example, a company may have a database with a table for
employees, another table for customers, and another for stores. Each table is built
of columns and rows (called attributes and tuples in relational theory). Each
column represents some attribute of the object represented by the table.
Scalable
SQL Server 2005 supports having a wide range of users access it at the
same time. An instance of SQL Server 2005 includes the files that make up a set
of databases and a copy of the DBMS software. Applications running on separate
computers use a SQL Server 2005 communications component to transmit
commands over a network to the SQL Server 2005 instance. When an application
connects to an instance of SQL Server 2005, it can reference any of the databases
in that instance that the user is authorized to access. The communication
component also allows communication between an instance of SQL Server 2005
and an application running on the same computer. You can run multiple instances
of SQL Server 2005 on a single computer.
18
Structured Query Language
To work with data in a database, you have to use a set of commands and
statements (language) defined by the DBMS software. Several different
languages can be used with relational databases; the most common is SQL. The
American National Standards Institute (ANSI) and the International Standards
Organization (ISO) define software standards, including standards for the SQL
language. SQL Server 2005 supports the Entry Level of SQL-92, the SQL
standard published by ANSI and ISO in 1992. The dialect of SQL supported by
Microsoft SQL Server is called Transact-SQL (T-SQL). T-SQL is the primary
language used by Microsoft SQL Server applications.
19
2.5 SYSTEM DESIGN
System design is the process of planning a new system to complement or
altogether replace the old system. The Purpose of the design phase is the first
step is moving from the problem domain to the solution domain. The design
of the system is critical aspect that affects the quality of the software. System
design is also called top-level design.
Start
Logi
n
Chec
Forget
New User Password
Registration
Change
Add New
Password
Friend List
Friend List
View All
View
Address
Address
Book
Enter Your
Friend
20
2.5.2 Data Flow Diagram
Register Details
Check User
False Name/Passwo Register
rd
Check User Register
Name True
False
& Question
Type Old P/w
Type Answer &New P/w
&Confirm P/w
Wrong
Check Register Wrong
Answer Check Old
Correct
Password
Password got
your
Change Your
Password
Correct
Register
21
A
Level 1
True False
Check Names Friend Add
Your
Enter Your
True False Check
Friend Address
Unnamed
True False
Enter Your
Check
Friend Details
Unnamed
Address details Not inserted
True False Inserted type correct
Address
Details
A friend
22
Level 2
B
Compose Mail
Show
Show All Address
Details
Show All
Address& Display
Select Message
Type Confidential
/Normal
Share all details hire date, to add Share all details no, date, to add,
rate, status & Message type rate, status & Message type
23
Level 3
Database Mail
Press layout
Button message
Automatically
Deleted
24
2.6 TESTING AND IMPLEMENTATION
2.6.1 Introduction
System Testing
Unit Testing
Integration Testing
Validation Testing
White Box Testing
Black Box Testing
25
2.6.1.1 System Testing
Testing is the set of activities that can be planned in advance and conducted
systematically. Different test conditions should be thoroughly checked and the
bugs detected should be fixed. The testing strategies formed by the user are
performed to prove that the software is free and clear from errors. To do this,
there are many ways of testing the system’s reliability, completeness and
maintainability.
In the unit testing the analyst tests the program making up a system. The
software units in a system are the modules and routines that are assembled and
integrated to perform a specific function. In a large system, many modules on
different levels are needed.
Unit testing can be performed from the bottom up starting with the smallest
and lowest level modules and proceeding one at a time. For each module in a
bottom-up testing, a short program executes the module and provides the needed
data.
26
2.6.1.3 Integration Testing
White box testing, sometimes called glass-box testing is a test case design
method that uses the control structure of the procedural design to derive test cases.
Using white box testing methods, the software engineer can derive test cases that
Guarantee that all independent paths with in a module have been exercised
at least once.
27
Exercise all logical decisions on their true and false sides.
Execute all loops at their boundaries and within their operational bounds
and
This method treats the coded module as a black box. The module runs with
inputs that are likely to cause errors. Then the output is checked to see if any error
occurred. This method cannot be used to test all errors, because some errors may
depend on the code or algorithm used to implement the module.
28
If involves careful planning, investigation of the current system and its
constraints on implementation, design of methods to achieve the changeover, an
evaluation of changeover methods apart from planning. Two major tasks of
preparing the implementation are education, training of the users and testing the
systems. System analysis and design efforts will be more for complex systems
beings implemented. Based on policies of individual’s organization an
implementation coordinating committee has been appointed.
The implementation process begins with preparing a plan for the
implementation system. According to this plan, the other activities are to be
carried out. In this plan, discussion has been made regarding the equipment,
resources and how to test the activities. Thus a clear plan is preparing for the
activities.
Equipment Acquisition
According to the above plan, the necessary equipment has to be acquired
to implement the new system. Prime Tech has all the hardware requirements for
installing and maintaining the package.
Program Code Preparation
One of the most important development activities is the code of
programming. The system DFD’s and other channels are converted to modular
programs. They have to be complied, tested and debugged.
User Manuals
Once planning has been completed the major effort of the computer
department is to ensure that the user department consists of education and trained
staff, as the system becomes more complex. The success of a system depends
upon how they are operated and used. Thus the quality of training, the personnel
is connected to the success of the system.
For this purpose system and user manuals are prepared. In system manuals,
details about the forms and blocks triggers. Which were used to develop them,
were specified. In user manuals data flow diagrams, charts and screen formats
29
are given. Also error messages associated were explained in details. The users
were shown the success and they were taught how to operate the system. Live
demonstration and visuals aids were used to teach them.
30
3.1 CONCLUSION
This project will survive best among the users and provide them a best way
to interact through the net.
The system maintains mails sent by other client and store them in their
respective mail boxes at server side. It uses the uses SMTP and POP3 protocols.
SMTP protocol allows clients to send mails to other user of SMTP server. To
retrieve the mails received a client uses POP3 protocol. The System increases the
speed and Accuracy to passing the information among the departments. Project
aims at establishing interdepartmental communication for the smooth
functioning of the organization.
31
3.2 FUTURE ENHANCEMENT
At this stage, the cipher mail has started to provide standard Support
service on the use of ms outlook through its help desk provision. The issues of
installing and setting up ms outlook as well as on the migration From eudora to
this new tool. As part of its built-in function, the exchange Server also provides
outlook mobile access and exchange server activesync Features.
32
APPENDICES
APPENDIX-1 SCREEN LAYOUTS
Home Page
33
New User Registration
34
Send Your Mail
35
Sent Item View
36
View Friend List
37
Forward Mail (Encrypted Format)
38
View Attachments in Encrypted Format
39
Forget Password
40
Identify Confirmation
41
Change Password
42
CODING
Compose
SqlConnection con;
SqlCommand cmd;
SqlDataReader rs;
FileStream fo;
FileInfo fi;
byte[] b ={ 0 };
string a;
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
try
{
//toadd
if (TextBox1.Text == TextBox2.Text)
43
{
Label1.Text = "Type Correct EMailID.....";
return;
}
cmd = new SqlCommand("select username from aregister where
username=@username", con);
cmd.Parameters.AddWithValue("@username", TextBox1.Text);
rs = cmd.ExecuteReader();
bool b1 = rs.Read();
rs.Close();
cmd.Dispose();
if (b1 == false)
{
Label1.Text = "ToAddress Not Found,Please Type Correct ID......";
return;
}
string fname = FileUpload1.FileName;
if (fname == "")
{
fname = "null";
}
else
{
FileUpload1.PostedFile.SaveAs(Server.MapPath("temp/" +
FileUpload1.FileName));
fo = new FileStream(Server.MapPath("temp/" + FileUpload1.FileName),
FileMode.Open, FileAccess.Read);
fi = new FileInfo(Server.MapPath("temp/" + FileUpload1.FileName));
b = new byte[fo.Length];
44
fo.Read(b, 0, b.Length);
fo.Close();
fi.Delete();
}
cmd = new SqlCommand("select isnull(max(rno),0)+1 from
senditemtable", con);
int no = int.Parse(cmd.ExecuteScalar().ToString());
cmd.Dispose();
if (a == null)
{
DateTime d = DateTime.Now;
cmd = new SqlCommand("insert into ainboxtable
values(@rno,@sender,@subject,@hiredate,@weight,@toadd,@attach,@filena
me,@messagetype)", con);
cmd.Parameters.AddWithValue("@rno", no);
cmd.Parameters.AddWithValue("@sender", TextBox2.Text);
cmd.Parameters.AddWithValue("@subject", TextBox3.Text);
cmd.Parameters.AddWithValue("@hiredate", d);
cmd.Parameters.AddWithValue("@weight", TextBox4.Text);
cmd.Parameters.AddWithValue("@toadd", TextBox1.Text);
cmd.Parameters.AddWithValue("@attach", b);
cmd.Parameters.AddWithValue("@filename", fname);
cmd.Parameters.AddWithValue("@messagetype",
RadioButtonList1.SelectedItem.Text);
int n = cmd.ExecuteNonQuery();
cmd.Dispose();
if (n == 1)
{
45
cmd = new SqlCommand("insert into
senditemtable(rno,sender,subject,hiredate,toadd,status,messagetype)
values(@rno,@sender,@subject,@hiredate,@toadd,@status,@messagetype)",
con);
cmd.Parameters.AddWithValue("@rno", no);
cmd.Parameters.AddWithValue("@sender", TextBox2.Text);
cmd.Parameters.AddWithValue("@subject", TextBox3.Text);
cmd.Parameters.AddWithValue("@hiredate", d);
cmd.Parameters.AddWithValue("@toadd", TextBox1.Text);
cmd.Parameters.AddWithValue("@status", "not view");
cmd.Parameters.AddWithValue("@messagetype",
RadioButtonList1.SelectedItem.Text);
cmd.ExecuteNonQuery();
cmd.Dispose();
}
cmd.Dispose();
fo.Close();
fi.Delete();
// Session.Add("username1", s);
Label1.Text = "Your Mail Successfully Send......";
}
else
{
//TextBox1.Text = a;
DateTime d = DateTime.Now;
46
cmd = new SqlCommand("insert into ainboxtable
values(@rno,@sender,@subject,@hiredate,@weight,@toadd,@attach,@filena
me,@messagetype)", con);
cmd.Parameters.AddWithValue("@rno", no);
cmd.Parameters.AddWithValue("@sender", TextBox2.Text);
cmd.Parameters.AddWithValue("@subject", TextBox3.Text);
cmd.Parameters.AddWithValue("@hiredate", d);
cmd.Parameters.AddWithValue("@weight", TextBox4.Text);
cmd.Parameters.AddWithValue("@toadd", a);
cmd.Parameters.AddWithValue("@attach", b);
cmd.Parameters.AddWithValue("@filename", fname);
cmd.Parameters.AddWithValue("@messagetype",
RadioButtonList1.SelectedItem.Text);
int n = cmd.ExecuteNonQuery();
if (n == 1)
{
cmd = new SqlCommand("insert into
senditemtable(rno,sender,subject,hiredate,toadd,status,messagetype)
values(@rno,@sender,@subject,@hiredate,@toadd,@status,@messagetype)",
con);
cmd.Parameters.AddWithValue("@rno", no);
cmd.Parameters.AddWithValue("@sender", TextBox2.Text);
cmd.Parameters.AddWithValue("@subject", TextBox3.Text);
cmd.Parameters.AddWithValue("@hiredate", d);
cmd.Parameters.AddWithValue("@toadd", TextBox1.Text);
cmd.Parameters.AddWithValue("@status", "not view");
cmd.Parameters.AddWithValue("@messagetype",
RadioButtonList1.SelectedItem.Text);
47
cmd.ExecuteNonQuery();
cmd.Dispose();
}
cmd.Dispose();
fo.Close();
fi.Delete(); // Session.Add("username1", s);
Label1.Text = "Your Mail Successfully Send......";
}
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
}
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
RadioButtonList1.SelectedIndex = -1;
}
View Inbox
SqlConnection con;
SqlDataAdapter adp;
DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
48
try
{
Label1.Text = "";
con = (SqlConnection)Application.Get("connection");
string s;
if (Session["uname"] != null)
{
s = Session["uname"].ToString();
//string s=string.Empty ,k;
Label2.Text = "Hi " + s;
adp = new SqlDataAdapter("select * from ainboxtable where toadd=@toadd",
con);
adp.SelectCommand .Parameters.AddWithValue("@toadd", s);
ds = new DataSet();
adp.Fill(ds);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
}
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
}
Friends List
SqlConnection con;
49
SqlCommand cmd;
SqlDataReader rs;
protected void Page_Load(object sender, EventArgs e)
{
con = (SqlConnection)Application.Get("connection");
Label1.Text = "";
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
try
{
if (Session["uname"] != null)
{
string s = Session["uname"].ToString();
if (s.ToLower() == TextBox3.Text.ToLower())
{
Label1.Text = "Please Type Your Friend EmailID.......";
return;
}
cmd = new SqlCommand("select username from aregister where
username=@username", con);
cmd.Parameters.AddWithValue("username", TextBox3.Text);
rs = cmd.ExecuteReader();
bool b = rs.Read();
rs.Close();
cmd.Dispose();
if (b == false)
{
50
Label1.Text = "EmailID Not Found,Please Type Correct
EmailID......";
return;
}
cmd = new SqlCommand("select emailid from afriends where
emailid=@emailid and uname=@uname", con);
cmd.Parameters.AddWithValue("@emailid", TextBox3.Text);
cmd.Parameters.AddWithValue("@uname", s);
rs = cmd.ExecuteReader();
bool b1 = rs.Read();
rs.Close();
cmd.Dispose();
if (b1)
{
Label1.Text = "EmailID Already Inserted.....";
return;
}
cmd = new SqlCommand("insert into afriends
(firstname,lastname,emailid,phno,address,uname)
values(@firstname,@lastname,@emailid,@phno,@address,@uname)", con);
cmd.Parameters.AddWithValue ("@firstname",TextBox1 .Text );
cmd.Parameters.AddWithValue ("@lastname",TextBox2 .Text );
cmd.Parameters.AddWithValue ("@emailid",TextBox3 .Text );
cmd.Parameters.AddWithValue ("@phno",TextBox4 .Text );
cmd.Parameters.AddWithValue ("@address",TextBox5 .Text );
cmd.Parameters.AddWithValue ("@uname",s);
cmd.ExecuteNonQuery();
cmd.Dispose();
Label1.Text = "Friends List Inserted......";
51
}
}
catch (Exception ex)
{
if (rs != null)
rs.Close();
Label1.Text = ex.ToString();
}
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
TextBox1.Focus();
}
52
try
{
Label1.Text = "";
con = (SqlConnection)Application.Get("connection");
if (!Page.IsPostBack)
if (Session["uname"] != null)
{
bindgrid();
}
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
}
}
void bindgrid()
{
try
{
cmd = new SqlCommand("select * from senditemtable where sender='"
+ Session["uname"].ToString() + "'", con);
rs = cmd.ExecuteReader();
GridView1.DataSource = rs;
GridView1.DataBind();
rs.Close();
cmd.Dispose();
53
}
catch (Exception ex)
{
if (rs != null)
rs.Close();
Label1.Text = ex.ToString();
}
}
protected void GridView1_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
try
{
int no = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
cmd = new SqlCommand("delete from senditemtable where rno=" + no,
con);
cmd.ExecuteNonQuery();
cmd.Dispose();
cmd = new SqlCommand("delete from ainboxtable where rno=" + no,
con);
cmd.ExecuteNonQuery();
cmd.Dispose();
bindgrid();
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
54
}
}
View Mail
SqlConnection con;
SqlCommand cmd;
SqlDataReader rs;
static byte[] b;
string s;
protected void Page_Load(object sender, EventArgs e)
{
try
{
Label1.Text = "";
con = (SqlConnection)Application.Get("connection");
s = Request.QueryString["data1"];
string sdate = null;
LinkButton1.Visible = false;
cmd = new SqlCommand("select recieveddate from senditemtable where
rno=" + s, con);
rs = cmd.ExecuteReader();
if (rs.Read())
sdate = rs["recieveddate"].ToString();
rs.Close();
cmd.Dispose();
if (sdate != "")
data();
else
{
55
cmd = new SqlCommand("update senditemtable set recieveddate=
'"+DateTime .Now +"', status='view' where rno=" + s, con);
cmd.ExecuteNonQuery();
cmd.Dispose();
data();
}
}
catch (Exception ex)
{
if (rs != null)
rs.Close();
Label1.Text = ex.ToString();
}
}
void data()
{
try
{
cmd = new SqlCommand("select * from ainboxtable where rno=" + s,
con);
rs = cmd.ExecuteReader();
if (rs.Read())
{
TextBox1.Text = rs[1].ToString();
TextBox2.Text = rs[2].ToString();
if (rs[7].ToString() != "null")
{
56
LinkButton1.Visible = true;
LinkButton1.Text = rs[7].ToString();
b = (byte[])rs[6];
}
}
TextBox3.Text = rs[4].ToString();
rs.Close();
cmd.Dispose();
}
catch (Exception ex)
{
if (rs != null)
rs.Close();
Label1.Text = ex.ToString();
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
string fName = LinkButton1.Text;
if ((fName.EndsWith(".pdf")) || (fName.EndsWith(".PDF")))
{
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + fName);
Response.ContentType = "Application/pdf";
Response.BinaryWrite(b);
}
else if ((fName.EndsWith(".doc")) || (fName.EndsWith(".DOC")))
{
57
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + fName);
Response.ContentType = "Application/msword";
Response.BinaryWrite(b);
}
else if ((fName.EndsWith(".txt")) || (fName.EndsWith(".TXT")))
{
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + fName);
Response.ContentType = "Application/text";
Response.BinaryWrite(b);
}
else if ((fName.EndsWith(".jpg")) || (fName.EndsWith(".JPG")))
{
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + fName);
Response.ContentType = "Image/jpg";
Response.BinaryWrite(b);
}
else if ((fName.EndsWith(".bmp")) || (fName.EndsWith(".BMP")))
{
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + fName);
Response.ContentType = "Application/msword";
Response.BinaryWrite(b);
}
else if ((fName.EndsWith(".zip")) || (fName.EndsWith(".ZIP")))
{
58
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + fName);
Response.ContentType = "Application/Zip";
Response.BinaryWrite(b);
}
else if ((fName.EndsWith(".aspx")) || (fName.EndsWith(".ASPX")))
{
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + fName);
Response.ContentType = "weppage/aspxfiles";
Response.BinaryWrite(b);
}
else
{
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + fName);
Response.ContentType = "Application/Binary";
Response.BinaryWrite(b);
}
59
REFERENCES
60