private static object m_SyncRoot = new Object(); //互斥对象

        #endregion Fields

        #region Methods

        public ActionResult GetChargeItemDictionaryTrees()
        {
            try
            {
                M_DictionaryTreeBLL bll = new M_DictionaryTreeBLL();
                //string ParentID, string TypeID, string treeState
                string ParentID = Request.Form["ParentID"].ToString();
                string TypeID = Request.Form["TypeID"].ToString();
                string treeState = Request.Form["treeState"].ToString();
                var result = new object();
                //增加缓存
                lock (m_SyncRoot)
                {
                    result = CacheHelper.GetCache(TypeID);
                    if (result == null)
                    {
                        result = bll.GetModelChargeItemList(ParentID, TypeID,treeState);
                        CacheHelper.SetCache(TypeID, result);
                    }
                }
                JsonResult j = this.Json(result, "appliction/json", JsonRequestBehavior.AllowGet);
                return j;
            }
            catch
            {
                return this.Json("");
            }
        }
Example #2
0
        /// <summary>
        /// 获取字典表树形结构信息
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="ParentID"></param>
        /// <param name="TypeID"></param>
        /// <returns></returns>
        public ActionResult GetAllDictionaryTrees(string tableName, string ParentID, string TypeID)
        {
            try
            {
                M_DictionaryTreeBLL bll = new M_DictionaryTreeBLL();

                var result = new object();
                //增加缓存
                lock (m_SyncRoot)
                {
                    //result = CacheHelper.GetCache(tableName);
                    //if (result == null)
                    //{
                        result = bll.GetModelList(tableName, ParentID, TypeID);//
                    //    CacheHelper.SetCache(tableName, result);
                    //}
                }
                JsonResult j = this.Json(result, "appliction/json", JsonRequestBehavior.AllowGet);
                return j;
            }
            catch (Exception ex)
            {
                LogUtility.Error("MedicalController/GetAllDictionaryTrees()", ex.ToString());
                return this.Json("");
            }
        }