Ejemplo n.º 1
0
        public override void DataBind()
        {
            UserList.DataSource = User.GetListActive();
            UserList.DataBind();

            if (DataItem != null)
            {
                PropertyValueCollection properties = WorkflowActivityWrapper.GetAssignmentProperties(DataItem);

                object prop;

                // User
                prop = properties[AssignmentEntity.FieldUserId];
                if (prop != null)
                {
                    CHelper.SafeSelect(UserList, prop.ToString());
                }

                // Subject
                prop = properties[AssignmentEntity.FieldSubject];
                if (prop != null)
                {
                    SubjectText.Text = prop.ToString();
                }
            }
        }
Ejemplo n.º 2
0
        private void BindData()
        {
            if (activity == null)               // new
            {
                ActivityMaster[] list = shemaMaster.GetAllowedActivities(ParentActivityName);
                if (list != null && list.Length > 0)
                {
                    foreach (ActivityMaster item in list)
                    {
                        ActivityTypeList.Items.Add(new ListItem(CHelper.GetResFileString(item.Description.Comment), item.Description.Name));
                    }

                    ActivityMaster currentActivityMaster = list[0];
                    CHelper.SafeSelect(ActivityTypeList, currentActivityMaster.Description.Name);
                    ControlName = currentActivityMaster.Description.UI.CreateControl;
                }
            }
            else             // edit
            {
                ActivityMaster currentActivityMaster = WorkflowActivityWrapper.GetActivityMaster(shemaMaster, activity, ActivityName);

                ActivityTypeList.Items.Add(new ListItem(CHelper.GetResFileString(currentActivityMaster.Description.Comment), currentActivityMaster.Description.Name));
                ActivityTypeList.Enabled = false;

                ControlName = currentActivityMaster.Description.UI.EditControl;
            }
        }
Ejemplo n.º 3
0
        public override object Save(object dataItem)
        {
            BlockActivityType selectedType = (BlockActivityType)Enum.Parse(typeof(BlockActivityType), BlockTypeList.SelectedValue);

            WorkflowActivityWrapper.SetBlockActivityType(dataItem, selectedType);
            return(base.Save(dataItem));
        }
Ejemplo n.º 4
0
 public override void DataBind()
 {
     if (DataItem != null)
     {
         BlockActivityType type = WorkflowActivityWrapper.GetBlockActivityType(DataItem);
         CHelper.SafeSelect(BlockTypeList, ((int)type).ToString());
     }
 }
Ejemplo n.º 5
0
        public override object Save(object dataItem)
        {
            PropertyValueCollection properties = WorkflowActivityWrapper.GetAssignmentProperties(dataItem);

            properties[AssignmentEntity.FieldSubject] = SubjectText.Text.Trim();
            properties[AssignmentEntity.FieldUserId]  = int.Parse(UserList.SelectedValue);

            return(base.Save(dataItem));
        }
Ejemplo n.º 6
0
        protected void Application_End(Object sender, EventArgs e)
        {
            // O.R. [2009-07-28]: Check license and NET Framework version
            if (Configuration.WorkflowModule && WorkflowActivityWrapper.IsFramework35Installed())
            {
                GlobalWorkflowRuntime.StopRuntime();
            }

            Configuration.Uninitialize();
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            info = WorkflowActivityWrapper.GetBusinessProcessInfo(ObjectId);

            if (!IsPostBack)
            {
                BindData();
                BindActivities();
            }

            BindToolbar();
        }
Ejemplo n.º 8
0
        private void BindData()
        {
            SchemaMaster currentShemaMaster = SchemaManager.GetShemaMaster(instance.SchemaId);
            object       rootActivity       = McWorkflowSerializer.GetObject(instance.Xaml);

            WorkflowDescription wfDescription = new WorkflowDescription((Guid)instance.PrimaryKeyId.Value,
                                                                        instance.Name,
                                                                        currentShemaMaster,
                                                                        rootActivity);

            ActivityGrid.DataSource = WorkflowActivityWrapper.GetActivityList(wfDescription, rootActivity);
            ActivityGrid.DataBind();
        }
Ejemplo n.º 9
0
        public bool IsEnable(object Sender, object Element)
        {
            bool retval = false;

            // O.R. [2009-07-28]: Check license and NET Framework version
            // O.R. [2009-10-28]: Check SchemaManager count
            SchemaMaster[] list = SchemaManager.GetAvailableShemaMasters();
            if (Configuration.WorkflowModule && WorkflowActivityWrapper.IsFramework35Installed() && list != null && list.Length > 0)
            {
                retval = true;
            }

            return(retval);
        }
