using System; using System.Text; using System.Data; using OWCChart; namespace Ant.Service.Utilities { ///// ///// Assistant 的摘要说明。 ///// //public sealed class Assistant //{ // #region 创建显示图像的标签 // /// // /// 创建显示图像的标签(flash加点击) // /// // public static string CreateTag(string ADID, string filename, string desc, string FileType, string LinkURL, int Width, int High) // { // StringBuilder TagStr = new StringBuilder(); // switch (FileType) // { // case "image/gif": // case "image/bmp": // case "image/pjpeg": // { // if ((LinkURL.Trim() != "") && (LinkURL.Trim() != "http://"))//非空 // { // TagStr.Append(""); // } // TagStr.Append(" \"""); // if ((LinkURL.Trim() != "") && (LinkURL.Trim() != "http://")) // { // TagStr.Append(""); // } // break; // } // case "application/x-shockwave-flash": // { // // TagStr.Append(" "); // //// TagStr.Append(" "); // // TagStr.Append(" "); // // TagStr.Append(" "); // // // // TagStr.Append(" "); // // TagStr.Append(" "); // TagStr.Append(" "); // } // break; // case "video/x-ms-wmv": // case "video/mpeg": // case "video/x-ms-asf": // case "video/avi": // case "audio/mpeg": // case "audio/mid": // case "audio/wav": // case "audio/x-ms-wma": // TagStr.Append(""); // break; // default: // //TagStr.Append("不允许该格式文件显示!"); // break; // } // return TagStr.ToString(); // } // /// // /// 创建显示图像的标签(flash无点击) // /// // public static string CreateTag2(string ADID, string filename, string desc, string FileType, string LinkURL, int Width, int High) // { // StringBuilder TagStr = new StringBuilder(); // switch (FileType) // { // case "image/gif": // case "image/bmp": // case "image/pjpeg": // { // TagStr.Append(""); // TagStr.Append(" \"""); // TagStr.Append(""); // break; // } // case "application/x-shockwave-flash": // { // // TagStr.Append(""); // TagStr.Append(" "); // // TagStr.Append(""); // } // break; // case "video/x-ms-wmv": // case "video/mpeg": // case "video/x-ms-asf": // case "video/avi": // case "audio/mpeg": // case "audio/mid": // case "audio/wav": // case "audio/x-ms-wma": // // TagStr.Append(""); // TagStr.Append(""); // // TagStr.Append(""); // break; // default: // // TagStr.Append("不允许该格式文件显示!"); // break; // } // return TagStr.ToString(); // } // /// // /// 创建显示图像的标签(重载),无宽高限制,(flash加点击) // /// // public static string CreateTag(string ADID, string filename, string desc, string FileType, string LinkURL) // { // StringBuilder TagStr = new StringBuilder(); // switch (FileType) // { // case "image/gif": // case "image/bmp": // case "image/pjpeg": // { // TagStr.Append(""); // TagStr.Append(" \"""); // TagStr.Append(""); // break; // } // case "application/x-shockwave-flash": // { // TagStr.Append(" "); // // TagStr.Append(" "); // TagStr.Append(" "); // TagStr.Append(" "); // TagStr.Append(" "); // TagStr.Append(" "); // } // break; // case "video/x-ms-wmv": // case "video/mpeg": // case "video/x-ms-asf": // case "video/avi": // case "audio/mpeg": // case "audio/mid": // case "audio/wav": // case "audio/x-ms-wma": // TagStr.Append(""); // break; // default: // break; // } // return TagStr.ToString(); // } // /// // /// 创建显示图像的标签(重载),无宽高限制,(flash无点击) // /// // public static string CreateTag2(string ADID, string filename, string desc, string FileType, string LinkURL) // { // StringBuilder TagStr = new StringBuilder(); // switch (FileType) // { // case "image/gif": // case "image/bmp": // case "image/pjpeg": // { // TagStr.Append(""); // TagStr.Append(" \"""); // TagStr.Append(""); // break; // } // case "application/x-shockwave-flash": // { // TagStr.Append(" "); // } // break; // case "video/x-ms-wmv": // case "video/mpeg": // case "video/x-ms-asf": // case "video/avi": // case "audio/mpeg": // case "audio/mid": // case "audio/wav": // case "audio/x-ms-wma": // TagStr.Append(""); // break; // default: // break; // } // return TagStr.ToString(); // } // #region // /// // /// 创建显示图像的标签 // /// // /// // /// // /// // /// // /// // /// // /// // public static string CreateTagOld(string filename, string desc, string FileType, string LinkURL, int Width, int High) // { // StringBuilder TagStr = new StringBuilder(); // switch (FileType) // { // case "image/gif": // case "image/bmp": // case "image/pjpeg": // { // TagStr.Append(""); // TagStr.Append(" \"""); // TagStr.Append(""); // break; // } // case "application/x-shockwave-flash": // { // TagStr.Append(""); // TagStr.Append(" "); // // TagStr.Append(" "); // TagStr.Append(""); // } // break; // case "video/x-ms-wmv": // case "video/mpeg": // case "video/x-ms-asf": // case "video/avi": // case "audio/mpeg": // case "audio/mid": // case "audio/wav": // case "audio/x-ms-wma": // // TagStr.Append(""); // // TagStr.Append(""); // // TagStr.Append(""); // // TagStr.Append(""); // // TagStr.Append(""); // // TagStr.Append(""); // TagStr.Append(""); // TagStr.Append(""); // TagStr.Append(""); // break; // default://其他类型作为附件链接下载 // TagStr.Append("不允许该格式文件显示!"); // break; // } // return TagStr.ToString(); // } // #endregion // #endregion // #region 创建数据图形文件 // /// // /// 创建数据图形文件 // /// // /// 数据源 // /// 图类型 Column,Pie // /// 图像存放目录 // /// 图形标题 // /// // public static string CreateChart(DataTable dt, string CharType, string ImagePath, string Title) // { // String PhaysicalImagePath = ImagePath; // OWCChart.OWCChartFactory mychart = new OWCChartFactory(Title, PhaysicalImagePath, 530, 300, new OWCChartFontStyle()); // OWCChart.OWCSeriesClass MyItem = new OWCSeriesClass(); // MyItem.SeriesName = "次数"; // MyItem.SetDataSource(dt, "Item", "Value"); // switch (CharType) // { // case "Column": // mychart.CreateOneColumn("时间", "次", MyItem); // break; // case "Pie": // mychart.CreateSinglePie(MyItem); // break; // } // String imageName = mychart.ExportPictuire(); // return imageName; // // Image1.ImageUrl = ".\\"+m_imagePath+imageName; // } // public static string CreateMultiColumns(DataTable[] dts, string ImagePath, string Title) // { // String PhaysicalImagePath = ImagePath; // OWCChart.OWCChartFactory mychart = new OWCChartFactory(Title, PhaysicalImagePath, 530, 300, new OWCChartFontStyle()); // OWCChart.OWCSeriesClass[] MyItems = new OWCSeriesClass[dts.Length]; // MyItems[0] = new OWCSeriesClass(); // MyItems[0].SeriesName = "显示次数"; // MyItems[0].SetDataSource(dts[0], "Item", "Value"); // MyItems[1] = new OWCSeriesClass(); // MyItems[1].SeriesName = "点击次数"; // MyItems[1].SetDataSource(dts[1], "Item", "Value"); // mychart.CreateMultiColumns("时间", "次", MyItems); // String imageName = mychart.ExportPictuire(); // return imageName; // } // public static string CreateSingleBar(DataTable dt, string CharType, string ImagePath, string Title) // { // String PhaysicalImagePath = ImagePath; // OWCChart.OWCChartFactory mychart = new OWCChartFactory(Title, PhaysicalImagePath, 500, 600, new OWCChartFontStyle()); // OWCChart.OWCSeriesClass MyItem = new OWCSeriesClass(); // MyItem.SeriesName = "次数"; // MyItem.SetDataSource(dt, "Item", "Value"); // mychart.CreateSingleBar(" ", "", MyItem); // String imageName = mychart.ExportPictuire(); // return imageName; // } // public static string CreateMultiBar(DataTable[] dts, string ImagePath, string Title) // { // String PhaysicalImagePath = ImagePath; // OWCChart.OWCChartFactory mychart = new OWCChartFactory(Title, PhaysicalImagePath, 500, 600, new OWCChartFontStyle()); // OWCChart.OWCSeriesClass[] MyItems = new OWCSeriesClass[dts.Length]; // MyItems[0] = new OWCSeriesClass(); // MyItems[0].SeriesName = "显示次数"; // MyItems[0].SetDataSource(dts[0], "Item", "Value"); // MyItems[1] = new OWCSeriesClass(); // MyItems[1].SeriesName = "点击次数"; // MyItems[1].SetDataSource(dts[1], "Item", "Value"); // mychart.CreateMultiBar(" ", "", MyItems); // String imageName = mychart.ExportPictuire(); // return imageName; // } // #endregion // #region // /// // /// 从字符串里随机得到,规定个数的字符串. // /// // /// // /// // /// // private string GetRandomCode(string allChar, int CodeCount) // { // //string allChar = "1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,i,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"; // string[] allCharArray = allChar.Split(','); // string RandomCode = ""; // int temp = -1; // Random rand = new Random(); // for (int i = 0; i < CodeCount; i++) // { // if (temp != -1) // { // rand = new Random(temp * i * ((int)DateTime.Now.Ticks)); // } // int t = rand.Next(allCharArray.Length - 1); // while (temp == t) // { // t = rand.Next(allCharArray.Length - 1); // } // temp = t; // RandomCode += allCharArray[t]; // } // return RandomCode; // } // #endregion //} }