-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventDetail.aspx.cs
107 lines (102 loc) · 3.21 KB
/
EventDetail.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq;
using System.Data;
using System.Data.Linq;
using System.Data.Linq.Mapping;
public partial class EventDetail : System.Web.UI.Page
{
DBClassDataContext db = new DBClassDataContext();
clsSecurity Security = new clsSecurity();
clsLanguage lang = new clsLanguage();
string strLang = string.Empty;
public EventDetail()
{
strLang = lang.LanguageCurrent;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindEvent();
BindContent();
clsDefault clsDefault = new clsDefault();
if (Security.LoginGroup == "Admin")
{
pnAdmin.Visible = true;
//btEdit.Visible = true;
btDelete.Visible = true;
}
}
}
private void BindEvent()
{
clsDefault clsDefault = new clsDefault();
int UID = Convert.ToInt32(clsDefault.URLRouting("id")); //Convert.ToInt32(Request.QueryString["UID"]);
if (!string.IsNullOrEmpty(UID.ToString()))
{
var tbEvent = from ev in db.Events
where ev.UID == UID
select ev;
foreach (Event ev in tbEvent)
{
lblUID.Text = ev.UID.ToString();
lblSubject.Text = ev.Subject;
lblDetail.Text = ev.Detail;
PicFull.ImageUrl = ev.PicFull;
lblSiteMap.Text = ev.Subject;
Page.MetaKeywords = ev.MetaKeywords;
Page.MetaDescription = ev.MetaDescription;
}
}
else
{
Response.Redirect("EventView.aspx");
}
}
protected void btEdit_Click(object sender, EventArgs e)
{
ucColorBox1.IFrame("EventForm.aspx?UID=" + lblUID.Text.Trim() + "", "90%", "90%", true);
}
protected void btDelete_Click(object sender, EventArgs e)
{
var tbEvent = from ev in db.Events
where ev.UID == Convert.ToInt32(lblUID.Text)
select ev;
foreach (Event evt in tbEvent)
{
db.Events.DeleteOnSubmit(evt);
}
try
{
db.SubmitChanges();
}
catch (Exception ex)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "Information", "alert('" + ex.ToString() + "')", true);
}
BindEvent();
}
private void BindContent()
{
if (strLang == "th-TH")
{
lblTitle.Text = "กิจกรรม";
lblSiteMap.Text = "ข่าวสารโรงพยาบาล > กิจกรรม > " + lblSubject.Text;
}
else if (strLang == "en-US")
{
lblTitle.Text = "Events";
lblSiteMap.Text = "Hospital News > Events > " + lblSubject.Text;
}
else
{
lblTitle.Text = "กิจกรรม";
lblSiteMap.Text = "ข่าวสารโรงพยาบาล > กิจกรรม > " + lblSubject.Text;
}
}
}