Ejemplo n.º 1
0
        //备份:之前版本的图片保存
        //public void SaveZed(string path)
        //{
        //    imageZed.Save(path);
        //}

        /// <summary>
        /// 保存图片
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="underlying"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="netProfit"></param>
        /// <param name="anualSharp"></param>
        /// <param name="MDD"></param>
        public void SaveZed(string tag, string underlying, DateTime start, DateTime end, string netProfit, string anualSharp, string MDD)
        {
            //从配置文件读出来的“基本路径”
            var fullPath = ConfigurationManager.AppSettings["RootPath"] + ConfigurationManager.AppSettings["CacheData.ResultPath"] + ConfigurationManager.AppSettings["CacheData.ImagePath"];

            //程序运行时间(作为文件夹的名称)
            var todayDate = Kit.ToInt_yyyyMMdd(DateTime.Now).ToString() + "_image";

            var startDate = Kit.ToInt_yyyyMMdd(start).ToString(); //开始时间
            var endDate   = Kit.ToInt_yyyyMMdd(end).ToString();   //结束时间

            //得到真正的本地保存路径
            fullPath = ResultPathUtil.GetImageLocalPath(fullPath, tag, todayDate, underlying, startDate, endDate, netProfit,
                                                        anualSharp, MDD);

            //若文件路径不存在则生成该文件夹
            var dirPath = Path.GetDirectoryName(fullPath);

            if (dirPath != "" && !Directory.Exists(fullPath))
            {
                Directory.CreateDirectory(dirPath);
            }

            imageZed.Save(fullPath);
            //imageZed.Save(path);
        }
Ejemplo n.º 2
0
        public static void recordToCsv <T>(IList <T> data, string tag, string type, string parameters = "", string performance = "")
        {
            var fullPath = ConfigurationManager.AppSettings["RootPath"] + ConfigurationManager.AppSettings["CacheData.ResultPath"] + ConfigurationManager.AppSettings["CacheData.StrategyPath"];
            var dateStr  = Kit.ToInt_yyyyMMdd(DateTime.Now).ToString();

            fullPath = ResultPathUtil.GetLocalPath(fullPath, tag, dateStr, type, parameters, performance);
            var dt = DataTableUtils.ToDataTable(data);

            CsvFileUtils.WriteToCsvFile(fullPath, dt);
        }