Académique Documents
Professionnel Documents
Culture Documents
ASSIGNMENT 3
SUBMITTED TO
Department of Computer Science & Engineering
by
SAMYAK GUPTA
140905260
7th Semester, CSE-D
E-mail: samyak.gupta@learner.manipal.edu
Mobile: 9663600683
1
CODE:
deliverypersons.aspx
<%@ Page Language="C#" MasterPageFile="~/masterfile.master" AutoEventWireup="true"
CodeBehind="deliverypersons.aspx.cs" Inherits="IT_Project.deliverypersons" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<a href="FrontPage.aspx">Home</a>
<a href="#">See Deliveries</a>
<a href="#">Generate Bill</a>
<a href="FrontPage.aspx">Logout</a>
</asp:Content>
</form>
</asp:Content>
deliverypersons.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.Sql;
using System.Data.SqlClient;
using System.Data;
namespace IT_Project
{
public partial class deliverypersons : System.Web.UI.Page
{
int deliveryperson_id=0;
int flag = 1;
protected void Page_Load(object sender, EventArgs e)
2
{
if (Session["deliveryboydata"] != null || flag==0)
deliveryperson_id = (int)Session["deliveryboydata"]-1;
flag = 1;
SqlConnection conn = new SqlConnection();
SqlConnection conn1 = new SqlConnection();
SqlDataAdapter adapter;
SqlDataReader reader=null;
DataSet ds = new DataSet();
using (conn)
{
conn.Open();
conn1.Open();
command6.Parameters["@a_id"].Value = Convert.ToInt32(address[i]);
reader = command6.ExecuteReader();
if (reader.Read())
{
3
weights[i] = Convert.ToInt32(reader["weight"]);
}
reader.Close();
}
conn1.Close();
temp = id[j];
id[j] = id[j + 1];
id[j + 1] = temp;
temp = weights[j];
weights[j] = weights[j + 1];
weights[j + 1] = temp;
}
}
}
try
{
conn1.Open();
int k = 1;
for (i = deliveryperson_id*noofdeliveries+1, k=1 ; i <=
(deliveryperson_id+1) * noofdeliveries; i++,k++)
{
4
command4.Parameters["@c_id"].Value = Convert.ToInt32(id[i-1]);
reader = command4.ExecuteReader();
if(reader.Read())
{
customername = reader["name"].ToString();
customeraddressid = reader["address"].ToString();
customeremail = reader["email"].ToString();
pub_ids = reader["publication_ids"].ToString().Split(',');
}
reader.Close();
command5.Parameters["@a_id"].Value = Convert.ToInt32(customeraddressid);
reader = command5.ExecuteReader();
if (reader.Read())
{
customeraddress = reader["address"].ToString();
}
reader.Close();
pub_names = "";
for (j = 0; j < pub_ids.Length; j++)
{
command3.Parameters["@p_id"].Value = Convert.ToInt32(pub_ids[j]);
reader = command3.ExecuteReader();
if (reader.Read())
pub_names += reader["name"] + ", ";
reader.Close();
}
pub_names = pub_names.Substring(0, pub_names.Length - 2);
dt.Rows.Add(k, customername, customeraddress, customeremail, pub_names);
}
GridView1.DataSource = dt;
GridView1.DataBind();
}
catch (Exception excep)
{
string debug = excep.Message;
}
finally
{
conn.Close();
}
}
5
SCREENSHOTS:
By making use of AJAX we can view the delivery schedules of any Delivery Boy on
a single page without reloading the whole page again, which was earlier done by
using Sessions.
6
7
By logging into their the respective accounts, the Delivery Boys can see their own
schedule only. The login information is stored in the session variable and the next
page shows the schedule.
Using this method we can only see the schedule of the person who is logged in because
the information fetched from the database is only for that person and the information
to be fetched via the session variables which store the login information and maps the
delivery boy.
If we compare to this the method used with AJAX, we can set the particular delivery
boy from the dropdown list and the GridView is update accordingly without reloading
the whole page.