Beispiel #1
0
        public bool reflashRoleCache()
        {
            bool isSuccess = false;

            ICriteria icr = CreateCriteria <RoleModel>();
            //icr.Add(Restrictions.Eq("isreserve", HotelModel.RESERVE_OK));
            IList                list     = icr.List();
            DatagridObject       datagrid = DatagridObject.ToDatagridObject(list);
            JSONObjectCollection json     = datagrid.toJSONObjectCollection();
            StringBuilder        sbr      = new StringBuilder("");

            sbr
            .Append("Class.forName(\"Toyz4js.cache\"); \n\n")
            .Append("Toyz4js[\"cache\"][\"RoleModel\"]=").Append(json.ToString()).Append(";  \n\n \n\n");
            ;
            try
            {
                FileUtil.WriteFile(this.pathRoleCache, sbr.ToString());
            }
            catch (Exception ex)
            {
                isSuccess = false;
            }
            return(isSuccess);
        }