public CoreType GetCoreType(int typeId) { string cacheKey; CoreType objType; cacheKey = "THCore_" + typeId.ToString(); if (Cache[cacheKey] == null) { objType = new CoreType(typeId); Cache.Insert(cacheKey, objType); } else { objType = (CoreType)Cache[cacheKey]; } return(objType); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { m_ReturnTabId = this.TabId; if (Request.QueryString["PreTab"] != null) { try { m_ReturnTabId = int.Parse(Request.QueryString["PreTab"]); } catch { } } #region Apply Core Type if (m_typeId == -1) { CboType(); BindCboFolder(); } else { BindCboExcludedCategories(); cboType.Visible = false; CoreType objCoreType = GetCoreType(m_typeId); if (!objCoreType.IsUseXSL) { this.lblIsDefaultXSL.Visible = false; this.chkIsDefaultXSL.Visible = false; this.urlXslFile.Visible = false; } if (!objCoreType.IsUseToolTip) { this.lblToolTip.Visible = false; this.txtToolTip.Visible = false; } if (!objCoreType.IsUseApprove) { this.lblIsNeedApprove.Visible = false; this.chkIsNeedApprove.Visible = false; } if (!objCoreType.IsUseFolder) { this.lblDefaultFolder.Visible = false; this.cbDefaultFolder.Visible = false; } else { BindCboFolder(); } if (!objCoreType.IsUseIcon) { this.lblIcon.Visible = false; this.urlIcon.Visible = false; } if (!objCoreType.IsUsePublic) { this.lblIsNeedPublic.Visible = false; this.chkIsNeedPublic.Visible = false; } } #endregion if (m_intCategoryId != -1) { BindData(); lblError.Text = "Cập nhật chuyên mục"; } else { this.cbCategories.SelectedIndex = 0; } } }