コード例 #1
0
 public void HandleValue(Xy.Web.Page.PageAbstract CurrentPageClass)
 {
     foreach (DataParameter _item in this.Values)
     {
         _item.HandleValue(CurrentPageClass);
     }
 }
コード例 #2
0
 public System.Xml.XPath.XPathDocument HandleData(Xy.Web.Page.PageAbstract CurrentPageClass)
 {
     Xy.Data.Procedure _procedure;
     if (!string.IsNullOrEmpty(_command))
     {
         _procedure = new Data.Procedure("XYControlInnerProcedure", _command);
     }
     else
     {
         _procedure = new Data.Procedure(_procedureName);
     }
     if (!string.IsNullOrEmpty(_parameter) || !string.IsNullOrEmpty(_defaultParameter))
     {
         if (!_dataParameterCollection.Inited)
         {
             _dataParameterCollection.AnalyzeParameter(_parameter, _defaultParameter);
         }
         _dataParameterCollection.HandleValue(CurrentPageClass);
         if (_dataParameterCollection.HasContent)
         {
             _dataParameterCollection.FillParameter(_procedure);
         }
     }
     if (!string.IsNullOrEmpty(_dataConnection))
     {
         _procedure.SetDataBase(new Xy.Data.DataBase(_dataConnection));
     }
     _data = _procedure.InvokeProcedureFill();
     if (_dataParameterCollection.HasReturn)
     {
         _dataParameterCollection.GetReturnParameter(_procedure);
     }
     return(new System.Xml.XPath.XPathDocument(new System.IO.StringReader(Xy.Tools.IO.XML.ConvertDataTableToXML(_data))));
 }
コード例 #3
0
        private void handleValue(string value, Xy.Web.Page.PageAbstract CurrentPageClass)
        {
            if (string.IsNullOrEmpty(value))
            {
                return;
            }
            _parameterType = System.Data.DbType.String;
            if (value.IndexOf('|') >= 0)
            {
                switch (value.Substring(value.LastIndexOf('|') + 1))
                {
                case "s":
                case "short": _parameterType = System.Data.DbType.Int16; break;

                case "i":
                case "int": _parameterType = System.Data.DbType.Int32; break;

                case "l":
                case "long": _parameterType = System.Data.DbType.Int64; break;

                case "d":
                case "date": _parameterType = System.Data.DbType.Date; break;

                case "t":
                case "time": _parameterType = System.Data.DbType.DateTime; break;
                }
                value = value.Substring(0, value.LastIndexOf('|'));
            }

            value = Xy.Tools.Control.Tag.TransferValue(_parameterName, value, CurrentPageClass);
            if (!string.IsNullOrEmpty(value))
            {
                _parameterValue = value;
            }
        }
コード例 #4
0
 public void HandleValue(Xy.Web.Page.PageAbstract PaCurrentPageClassge)
 {
     handleValue(_parameterValueText, PaCurrentPageClassge);
     if (string.IsNullOrEmpty(_parameterValue))
     {
         handleValue(_parameterDefaultValueText, PaCurrentPageClassge);
     }
     _isHandled = true;
 }
コード例 #5
0
        public static string TransferValue(string key, string value, Xy.Web.Page.PageAbstract page)
        {
            string _value      = value;
            string tempGetName = key;

            if (_value.IndexOf(':') > 0)
            {
                tempGetName = _value.Substring(_value.LastIndexOf(':') + 1);
                _value      = _value.Substring(0, _value.LastIndexOf(':'));
            }

            switch (_value)
            {
            case "Request":
                _value = page.Request[tempGetName];
                break;

            case "Url":
                _value = page.Request.QueryString[tempGetName];
                break;

            case "Form":
                _value = page.Request.Form[tempGetName];
                break;

            case "Group":
                _value = page.Request.GroupString[tempGetName];
                break;

            case "Values":
                _value = page.Request.Values[tempGetName];
                break;

            case "Data":
                _value = page.PageData[tempGetName] == null ? string.Empty : page.PageData[tempGetName].GetDataString();
                break;

            case "Config":
                if (tempGetName == key)
                {
                    _value = page.WebSetting.Name;
                }
                else
                {
                    _value = page.WebSetting.Config[tempGetName];
                }
                break;

            case "App":
                switch (tempGetName)
                {
                case "Domain": _value = page.URL.Site; break;

                case "BasePath": _value = string.Concat(page.URL.Site, page.URL.Folder); break;

                case "CssPath": _value = string.Concat(page.URL.Site, page.URL.Folder, page.WebSetting.CssPath); break;

                case "ScriptPath": _value = string.Concat(page.URL.Site, page.URL.Folder, page.WebSetting.ScriptPath); break;

                case "Config": _value = page.WebSetting.Name; break;
                }
                break;
            }
            return(_value);
        }