Ejemplo n.º 10
0
        public override void DataBind()
        {
            BlockTypeLabel.Text = string.Empty;

            if (DataItem != null)
            {
                BlockActivityType type = WorkflowActivityWrapper.GetBlockActivityType(DataItem);
                if (type == BlockActivityType.All)
                {
                    BlockTypeLabel.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "BlockActivityTypeAll").ToString();
                }
                else if (type == BlockActivityType.Any)
                {
                    BlockTypeLabel.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "BlockActivityTypeAny").ToString();
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Users the can write.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        private bool CanUserWrite(AssignmentEntity entity)
        {
            if (entity.WorkflowInstanceId.HasValue &&
                !string.IsNullOrEmpty(entity.WorkflowActivityName))
            {
                PropertyValueCollection properties = WorkflowActivityWrapper.GetAssignmentProperties((Guid)entity.WorkflowInstanceId.Value, entity.WorkflowActivityName);

                if (properties.Contains(AssignmentCustomProperty.ReadOnlyLibraryAccess))
                {
                    bool?value = properties[AssignmentCustomProperty.ReadOnlyLibraryAccess] as bool?;
                    if (value.HasValue)
                    {
                        return(!value.Value);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 12
0
        protected void SaveButton_ServerClick(object sender, EventArgs e)
        {
            if (activity == null)             // new
            {
                ActivityMaster currentActivityMaster = shemaMaster.GetActivityMaster(ActivityTypeList.SelectedValue);
                activity = currentActivityMaster.InstanceFactory.CreateInstance();

                if (MainPlaceHolder.Controls.Count > 0)
                {
                    MCDataSavedControl control = (MCDataSavedControl)MainPlaceHolder.Controls[0];
                    control.Save(activity);
                }

                object parentActivity = WorkflowActivityWrapper.GetActivityByName(rootActivity, ParentActivityName);
                WorkflowActivityWrapper.AddActivity(parentActivity, activity);
            }
            else             // edit
            {
                if (MainPlaceHolder.Controls.Count > 0)
                {
                    MCDataSavedControl control = (MCDataSavedControl)MainPlaceHolder.Controls[0];
                    control.Save(activity);
                }
            }

            // Save data
            instance.Xaml = McWorkflowSerializer.GetString(rootActivity);
            BusinessManager.Update(instance);

            // Close popup
            if (!String.IsNullOrEmpty(Request["closeFramePopup"]))
            {
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, string.Empty, true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                        "<script language='javascript'>" +
                                                        "try {window.opener.location.href=window.opener.location.href;}" +
                                                        "catch (e){} window.close();</script>");
            }
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // O.R. [2009-07-28]: Check license and NET Framework version
            if (Mediachase.IBN.Business.Configuration.WorkflowModule && WorkflowActivityWrapper.IsFramework35Installed())
            {
#if DEBUG
                if (Request["Id"] != null)
                {
                    Dictionary <string, string> dicNew = new Dictionary <string, string>();
                    dicNew.Add("parentName", "_parentName_");
                    CommandParameters cpNew = new CommandParameters("WFNewActivityPopup", dicNew);

                    Dictionary <string, string> dicEdit = new Dictionary <string, string>();
                    dicEdit.Add("activityName", "_activityName_");
                    CommandParameters cpEdit = new CommandParameters("WFEditActivityPopup", dicEdit);

                    string _newActivity  = CommandManager.GetCurrent(this.Page).AddCommand("WorkflowInstance", string.Empty, string.Empty, cpNew);
                    string _editActivity = CommandManager.GetCurrent(this.Page).AddCommand("WorkflowInstance", string.Empty, string.Empty, cpEdit);

                    ctrlWFBuilder.NewActivityScript  = _newActivity;
                    ctrlWFBuilder.EditActivityScript = _editActivity;
                    ctrlWFBuilder.AddText            = CHelper.GetResFileString("{IbnFramework.BusinessProcess:NewActivity}");
                    ctrlWFBuilder.EditText           = CHelper.GetResFileString("{IbnFramework.BusinessProcess:EditActivity}");
                    ctrlWFBuilder.DeleteText         = CHelper.GetResFileString("{IbnFramework.BusinessProcess:DeleteActivity}");

                    ctrlWFBuilder.WorkflowId = PrimaryKeyId.Parse(Request["Id"]);
                    ctrlWFBuilder.DataBind();
                }

                LayoutExtender _extender = LayoutExtender.GetCurrent(this.Page);
                if (_extender != null)
                {
                    _extender.NoHeightResize = true;
                }

                Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), Guid.NewGuid().ToString(),
                                                            String.Format("<link type='text/css' rel='stylesheet' href='{0}' />", McScriptLoader.Current.GetScriptUrl("~/styles/IbnFramework/assignment.css", this.Page)));
#endif
            }
        }
Ejemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (InstanceId != PrimaryKeyId.Empty)
            {
                instance     = (WorkflowInstanceEntity)BusinessManager.Load(WorkflowInstanceEntity.ClassName, InstanceId);
                shemaMaster  = SchemaManager.GetShemaMaster(instance.SchemaId);
                rootActivity = McWorkflowSerializer.GetObject(instance.Xaml);

                if (!String.IsNullOrEmpty(ActivityName))
                {
                    activity = WorkflowActivityWrapper.GetActivityByName(rootActivity, ActivityName);
                }
            }

            if (!IsPostBack)
            {
                BindInfo();
                BindData();
            }

            LoadControlToPlaceHolder(!IsPostBack);
        }
Ejemplo n.º 15
0
        public override void DataBind()
        {
            if (DataItem != null)
            {
                PropertyValueCollection properties = WorkflowActivityWrapper.GetAssignmentProperties(DataItem);

                object prop;

                // User
                prop = properties[AssignmentEntity.FieldUserId];
                if (prop != null)
                {
                    UserLight user = UserLight.Load((int)prop);
                    UserLabel.Text = user.DisplayName;
                }

                // Subject
                prop = properties[AssignmentEntity.FieldSubject];
                if (prop != null)
                {
                    SubjectLabel.Text = prop.ToString();
                }
            }
        }
Ejemplo n.º 16
0
		/// <summary>
		/// When overridden in an abstract class, creates the control hierarchy that is used to render the composite data-bound control based on the values from the specified data source.
		/// </summary>
		/// <param name="dataSource">An <see cref="T:System.Collections.IEnumerable"/> that contains the values to bind to the control.</param>
		/// <param name="dataBinding">true to indicate that the <see cref="M:System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls(System.Collections.IEnumerable,System.Boolean)"/> is called during data binding; otherwise, false.</param>
		/// <returns>
		/// The number of items created by the <see cref="M:System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls(System.Collections.IEnumerable,System.Boolean)"/>.
		/// </returns>
		protected override int CreateChildControls(System.Collections.IEnumerable dataSource, bool dataBinding)
		{
			InitImages(this.CurrentContainer.Page);
			divContainer = new Panel();
			divInnerContainer = new Panel();
			divIcons = new Panel();
			divSubIcons = new Panel();

			divIcons.CssClass = "iconBlock";
			divSubIcons.CssClass = "subiconBlock";
			divContainer.CssClass = "itemcontainerBlock";
			divInnerContainer.CssClass = "innerContainerBlock";

			#region Create and init controls
			#region ddType/lblType/extType
			ddType = new DropDownList();
			ddType.ID = this.ID + "_ddType";
			List<string> typeItems = AssignmentFactory.GetAvailableActivities();
			ddType.Items.Add(new ListItem("New activity", "0"));

			foreach (String s in typeItems)
			{
				ddType.Items.Add(new ListItem(s, s));
			}

			ddType.AutoPostBack = true;
			ddType.SelectedIndexChanged += new EventHandler(ddType_SelectedIndexChanged);
			ddType.Style.Add(HtmlTextWriterStyle.Display, "none");

			lblType = new Label();
			lblType.Text = this.CurrentContainer.AddText;
			lblType.Visible = (this.CurrentActivity is CompositeActivity);
			lblType.ID = this.ID + "_lblType";
			lblType.CssClass = "createAssignmentLink";
			if (!String.IsNullOrEmpty(this.CurrentContainer.NewActivityScript))
			{
				//string parentActivity = string.Empty;
				//if (this.CurrentActivity.Parent != null)
				//    parentActivity = this.CurrentActivity.Parent.Name;
				//else
				//    parentActivity = this.CurrentActivity.Name;

				string _newActivityScript = this.CurrentContainer.NewActivityScript.Replace("_parentName_", this.CurrentActivity.Name);
				lblType.Attributes.Add("onclick", _newActivityScript);
			}

			//extType = new HiderExtender();
			//extType.ID = this.ID + "_extType";

			//extType.TargetControlID = ddType.ID;
			#endregion

			#region ddPrototype
			ddPrototype = new DropDownList();
			ddPrototype.Items.AddRange(this.Prototypes.ToArray());
			ddPrototype.DataBind(); 
			#endregion

			#region button Create
			btnCreate = new Button();
			btnCreate.Text = "Add";
			btnCreate.ID = this.ID + "_btnCreate";
			btnCreate.Click += new EventHandler(btnCreate_Click);
			#endregion

			#region button Delete
			btnDelete = new ImageButton();
			//btnDelete.Text = "Delete";
			btnDelete.OnClientClick = String.Format("return confirm('{0}');", this.CurrentContainer.DeleteText);
			btnDelete.ImageUrl = _imageDenyUrl;
			btnDelete.Click += new ImageClickEventHandler(btnDelete_Click);
			#endregion

			#region btnUp
			btnUp = new ImageButton();
			//btnUp.Text = "Up";
			btnUp.ImageUrl = _imageUpUrl;
			btnUp.Click += new ImageClickEventHandler(btnUp_Click);
			#endregion

			#region btnDown
			btnDown = new ImageButton();
			//btnDown.Text = "Down";
			btnDown.ImageUrl = _imageDownUrl;
			btnDown.Click += new ImageClickEventHandler(btnDown_Click);
			#endregion

			#region btnEdit
			btnEdit = new Button();
			btnEdit.Text = "Edit prototype";
			btnEdit.Click += new EventHandler(btnEdit_Click);
			#endregion 

			lblEditPrototype = new HtmlGenericControl("DIV");
			lblEditPrototype.Attributes.Add("class", "editPrototypeLabel");
			lblEditPrototype.InnerHtml = string.Format("<img src='{0}' border='0'/><span>{1}</span>", this.ResolveUrl(_imageEditUrl), this.CurrentContainer.EditText);
			if (!String.IsNullOrEmpty(this.CurrentContainer.EditActivityScript))
			{
				string _editActivityScript = this.CurrentContainer.EditActivityScript.Replace("_activityName_", this.CurrentActivity.Name);
				lblEditPrototype.Attributes.Add("onclick", _editActivityScript);
			}
			lblEditPrototype.Visible = (WorkflowActivityWrapper.GetActivityMaster(this.CurrentContainer.CurrentSchemaMaster, this.CurrentActivity, this.CurrentActivity.Name) != null);
			//if (this.CurrentContainer.CurrentSchemaMaster
//			lblEditPrototype.Attributes.Add("onclick", "");

			#endregion

			divContainer.ID = this.ID + "_divContainer";
			divContainer.Style.Add(HtmlTextWriterStyle.Display, "inline");
			Control c = AssignmentFactory.GetActivityPrimitive(this.CurrentActivity, this.CurrentContainer.CurrentSchemaMaster, this.CurrentContainer.Page);
			//extType.TestPerform(lblType.ClientID);
			#region Create inner control structure
			if (c != null)
			{
				divInnerContainer.Controls.Add(c);
				((MCDataBoundControl)c).DataItem = this.CurrentActivity;
				((MCDataBoundControl)c).DataBind();
			}

			divIcons.Controls.Add(btnDelete);
			divIcons.Controls.Add(btnUp);
			divIcons.Controls.Add(btnDown);

			divIcons.Controls.Add(ddType);
			divIcons.Controls.Add(lblType);
			//divIcons.Controls.Add(extType);

			//divIcons.Controls.Add(lblEditPrototype);

			btnCreate.Visible = false;
			divIcons.Controls.Add(btnCreate);

			divSubIcons.Controls.Add(ddPrototype);
			divSubIcons.Controls.Add(btnEdit);
			divIcons.Controls.Add(lblEditPrototype);

			divContainer.Controls.Add(divIcons);
			divContainer.Controls.Add(divSubIcons);
			divContainer.Controls.Add(divInnerContainer); 
			#endregion

			this.Controls.Add(divContainer);
			//this.Controls.Add(extType);

			return 1;
		}
Ejemplo n.º 17
0
        /// <summary>
        /// Gets the user list.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        private int[] GetUserList(WorkflowInstanceEntity entity)
        {
            object workflowRoot = McWorkflowSerializer.GetObject(entity.Xaml);

            return(WorkflowActivityWrapper.GetActivityUserList(workflowRoot));
        }
Ejemplo n.º 18
0
        private void BindTabs()
        {
            bool CanViewFinances = Document.CanViewFinances(DocumentId);

            // O.R. [2009-04-06]: Workflow
            if (Tab != null && (Tab == "General" || Tab == "FileLibrary" || Tab == "Finance" || Tab == "Discussions" || Tab == "Customization" || Tab == "Workflow"))
            {
                pc["DocumentView_CurrentTab"] = Tab;
            }
            else if (ViewState["CurrentTab"] != null)
            {
                pc["DocumentView_CurrentTab"] = ViewState["CurrentTab"].ToString();
            }
            else if (pc["DocumentView_CurrentTab"] == null)
            {
                pc["DocumentView_CurrentTab"] = "General";
            }

            if (!CanViewFinances && Tab == "Finance")
            {
                pc["DocumentView_CurrentTab"] = "General";
            }

            // O.R. [2009-10-28]: Workflow. Check Schemas
            Mediachase.Ibn.Assignments.Schemas.SchemaMaster[] list = Mediachase.Ibn.Assignments.Schemas.SchemaManager.GetAvailableShemaMasters();
            if (Tab == "Workflow" && !(Configuration.WorkflowModule && WorkflowActivityWrapper.IsFramework35Installed() && list != null && list.Length > 0))
            {
                pc["DocumentView_CurrentTab"] = "General";
            }

            ctrlTopTab.AddTab(LocRM.GetString("tabGeneral"), "General");
            ctrlTopTab.AddTab(LocRM.GetString("tbDetails"), "Customization");
            ctrlTopTab.AddTab(LocRM.GetString("tabLibrary"), "FileLibrary");
            if (CanViewFinances && !Security.CurrentUser.IsExternal)
            {
                ctrlTopTab.AddTab(LocRM.GetString("tabFinance"), "Finance");
            }
            else
            {
                if (pc["DocumentView_CurrentTab"] == "Finance")
                {
                    pc["DocumentView_CurrentTab"] = "General";
                }
            }
            ctrlTopTab.AddTab(LocRM.GetString("tabDiscussions"), "Discussions");

            // O.R. [2009-07-28]: Check license and NET Framework version
            if (Configuration.WorkflowModule && WorkflowActivityWrapper.IsFramework35Installed() && list != null && list.Length > 0)
            {
                ctrlTopTab.AddTab(GetGlobalResourceObject("IbnFramework.BusinessProcess", "Workflows").ToString(), "Workflow");
            }

            ctrlTopTab.SelectItem(pc["DocumentView_CurrentTab"]);

            string controlName = "DocumentGeneral2.ascx";

            switch (pc["DocumentView_CurrentTab"])
            {
            case "General":
                controlName = "DocumentGeneral2.ascx";
                break;

            case "Customization":
                controlName = "MetaDataView.ascx";
                break;

            case "Finance":
                if (CanViewFinances)
                {
                    controlName = "Finance.ascx";
                }
                break;

            case "FileLibrary":
                controlName = "FileLibrary.ascx";
                break;

            case "Discussions":
                controlName = "Discussions.ascx";
                break;

            case "Workflow":                            // O.R. [2009-04-06]: Workflow hack
                controlName = "~/Apps/BusinessProcess/Modules/WorkflowListByObject.ascx";
                break;
            }

            System.Web.UI.UserControl control = (System.Web.UI.UserControl)LoadControl(controlName);
            phItems.Controls.Add(control);
        }
Ejemplo n.º 19
0
        protected void Application_BeginRequest(Object sender, EventArgs e)
        {
            GetCultureFromRequest();
            InitializeGlobalContext();
            GlobalResourceManager.Initialize(HostingEnvironment.MapPath("~/App_GlobalResources/GlobalResources.xml"));

            string path = Request.Path;

            #region Remove /portals/ from query
            string constOldUrl = "/portals/";
            if (path.IndexOf(constOldUrl, StringComparison.OrdinalIgnoreCase) >= 0)
            {
                string fullPath    = Request.RawUrl;
                int    index       = fullPath.IndexOf(constOldUrl, StringComparison.OrdinalIgnoreCase);
                string begin       = fullPath.Substring(0, index);
                string end         = fullPath.Substring(index + constOldUrl.Length);
                int    endOfDomain = end.IndexOf('/');
                if (endOfDomain >= 0)
                {
                    end = end.Substring(endOfDomain + 1);
                }
                path = begin + '/' + end;

                //OZ: RewritePath чтобы работали старые клиентские инструменты
                //AK: 2009-01-26 - exclude css
                if (path.EndsWith(".css", StringComparison.OrdinalIgnoreCase))
                {
                    Response.Redirect(path, true);
                }
                else
                {
                    HttpContext.Current.RewritePath(path);
                }
            }
            #endregion

            bool pathContainsFiles  = (path.IndexOf("/files/", StringComparison.OrdinalIgnoreCase) >= 0);
            bool pathContainsWebDav = (path.IndexOf("/webdav/", StringComparison.OrdinalIgnoreCase) >= 0);

            if (!pathContainsFiles && !pathContainsWebDav &&
                (path.EndsWith("error.aspx", StringComparison.OrdinalIgnoreCase) ||
                 path.EndsWith(".css", StringComparison.OrdinalIgnoreCase) ||
                 path.EndsWith(".html", StringComparison.OrdinalIgnoreCase) ||
                 path.EndsWith("webresource.axd", StringComparison.OrdinalIgnoreCase) ||
                 path.EndsWith("scriptresource.axd", StringComparison.OrdinalIgnoreCase) ||
                 path.EndsWith("licenseexpired.aspx", StringComparison.OrdinalIgnoreCase)
                )
                )
            {
                return;
            }


            //Обработка файлов которые подвергаются кэшированию
            // TODO: перенести список строк и время жизни кеша в web.config
            if (!pathContainsFiles && !pathContainsWebDav &&
                !path.EndsWith("Reserved.ReportViewerWebControl.axd", StringComparison.OrdinalIgnoreCase) &&
                (path.EndsWith(".js", StringComparison.OrdinalIgnoreCase) ||
                 path.EndsWith(".gif", StringComparison.OrdinalIgnoreCase) ||
                 path.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) ||
                 path.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ||
                 path.EndsWith(".axd", StringComparison.OrdinalIgnoreCase)
                )
                )
            {
                HttpCachePolicy cache = HttpContext.Current.Response.Cache;
                //HttpContext.Current.Response.AddFileDependency(Server.MapPath(path));
                bool _hanldeFlag = true;

                //Вид кэширования (включает возможность кэширования на прокси)
                cache.SetCacheability(HttpCacheability.Public);

                //кэширование по параметрам в QueryString (d, versionUid)
                //все запросы включающие любой из этих параметров будут кешироваться по значению параметра
                cache.VaryByParams["d"]          = true;
                cache.VaryByParams["versionUid"] = true;
                cache.SetOmitVaryStar(true);

                //устанавливаем срок годности закэшированого файла
                //Можно сделать для разных типов фалов - разные сроки хранения
                double cacheExpires = 1;
                if (System.Configuration.ConfigurationManager.AppSettings["ClientCache"] != null)
                {
                    cacheExpires = Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["ClientCache"], CultureInfo.InvariantCulture);
                }
                cache.SetExpires(DateTime.Now + TimeSpan.FromMinutes(cacheExpires));
                //cache.SetMaxAge(TimeSpan.FromSeconds(259200));


                //разрешаем хранить кэш на диске
                cache.SetAllowResponseInBrowserHistory(true);
                cache.SetValidUntilExpires(true);

#if (DEBUG)
                cache.SetExpires(DateTime.Now);
                cache.SetAllowResponseInBrowserHistory(false);
#endif

                DateTime dtRequest = DateTime.MinValue;

#if (!DEBUG)
                //проверка даты модификации файла
                if (File.Exists(Server.MapPath(path)))
                {
                    cache.SetLastModified(File.GetLastWriteTime(Server.MapPath(path)).ToUniversalTime());

                    //Не удалять(!) Включает режим более строгово кеширования
                    //Кэшеирует файлы даже после рестарта IIS, вернусь после отпуска протестирую и включу (dvs)

                    if (HttpContext.Current.Request.Headers["If-Modified-Since"] != null)
                    {
                        try
                        {
                            dtRequest = Convert.ToDateTime(HttpContext.Current.Request.Headers["If-Modified-Since"], CultureInfo.InvariantCulture);
                        }
                        catch
                        {
                        }

                        //если файл существует и его дата модификации совпадает с версией на клиенте то возвращаем 304, в противном случае
                        //обрабатывать данный запрос будет дефолтный хэндлер ASP.NET (подробнее см. System.Web.Cachig.OutputCacheModule)
                        if (File.GetLastWriteTime(Server.MapPath(path)).ToUniversalTime().ToString("r") == dtRequest.ToUniversalTime().ToString("r"))
                        {
                            //Если отладка загрузки скриптов включена, то не кэшируем их
                            if ((path.EndsWith(".js", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".axd", StringComparison.OrdinalIgnoreCase)) && Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["LogSriptLoading"], CultureInfo.InvariantCulture))
                            {
                                cache.SetExpires(DateTime.Now);
                            }
                            else
                            {
                                Response.ClearContent();
                                Response.StatusCode = 304;
                                _hanldeFlag         = false;
                            }
                        }
                    }
                }
