コード例 #1
0
ファイル: Real.cs プロジェクト: NickQi/TianheDemo
        private string GetXmlFilePath(BaseListModel model)
        {
            //string filePath = System.AppDomain.CurrentDomain.BaseDirectory + "realdata\\2012-10-19-9-4-27_AI.xml";
            string filePath;

            try
            {
                int sobjectid = model.ObjectId;
                int stype     = model.CategoryId;

                string queryString = "sobjectid=" + sobjectid + "&stype=" + stype;
                string queryCache  = NTS.WEB.Common.CacheHelper.GetCache("CurQueryString") == null ? "" : NTS.WEB.Common.CacheHelper.GetCache("CurQueryString").ToString();
                object queryPath   = NTS.WEB.Common.CacheHelper.GetCache("CurQueryPath");

                if (queryCache != string.Empty && queryPath != null && queryCache == queryString)
                {
                    filePath = queryPath.ToString();
                }
                else
                {
                    var inter = new IRealtimeData();

                    filePath = inter.sergetcurrentdata(sobjectid, 3, stype);

                    if (ConfigurationManager.AppSettings["realtimedataurl"].IndexOf("localhost", System.StringComparison.Ordinal) == -1)
                    {
                        filePath = string.Format("{0}{1}", ConfigurationManager.AppSettings["serverurl"], filePath.Substring(filePath.LastIndexOf("\\", StringComparison.Ordinal)));
                    }
                    NTS.WEB.Common.CacheHelper.SetCache("CurQueryString", queryString);
                    NTS.WEB.Common.CacheHelper.SetCache("CurQueryPath", filePath);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }


            return(filePath);
        }
コード例 #2
0
ファイル: Real.cs プロジェクト: NickQi/TianheDemo
        private string GetXmlFilePath(BaseListModel model)
        {
            //string filePath = System.AppDomain.CurrentDomain.BaseDirectory + "realdata\\2012-10-19-9-4-27_AI.xml";
            string filePath;
            try
            {
                int sobjectid = model.ObjectId;
                int stype = model.CategoryId;

                string queryString = "sobjectid=" + sobjectid + "&stype=" + stype;
                string queryCache = NTS.WEB.Common.CacheHelper.GetCache("CurQueryString") == null ? "" : NTS.WEB.Common.CacheHelper.GetCache("CurQueryString").ToString();
                object queryPath = NTS.WEB.Common.CacheHelper.GetCache("CurQueryPath");

                if (queryCache != string.Empty && queryPath != null && queryCache == queryString)
                {
                    filePath = queryPath.ToString();
                }
                else
                {

                    var inter = new IRealtimeData();

                    filePath = inter.sergetcurrentdata(sobjectid, 3, stype);

                    if (ConfigurationManager.AppSettings["realtimedataurl"].IndexOf("localhost", System.StringComparison.Ordinal) == -1)
                    {
                        filePath = string.Format("{0}{1}", ConfigurationManager.AppSettings["serverurl"], filePath.Substring(filePath.LastIndexOf("\\", StringComparison.Ordinal)));
                    }
                    NTS.WEB.Common.CacheHelper.SetCache("CurQueryString", queryString);
                    NTS.WEB.Common.CacheHelper.SetCache("CurQueryPath", filePath);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return filePath;
        }