/
Messages.aspx.cs
63 lines (62 loc) · 2.05 KB
/
Messages.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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.IO;
public partial class Messages : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["type"].ToString() == "files")
MultiView1.ActiveViewIndex = 1;
else
MultiView1.ActiveViewIndex = 0;
}
protected void ListView2_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName.Equals("attachment"))
{
Response.ContentType = ContentType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(e.CommandArgument.ToString()));
Response.WriteFile(e.CommandArgument.ToString());
Response.End();
}
}
protected string GetName(string name)
{
try
{
if (name.Contains("Dept"))
{
string[] n = name.Split('-');
Dept obj = new Dept();
name = obj.getDeptName(Convert.ToInt32(n[1]));
return name;
}
if (name.Contains("Applicant"))
{
string[] n = name.Split('-');
string query = "Select Applicant_Name from Applicant where Applicant_ID=" + n[1];
dbConnect db = new dbConnect();
DataSet dset = db.executeSelectStatemant(query);
if (!dset.HasErrors && dset.Tables[0].Rows.Count > 0)
{
return dset.Tables[0].Rows[0][0].ToString();
}
else
return name;
}
else
return name;
}
catch (Exception ex)
{
writeException obj = new writeException();
obj.WriteExceptionToFile(ex, "Messages=deptName");
return "Exception Occured";
}
}
}