private void DrawBmTableBody(AISTOCK_STOCK_AVG_PRICE_DATA data) { if (data == null) { return; } if (data.AISTOCK_STOCK_AVG_PRICE.Count <= 0) { return; } TableRow bodyRow; foreach (AISTOCK_STOCK_AVG_PRICE_DATA.AISTOCK_STOCK_AVG_PRICERow row in data.AISTOCK_STOCK_AVG_PRICE.Rows) { bodyRow = this.BmBlafTableStock.AddBodyRow(); this.BmBlafTableStock.AddCell(bodyRow, row.STOCK_CODE, HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.STOCK_NAME, HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.IsFIVE_AVGNull() ? string.Empty : row.FIVE_AVG.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.IsTEN_AVGNull() ? string.Empty : row.TEN_AVG.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.IsTWENTY_AVGNull() ? string.Empty : row.TWENTY_AVG.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.IsTHIRTY_AVGNull() ? string.Empty : row.THIRTY_AVG.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.IsSIXTY_AVGNull() ? string.Empty : row.SIXTY_AVG.ToString(), HorizontalAlign.Left); } }
public AISTOCK_STOCK_AVG_PRICE_DATA GetStockAvgHistory(StockQueryCondition qc) { AISTOCK_STOCK_AVG_PRICE_DATA data = new AISTOCK_STOCK_AVG_PRICE_DATA(); using (DaStock da = new DaStock()) { da.LoadStockAvgHistory(data.AISTOCK_STOCK_AVG_PRICE, qc); } return(data); }
public AISTOCK_STOCK_AVG_PRICE_DATA GetStockAvgData(string date) { AISTOCK_STOCK_AVG_PRICE_DATA data = new AISTOCK_STOCK_AVG_PRICE_DATA(); using (DaStock da = new DaStock()) { da.LoadStockAvgData(data.AISTOCK_STOCK_AVG_PRICE, date); } return(data); }
private void Refresh() { string dateFrom = Request.QueryString["datefrom"] == null ? string.Empty : Request.QueryString["datefrom"]; string dateTo = Request.QueryString["dateto"] == null ? string.Empty : Request.QueryString["dateto"]; string market = Request.QueryString["market"] == null ? string.Empty : Request.QueryString["market"]; string field = Request.QueryString["field"] == null ? string.Empty : Request.QueryString["field"]; string chart = Request.QueryString["chart"] == null ? string.Empty : Request.QueryString["chart"]; string province = Request.QueryString["province"] == null ? string.Empty : Request.QueryString["province"]; string stockName = Request.QueryString["stockName"] == null ? string.Empty : Request.QueryString["stockName"].ToString().Trim(); string stockcode = Request.QueryString["stockcode"] == null ? string.Empty : Request.QueryString["stockcode"]; string MarketName = Request.QueryString["MarketName"] == "--请选择--" ? string.Empty : Request.QueryString["MarketName"]; string FieldName = Request.QueryString["FieldName"] == "--请选择--" ? string.Empty : Request.QueryString["FieldName"].Trim(); string ChartName = Request.QueryString["ChartName"] == "--请选择--" ? string.Empty : Request.QueryString["ChartName"]; string ProvinceName = Request.QueryString["ProvinceName"] == "--请选择--" ? string.Empty : Request.QueryString["ProvinceName"].Trim(); StockQueryCondition qc = new StockQueryCondition(); qc.DatePickerFrom = dateFrom; qc.DatePickerTo = dateTo; qc.StockCode = stockcode; qc.StockName = stockName; qc.Market = MarketName; qc.Field = FieldName; qc.Chart = ChartName; qc.Province = ProvinceName; this.ViewState["_StockQueryCondition"] = qc.SerializeToString(); AISTOCK_STOCK_DAILY_DATA_V_DATA data = new AISTOCK_STOCK_DAILY_DATA_V_DATA(); data = new StockSystem().GetStockHistory(qc); AISTOCK_STOCK_AVG_PRICE_DATA avgData = new AISTOCK_STOCK_AVG_PRICE_DATA(); avgData = new StockSystem().GetStockAvgHistory(qc); this.BmBlafTableHistory.Clear(); this.BmBlafTableHistory.BorderColor = Color.Black; this.BmBlafTableHistory.BorderWidth = Unit.Point(1); this.DrawBlafTableHeader(); this.DrawBlafTableBody(data, avgData); this.LabelTitle.Text = "名称:查询股票历史记录<br>" + "创建时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "<br>" + "时间:" + qc.DatePickerFrom + "至" + qc.DatePickerTo + "<br>" + "所属证券市场:" + (qc.Market == string.Empty ? "ALL" : qc.Market) + "<br>" + "所属证监会行业:" + (qc.Field == string.Empty ? "ALL" : qc.Field) + "<br>" + "所属省份:" + (qc.Province == string.Empty ? "ALL" : qc.Province) + "<br>" + "K线图:" + (qc.Chart == string.Empty ? "ALL" : qc.Chart) + "<br>" + "股票代码:" + (qc.StockCode == string.Empty ? "ALL" : qc.StockCode) + "<br>" + "股票名称:" + (qc.StockName == string.Empty ? "ALL" : qc.StockName); }
public void InsertAvgPrice(AISTOCK_STOCK_AVG_PRICE_DATA data) { using (DaStock da = new DaStock()) { try { da.SaveAvgPrice(data.AISTOCK_STOCK_AVG_PRICE); } catch (Exception ex) { throw new CommonException("保存股票信息数据时出错,请联系管理!" + ex.Message); } } }
private void Refresh() { StockQueryCondition qc = new StockQueryCondition(); qc.DeserializeFromString(this.ViewState["_StockQueryCondition"].ToString()); DateTime dateFrom = DateTime.Parse(this.DatePickerFrom.DateTime.ToString()); DateTime dateTo = DateTime.Parse(this.DatePickerTo.DateTime.ToString()); if (dateFrom > dateTo) { this.RestoreQueryCondition(); this.labScript.Text = JavaScriptFunction.Alert("选择的查询时间段不对,请重新选择。"); return; } AISTOCK_STOCK_DAILY_DATA_V_DATA data = new AISTOCK_STOCK_DAILY_DATA_V_DATA(); data = new StockSystem().GetStockHistory(qc); AISTOCK_STOCK_AVG_PRICE_DATA avgData = new AISTOCK_STOCK_AVG_PRICE_DATA(); avgData = new StockSystem().GetStockAvgHistory(qc); this.BmBlafTableHistory.Clear(); this.BmBlafTableHistory.IsEnableScroll = true; this.BmBlafTableHistory.FreezeColumnCount = 6; if (data == null || data.AISTOCK_STOCK_DAILY_DATA_V.Count <= 0) { //this.BmBlafTableHistory.TitleRowCount = 1; this.DrawBlafTableHeader(); } else { //this.BmBlafTableHistory.TitleRowCount = 2; this.DrawBlafTableHeader(); this.DrawBlafTableBody(data, avgData); } //恢复记录 this.RestoreQueryCondition(); }
private void CalculateAvgPriceData() { AISTOCK_STOCK_AVG_PRICE_DATA data = new AISTOCK_STOCK_AVG_PRICE_DATA(); //List<Stock> stocks = new ParseStock().ParseStockXml(); AISTOCK_STOCK_IMPORT_DATA stocks = new StockSystem().GetStockImport(); string stockCode = string.Empty; string date = DateTimeFunction.ConvertDate(this.DatePickerImportDate.DateTime); decimal fiveAvg = 0; decimal tenAvg = 0; decimal twentyAvg = 0; decimal thirtyAvg = 0; decimal sixtyAvg = 0; foreach (var item in stocks.AISTOCK_STOCK_IMPORT) { AISTOCK_STOCK_AVG_PRICE_DATA.AISTOCK_STOCK_AVG_PRICERow row = data.AISTOCK_STOCK_AVG_PRICE.NewAISTOCK_STOCK_AVG_PRICERow(); Guid stock_id = Guid.NewGuid(); stockCode = item.STOCK_CODE; fiveAvg = new StockSystem().GetAvgPrice(stockCode, date, 5); tenAvg = new StockSystem().GetAvgPrice(stockCode, date, 10); twentyAvg = new StockSystem().GetAvgPrice(stockCode, date, 20); thirtyAvg = new StockSystem().GetAvgPrice(stockCode, date, 30); sixtyAvg = new StockSystem().GetAvgPrice(stockCode, date, 60); row.STOCK_AVG_ID = stock_id.ToString(); row.STOCK_CODE = stockCode; row.STOCK_NAME = item.STOCK_NAME; row.STOCK_DAY = date; row.FIVE_AVG = fiveAvg; row.TEN_AVG = tenAvg; row.TWENTY_AVG = twentyAvg; row.THIRTY_AVG = thirtyAvg; row.SIXTY_AVG = sixtyAvg; data.AISTOCK_STOCK_AVG_PRICE.Rows.Add(row); } new StockSystem().InsertAvgPrice(data); }
public void InsertAvgPrice(AISTOCK_STOCK_AVG_PRICE_DATA data) { new Stock().InsertAvgPrice(data); }
private void DrawBlafTableBody(AISTOCK_STOCK_DAILY_DATA_V_DATA data, AISTOCK_STOCK_AVG_PRICE_DATA avgData) { if (data == null) { throw new CommonException("获取收入历史数据出错"); } if (data.AISTOCK_STOCK_DAILY_DATA_V.Count <= 0) { return; } string[,] stockData = new string[_dateList.Count, 12]; bool flag = false; TableRow bodyRow; int count = 0; for (int i = 0; i < data.AISTOCK_STOCK_DAILY_DATA_V.Count; i = count) { AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow row = data.AISTOCK_STOCK_DAILY_DATA_V[i]; flag = true; for (int j = _dateList.Count - 1; j >= 0; j--) { string[] dateArr = _dateList[_dateList.Count - 1].ToString().Split('-'); string date = dateArr[0] + (int.Parse(dateArr[1]) < 10 ? "0" + dateArr[1] : dateArr[1]) + (int.Parse(dateArr[2]) < 10 ? "0" + dateArr[2] : dateArr[2]); DataRow[] thisRow = data.AISTOCK_STOCK_DAILY_DATA_V.Select("STOCK_CODE = '" + row.STOCK_CODE + "' AND STOCK_DAY = '" + date + "'"); if (thisRow.Length <= 0) { flag = false; } dateArr = _dateList[j].ToString().Split('-'); date = dateArr[0] + (int.Parse(dateArr[1]) < 10 ? "0" + dateArr[1] : dateArr[1]) + (int.Parse(dateArr[2]) < 10 ? "0" + dateArr[2] : dateArr[2]); DataRow[] tmpRow = data.AISTOCK_STOCK_DAILY_DATA_V.Select("STOCK_CODE = '" + row.STOCK_CODE + "' AND STOCK_DAY = '" + date + "'"); DataRow[] tmpAvgRow = avgData.AISTOCK_STOCK_AVG_PRICE.Select("STOCK_CODE = '" + row.STOCK_CODE + "' AND STOCK_DAY = '" + date + "'"); if (tmpRow.Length > 0) { count++; stockData[j, 0] = ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).IsTODAY_BEGINNull() ? string.Empty : ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).TODAY_BEGIN.ToString(); stockData[j, 1] = ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).IsYESTERDAY_ENDNull() ? string.Empty : ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).YESTERDAY_END.ToString(); stockData[j, 2] = ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).IsTODAY_ENDNull() ? string.Empty : ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).TODAY_END.ToString(); stockData[j, 3] = ((AISTOCK_STOCK_AVG_PRICE_DATA.AISTOCK_STOCK_AVG_PRICERow)tmpAvgRow[0]).IsFIVE_AVGNull() ? string.Empty : ((AISTOCK_STOCK_AVG_PRICE_DATA.AISTOCK_STOCK_AVG_PRICERow)tmpAvgRow[0]).FIVE_AVG.ToString(); stockData[j, 4] = ((AISTOCK_STOCK_AVG_PRICE_DATA.AISTOCK_STOCK_AVG_PRICERow)tmpAvgRow[0]).IsTEN_AVGNull() ? string.Empty : ((AISTOCK_STOCK_AVG_PRICE_DATA.AISTOCK_STOCK_AVG_PRICERow)tmpAvgRow[0]).TEN_AVG.ToString(); stockData[j, 5] = ((AISTOCK_STOCK_AVG_PRICE_DATA.AISTOCK_STOCK_AVG_PRICERow)tmpAvgRow[0]).IsTWENTY_AVGNull() ? string.Empty : ((AISTOCK_STOCK_AVG_PRICE_DATA.AISTOCK_STOCK_AVG_PRICERow)tmpAvgRow[0]).TWENTY_AVG.ToString(); stockData[j, 6] = ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).IsMAX_PRICENull() ? string.Empty : ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).MAX_PRICE.ToString(); stockData[j, 7] = ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).IsMIN_PRICENull() ? string.Empty : ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).MIN_PRICE.ToString(); stockData[j, 8] = ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).IsQUANTITYNull() ? string.Empty : ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).QUANTITY.ToString(); stockData[j, 9] = ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).IsTOTAL_MONEYNull() ? string.Empty : ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).TOTAL_MONEY.ToString(); stockData[j, 10] = ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).IsINCREASE_PERCENTNull() ? string.Empty : ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).INCREASE_PERCENT.ToString(); stockData[j, 11] = ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).IsCHARTNull() ? string.Empty : ((AISTOCK_STOCK_DAILY_DATA_V_DATA.AISTOCK_STOCK_DAILY_DATA_VRow)tmpRow[0]).CHART.ToString(); } else { for (int k = 0; k < 12; k++) { stockData[j, k] = string.Empty; } } } if (flag)//画一行 { bodyRow = this.BmBlafTableHistory.AddBodyRow(); this.BmBlafTableHistory.AddCell(bodyRow, row.STOCK_CODE, HorizontalAlign.Left); this.BmBlafTableHistory.AddCell(bodyRow, row.STOCK_NAME, HorizontalAlign.Left); this.BmBlafTableHistory.AddCell(bodyRow, row.STOCK_ADDR, HorizontalAlign.Left); this.BmBlafTableHistory.AddCell(bodyRow, row.FIELD_MAIN, HorizontalAlign.Left); this.BmBlafTableHistory.AddCell(bodyRow, row.FIELD, HorizontalAlign.Left); this.BmBlafTableHistory.AddCell(bodyRow, row.PROVINCE, HorizontalAlign.Left); for (int m = _dateList.Count - 1; m >= 0; m--) { for (int n = 0; n < 12; n++) { this.BmBlafTableHistory.AddCell(bodyRow, stockData[m, n], HorizontalAlign.Left); } } decimal accu = 0; if (decimal.Parse(stockData[0, 1]) != 0) { accu = (decimal.Parse(stockData[_dateList.Count - 1, 2]) - decimal.Parse(stockData[0, 1])) / decimal.Parse(stockData[0, 1]) * 100; } if (_dateList.Count > 1) { this.BmBlafTableHistory.AddCell(bodyRow, accu.ToString(), HorizontalAlign.Left); for (int p = _dateList.Count - 1; p > 0; p--) { if (decimal.Parse(stockData[p - 1, 8]) != 0 && decimal.Parse(stockData[p, 8]) != 0) { this.BmBlafTableHistory.AddCell(bodyRow, (decimal.Parse(stockData[p, 8]) / decimal.Parse(stockData[p - 1, 8])).ToString(), HorizontalAlign.Left); } else { this.BmBlafTableHistory.AddCell(bodyRow, string.Empty, HorizontalAlign.Left); } } } this.BmBlafTableHistory.AddCell(bodyRow, row.TOTAL_STOCK.ToString(), HorizontalAlign.Left); this.BmBlafTableHistory.AddCell(bodyRow, row.STOCKER.ToString(), HorizontalAlign.Left); this.BmBlafTableHistory.AddCell(bodyRow, row.IsREVENUENull() ? string.Empty :row.REVENUE.ToString(), HorizontalAlign.Left); this.BmBlafTableHistory.AddCell(bodyRow, row.IsPROFITNull() ? string.Empty : row.PROFIT.ToString(), HorizontalAlign.Left); this.BmBlafTableHistory.AddCell(bodyRow, row.IsPROFIT_PERCENTNull() ? string.Empty : row.PROFIT_PERCENT.ToString(), HorizontalAlign.Left); } } }