| | |
| | | using DataTable = System.Data.DataTable; |
| | | using IFont = NPOI.SS.UserModel.IFont; |
| | | |
| | | |
| | | namespace CommonHelper |
| | | { |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="dt"></param> |
| | | /// <param name="file"></param> |
| | | public static void FRMExportExcel(DataTable dt, string file,string title) |
| | | public static void FRMExportExcel(DataTable dt, string file, string title) |
| | | { |
| | | IWorkbook workbook; |
| | | string fileExt = Path.GetExtension(file).ToLower(); |
| | |
| | | |
| | | //表头 |
| | | IRow row = sheet.CreateRow(0); |
| | | row.Height = 25 * 20; //行高为30 |
| | | // sheet.SetColumnWidth(0, 13 * 256); |
| | | CellRangeAddress region = new CellRangeAddress(0, 0, 0, dt.Columns.Count-1); |
| | | row.Height = 25 * 20; //行高为30 |
| | | // sheet.SetColumnWidth(0, 13 * 256); |
| | | CellRangeAddress region = new CellRangeAddress(0, 0, 0, dt.Columns.Count - 1); |
| | | sheet.SetColumnWidth(0, 30 * 256); |
| | | sheet.AddMergedRegion(region); |
| | | #region 标题样式 |
| | | ICellStyle style = workbook.CreateCellStyle();//创建样式对象 |
| | | IFont font = workbook.CreateFont(); //创建一个字体样式对象 |
| | | font.FontName = "微软雅黑"; //和excel里面的字体对应 |
| | | // font.Color = new HSSFColor.Pink().GetIndex();//颜色参考NPOI的颜色对照表(替换掉PINK()) |
| | | // font.Color = new HSSFColor.Pink().GetIndex();//颜色参考NPOI的颜色对照表(替换掉PINK()) |
| | | font.IsItalic = false; //斜体 |
| | | font.FontHeightInPoints = 14;//字体大小 |
| | | font.Boldweight = short.MaxValue;//字体加粗 |
| | |
| | | #endregion |
| | | #region 内容样式 1 右对齐 千位符保留两位小数 |
| | | ICellStyle style1 = workbook.CreateCellStyle(); |
| | | IFont font1 = workbook.CreateFont(); |
| | | IFont font1 = workbook.CreateFont(); |
| | | var format1 = workbook.CreateDataFormat(); |
| | | font1.FontName = "微软雅黑"; |
| | | font1.IsItalic = false; |
| | | font1.FontName = "微软雅黑"; |
| | | font1.IsItalic = false; |
| | | font1.FontHeightInPoints = 12; |
| | | font1.Boldweight = short.MaxValue; |
| | | style1.SetFont(font1); |
| | |
| | | style1.WrapText = true;//设置自动换行 |
| | | style1.Alignment = HorizontalAlignment.Right; |
| | | #endregion |
| | | |
| | | |
| | | #region 内容样式2 左对齐 |
| | | ICellStyle style2 = workbook.CreateCellStyle(); |
| | | IFont font2 = workbook.CreateFont(); |
| | | font2.FontName = "微软雅黑"; |
| | | font2.IsItalic = false; |
| | | IFont font2 = workbook.CreateFont(); |
| | | font2.FontName = "微软雅黑"; |
| | | font2.IsItalic = false; |
| | | font2.FontHeightInPoints = 12; |
| | | font2.Boldweight = short.MaxValue; |
| | | style2.SetFont(font2); |
| | | style2.SetFont(font2); |
| | | style2.BorderTop = BorderStyle.Thin; |
| | | style2.BorderBottom = BorderStyle.Thin; |
| | | style2.BorderLeft = BorderStyle.Thin; |
| | |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | |
| | | int OldHg = row1.Height; |
| | | for (int z= 0; z < dt.Columns.Count; z++) |
| | | for (int z = 0; z < dt.Columns.Count; z++) |
| | | { |
| | | if (row1.GetCell(z) == null) |
| | | { |
| | |
| | | //row1.Height = 36 * 20; |
| | | for (int j = 0; j < dt.Columns.Count; j++) |
| | | { |
| | | |
| | | dt.Rows[i][j] = dt.Rows[i][j].ToString().Replace("wqeewqsdad","").Replace( "--------", "*").Replace("木部","本部").Replace("贷币", "货币"); |
| | | |
| | | dt.Rows[i][j] = dt.Rows[i][j].ToString().Replace("wqeewqsdad", "").Replace("--------", "*").Replace("木部", "本部").Replace("贷币", "货币"); |
| | | if (i == 0) |
| | | { |
| | | if (dt.Rows[i][j].ToString() == "" || dt.Rows[i][j].ToString().Length > 5) |
| | |
| | | } |
| | | } |
| | | } |
| | | if (dt.Columns.Count==4&&i == 0) |
| | | if (dt.Columns.Count == 4 && i == 0) |
| | | { |
| | | if (dt.Rows[i][j].ToString() == "") |
| | | { |
| | | if (j==0) |
| | | if (j == 0) |
| | | { |
| | | dt.Rows[i][j] = "项目"; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | ICell cell = row1.CreateCell(j); |
| | | if (j == 0) |
| | | { |
| | | if ((dt.Rows[i][j].ToString().Contains("流动资产") && dt.Rows[i][j].ToString().Length < 6 )||( dt.Rows[i][j].ToString().Contains("非流动资产"))&& dt.Rows[i][j].ToString().Length<7|| dt.Rows[i][j].ToString().Contains("合计")|| dt.Rows[i][j].ToString().Contains("总计")) |
| | | if ((dt.Rows[i][j].ToString().Contains("流动资产") && dt.Rows[i][j].ToString().Length < 6) || (dt.Rows[i][j].ToString().Contains("非流动资产")) && dt.Rows[i][j].ToString().Length < 7 || dt.Rows[i][j].ToString().Contains("合计") || dt.Rows[i][j].ToString().Contains("总计")) |
| | | { |
| | | FontFlag = true; |
| | | cell.CellStyle = style3; |
| | |
| | | { |
| | | cell.CellStyle = style2; |
| | | } |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | cell.CellStyle = style1; |
| | | } |
| | | |
| | | |
| | | } |
| | | double Money = -1; |
| | | if (double.TryParse(dt.Rows[i][j].ToString(),out Money)) |
| | | if (double.TryParse(dt.Rows[i][j].ToString(), out Money)) |
| | | { |
| | | cell.SetCellValue(double.Parse(dt.Rows[i][j].ToString())); |
| | | } |
| | |
| | | { |
| | | cell.SetCellValue(dt.Rows[i][j].ToString()); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | #region 导出报表 |
| | | public static void GenerateReportExcel(string TempletFilePath, string ReportFilePath, string SheetName, DataTable dt,string ReportType, int MaxColumn) |
| | | public static void GenerateReportExcel(string TempletFilePath, string ReportFilePath, string SheetName, DataTable dt, string ReportType, int MaxColumn) |
| | | { |
| | | using (FileStream ExcelFileStream = new FileStream(TempletFilePath, FileMode.Open, FileAccess.Read)) |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | else if(SheetName== "现金流量表") |
| | | else if (SheetName == "现金流量表") |
| | | { |
| | | if (ReportType == "合并报表") |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | else if (SheetName=="现金流量表补充资料") |
| | | else if (SheetName == "现金流量表补充资料") |
| | | { |
| | | if (ReportType== "合并报表") |
| | | if (ReportType == "合并报表") |
| | | { |
| | | SheetName = "现金流量表补充资料-合并"; |
| | | } |
| | |
| | | } |
| | | SheetRow = 32; |
| | | } |
| | | else if (SheetName== "所有者权益变动表") |
| | | else if (SheetName == "所有者权益变动表") |
| | | { |
| | | if (ReportType == "合并报表") |
| | | { |
| | |
| | | { |
| | | for (int j = 0; j < MaxColumn; j++) |
| | | { |
| | | if (ReportType=="合并报表") |
| | | if (ReportType == "合并报表") |
| | | { |
| | | if (j == 0 || j == 15) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | #endregion |
| | | } |
| | | var Num = SheetRow - dt.Rows.Count; |
| | | if (Num>0) |
| | | if (Num > 0) |
| | | { |
| | | for (int i = dt.Rows.Count; i <= SheetRow; i++) |
| | | { |
| | |
| | | for (int j = 0; j < MaxColumn; j++) |
| | | { |
| | | ICell cell = row.GetCell(j); |
| | | if (cell!=null) |
| | | if (cell != null) |
| | | { |
| | | row.RemoveCell(cell); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | using (FileStream ExcelFileStream = new FileStream(TempletFilePath, FileMode.Open, FileAccess.Read)) |
| | | { |
| | | IWorkbook workbook = NPOI.SS.UserModel.WorkbookFactory.Create(ExcelFileStream); |
| | | |
| | | |
| | | ISheet sheet1 = workbook.GetSheet(SheetName); |
| | | //sheet1.ProtectSheet(SheetLockPassword); |
| | | ISheet sheetNote = workbook.GetSheet("填写说明"); |
| | |
| | | // return Result; |
| | | //} |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | private void InitializeComponent() |
| | | { |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | this.monthCalAStockLtd = new Sunny.UI.UIDatePicker(); |
| | | this.dgViewAStockLtd = new Sunny.UI.UIDataGridView(); |
| | | this.lblAStockLtd = new Sunny.UI.UITextBox(); |
| | |
| | | // |
| | | this.dgViewAStockLtd.AllowUserToAddRows = false; |
| | | this.dgViewAStockLtd.AllowUserToDeleteRows = false; |
| | | dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | this.dgViewAStockLtd.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; |
| | | dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | this.dgViewAStockLtd.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; |
| | | this.dgViewAStockLtd.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
| | | | System.Windows.Forms.AnchorStyles.Left) |
| | | | System.Windows.Forms.AnchorStyles.Right))); |
| | | this.dgViewAStockLtd.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; |
| | | this.dgViewAStockLtd.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | this.dgViewAStockLtd.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; |
| | | dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
| | | dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle7.ForeColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; |
| | | dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewAStockLtd.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; |
| | | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
| | | dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; |
| | | dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewAStockLtd.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; |
| | | this.dgViewAStockLtd.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
| | | dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle8.BackColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; |
| | | this.dgViewAStockLtd.DefaultCellStyle = dataGridViewCellStyle8; |
| | | dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; |
| | | this.dgViewAStockLtd.DefaultCellStyle = dataGridViewCellStyle3; |
| | | this.dgViewAStockLtd.EnableHeadersVisualStyles = false; |
| | | this.dgViewAStockLtd.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.dgViewAStockLtd.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255))))); |
| | | this.dgViewAStockLtd.Location = new System.Drawing.Point(17, 88); |
| | | this.dgViewAStockLtd.Name = "dgViewAStockLtd"; |
| | | dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewAStockLtd.RowHeadersDefaultCellStyle = dataGridViewCellStyle9; |
| | | dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewAStockLtd.RowHeadersDefaultCellStyle = dataGridViewCellStyle4; |
| | | this.dgViewAStockLtd.RowHeight = 27; |
| | | dataGridViewCellStyle10.BackColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle10.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | this.dgViewAStockLtd.RowsDefaultCellStyle = dataGridViewCellStyle10; |
| | | dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | this.dgViewAStockLtd.RowsDefaultCellStyle = dataGridViewCellStyle5; |
| | | this.dgViewAStockLtd.RowTemplate.Height = 27; |
| | | this.dgViewAStockLtd.SelectedIndex = -1; |
| | | this.dgViewAStockLtd.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
| | |
| | | // |
| | | this.lblAStockLtd.AutoSize = true; |
| | | this.lblAStockLtd.Cursor = System.Windows.Forms.Cursors.WaitCursor; |
| | | this.lblAStockLtd.Enabled = false; |
| | | this.lblAStockLtd.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.lblAStockLtd.Location = new System.Drawing.Point(727, 43); |
| | | this.lblAStockLtd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | |
| | | this.txtIndustryIndex = new Sunny.UI.UITextBox(); |
| | | this.dgViewIndustryIndex = new Sunny.UI.UIDataGridView(); |
| | | this.uiPagination1 = new Sunny.UI.UIPagination(); |
| | | this.lblCompanyIn = new Sunny.UI.UITextBox(); |
| | | ((System.ComponentModel.ISupportInitialize)(this.dgViewIndustryIndex)).BeginInit(); |
| | | this.SuspendLayout(); |
| | | // |
| | |
| | | this.dgViewIndustryIndex.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
| | | | System.Windows.Forms.AnchorStyles.Left) |
| | | | System.Windows.Forms.AnchorStyles.Right))); |
| | | this.dgViewIndustryIndex.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; |
| | | this.dgViewIndustryIndex.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | this.dgViewIndustryIndex.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; |
| | | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
| | |
| | | dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; |
| | | dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewIndustryIndex.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; |
| | | this.dgViewIndustryIndex.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
| | | this.dgViewIndustryIndex.ColumnHeadersHeight = 32; |
| | | this.dgViewIndustryIndex.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; |
| | | dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | |
| | | this.uiPagination1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; |
| | | this.uiPagination1.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.uiPagination1_PageChanged); |
| | | // |
| | | // lblCompanyIn |
| | | // |
| | | this.lblCompanyIn.AutoSize = true; |
| | | this.lblCompanyIn.Cursor = System.Windows.Forms.Cursors.WaitCursor; |
| | | this.lblCompanyIn.Enabled = false; |
| | | this.lblCompanyIn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.lblCompanyIn.Location = new System.Drawing.Point(426, 44); |
| | | this.lblCompanyIn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | | this.lblCompanyIn.MinimumSize = new System.Drawing.Size(1, 16); |
| | | this.lblCompanyIn.Name = "lblCompanyIn"; |
| | | this.lblCompanyIn.ReadOnly = true; |
| | | this.lblCompanyIn.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; |
| | | this.lblCompanyIn.ShowText = false; |
| | | this.lblCompanyIn.Size = new System.Drawing.Size(408, 35); |
| | | this.lblCompanyIn.TabIndex = 33; |
| | | this.lblCompanyIn.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; |
| | | this.lblCompanyIn.WatermarkColor = System.Drawing.Color.Black; |
| | | // |
| | | // DomesticPolicyData |
| | | // |
| | | this.AllowShowTitle = true; |
| | | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; |
| | | this.ClientSize = new System.Drawing.Size(879, 521); |
| | | this.Controls.Add(this.lblCompanyIn); |
| | | this.Controls.Add(this.uiPagination1); |
| | | this.Controls.Add(this.uiButton1); |
| | | this.Controls.Add(this.btnIndustryIndex); |
| | |
| | | private UITextBox txtIndustryIndex; |
| | | private UIDataGridView dgViewIndustryIndex; |
| | | private UIPagination uiPagination1; |
| | | private UITextBox lblCompanyIn; |
| | | } |
| | | } |
| | |
| | | JObject item = (JObject)GetChinaStockList(1, 1, URL + 1 + "&PageSize=" + 1); |
| | | var items = item["data"]["totalItems"]; |
| | | uiPagination1.TotalCount = items.Value<int>(); |
| | | uiPagination1.PageSize = 5; |
| | | uiPagination1.PageSize = 15; |
| | | } |
| | | |
| | | //public static String GetData(String url, Encoding encode) |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public class SugarTableSearchSimple |
| | | { |
| | | /// <summary> |
| | |
| | | |
| | | public void GetdgViewIndustryIndex(int PageIndex, int PageSize) |
| | | { |
| | | string url = URL + PageIndex + "&PageSize=" + PageSize; |
| | | JObject item = (JObject)GetChinaStockList(PageIndex, PageSize, url); |
| | | if (item["data"]["items"] != null) |
| | | try |
| | | { |
| | | var items = item["data"]["items"]; |
| | | dgViewIndustryIndex.DataSource = items; |
| | | for (int i = 0; i < dgViewIndustryIndex.Columns.Count; i++) |
| | | string url = URL + PageIndex + "&PageSize=" + PageSize; |
| | | JObject item = (JObject)GetChinaStockList(PageIndex, PageSize, url); |
| | | if (item["data"]["items"] != null) |
| | | { |
| | | string colName = dgViewIndustryIndex.Columns[i].Name; |
| | | if (colName == "id") |
| | | var items = item["data"]["items"]; |
| | | dgViewIndustryIndex.DataSource = items; |
| | | dgViewIndustryIndex.Columns[0].Width = 87; |
| | | dgViewIndustryIndex.Columns[1].Width = 245; |
| | | dgViewIndustryIndex.Columns[2].Width = 485; |
| | | dgViewIndustryIndex.Columns[3].Width = 358; |
| | | dgViewIndustryIndex.Columns[4].Width = 60; |
| | | dgViewIndustryIndex.Columns[5].Width = 60; |
| | | dgViewIndustryIndex.Columns[6].Width = 86; |
| | | dgViewIndustryIndex.Columns[7].Width = 203; |
| | | for (int i = 0; i < dgViewIndustryIndex.Columns.Count; i++) |
| | | { |
| | | dgViewIndustryIndex.Columns[i].Visible = false; |
| | | string colName = dgViewIndustryIndex.Columns[i].Name; |
| | | if (colName == "id") |
| | | { |
| | | dgViewIndustryIndex.Columns[i].Visible = false; |
| | | } |
| | | if (colName == "publishDate") |
| | | { |
| | | for (int x = 0; x < dgViewIndustryIndex.Rows.Count; x++) |
| | | { |
| | | if (dgViewIndustryIndex.Rows[x].Cells[i].Value.ToString() != "") |
| | | { |
| | | dgViewIndustryIndex.Rows[x].Cells[i].Value = dgViewIndustryIndex.Rows[x].Cells[i].Value.ToString().Substring(0, 10); |
| | | } |
| | | } |
| | | } |
| | | if (colName == "content" || colName == "url") |
| | | { |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[i].Value.ToString(); |
| | | if (introduction.Length > 13) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 13) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 13) + introduction.Substring(13); |
| | | } |
| | | if (introduction.Length > 26) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 26) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 26) + "\n" + introduction.Substring(26); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | } |
| | | } |
| | | dgViewIndustryIndex.Columns[i].HeaderText = GetDgvColumName(colName); |
| | | lblCompanyIn.Text = "查询完成!总计" + uiPagination1.TotalCount + "项!"; |
| | | } |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[i].Value.ToString(); |
| | | if (introduction.Length > 13) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 10) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 13) + introduction.Substring(13); |
| | | } |
| | | if (introduction.Length > 30) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 10) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | } |
| | | dgViewIndustryIndex.Columns[i].HeaderText = GetDgvColumName(colName); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | throw e; |
| | | } |
| | | |
| | | } |
| | | |
| | | private void DomesticPolicyData_Load(object sender, EventArgs e) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private void uiPagination1_PageChanged(object sender, object pagingSource, int pageIndex, int count) |
| | | { |
| | | GetdgViewIndustryIndex(pageIndex, uiPagination1.PageSize); |
| | |
| | | |
| | | private void btnIndustryIndex_Click(object sender, EventArgs e) |
| | | { |
| | | dgViewIndustryIndex.DataSource = null; |
| | | for (int i = 1; i <= uiPagination1.TotalCount; i++) |
| | | try |
| | | { |
| | | string url = URL + i + "&PageSize=" + 1; |
| | | JObject item = (JObject)GetChinaStockList(i, 1, url); |
| | | if (item["data"]["items"] != null) |
| | | if (this.txtIndustryIndex.Text.Trim() != "") |
| | | { |
| | | var items = item["data"]["items"]; |
| | | var title = items[0]["title"].Value<string>(); |
| | | if (this.txtIndustryIndex.Text.Trim() != "") |
| | | dgViewIndustryIndex.DataSource = null; |
| | | List<List> iteme = new List<List>(); |
| | | //循环出匹配的结果 |
| | | for (int i = 1; i <= uiPagination1.TotalCount; i++) |
| | | { |
| | | if (title.Contains(this.txtIndustryIndex.Text.Trim())) |
| | | string url = URL + i + "&PageSize=" + uiPagination1.PageSize; |
| | | JObject item = (JObject)GetChinaStockList(i, uiPagination1.PageSize, url); |
| | | if (item["data"]["items"] != null) |
| | | { |
| | | dgViewIndustryIndex.DataSource = items; |
| | | for (int x = 0; x < dgViewIndustryIndex.Columns.Count; x++) |
| | | |
| | | var items = item["data"]["items"]; |
| | | for (int z = 0; z < items.Count(); z++) |
| | | { |
| | | string colName = dgViewIndustryIndex.Columns[x].Name; |
| | | if (colName == "id") |
| | | List list = null; |
| | | var title = items[z]["title"].Value<string>(); |
| | | if (title.Contains(this.txtIndustryIndex.Text.Trim())) |
| | | { |
| | | dgViewIndustryIndex.Columns[x].Visible = false; |
| | | list = new List(); |
| | | list.publishDate = items[z]["publishDate"].Value<string>(); |
| | | list.title = items[z]["title"].Value<string>(); |
| | | list.organization = items[z]["organization"].Value<string>(); |
| | | list.country = items[z]["country"].Value<string>(); |
| | | list.area = items[z]["area"].Value<string>(); |
| | | list.type = items[z]["type"].Value<string>(); |
| | | list.url = items[z]["url"].Value<string>(); |
| | | list.content = items[z]["content"].Value<string>(); |
| | | iteme.Add(list); |
| | | } |
| | | |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[x].Value.ToString(); |
| | | if (introduction.Length > 13) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].Value = introduction.Substring(0, 13) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 13) + introduction.Substring(13); |
| | | } |
| | | if (introduction.Length > 30) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].Value = introduction.Substring(0, 10) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | } |
| | | dgViewIndustryIndex.Columns[x].HeaderText = GetDgvColumName(colName); |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | | //将数据显示在DataSource上 |
| | | dgViewIndustryIndex.DataSource = iteme; |
| | | dgViewIndustryIndex.Columns[0].Width = 87; |
| | | dgViewIndustryIndex.Columns[1].Width = 245; |
| | | dgViewIndustryIndex.Columns[2].Width = 485; |
| | | dgViewIndustryIndex.Columns[3].Width = 358; |
| | | dgViewIndustryIndex.Columns[4].Width = 60; |
| | | dgViewIndustryIndex.Columns[5].Width = 60; |
| | | dgViewIndustryIndex.Columns[6].Width = 86; |
| | | dgViewIndustryIndex.Columns[7].Width = 203; |
| | | for (int x = 0; x < dgViewIndustryIndex.Columns.Count; x++) |
| | | { |
| | | GetdgViewIndustryIndex(1, uiPagination1.PageSize); |
| | | //DomesticPolicyData_Load(); |
| | | string colName = dgViewIndustryIndex.Columns[x].Name; |
| | | if (colName == "id") |
| | | { |
| | | dgViewIndustryIndex.Columns[x].Visible = false; |
| | | } |
| | | if (colName == "publishDate") |
| | | { |
| | | for (int q = 0; q < dgViewIndustryIndex.Rows.Count; q++) |
| | | { |
| | | if (dgViewIndustryIndex.Rows[q].Cells[x].Value.ToString() != "") |
| | | { |
| | | dgViewIndustryIndex.Rows[q].Cells[x].Value = dgViewIndustryIndex.Rows[q].Cells[x].Value.ToString().Substring(0, 10); |
| | | } |
| | | } |
| | | } |
| | | if (colName == "content" || colName == "url") |
| | | { |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[x].Value.ToString(); |
| | | if (introduction.Length > 13) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].Value = introduction.Substring(0, 13) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 13) + introduction.Substring(13); |
| | | } |
| | | if (introduction.Length > 26) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].Value = introduction.Substring(0, 26) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 26) + "\n" + introduction.Substring(26); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | } |
| | | } |
| | | |
| | | dgViewIndustryIndex.Columns[x].HeaderText = GetDgvColumName(colName); |
| | | lblCompanyIn.Text = "查询完成!总计" + dgViewIndustryIndex.RowCount + "项!"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GetdgViewIndustryIndex(1, uiPagination1.PageSize); |
| | | //DomesticPolicyData_Load(); |
| | | } |
| | | } |
| | | if (dgViewIndustryIndex.DataSource == null) |
| | | catch (Exception x) |
| | | { |
| | | MessageBox.Show("没有查询到匹配数据!"); |
| | | |
| | | MessageBox.Show(x.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void uiButton1_Click(object sender, EventArgs e) |
| | | { |
| | | this.txtIndustryIndex.Text = ""; |
| | | } |
| | | |
| | | //点击关于时查询所需的类 |
| | | public class List |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 日期 |
| | | /// </summary> |
| | | public string publishDate { get; set; } |
| | | /// <summary> |
| | | /// 发布单位 |
| | | /// </summary> |
| | | public string organization { get; set; } |
| | | /// <summary> |
| | | /// 政策名称 |
| | | /// </summary> |
| | | public string title { get; set; } |
| | | /// <summary> |
| | | /// 主要内容 |
| | | /// </summary> |
| | | public string content { get; set; } |
| | | /// <summary> |
| | | /// 国家 |
| | | /// </summary> |
| | | public string country { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 区域 |
| | | /// </summary> |
| | | public string area { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 政策性质 |
| | | /// </summary> |
| | | public string type { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 来源 |
| | | /// </summary> |
| | | public string url { get; set; } |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | private void InitializeComponent() |
| | | { |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); |
| | | this.uiPagination1 = new Sunny.UI.UIPagination(); |
| | | this.uiButton1 = new Sunny.UI.UIButton(); |
| | | this.btnIndustryIndex = new Sunny.UI.UIButton(); |
| | | this.txtIndustryIndex = new Sunny.UI.UITextBox(); |
| | | this.dgViewIndustryIndex = new Sunny.UI.UIDataGridView(); |
| | | this.lblCompanyIn = new Sunny.UI.UITextBox(); |
| | | ((System.ComponentModel.ISupportInitialize)(this.dgViewIndustryIndex)).BeginInit(); |
| | | this.SuspendLayout(); |
| | | // |
| | |
| | | // |
| | | this.dgViewIndustryIndex.AllowUserToAddRows = false; |
| | | this.dgViewIndustryIndex.AllowUserToDeleteRows = false; |
| | | dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | this.dgViewIndustryIndex.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; |
| | | dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | this.dgViewIndustryIndex.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; |
| | | this.dgViewIndustryIndex.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
| | | | System.Windows.Forms.AnchorStyles.Left) |
| | | | System.Windows.Forms.AnchorStyles.Right))); |
| | | this.dgViewIndustryIndex.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; |
| | | this.dgViewIndustryIndex.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | this.dgViewIndustryIndex.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; |
| | | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
| | | dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; |
| | | dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewIndustryIndex.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; |
| | | dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
| | | dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle7.ForeColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; |
| | | dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewIndustryIndex.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; |
| | | this.dgViewIndustryIndex.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
| | | dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; |
| | | this.dgViewIndustryIndex.DefaultCellStyle = dataGridViewCellStyle3; |
| | | dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle8.BackColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; |
| | | this.dgViewIndustryIndex.DefaultCellStyle = dataGridViewCellStyle8; |
| | | this.dgViewIndustryIndex.EnableHeadersVisualStyles = false; |
| | | this.dgViewIndustryIndex.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.dgViewIndustryIndex.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255))))); |
| | | this.dgViewIndustryIndex.Location = new System.Drawing.Point(12, 89); |
| | | this.dgViewIndustryIndex.MultiSelect = false; |
| | | this.dgViewIndustryIndex.Name = "dgViewIndustryIndex"; |
| | | dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewIndustryIndex.RowHeadersDefaultCellStyle = dataGridViewCellStyle4; |
| | | dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewIndustryIndex.RowHeadersDefaultCellStyle = dataGridViewCellStyle9; |
| | | this.dgViewIndustryIndex.RowHeight = 27; |
| | | dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewIndustryIndex.RowsDefaultCellStyle = dataGridViewCellStyle5; |
| | | dataGridViewCellStyle10.BackColor = System.Drawing.Color.White; |
| | | dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | dataGridViewCellStyle10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); |
| | | dataGridViewCellStyle10.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); |
| | | dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; |
| | | this.dgViewIndustryIndex.RowsDefaultCellStyle = dataGridViewCellStyle10; |
| | | this.dgViewIndustryIndex.RowTemplate.Height = 27; |
| | | this.dgViewIndustryIndex.SelectedIndex = -1; |
| | | this.dgViewIndustryIndex.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
| | |
| | | this.dgViewIndustryIndex.TabIndex = 28; |
| | | this.dgViewIndustryIndex.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgViewIndustryIndex_CellContentClick); |
| | | // |
| | | // lblCompanyIn |
| | | // |
| | | this.lblCompanyIn.AutoSize = true; |
| | | this.lblCompanyIn.Cursor = System.Windows.Forms.Cursors.WaitCursor; |
| | | this.lblCompanyIn.Enabled = false; |
| | | this.lblCompanyIn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.lblCompanyIn.Location = new System.Drawing.Point(426, 44); |
| | | this.lblCompanyIn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | | this.lblCompanyIn.MinimumSize = new System.Drawing.Size(1, 16); |
| | | this.lblCompanyIn.Name = "lblCompanyIn"; |
| | | this.lblCompanyIn.ReadOnly = true; |
| | | this.lblCompanyIn.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; |
| | | this.lblCompanyIn.ShowText = false; |
| | | this.lblCompanyIn.Size = new System.Drawing.Size(408, 35); |
| | | this.lblCompanyIn.TabIndex = 38; |
| | | this.lblCompanyIn.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; |
| | | this.lblCompanyIn.WatermarkColor = System.Drawing.Color.Black; |
| | | // |
| | | // ForeignPolicyData |
| | | // |
| | | this.AllowShowTitle = true; |
| | | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; |
| | | this.ClientSize = new System.Drawing.Size(879, 521); |
| | | this.Controls.Add(this.lblCompanyIn); |
| | | this.Controls.Add(this.dgViewIndustryIndex); |
| | | this.Controls.Add(this.uiPagination1); |
| | | this.Controls.Add(this.uiButton1); |
| | |
| | | private UIButton btnIndustryIndex; |
| | | private UITextBox txtIndustryIndex; |
| | | private UIDataGridView dgViewIndustryIndex; |
| | | private UITextBox lblCompanyIn; |
| | | } |
| | | } |
| | |
| | | |
| | | public void GetdgViewIndustryIndex(int PageIndex, int PageSize) |
| | | { |
| | | string url = URL + PageIndex + "&PageSize=" + PageSize; |
| | | JObject item = (JObject)GetChinaStockList(PageIndex, PageSize, url); |
| | | if (item["data"]["items"] != null) |
| | | try |
| | | { |
| | | var items = item["data"]["items"]; |
| | | dgViewIndustryIndex.DataSource = items; |
| | | for (int i = 0; i < dgViewIndustryIndex.Columns.Count; i++) |
| | | string url = URL + PageIndex + "&PageSize=" + PageSize; |
| | | JObject item = (JObject)GetChinaStockList(PageIndex, PageSize, url); |
| | | if (item["data"]["items"] != null) |
| | | { |
| | | string colName = dgViewIndustryIndex.Columns[i].Name; |
| | | if (colName == "id") |
| | | var items = item["data"]["items"]; |
| | | dgViewIndustryIndex.DataSource = items; |
| | | for (int i = 0; i < dgViewIndustryIndex.Columns.Count; i++) |
| | | { |
| | | dgViewIndustryIndex.Columns[i].Visible = false; |
| | | string colName = dgViewIndustryIndex.Columns[i].Name; |
| | | if (colName == "id") |
| | | { |
| | | dgViewIndustryIndex.Columns[i].Visible = false; |
| | | } |
| | | if (colName == "publishDate") |
| | | { |
| | | for (int x = 0; x < dgViewIndustryIndex.Rows.Count; x++) |
| | | { |
| | | if (dgViewIndustryIndex.Rows[x].Cells[i].Value.ToString() != "") |
| | | { |
| | | dgViewIndustryIndex.Rows[x].Cells[i].Value = dgViewIndustryIndex.Rows[x].Cells[i].Value.ToString().Substring(0, 10); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (colName == "content" || colName == "url") |
| | | { |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[i].Value.ToString(); |
| | | if (introduction.Length > 13) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 13) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 13) + introduction.Substring(13); |
| | | } |
| | | if (introduction.Length > 26) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 26) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 26) + "\n" + introduction.Substring(26); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | } |
| | | } |
| | | dgViewIndustryIndex.Columns[0].Width = 87; |
| | | dgViewIndustryIndex.Columns[1].Width = 245; |
| | | dgViewIndustryIndex.Columns[2].Width = 485; |
| | | dgViewIndustryIndex.Columns[3].Width = 358; |
| | | dgViewIndustryIndex.Columns[4].Width = 60; |
| | | dgViewIndustryIndex.Columns[5].Width = 60; |
| | | dgViewIndustryIndex.Columns[6].Width = 86; |
| | | dgViewIndustryIndex.Columns[7].Width = 203; |
| | | dgViewIndustryIndex.Columns[i].HeaderText = GetDgvColumName(colName); |
| | | lblCompanyIn.Text = "查询完成!总计" + uiPagination1.TotalCount + "项!"; |
| | | } |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[i].Value.ToString(); |
| | | if (introduction.Length > 13) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 10) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 13) + introduction.Substring(13); |
| | | } |
| | | if (introduction.Length > 30) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 10) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | } |
| | | dgViewIndustryIndex.Columns[i].HeaderText = GetDgvColumName(colName); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | throw e; |
| | | } |
| | | |
| | | } |
| | | |
| | | private void ForeignPolicyData_Load(object sender, EventArgs e) |
| | |
| | | |
| | | private void btnIndustryIndex_Click_1(object sender, EventArgs e) |
| | | { |
| | | dgViewIndustryIndex.DataSource = null; |
| | | for (int i = 1; i <= uiPagination1.TotalCount; i++) |
| | | try |
| | | { |
| | | string url = URL + i + "&PageSize=" + 1; |
| | | JObject item = (JObject)GetChinaStockList(i, 1, url); |
| | | if (item["data"]["items"] != null) |
| | | if (this.txtIndustryIndex.Text.Trim() != "") |
| | | { |
| | | var items = item["data"]["items"]; |
| | | var title = items[0]["title"].Value<string>(); |
| | | if (this.txtIndustryIndex.Text.Trim() != "") |
| | | dgViewIndustryIndex.DataSource = null; |
| | | List<List> iteme = new List<List>(); |
| | | //循环出匹配的结果 |
| | | for (int i = 1; i <= uiPagination1.TotalCount; i++) |
| | | { |
| | | if (title.Contains(this.txtIndustryIndex.Text.Trim())) |
| | | string url = URL + i + "&PageSize=" + uiPagination1.PageSize; |
| | | JObject item = (JObject)GetChinaStockList(i, uiPagination1.PageSize, url); |
| | | if (item["data"]["items"] != null) |
| | | { |
| | | dgViewIndustryIndex.DataSource = items; |
| | | for (int x = 0; x < dgViewIndustryIndex.Columns.Count; x++) |
| | | |
| | | var items = item["data"]["items"]; |
| | | for (int z = 0; z < items.Count(); z++) |
| | | { |
| | | string colName = dgViewIndustryIndex.Columns[x].Name; |
| | | if (colName == "id") |
| | | List list = null; |
| | | var title = items[z]["title"].Value<string>(); |
| | | if (title.Contains(this.txtIndustryIndex.Text.Trim())) |
| | | { |
| | | dgViewIndustryIndex.Columns[x].Visible = false; |
| | | list = new List(); |
| | | list.publishDate = items[z]["publishDate"].Value<string>(); |
| | | list.title = items[z]["title"].Value<string>(); |
| | | list.organization = items[z]["organization"].Value<string>(); |
| | | list.country = items[z]["country"].Value<string>(); |
| | | list.area = items[z]["area"].Value<string>(); |
| | | list.type = items[z]["type"].Value<string>(); |
| | | list.url = items[z]["url"].Value<string>(); |
| | | list.content = items[z]["content"].Value<string>(); |
| | | iteme.Add(list); |
| | | } |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[x].Value.ToString(); |
| | | if (introduction.Length > 13) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].Value = introduction.Substring(0, 10) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 13) + introduction.Substring(13); |
| | | } |
| | | if (introduction.Length > 30) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].Value = introduction.Substring(0, 10) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | } |
| | | dgViewIndustryIndex.Columns[x].HeaderText = GetDgvColumName(colName); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | | //将数据显示在DataSource上 |
| | | dgViewIndustryIndex.DataSource = iteme; |
| | | dgViewIndustryIndex.Columns[0].Width = 87; |
| | | dgViewIndustryIndex.Columns[1].Width = 245; |
| | | dgViewIndustryIndex.Columns[2].Width = 485; |
| | | dgViewIndustryIndex.Columns[3].Width = 358; |
| | | dgViewIndustryIndex.Columns[4].Width = 60; |
| | | dgViewIndustryIndex.Columns[5].Width = 60; |
| | | dgViewIndustryIndex.Columns[6].Width = 86; |
| | | dgViewIndustryIndex.Columns[7].Width = 203; |
| | | for (int x = 0; x < dgViewIndustryIndex.Columns.Count; x++) |
| | | { |
| | | GetdgViewIndustryIndex(1, uiPagination1.PageSize); |
| | | //DomesticPolicyData_Load(); |
| | | string colName = dgViewIndustryIndex.Columns[x].Name; |
| | | if (colName == "id") |
| | | { |
| | | dgViewIndustryIndex.Columns[x].Visible = false; |
| | | } |
| | | if (colName == "publishDate") |
| | | { |
| | | for (int q = 0; q < dgViewIndustryIndex.Rows.Count; q++) |
| | | { |
| | | if (dgViewIndustryIndex.Rows[q].Cells[x].Value.ToString() != "") |
| | | { |
| | | dgViewIndustryIndex.Rows[q].Cells[x].Value = dgViewIndustryIndex.Rows[q].Cells[x].Value.ToString().Substring(0, 10); |
| | | } |
| | | } |
| | | } |
| | | if (colName == "content" || colName == "url") |
| | | { |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[x].Value.ToString(); |
| | | if (introduction.Length > 13) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].Value = introduction.Substring(0, 13) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 13) + introduction.Substring(13); |
| | | } |
| | | if (introduction.Length > 26) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].Value = introduction.Substring(0, 26) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 26) + "\n" + introduction.Substring(26); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[x].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | } |
| | | } |
| | | dgViewIndustryIndex.Columns[x].HeaderText = GetDgvColumName(colName); |
| | | lblCompanyIn.Text = "查询完成!总计" + dgViewIndustryIndex.RowCount + "项!"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GetdgViewIndustryIndex(1, uiPagination1.PageSize); |
| | | //DomesticPolicyData_Load(); |
| | | } |
| | | } |
| | | if (dgViewIndustryIndex.DataSource == null) |
| | | catch (Exception x) |
| | | { |
| | | MessageBox.Show("没有查询到匹配数据!"); |
| | | |
| | | MessageBox.Show(x.Message); |
| | | } |
| | | } |
| | | |
| | |
| | | this.txtIndustryIndex.Text = ""; |
| | | } |
| | | |
| | | |
| | | //点击打开dgView里的url网页 |
| | | private void dgViewIndustryIndex_CellContentClick(object sender, DataGridViewCellEventArgs e) |
| | | { |
| | | if (e.ColumnIndex == 7) |
| | |
| | | //this.dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //点击关于时查询所需的类 |
| | | public class List |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 日期 |
| | | /// </summary> |
| | | public string publishDate { get; set; } |
| | | /// <summary> |
| | | /// 发布单位 |
| | | /// </summary> |
| | | public string organization { get; set; } |
| | | /// <summary> |
| | | /// 政策名称 |
| | | /// </summary> |
| | | public string title { get; set; } |
| | | /// <summary> |
| | | /// 主要内容 |
| | | /// </summary> |
| | | public string content { get; set; } |
| | | /// <summary> |
| | | /// 国家 |
| | | /// </summary> |
| | | public string country { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 区域 |
| | | /// </summary> |
| | | public string area { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 政策性质 |
| | | /// </summary> |
| | | public string type { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 来源 |
| | | /// </summary> |
| | | public string url { get; set; } |
| | | } |
| | | } |
| | | } |
| | |
| | | // |
| | | this.lblCompanyIn.AutoSize = true; |
| | | this.lblCompanyIn.Cursor = System.Windows.Forms.Cursors.WaitCursor; |
| | | this.lblCompanyIn.Enabled = false; |
| | | this.lblCompanyIn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.lblCompanyIn.Location = new System.Drawing.Point(727, 43); |
| | | this.lblCompanyIn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | |
| | | // |
| | | this.lblCompanyIn.AutoSize = true; |
| | | this.lblCompanyIn.Cursor = System.Windows.Forms.Cursors.WaitCursor; |
| | | this.lblCompanyIn.Enabled = false; |
| | | this.lblCompanyIn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.lblCompanyIn.Location = new System.Drawing.Point(727, 43); |
| | | this.lblCompanyIn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | |
| | | // |
| | | this.lblCompanyMain.AutoSize = true; |
| | | this.lblCompanyMain.Cursor = System.Windows.Forms.Cursors.WaitCursor; |
| | | this.lblCompanyMain.Enabled = false; |
| | | this.lblCompanyMain.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.lblCompanyMain.Location = new System.Drawing.Point(438, 41); |
| | | this.lblCompanyMain.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | |
| | | // |
| | | this.lblOutStockLtd.AutoSize = true; |
| | | this.lblOutStockLtd.Cursor = System.Windows.Forms.Cursors.WaitCursor; |
| | | this.lblOutStockLtd.Enabled = false; |
| | | this.lblOutStockLtd.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.lblOutStockLtd.Location = new System.Drawing.Point(727, 43); |
| | | this.lblOutStockLtd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | |
| | | // |
| | | this.uiPagination1.Dock = System.Windows.Forms.DockStyle.Bottom; |
| | | this.uiPagination1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.uiPagination1.Location = new System.Drawing.Point(0, 501); |
| | | this.uiPagination1.Location = new System.Drawing.Point(0, 484); |
| | | this.uiPagination1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | | this.uiPagination1.MinimumSize = new System.Drawing.Size(1, 1); |
| | | this.uiPagination1.Name = "uiPagination1"; |
| | | this.uiPagination1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; |
| | | this.uiPagination1.ShowText = false; |
| | | this.uiPagination1.Size = new System.Drawing.Size(879, 35); |
| | | this.uiPagination1.Size = new System.Drawing.Size(879, 37); |
| | | this.uiPagination1.TabIndex = 0; |
| | | this.uiPagination1.Text = "uiPagination1"; |
| | | this.uiPagination1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; |
| | | this.uiPagination1.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.uiPagination1_PageChanged); |
| | | // |
| | | // dgViewIndustryIndex |
| | | // |
| | |
| | | this.dgViewIndustryIndex.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
| | | | System.Windows.Forms.AnchorStyles.Left) |
| | | | System.Windows.Forms.AnchorStyles.Right))); |
| | | this.dgViewIndustryIndex.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; |
| | | this.dgViewIndustryIndex.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; |
| | | this.dgViewIndustryIndex.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | this.dgViewIndustryIndex.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; |
| | | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
| | |
| | | this.dgViewIndustryIndex.EnableHeadersVisualStyles = false; |
| | | this.dgViewIndustryIndex.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.dgViewIndustryIndex.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255))))); |
| | | this.dgViewIndustryIndex.Location = new System.Drawing.Point(9, 81); |
| | | this.dgViewIndustryIndex.Location = new System.Drawing.Point(12, 89); |
| | | this.dgViewIndustryIndex.Name = "dgViewIndustryIndex"; |
| | | dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; |
| | | dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | |
| | | this.dgViewIndustryIndex.RowsDefaultCellStyle = dataGridViewCellStyle5; |
| | | this.dgViewIndustryIndex.RowTemplate.Height = 23; |
| | | this.dgViewIndustryIndex.SelectedIndex = -1; |
| | | this.dgViewIndustryIndex.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
| | | this.dgViewIndustryIndex.ShowGridLine = true; |
| | | this.dgViewIndustryIndex.Size = new System.Drawing.Size(835, 400); |
| | | this.dgViewIndustryIndex.Size = new System.Drawing.Size(822, 388); |
| | | this.dgViewIndustryIndex.TabIndex = 1; |
| | | // |
| | | // lblCompanyIn |
| | | // |
| | | this.lblCompanyIn.AutoSize = true; |
| | | this.lblCompanyIn.Cursor = System.Windows.Forms.Cursors.WaitCursor; |
| | | this.lblCompanyIn.Enabled = false; |
| | | this.lblCompanyIn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.lblCompanyIn.Location = new System.Drawing.Point(426, 39); |
| | | this.lblCompanyIn.Location = new System.Drawing.Point(426, 44); |
| | | this.lblCompanyIn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | | this.lblCompanyIn.MinimumSize = new System.Drawing.Size(1, 16); |
| | | this.lblCompanyIn.Name = "lblCompanyIn"; |
| | | this.lblCompanyIn.ReadOnly = true; |
| | | this.lblCompanyIn.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; |
| | | this.lblCompanyIn.ShowText = false; |
| | | this.lblCompanyIn.Size = new System.Drawing.Size(265, 35); |
| | | this.lblCompanyIn.Size = new System.Drawing.Size(408, 35); |
| | | this.lblCompanyIn.TabIndex = 27; |
| | | this.lblCompanyIn.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; |
| | | this.lblCompanyIn.WatermarkColor = System.Drawing.Color.Black; |
| | |
| | | // |
| | | this.btnClearIn.Cursor = System.Windows.Forms.Cursors.Hand; |
| | | this.btnClearIn.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.btnClearIn.Location = new System.Drawing.Point(319, 37); |
| | | this.btnClearIn.Location = new System.Drawing.Point(315, 44); |
| | | this.btnClearIn.MinimumSize = new System.Drawing.Size(1, 1); |
| | | this.btnClearIn.Name = "btnClearIn"; |
| | | this.btnClearIn.Size = new System.Drawing.Size(100, 35); |
| | | this.btnClearIn.TabIndex = 24; |
| | | this.btnClearIn.Text = "清空"; |
| | | this.btnClearIn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.btnClearIn.Click += new System.EventHandler(this.btnClearIn_Click); |
| | | // |
| | | // btnCompanyIn |
| | | // |
| | | this.btnCompanyIn.Cursor = System.Windows.Forms.Cursors.Hand; |
| | | this.btnCompanyIn.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.btnCompanyIn.Location = new System.Drawing.Point(202, 37); |
| | | this.btnCompanyIn.Location = new System.Drawing.Point(198, 44); |
| | | this.btnCompanyIn.MinimumSize = new System.Drawing.Size(1, 1); |
| | | this.btnCompanyIn.Name = "btnCompanyIn"; |
| | | this.btnCompanyIn.Size = new System.Drawing.Size(100, 35); |
| | | this.btnCompanyIn.TabIndex = 23; |
| | | this.btnCompanyIn.Text = "查询"; |
| | | this.btnCompanyIn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.btnCompanyIn.Click += new System.EventHandler(this.btnCompanyIn_Click); |
| | | // |
| | | // txtCompanyIn |
| | | // |
| | | this.txtCompanyIn.Cursor = System.Windows.Forms.Cursors.IBeam; |
| | | this.txtCompanyIn.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.txtCompanyIn.Location = new System.Drawing.Point(7, 40); |
| | | this.txtCompanyIn.Location = new System.Drawing.Point(12, 45); |
| | | this.txtCompanyIn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | | this.txtCompanyIn.MinimumSize = new System.Drawing.Size(1, 16); |
| | | this.txtCompanyIn.Name = "txtCompanyIn"; |
| | |
| | | // |
| | | this.AllowShowTitle = true; |
| | | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; |
| | | this.ClientSize = new System.Drawing.Size(879, 536); |
| | | this.ClientSize = new System.Drawing.Size(879, 521); |
| | | this.Controls.Add(this.lblCompanyIn); |
| | | this.Controls.Add(this.btnClearIn); |
| | | this.Controls.Add(this.btnCompanyIn); |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Configuration; |
| | |
| | | { |
| | | public partial class RealTimeFinancialShortNews : UIPage |
| | | { |
| | | private Hashtable ht = new Hashtable(); |
| | | |
| | | /// <summary> |
| | | /// 表格标题重命名 |
| | | /// </summary> |
| | | /// <param name="ColName"></param> |
| | | /// <returns></returns> |
| | | private string GetDgvColumName(string ColName) |
| | | { |
| | | if (ht.Contains(ColName)) return ht[ColName].ToString(); |
| | | else return ColName; |
| | | } |
| | | private ChromiumWebBrowser browser; |
| | | //public void InitBrowser(string bimUrl) |
| | | //{ |
| | |
| | | // } |
| | | //} |
| | | |
| | | |
| | | |
| | | //接口地址 |
| | | string ShortNew = ConfigurationManager.AppSettings["ShortNew"].ToString(); |
| | | public RealTimeFinancialShortNews() |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | string url = ShortNew; |
| | | JObject item = (JObject)GetChinaStockList(PageIndex, PageSize, url); |
| | | JObject item = (JObject)GetChinaStockList(PageIndex, PageSize, ShortNew); |
| | | if (item["Data"]["TushareNewses"] != null) |
| | | { |
| | | var items = item["Data"]["TushareNewses"]; |
| | | dgViewIndustryIndex.DataSource = items; |
| | | //交换列名 |
| | | dgViewIndustryIndex.Columns[1].Name = "NewDateTime"; |
| | | dgViewIndustryIndex.Columns[7].Name = "Contents"; |
| | | for (int i = 0; i < dgViewIndustryIndex.Columns.Count; i++) |
| | | { |
| | | string colName = dgViewIndustryIndex.Columns[i].Name; |
| | | if (colName == "id") |
| | | //隐藏不必显示的列 |
| | | if (colName == "Id" || colName == "Channels" || colName == "SubClassId" || colName == "Sources" || colName == "SrcType") |
| | | { |
| | | dgViewIndustryIndex.Columns[i].Visible = false; |
| | | } |
| | | //for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | //{ |
| | | // string introduction = dgViewIndustryIndex.Rows[j].Cells[i].Value.ToString(); |
| | | // if (introduction.Length > 13) |
| | | // { |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 10) + "..."; |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 13) + introduction.Substring(13); |
| | | // } |
| | | // if (introduction.Length > 30) |
| | | // { |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 10) + "..."; |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30); |
| | | // } |
| | | // if (introduction.Length > 60) |
| | | // { |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | // } |
| | | // if (introduction.Length > 90) |
| | | // { |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | // } |
| | | // if (introduction.Length > 120) |
| | | // { |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | // } |
| | | // if (introduction.Length > 150) |
| | | // { |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | // } |
| | | // if (introduction.Length > 180) |
| | | // { |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | // } |
| | | // if (introduction.Length > 210) |
| | | // { |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | // } |
| | | // if (introduction.Length > 240) |
| | | // { |
| | | // dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | // } |
| | | //} |
| | | //dgViewIndustryIndex.Columns[i].HeaderText = GetDgvColumName(colName); |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | //拿到交换前的值 |
| | | string Contents; |
| | | string NewDateTime; |
| | | if (dgViewIndustryIndex.Rows[j].Cells[7].Value.ToString() == "") |
| | | { |
| | | NewDateTime = ""; |
| | | } |
| | | else |
| | | { |
| | | NewDateTime = dgViewIndustryIndex.Rows[j].Cells[7].Value.ToString(); |
| | | } |
| | | if (dgViewIndustryIndex.Rows[j].Cells[1].Value.ToString() == "") |
| | | { |
| | | Contents = ""; |
| | | } |
| | | else |
| | | { |
| | | Contents = dgViewIndustryIndex.Rows[j].Cells[1].Value.ToString(); |
| | | } |
| | | //进行交换并隐藏字符 |
| | | if (colName == "Contents") |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[1].Value = NewDateTime; |
| | | dgViewIndustryIndex.Rows[j].Cells[7].Value = Contents; |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[i].Value.ToString(); |
| | | if (introduction.Length > 35) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 32) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | if (introduction.Length > 270) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240, 30) + "\n" + introduction.Substring(270); |
| | | } |
| | | } |
| | | } |
| | | dgViewIndustryIndex.Columns[i].HeaderText = GetDgvColumName(colName); |
| | | lblCompanyIn.Text = "查询完成!总计" + uiPagination1.TotalCount + "项!"; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | throw e; |
| | | MessageBox.Show("错误:" + e.Message); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | public string SendRequest(string url, string content, Encoding encoding) |
| | |
| | | //LoadingHelper.CloseForm(); |
| | | //this.webBrowser1.Navigate(@"http://101.133.134.71:9001/Pages/index.html#/newList"); |
| | | LoadingHelper.CloseForm(); |
| | | ht.Add("Title", "新闻标题"); |
| | | ht.Add("NewDateTime", "发布时间"); |
| | | ht.Add("Contents", "新闻内容"); |
| | | GetdgViewIndustryIndex(1, uiPagination1.PageSize); |
| | | } |
| | | |
| | |
| | | public string ParContent { get { return ""; } } |
| | | public string SubClassId { get { return "0"; } } |
| | | } |
| | | |
| | | private void uiPagination1_PageChanged(object sender, object pagingSource, int pageIndex, int count) |
| | | { |
| | | //LoadingHelper.ShowLoadingScreen(); |
| | | GetdgViewIndustryIndex(pageIndex, uiPagination1.PageSize); |
| | | //LoadingHelper.CloseForm(); |
| | | } |
| | | |
| | | private void btnClearIn_Click(object sender, EventArgs e) |
| | | { |
| | | this.txtCompanyIn.Text = ""; |
| | | } |
| | | |
| | | private void btnCompanyIn_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | dgViewIndustryIndex.DataSource = null; |
| | | for (int i = 1; i <= uiPagination1.TotalCount; i++) |
| | | { |
| | | JObject item = (JObject)GetChinaStockList(i, uiPagination1.PageSize, ShortNew); |
| | | if (item["Data"]["TushareNewses"] != null) |
| | | { |
| | | var items = item["Data"]["TushareNewses"]; |
| | | var title = items[i]["Title"].Value<string>(); |
| | | if (this.txtCompanyIn.Text.Trim() != "") |
| | | { |
| | | if (title.Contains(this.txtCompanyIn.Text.Trim())) |
| | | { |
| | | dgViewIndustryIndex.DataSource = items; |
| | | //交换列名 |
| | | dgViewIndustryIndex.Columns[1].Name = "NewDateTime"; |
| | | dgViewIndustryIndex.Columns[7].Name = "Contents"; |
| | | for (int x = 0; x < dgViewIndustryIndex.Columns.Count; x++) |
| | | { |
| | | string colName = dgViewIndustryIndex.Columns[i].Name; |
| | | //隐藏不必显示的列 |
| | | if (colName == "Id" || colName == "Channels" || colName == "SubClassId" || colName == "Sources" || colName == "SrcType") |
| | | { |
| | | dgViewIndustryIndex.Columns[i].Visible = false; |
| | | } |
| | | for (int j = 0; j < dgViewIndustryIndex.Rows.Count; j++) |
| | | { |
| | | //拿到交换前的值 |
| | | string Contents; |
| | | string NewDateTime; |
| | | if (dgViewIndustryIndex.Rows[j].Cells[7].Value.ToString() == "") |
| | | { |
| | | NewDateTime = ""; |
| | | } |
| | | else |
| | | { |
| | | NewDateTime = dgViewIndustryIndex.Rows[j].Cells[7].Value.ToString(); |
| | | } |
| | | if (dgViewIndustryIndex.Rows[j].Cells[1].Value.ToString() == "") |
| | | { |
| | | Contents = ""; |
| | | } |
| | | else |
| | | { |
| | | Contents = dgViewIndustryIndex.Rows[j].Cells[1].Value.ToString(); |
| | | } |
| | | //进行交换并隐藏字符 |
| | | if (colName == "Contents") |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[1].Value = NewDateTime; |
| | | dgViewIndustryIndex.Rows[j].Cells[7].Value = Contents; |
| | | string introduction = dgViewIndustryIndex.Rows[j].Cells[i].Value.ToString(); |
| | | if (introduction.Length > 35) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].Value = introduction.Substring(0, 32) + "..."; |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30); |
| | | } |
| | | if (introduction.Length > 60) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60); |
| | | } |
| | | if (introduction.Length > 90) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90); |
| | | } |
| | | if (introduction.Length > 120) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120); |
| | | } |
| | | if (introduction.Length > 150) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150); |
| | | } |
| | | if (introduction.Length > 180) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180); |
| | | } |
| | | if (introduction.Length > 210) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210); |
| | | } |
| | | if (introduction.Length > 240) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240); |
| | | } |
| | | if (introduction.Length > 270) |
| | | { |
| | | dgViewIndustryIndex.Rows[j].Cells[i].ToolTipText = introduction.Substring(0, 30) + "\n" + introduction.Substring(30, 30) + "\n" + introduction.Substring(60, 30) + "\n" + introduction.Substring(90, 30) + "\n" + introduction.Substring(120, 30) + "\n" + introduction.Substring(150, 30) + "\n" + introduction.Substring(180, 30) + "\n" + introduction.Substring(210, 30) + "\n" + introduction.Substring(240, 30) + "\n" + introduction.Substring(270); |
| | | } |
| | | } |
| | | } |
| | | dgViewIndustryIndex.Columns[x].HeaderText = GetDgvColumName(colName); |
| | | lblCompanyIn.Text = "查询完成!总计" + uiPagination1.TotalCount + "项!"; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GetdgViewIndustryIndex(1, uiPagination1.PageSize); |
| | | //DomesticPolicyData_Load(); |
| | | } |
| | | } |
| | | } |
| | | if (dgViewIndustryIndex.DataSource == null) |
| | | { |
| | | MessageBox.Show("没有查询到匹配数据!"); |
| | | } |
| | | } |
| | | catch (Exception t) |
| | | { |
| | | MessageBox.Show("错误:" + t.Message); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | this.uiButton1 = new Sunny.UI.UIButton(); |
| | | this.btnIndustryIndex = new Sunny.UI.UIButton(); |
| | | this.txtIndustryIndex = new Sunny.UI.UITextBox(); |
| | | this.uiButtonExel = new Sunny.UI.UIButton(); |
| | | ((System.ComponentModel.ISupportInitialize)(this.dgViewIndustryIndex)).BeginInit(); |
| | | this.SuspendLayout(); |
| | | // |
| | |
| | | this.dgViewIndustryIndex.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
| | | | System.Windows.Forms.AnchorStyles.Left) |
| | | | System.Windows.Forms.AnchorStyles.Right))); |
| | | this.dgViewIndustryIndex.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; |
| | | this.dgViewIndustryIndex.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); |
| | | this.dgViewIndustryIndex.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; |
| | | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
| | |
| | | // |
| | | this.lblIndustryIndex.AutoSize = true; |
| | | this.lblIndustryIndex.Cursor = System.Windows.Forms.Cursors.WaitCursor; |
| | | this.lblIndustryIndex.Enabled = false; |
| | | this.lblIndustryIndex.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.lblIndustryIndex.Location = new System.Drawing.Point(727, 43); |
| | | this.lblIndustryIndex.Location = new System.Drawing.Point(851, 43); |
| | | this.lblIndustryIndex.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); |
| | | this.lblIndustryIndex.MinimumSize = new System.Drawing.Size(1, 16); |
| | | this.lblIndustryIndex.Name = "lblIndustryIndex"; |
| | |
| | | this.txtIndustryIndex.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; |
| | | this.txtIndustryIndex.Watermark = "请输入股票代码或简称"; |
| | | // |
| | | // uiButtonExel |
| | | // |
| | | this.uiButtonExel.Cursor = System.Windows.Forms.Cursors.Hand; |
| | | this.uiButtonExel.Font = new System.Drawing.Font("微软雅黑", 9.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.uiButtonExel.Location = new System.Drawing.Point(736, 43); |
| | | this.uiButtonExel.MinimumSize = new System.Drawing.Size(1, 1); |
| | | this.uiButtonExel.Name = "uiButtonExel"; |
| | | this.uiButtonExel.Size = new System.Drawing.Size(100, 35); |
| | | this.uiButtonExel.TabIndex = 27; |
| | | this.uiButtonExel.Text = "导出为Exel文件"; |
| | | this.uiButtonExel.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); |
| | | this.uiButtonExel.Click += new System.EventHandler(this.uiButtonExel_Click); |
| | | // |
| | | // SemiconductorIndustryIndex |
| | | // |
| | | this.AllowShowTitle = true; |
| | | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; |
| | | this.ClientSize = new System.Drawing.Size(879, 536); |
| | | this.Controls.Add(this.uiButtonExel); |
| | | this.Controls.Add(this.lblIndustryIndex); |
| | | this.Controls.Add(this.txtEndDate); |
| | | this.Controls.Add(this.txtStartDate); |
| | |
| | | private UIButton uiButton1; |
| | | private UIButton btnIndustryIndex; |
| | | private UITextBox txtIndustryIndex; |
| | | private UIButton uiButtonExel; |
| | | } |
| | | } |
| | |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Windows.Forms; |
| | | using ZTIC.BLL; |
| | | using NPOI.SS.UserModel; |
| | | |
| | | namespace Sunny.UI.Demo.Controls |
| | | { |
| | |
| | | MessageBox.Show(ex.ToString()); |
| | | } |
| | | } |
| | | |
| | | private void uiButtonExel_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | //DataTable dt = GetDgvToTable(dgViewIndustryIndex); |
| | | //string file = @"C: \Users\lk\Desktop\新建文件夹\测试\测试.XLSX"; |
| | | //CommonHelper.NPOIHelper.ExportExcel(dt, file); |
| | | //var a = c ExportExcel(dt, "测试"); |
| | | //if (a != null) |
| | | //{ |
| | | // MessageBox.Show("导出成功!"); |
| | | //} |
| | | } |
| | | catch (Exception q) |
| | | { |
| | | |
| | | MessageBox.Show("错误:" + q.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 将dgView列表数据转换为datatable数据 |
| | | /// </summary> |
| | | /// <param name="dgv">当前dgView列表对象</param> |
| | | /// <returns>datatable对象</returns> |
| | | private static DataTable GetDgvToTable(DataGridView dgv) |
| | | { |
| | | DataTable dt = new DataTable(); |
| | | |
| | | // 列强制转换 |
| | | for (int count = 0; count < dgv.Columns.Count; count++) |
| | | { |
| | | System.Data.DataColumn dc = new System.Data.DataColumn(dgv.Columns[count].Name.ToString()); |
| | | dt.Columns.Add(dc); |
| | | } |
| | | |
| | | // 循环行 |
| | | for (int count = 0; count < dgv.Rows.Count; count++) |
| | | { |
| | | DataRow dr = dt.NewRow(); |
| | | for (int countsub = 0; countsub < dgv.Columns.Count; countsub++) |
| | | { |
| | | dr[countsub] = Convert.ToString(dgv.Rows[count].Cells[countsub].Value); |
| | | } |
| | | dt.Rows.Add(dr); |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// Datatable生成Excel表格并返回路径 |
| | | /// </summary> |
| | | /// <param name="m_DataTable">Datatable</param> |
| | | /// <param name="s_FileName">文件名</param> |
| | | /// <returns></returns> |
| | | public static string DataToExcel(System.Data.DataTable m_DataTable, string s_FileName) |
| | | { |
| | | string FileName = @"C: \Users\lk\Desktop\新建文件夹\测试\" + s_FileName + ".XLSX"; //文件存放路径 |
| | | if (System.IO.File.Exists(FileName)) //存在则删除 |
| | | { |
| | | System.IO.File.Delete(FileName); |
| | | } |
| | | System.IO.FileStream objFileStream; |
| | | System.IO.StreamWriter objStreamWriter; |
| | | string strLine = ""; |
| | | objFileStream = new System.IO.FileStream(FileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write); |
| | | objStreamWriter = new System.IO.StreamWriter(objFileStream, Encoding.Unicode); |
| | | for (int i = 0; i < m_DataTable.Columns.Count; i++) |
| | | { |
| | | strLine = strLine + m_DataTable.Columns[i].Caption.ToString() + Convert.ToChar(9); //写列标题 |
| | | } |
| | | objStreamWriter.WriteLine(strLine); |
| | | strLine = ""; |
| | | for (int i = 0; i < m_DataTable.Rows.Count; i++) |
| | | { |
| | | for (int j = 0; j < m_DataTable.Columns.Count; j++) |
| | | { |
| | | if (m_DataTable.Rows[i].ItemArray[j] == null) |
| | | strLine = strLine + " " + Convert.ToChar(9); //写内容 |
| | | else |
| | | { |
| | | string rowstr = ""; |
| | | rowstr = m_DataTable.Rows[i].ItemArray[j].ToString(); |
| | | if (rowstr.IndexOf("\r\n") > 0) |
| | | rowstr = rowstr.Replace("\r\n", " "); |
| | | if (rowstr.IndexOf("\t") > 0) |
| | | rowstr = rowstr.Replace("\t", " "); |
| | | strLine = strLine + rowstr + Convert.ToChar(9); |
| | | } |
| | | } |
| | | objStreamWriter.WriteLine(strLine); |
| | | strLine = ""; |
| | | } |
| | | objStreamWriter.Close(); |
| | | objFileStream.Close(); |
| | | return FileName; //返回生成文件的绝对路径 |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public List<PlatIndex> GetPlatIndexListByDate(string ts_code, string startdate, string enddate, int indexflag) |
| | | { |
| | | var sql = $"select * from PlatIndex where (ts_code like '%{ts_code}%' or ts_name like '%{ts_code}%') and trade_date>='{startdate}' and trade_date<='{enddate}' and indexflag={indexflag} order by ts_code desc"; |
| | | //var sql = $"select * from PlatIndex where (ts_code like '%{ts_code}%' or ts_name like '%{ts_code}%') and trade_date>='{startdate}' and trade_date<='{enddate}' and indexflag={indexflag} order by ts_code desc"; |
| | | var sql = $"select * from PlatIndex where (ts_code like '%{ts_code}%' or ts_name like '%{ts_code}%') and trade_date>='{startdate}' and trade_date<='{enddate}' and indexflag={indexflag} order by ts_name asc,trade_date desc"; |
| | | return Conn.Query<PlatIndex>(sql).ToList(); |
| | | } |
| | | |
| | |
| | | <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> |
| | | </PropertyGroup> |
| | | <ItemGroup> |
| | | <Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\Portable.BouncyCastle.1.8.9\lib\net40\BouncyCastle.Crypto.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="CefSharp, Version=106.0.290.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\CefSharp.Common.106.0.290\lib\net452\CefSharp.dll</HintPath> |
| | | </Reference> |
| | |
| | | <Reference Include="EO.WebEngine, Version=22.2.79.0, Culture=neutral, PublicKeyToken=e92353a6bf73fffc, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\EO.WebBrowser.22.2.79\lib\EO.WebEngine.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="MaterialSkin, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\MaterialSkin.Net4.1.0.0\lib\net40\MaterialSkin.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="NPOI, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="NPOI.OOXML, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.OOXML.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="NPOI.OpenXml4Net, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.OpenXml4Net.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="NPOI.OpenXmlFormats, Version=2.5.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\NPOI.2.5.6\lib\net45\NPOI.OpenXmlFormats.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="SqlSugar, Version=5.1.3.27, Culture=neutral, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\SqlSugar.5.1.3.27\lib\SqlSugar.dll</HintPath> |
| | | </Reference> |
| | |
| | | <package id="EO.WebBrowser.WinForm" version="22.2.79" targetFramework="net461" /> |
| | | <package id="MaterialSkin.Net4" version="1.0.0" targetFramework="net40" /> |
| | | <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" /> |
| | | <package id="NPOI" version="2.5.6" targetFramework="net461" /> |
| | | <package id="Portable.BouncyCastle" version="1.8.9" targetFramework="net461" /> |
| | | <package id="SharpZipLib" version="1.3.3" targetFramework="net461" /> |
| | | <package id="SqlSugar" version="5.1.3.27" targetFramework="net40" /> |
| | | <package id="SunnyUI" version="3.1.3" targetFramework="net40" /> |
| | | <package id="SunnyUI.Common" version="3.1.2" targetFramework="net40" /> |