Beispiel #1
0
        protected void Save_Click(object sender, EventArgs e)
        {
            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "ResetSubmitButton", "top.SubmitButton.resetAllStates();", true);

            try
            {
                Util.EnsureOperationSafe();
                SchemaObjectBase parent = null;

                if (this.currentParentID.Value.IsNotEmpty())
                {
                    parent = SchemaObjectAdapter.Instance.Load(this.currentParentID.Value);
                }

                SCObjectOperations.InstanceWithPermissions.DoOperation(this.OperationMode, this.Data, parent);

                SchemaObjectPhotoKey photoCacheKey = new SchemaObjectPhotoKey()
                {
                    ObjectID = this.Data.ID, PropertyName = "PhotoKey", TimePoint = DateTime.MinValue
                };

                CacheNotifyData notifyData = new CacheNotifyData(typeof(SchemaObjectPhotoCache), photoCacheKey, CacheNotifyType.Invalid);

                UdpCacheNotifier.Instance.SendNotify(notifyData);
                MmfCacheNotifier.Instance.SendNotify(notifyData);

                WebUtility.ResponseCloseWindowScriptBlock();

                //ScriptManager.RegisterClientScriptBlock(this.panelContainer, this.GetType(), "master", "top.window.close();", true);
            }
            catch (System.Exception ex)
            {
                WebUtility.ShowClientError(ex.GetRealException());
            }
        }
        /// <summary>
        /// 从Cache中获取图片
        /// </summary>
        /// <param name="id"></param>
        /// <param name="propertyName"></param>
        /// <param name="timePoint"></param>
        /// <returns></returns>
        public SchemaObjectPhoto GetObjectPhoto(string id, string propertyName, DateTime timePoint)
        {
            SchemaObjectPhotoKey cacheKey = new SchemaObjectPhotoKey()
            {
                ObjectID = id, PropertyName = propertyName, TimePoint = timePoint
            };

            return(SchemaObjectPhotoCache.Instance.GetOrAddNewValue(cacheKey, (cache, key) =>
            {
                SchemaObjectPhoto photo = LoadObjectPhoto(id, propertyName, timePoint);

                MixedDependency dependency = new MixedDependency(new UdpNotifierCacheDependency(), new MemoryMappedFileNotifierCacheDependency());

                cache.Add(cacheKey, photo, dependency);

                return photo;
            }));
        }
        protected void Save_Click(object sender, EventArgs e)
        {
            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "ResetSubmitButton", "top.SubmitButton.resetAllStates();", true);

            try
            {
                Util.EnsureOperationSafe();
                SchemaObjectBase parent = null;

                if (this.currentParentID.Value.IsNotEmpty())
                    parent = SchemaObjectAdapter.Instance.Load(this.currentParentID.Value);

                SCObjectOperations.InstanceWithPermissions.DoOperation(this.OperationMode, this.Data, parent);

                SchemaObjectPhotoKey photoCacheKey = new SchemaObjectPhotoKey() { ObjectID = this.Data.ID, PropertyName = "PhotoKey", TimePoint = DateTime.MinValue };

                CacheNotifyData notifyData = new CacheNotifyData(typeof(SchemaObjectPhotoCache), photoCacheKey, CacheNotifyType.Invalid);

                UdpCacheNotifier.Instance.SendNotify(notifyData);
                MmfCacheNotifier.Instance.SendNotify(notifyData);

                WebUtility.ResponseCloseWindowScriptBlock();

                //ScriptManager.RegisterClientScriptBlock(this.panelContainer, this.GetType(), "master", "top.window.close();", true);
            }
            catch (System.Exception ex)
            {
                WebUtility.ShowClientError(ex.GetRealException());
            }
        }