Files

190 lines
6.3 KiB
C#

using System;
using System.Web;
using System.Web.UI;
using System.ComponentModel;
using System.Data;
//using SPC.Common;
//using SPC.Common.Data;
/// <summary>
///PageBase 的摘要说明
/// </summary>
namespace SPC.WebUI
{
public class PageBase:System.Web.UI.Page
{
private const String UNHANDLED_EXCEPTION = "Unhandled Exception:";
private const String KEY_CACHEUSERS = "Cache:Users";
private const String KEY_CACHEASSEMBLELINEWORKPLACE = "Cache:AssembleLineWorkPlace";
private const String KEY_CACHEWORKPLACEMEASUREPART = "Cache:WorkPlaceMeasurePart";
private const String KEY_CACHEWORKPLACEMEASUREPARTCONTENT = "Cache:WorkPlaceMeasurePartContent";
private static string UrlSuffix
{
get
{
//return HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath; //多加端口号与网站发布方式有关,与发布网站带不带端口号有关
return HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + HttpContext.Current.Request.ApplicationPath;
}
}
public static String SecureUrlBase
{
get
{
//return (SPCWebConfiguration.EnableSsl ? @"https://" : @"http://") + UrlSuffix;
return @"http://" + UrlSuffix;
}
}
public static String UrlBase
{
get
{
return @"http://" + UrlSuffix;
}
}
public DataSet UserSys
{
get
{
try
{
return (DataSet)(Session[KEY_CACHEUSERS]);
}
catch
{
return (null);
}
}
set
{
if (null == value)
{
Session.Remove(KEY_CACHEUSERS);
}
else
{
Session[KEY_CACHEUSERS] = value;
}
}
}
///// <summary>
///// Retrieves the Cart for the session, forcing it to be created
///// if it does not already exist.
///// </summary>
//public MeasureContent AssembleLineWorkPlace()
//{
// return AssembleLineWorkPlace(true);
//}
///// <summary>
///// Retrieves the Cart for the session, optionally forcing it to
///// be created if it does not already exist.
///// <param name="forceCreate">Create the shopping cart if it does not exist.</param>
///// </summary>
//public MeasureContent AssembleLineWorkPlace(bool forceCreate)
//{
// //
// // Try to get the cart from the Session
// //
// MeasureContent returnValue = (MeasureContent)(Session[KEY_CACHEASSEMBLELINEWORKPLACE]);
// if (null == returnValue)
// {
// //
// // If there is no cart, create it now
// //
// returnValue = new MeasureContent();
// //
// // Save it for later
// //
// Session.Add(KEY_CACHEASSEMBLELINEWORKPLACE, returnValue);
// }
// if (forceCreate) returnValue.EnsureWritable();
// return returnValue;
//}
///// <summary>
///// Retrieves the Cart for the session, forcing it to be created
///// if it does not already exist.
///// </summary>
//public MeasureContent WorkPlaceMeasurePart()
//{
// return WorkPlaceMeasurePart(true);
//}
///// <summary>
///// Retrieves the Cart for the session, optionally forcing it to
///// be created if it does not already exist.
///// <param name="forceCreate">Create the shopping cart if it does not exist.</param>
///// </summary>
//public MeasureContent WorkPlaceMeasurePart(bool forceCreate)
//{
// //
// // Try to get the cart from the Session
// //
// MeasureContent returnValue = (MeasureContent)(Session[KEY_CACHEWORKPLACEMEASUREPART]);
// if (null == returnValue)
// {
// //
// // If there is no cart, create it now
// //
// returnValue = new MeasureContent();
// //
// // Save it for later
// //
// Session.Add(KEY_CACHEWORKPLACEMEASUREPART, returnValue);
// }
// if (forceCreate) returnValue.EnsureWritable();
// return returnValue;
//}
///// <summary>
///// Retrieves the Cart for the session, forcing it to be created
///// if it does not already exist.
///// </summary>
//public MeasureContent WorkPlaceMeasurePartContent()
//{
// return WorkPlaceMeasurePartContent(true);
//}
///// <summary>
///// Retrieves the Cart for the session, optionally forcing it to
///// be created if it does not already exist.
///// <param name="forceCreate">Create the shopping cart if it does not exist.</param>
///// </summary>
//public MeasureContent WorkPlaceMeasurePartContent(bool forceCreate)
//{
// //
// // Try to get the cart from the Session
// //
// MeasureContent returnValue = (MeasureContent)(Session[KEY_CACHEWORKPLACEMEASUREPARTCONTENT]);
// if (null == returnValue)
// {
// //
// // If there is no cart, create it now
// //
// returnValue = new MeasureContent();
// //
// // Save it for later
// //
// Session.Add(KEY_CACHEWORKPLACEMEASUREPARTCONTENT, returnValue);
// }
// if (forceCreate) returnValue.EnsureWritable();
// return returnValue;
//}
protected override void OnError(EventArgs e)
{
//ApplicationLog.WriteError(ApplicationLog.FormatException(Server.GetLastError(), UNHANDLED_EXCEPTION));
base.OnError(e);
}
}
}