コード例 #6
0
            private void handleValue(string value, Xy.Web.Page.PageAbstract CurrentPageClass)
            {
                if (string.IsNullOrEmpty(value))
                {
                    return;
                }
                _parameterType = System.Data.DbType.String;
                if (value.IndexOf('|') >= 0)
                {
                    switch (value.Substring(value.LastIndexOf('|') + 1))
                    {
                    case "s":
                    case "short": _parameterType = System.Data.DbType.Int16; break;

                    case "i":
                    case "int": _parameterType = System.Data.DbType.Int32; break;

                    case "l":
                    case "long": _parameterType = System.Data.DbType.Int64; break;

                    case "d":
                    case "date": _parameterType = System.Data.DbType.Date; break;

                    case "t":
                    case "time": _parameterType = System.Data.DbType.DateTime; break;
                    }
                    value = value.Substring(0, value.LastIndexOf('|'));
                }

                string tempGetName = _parameterName;

                if (value.IndexOf(':') > 0)
                {
                    tempGetName = value.Substring(value.LastIndexOf(':') + 1);
                    value       = value.Substring(0, value.LastIndexOf(':'));
                }

                switch (value)
                {
                case "Request":
                    value = CurrentPageClass.Request[tempGetName];
                    break;

                case "Url":
                    value = CurrentPageClass.Request.QueryString[tempGetName];
                    break;

                case "Form":
                    value = CurrentPageClass.Request.Form[tempGetName];
                    break;

                case "Group":
                    value = CurrentPageClass.Request.GroupString[tempGetName];
                    break;

                case "Data":
                    value = CurrentPageClass.PageData[tempGetName] == null ? string.Empty : CurrentPageClass.PageData[tempGetName].GetDataString();
                    break;

                case "Config":
                    if (tempGetName == _parameterName)
                    {
                        value = CurrentPageClass.WebSetting.Name;
                    }
                    else
                    {
                        value = CurrentPageClass.WebSetting.Config[tempGetName];
                    }
                    break;
                }
                if (!string.IsNullOrEmpty(value))
                {
                    _parameterValue = value;
                }
            }
コード例 #7
0
        public void Handle()
        {
            if (!string.IsNullOrEmpty(_urlItem.Mime))
            {
                _webContext.Response.ContentType = _urlItem.Mime;
            }
            switch (_urlItem.ContentType)
            {
            case URLManage.URLType.MainContent:
                //_webContext.Response.ContentType += "; charset=" + _webSetting.Encoding.WebName;
                //_webContext.Response.HeaderEncoding = _webSetting.Encoding;
                Xy.Web.Page.PageAbstract _page = Runtime.Web.PageClassLibrary.Get(_urlItem.PageClassName);
#if DEBUG
                Xy.Tools.Debug.Log.WriteEventLog("page created");
#endif
                _page.Init(this, this._webSetting);
#if DEBUG
                Xy.Tools.Debug.Log.WriteEventLog("page inited");
#endif
                try {
                    _page.Handle("@PageDir:" + _urlItem.PagePath, _urlItem.PagePath, _urlItem.EnableScript, false);
#if DEBUG
                    Xy.Tools.Debug.Log.WriteEventLog("page handled");
#endif
                } catch (Page.PageEndException) {
                    _content = _page.HTMLContainer;
                    return;
                } catch (Exception ex) {
                    try {
                        Page.PageErrorState _pes = _page.onError(ex);
                        if ((_pes & Page.PageErrorState.WriteLog) == Page.PageErrorState.WriteLog)
                        {
                            string _errorLogContent = _buildErrorString(_page, ex);
                            Xy.Tools.Debug.Log.WriteErrorLog(ex.Message);
                        }
                        if ((_pes & Page.PageErrorState.ThrowOut) == Page.PageErrorState.ThrowOut)
                        {
                            throw new Exception("A error occur on " + _urlItem.PageClassName, ex);
                        }
                    } catch (Page.PageEndException) {
                        return;
                    }
                }
                _content = _page.HTMLContainer;
                break;

            case URLManage.URLType.ResourceFile:
                DateTime _modifiedTime = System.IO.File.GetLastWriteTime(_url.PhysicalPath);
                if (Xy.Tools.IO.File.IsClientCached(_webContext.Request.Headers["If-Modified-Since"], _modifiedTime) && !_webSetting.DebugMode)
                {
                    WebContext.Response.StatusCode      = 304;
                    WebContext.Response.SuppressContent = true;
                }
                else
                {
                    WebContext.Response.Cache.SetLastModified(DateTime.Now);
                    if (_urlItem.Age.TotalMinutes > 0)
                    {
                        WebContext.Response.Cache.SetMaxAge(_urlItem.Age);
                        WebContext.Response.Cache.SetExpires(DateTime.Now.Add(_urlItem.Age));
                        WebContext.Response.Expires         = Convert.ToInt32(_urlItem.Age.TotalMinutes);
                        WebContext.Response.ExpiresAbsolute = DateTime.Now.Add(_urlItem.Age);
                        WebContext.Response.AddHeader("Cache-Control", "max-age=" + _urlItem.Age.TotalMinutes);
                    }
                    _webContext.Response.TransmitFile(_url.PhysicalPath);
                }
                break;

            case URLManage.URLType.Prohibit:
                throw new Exception("Access denied " + URL.ToString());
            }
        }
コード例 #8
0
 public System.Xml.XPath.XPathDocument HandleData(Xy.Web.Page.PageAbstract CurrentPageClass)
 {
     throw new NotImplementedException();
 }