/
PageBase.aspx.cs
207 lines (160 loc) · 5.3 KB
/
PageBase.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using FI.BusinessObjects;
namespace FI.UI.Web
{
/// <summary>
/// Summary description for PageBase.
/// </summary>
public class PageBase : System.Web.UI.Page
{
protected HtmlGenericControl pageHead;
protected System.Web.UI.WebControls.Panel ContentsPanel;
protected byte _cssStyleNum;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.Init += new System.EventHandler(this.PageBase_Init);
}
#endregion
private void PageBase_Init(object sender, System.EventArgs e)
{
//debug
//FI.BusinessObjects.BusinessFacade.Instance.TestGetSchemaMembersXML();
//Response.End();
if(Response.IsClientConnected==false)
Response.End();
LoadSession();
}
protected override void Render(HtmlTextWriter writer)
{
SaveSession();
base.Render (writer);
}
protected internal FI.BusinessObjects.User _user;
protected virtual void LoadSession()
{
//debug
/*
if(Session["User"]==null)
{
_user=new FI.BusinessObjects.User("salespp", "spp" , "spp");
_user.Login(true);
}
else
_user=(FI.BusinessObjects.User)Session["User"];
return;
*/
if(Session["User"]==null)
Response.Redirect(Request.ApplicationPath + "/Default.aspx?action=NewSession");
_user=(FI.BusinessObjects.User)Session["User"];
_cssStyleNum=_user.CssStyle;
if(_user.IsLoggedIn && _user.CheckSessionValidity()==false)
{
_user.Logout();
Session.Abandon();
Response.Redirect(Request.ApplicationPath + "/Default.aspx?action=NewSession&msg=Another user forced Your logout");
}
if(FI.Common.AppConfig.AuditPageHits)
_user.AuditPageHit();
//
}
protected virtual void SaveSession()
{
Session["User"]=_user;
}
public virtual void ShowException(Exception exc)
{
if(Common.AppConfig.IsDebugMode)
Common.LogWriter.Instance.WriteEventLogEntry(exc);
throw exc;
}
public enum RootTabsEnum
{
Home,
Olap_Reports,
Custom_SQL_Reports,
Custom_MDX_Reports,
Storecheck_Reports,
Administrative_Tools
}
protected int CreateRootTabs(FI.UI.Web.Controls.Tabs.TabView tv, string UserName, bool UserLoggedIn, bool NavigationEnabled, RootTabsEnum ActiveTab)
{
int ret=_CreateRootTabs(tv, UserName, UserLoggedIn, NavigationEnabled, ActiveTab);
tv.CssStyleNum=_user.CssStyle;
return ret;
}
internal static int _CreateRootTabs(FI.UI.Web.Controls.Tabs.TabView tv, string UserName, bool UserLoggedIn, bool NavigationEnabled, RootTabsEnum ActiveTab)
{
int tabId=0;
int activeTabId=0;
string activeLabelStr=ActiveTab.ToString().Replace("_", " ");
if(UserLoggedIn)
{
tv.EnableLogoutButton=true;
tv.LogoutHref="~/Default.aspx?action=Logout";
tv.WelcomeNote=FI.Common.AppConfig.AppName + "-[" + UserName + "]";
}
else
{
tv.EnableLogoutButton=false;
tv.WelcomeNote=FI.Common.AppConfig.AppName;
}
string label="";
string href="";
label=RootTabsEnum.Home.ToString();
href=(NavigationEnabled? "~/Default.aspx?action=Home" : "");
tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
activeTabId=(activeLabelStr==label?tabId:activeTabId);
label=RootTabsEnum.Olap_Reports.ToString().Replace("_", " ");
href=(NavigationEnabled? "~/ReportList.aspx?content=List&rpttype=0" : "");
tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
activeTabId=(activeLabelStr==label?tabId:activeTabId);
if(!FI.Common.AppConfig.HideCustomReports)
{
label=RootTabsEnum.Custom_SQL_Reports.ToString().Replace("_", " ");
href=(NavigationEnabled? "~/ReportList.aspx?content=List&rpttype=2" : "");
tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
activeTabId=(activeLabelStr==label?tabId:activeTabId);
label=RootTabsEnum.Custom_MDX_Reports.ToString().Replace("_", " ");
href=(NavigationEnabled? "~/ReportList.aspx?content=List&rpttype=3" : "");
tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
activeTabId=(activeLabelStr==label?tabId:activeTabId);
label=RootTabsEnum.Storecheck_Reports.ToString().Replace("_", " ");
href=(NavigationEnabled? "~/ReportList.aspx?content=List&rpttype=1" : "");
tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
activeTabId=(activeLabelStr==label?tabId:activeTabId);
}
label=RootTabsEnum.Administrative_Tools.ToString().Replace("_", " ");
href=(NavigationEnabled? "~/UserList.aspx" : "");
tabId=tv.AddTab(0 , label , href , (activeLabelStr==label) , false);
activeTabId=(activeLabelStr==label?tabId:activeTabId);
return activeTabId;
}
}
}