#endif

                if (_hanldeFlag)
                {
                    return;
                }
            }
            else
            {
                //25.02.2009 et: Не выполнять проверку для WebDav запросов
                if (!pathContainsFiles && !pathContainsWebDav)
                {
                    if (path.IndexOf('\\') >= 0 || System.IO.Path.GetFullPath(Request.PhysicalPath) != Request.PhysicalPath)
                    {
                        throw new HttpException(404, "not found");
                    }
                }

                InitializeDatabase();                 // Terminates request if error occurs.

                //AK 2009-01-16
                if (!PortalConfig.SystemIsActive)
                {
                    if (Request.AppRelativeCurrentExecutionFilePath.Equals("~/default.aspx", StringComparison.OrdinalIgnoreCase))
                    {
                        return;
                    }
                    else
                    {
                        Response.Redirect("~/default.aspx", true);
                    }
                }

                //Init TemplateResolver
                TemplateResolver.Current = new TemplateResolver();

                TemplateResolver.Current.AddSource("QueryString", new TemplateSource(HttpContext.Current.Request.QueryString));

                if (HttpContext.Current.Session != null)
                {
                    TemplateResolver.Current.AddSource("Session", new TemplateSource(HttpContext.Current.Session));
                }

                TemplateResolver.Current.AddSource("HttpContext", new TemplateSource(HttpContext.Current.Items));
                TemplateResolver.Current.AddSource("DataContext", new TemplateSource(DataContext.Current.Attributes));

                TemplateResolver.Current.AddSource("DateTime", new DateTimeTemplateSource());
                TemplateResolver.Current.AddSource("Security", new Mediachase.Ibn.Data.Services.SecurityTemplateSource());

                TemplateResolver.Current.AddSource("TimeTrackingSecurity", new Mediachase.IbnNext.TimeTracking.TimeTrackingSecurityTemplateSource());

                //Init PathTemplateResolver
                PathTemplateResolver.Current = new PathTemplateResolver();

                PathTemplateResolver.Current.AddSource("QueryString", new PathTemplateSource(HttpContext.Current.Request.QueryString));

                if (HttpContext.Current.Session != null)
                {
                    PathTemplateResolver.Current.AddSource("Session", new PathTemplateSource(HttpContext.Current.Session));
                }

                PathTemplateResolver.Current.AddSource("HttpContext", new PathTemplateSource(HttpContext.Current.Items));
                PathTemplateResolver.Current.AddSource("DataContext", new PathTemplateSource(DataContext.Current.Attributes));

                PathTemplateResolver.Current.AddSource("DateTime", new Mediachase.Ibn.Web.UI.Controls.Util.DateTimePathTemplateSource());
                PathTemplateResolver.Current.AddSource("Security", new Mediachase.Ibn.Web.UI.Controls.Util.SecurityPathTemplateSource());

                //PathTemplateResolver.Current.AddSource("TimeTrackingSecurity", new Mediachase.IbnNext.TimeTracking.TimeTrackingSecurityTemplateSource());

                // O.R. [2009-07-28]: Check license and .NET Framework version
                if (Configuration.WorkflowModule && WorkflowActivityWrapper.IsFramework35Installed())
                {
                    GlobalWorkflowRuntime.StartRuntime(DataContext.Current.SqlContext.ConnectionString);
                }
            }
        }