using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GZTW.AyaNova.BLL;
///
/// Base page for all edit pages
/// Handles rights, localization and all other
/// common methods
///
public class BaseEditPage : System.Web.UI.Page
{
public BaseEditPage()
{
//
// TODO: Add constructor logic here
//
}
protected override void OnPreInit(EventArgs e)
{
Util.SetUserLocale();
base.OnPreInit(e);
//if (Request.Cookies["Theme"] == null)
//{
// Response.Cookies["Theme"].Value = "Default";
// Response.Cookies["Theme"].Expires = DateTime.Now.AddYears(30);
// Page.Theme = "Default";
//}
//else
//{
// Page.Theme = ((string)Request.Cookies["Theme"].Value);
//}
////Test built in themes in new ajax controls
//Page.Theme = "Inox";
//if (Session["MyTheme"] == null)
//{
// Session.Add("MyTheme", "Default");
// Page.Theme = ((string)Session["MyTheme"]);
//}
//else
//{
// Page.Theme = ((string)Session["MyTheme"]);
//}
}
protected override void OnLoad(EventArgs e)
{
//Place code here that should be called before the inheriting page's onload is executed
//case 1651
string sIE9ForceCompatibility = System.Configuration.ConfigurationManager.AppSettings["IE9ForceCompatbilityMode"];
if (!string.IsNullOrWhiteSpace(sIE9ForceCompatibility))
{
if (sIE9ForceCompatibility.ToLower() == "true")
{
HtmlMeta meta = new HtmlMeta();
meta.HttpEquiv = "X-UA-Compatible";
meta.Content = "IE=8";
this.Header.Controls.Add(meta);
}
}
base.OnLoad(e);
//Place code here that should be called *after* the inheriting pages onload is executed
if (!IsAjaxCallback)
{
if (this.Context.Session != null)
Util.SessionAddKeepAlive(this.Page);
}
Literal l = new Literal();
l.Text = "";
l.ID = "aya";
if (Page.Header.FindControl(l.ID) == null)
Page.Header.Controls.Add(l);
//case 1111
Util.PageAddCustomContent(this.Page);
}
protected void CloseMe()
{
//this causes the original window to refresh, useful if record has changed
//Response.Write("");
// Response.Write("");
//Response.Write("");
//This version works around the IE7 tab close warning, that the above one generates
Response.Write(" ");
}
private bool checkedforcallback=false;
private bool iscallback = false;
public bool IsAjaxCallback
{
get
{
if (!checkedforcallback)
{
iscallback = Page.IsCallback;
//HttpContext ctx = HttpContext.Current;
//iscallback = (
// ctx != null &&
// ctx.Request != null &&
// (ctx.Request.QueryString["rcbID"] != null ||
// ctx.Request.Form["RadAJAXControlID"]!=null));
checkedforcallback = true;
}
return iscallback;
}
}
}