using System; using System.Web; using System.Web.UI; using System.ComponentModel; using System.Data; //using SPC.Common; //using SPC.Common.Data; /// ///PageBase 的摘要说明 /// 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; } } } ///// ///// Retrieves the Cart for the session, forcing it to be created ///// if it does not already exist. ///// //public MeasureContent AssembleLineWorkPlace() //{ // return AssembleLineWorkPlace(true); //} ///// ///// Retrieves the Cart for the session, optionally forcing it to ///// be created if it does not already exist. ///// Create the shopping cart if it does not exist. ///// //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; //} ///// ///// Retrieves the Cart for the session, forcing it to be created ///// if it does not already exist. ///// //public MeasureContent WorkPlaceMeasurePart() //{ // return WorkPlaceMeasurePart(true); //} ///// ///// Retrieves the Cart for the session, optionally forcing it to ///// be created if it does not already exist. ///// Create the shopping cart if it does not exist. ///// //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; //} ///// ///// Retrieves the Cart for the session, forcing it to be created ///// if it does not already exist. ///// //public MeasureContent WorkPlaceMeasurePartContent() //{ // return WorkPlaceMeasurePartContent(true); //} ///// ///// Retrieves the Cart for the session, optionally forcing it to ///// be created if it does not already exist. ///// Create the shopping cart if it does not exist. ///// //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); } } }