Exemplo n.º 1
0
        public databases.tmpDS.dataVarrianceDataTable TopBiggestChangeTable()
        {
            //Weekly Market data for user's interested code
            databases.tmpDS.dataVarrianceDataTable tbl = DataAccess.Libs.GetTopPriceVarrianceWeeklyOfLoginUser(10);
            //If NONE get weekly data of all the market
            if (tbl.Count == 0)
            {
                tbl = DataAccess.Libs.GetTopPriceVarrianceWeekly(10);
            }
            decimal[]        yValues  = new decimal[tbl.Count];
            string[]         xValues  = new string[tbl.Count];
            StringCollection topCodes = new StringCollection();

            int displayChartCount = Math.Min(tbl.Count, 5);

            for (int idx = 0; idx < tbl.Count; idx++)
            {
                if (idx < displayChartCount)
                {
                    yValues[idx] = tbl[idx].percent;
                    xValues[idx] = tbl[idx].code;
                }
                topCodes.Add(tbl[idx].code);
            }
            databases.tmpDS.dataVarrianceDataTable tbl2 = Market_DataDailyChange(topCodes);
            return(Market_DataDailyChange(topCodes));
        }
Exemplo n.º 2
0
        public static StringCollection Market_TopBiggestChange()
        {
            databases.tmpDS.dataVarrianceDataTable tbl = DataAccess.Libs.GetTopPriceVarrianceWeeklyOfLoginUser(10);
            ////Weekly Market data for user's interested code
            //DateTime beforeDate = DateTime.Today.AddDays(-7);
            //Gateway.ServiceConnector.InitService();
            //QuantumStockServiceProvider.tmpDS.dataVarrianceDataTable tbl = Statics.svc_Client.GetTopPriceVarrianceOfUser(beforeDate,DateTime.Today,"w1", commonClass.SysLibs.sysLoginCode, 10);
            ////If NONE get weekly data of all the market
            ////if (tbl.Count == 0) tbl = DataAccess.Libs.GetTopPriceVarrianceWeekly(10);
            //decimal[] yValues = new decimal[tbl.Count];
            //string[] xValues = new string[tbl.Count];
            //StringCollection topCodes = new StringCollection();

            //int displayChartCount = Math.Min(tbl.Count, 5);
            //for (int idx = 0; idx < tbl.Count; idx++)
            //{
            //    if (idx < displayChartCount)
            //    {
            //        yValues[idx] = tbl[idx].percent;
            //        xValues[idx] = tbl[idx].code;
            //    }
            //    topCodes.Add(tbl[idx].code);
            //}
            return(null);
        }
Exemplo n.º 3
0
        private databases.tmpDS.dataVarrianceDataTable Market_DataDailyChange(StringCollection codes)
        {
            databases.baseDS.lastPriceDataRow lastPriceRowOpen, lastPriceRowClose; 
            databases.baseDS.lastPriceDataDataTable openTbl = DataAccess.Libs.myLastDailyOpenPrice;
            databases.baseDS.lastPriceDataDataTable closeTbl = DataAccess.Libs.myLastDailyClosePrice; 
            databases.tmpDS.dataVarrianceRow varrianceRow;              
            databases.tmpDS.dataVarrianceDataTable tbl = new databases.tmpDS.dataVarrianceDataTable();
            for (int idx = 0; idx < codes.Count; idx++)
            {
                lastPriceRowOpen = openTbl.FindBystockCode(codes[idx]);
                lastPriceRowClose = closeTbl.FindBystockCode(codes[idx]);
                if (lastPriceRowOpen == null ||lastPriceRowClose == null) continue;
                decimal closePrice = lastPriceRowClose.value;
                decimal openPrice = lastPriceRowOpen.value;
                if (openPrice == 0 || closePrice == 0) continue;                


                varrianceRow = tbl.NewdataVarrianceRow();
                databases.AppLibs.InitData(varrianceRow);
                varrianceRow.code = codes[idx];
                varrianceRow.val1 = openPrice;
                varrianceRow.val2 = closePrice;
                varrianceRow.value = (closePrice - openPrice);
                varrianceRow.percent = ((closePrice - openPrice) / openPrice) * 100;

                //DataRowView[] foundRows = alertView.FindRows(codes[idx]);
                //if (foundRows.Length > 0)
                //{
                //    varrianceRow.notes = (foundRows[0].Row as databases.baseDS.tradeAlertRow).msg;
                //}
                tbl.AdddataVarrianceRow(varrianceRow);
            }
            return tbl;
        }
Exemplo n.º 4
0
        public void AnalyseReport(WordprocessingDocument wordDoc)
        {
            wDoc = wordDoc;
            //PROCESSING STRING EXPRESSION IN WORD
            this.SearchAndReplace(wordDoc, "", "", true);

            //PROCESSING StockTable_Tag
            string           tblTag   = "StockTable_Tag";
            MainDocumentPart mainPart = wordDoc.MainDocumentPart;
            //StockService.baseDS.stockCodeDataTable tbl = Gateway.PriceData.getPriceDataToDay();
            SdtBlock ccWithTable = mainPart.Document.Body.Descendants <SdtBlock>().Where
                                       (r => r.SdtProperties.GetFirstChild <Tag>().Val == tblTag).Single();

            // This should return only one table.
            Table theTable = ccWithTable.Descendants <Table>().Single();
            // Get the last row in the table.
            TableRow theRow = theTable.Elements <TableRow>().Last();

            StockReport stockReport = StockReport.getInstance();

            databases.tmpDS.dataVarrianceDataTable tbl = stockReport.TopBiggestChangeTable();
            foreach (databases.tmpDS.dataVarrianceRow item in tbl.Rows)
            {
                try
                {
                    TableRow rowCopy = (TableRow)theRow.CloneNode(true);
                    rowCopy.Descendants <TableCell>().ElementAt(0).Append(new Paragraph
                                                                              (new Run(new Text(item.code.ToString()))));
                    rowCopy.Descendants <TableCell>().ElementAt(1).Append(new Paragraph
                                                                              (new Run(new Text(String.Format("{0:0,0}", item.val1 * 1000) + " VNĐ"))));
                    rowCopy.Descendants <TableCell>().ElementAt(2).Append(new Paragraph
                                                                              (new Run(new Text(String.Format("{0:0,0}", item.val2 * 1000) + " VNĐ"))));
                    rowCopy.Descendants <TableCell>().ElementAt(3).Append(new Paragraph
                                                                              (new Run(new Text(String.Format("{0:0,0}", item.value * 1000) + " VNĐ"))));
                    rowCopy.Descendants <TableCell>().ElementAt(4).Append(new Paragraph
                                                                              (new Run(new Text((item.percent / 100).ToString("P")))));
                    theTable.AppendChild(rowCopy);
                }
                catch (Exception ex)
                {
                    continue;
                }
            }
            theTable.RemoveChild(theRow);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Showing Weekly change and call Daily changes
        /// </summary>
        private void Market_TopBiggestChange()
        {
            //Weekly Market data for user's interested code
            databases.tmpDS.dataVarrianceDataTable tbl = DataAccess.Libs.GetTopPriceVarrianceWeeklyOfLoginUser(10);
            //If NONE get weekly data of all the market
            if (tbl.Count == 0)
            {
                tbl = DataAccess.Libs.GetTopPriceVarrianceWeekly(10);
            }
            decimal[]        yValues  = new decimal[tbl.Count];
            string[]         xValues  = new string[tbl.Count];
            StringCollection topCodes = new StringCollection();

            int displayChartCount = Math.Min(tbl.Count, 5);

            for (int idx = 0; idx < tbl.Count; idx++)
            {
                if (idx < displayChartCount)
                {
                    yValues[idx] = tbl[idx].percent;
                    xValues[idx] = tbl[idx].code;
                }
                topCodes.Add(tbl[idx].code);
            }
            top10biggestChangeChart.Series[0].Points.DataBindXY(xValues, yValues);
            top10biggestChangeChart.Series[0].ChartType = SeriesChartType.Doughnut;


            for (int idx = 0; idx < top10biggestChangeChart.Series[0].Points.Count; idx++)
            {
                top10biggestChangeChart.Series[0].Points[idx].Label = xValues[idx] + common.Consts.constCRLF + (yValues[idx]).ToString(commonTypes.Settings.sysMaskPercent + "%");
                //top10biggestChangeChart.Series[0].Points[idx]["Exploded"] = "true";
                //top10biggestChangeChart.Series[0].Points[idx].Label = (yValues[idx]).ToString("##%");
            }
            // Set labels style
            top10biggestChangeChart.Series[0]["PieLabelStyle"] = "Inside";
            top10biggestChangeChart.Series[0].MarkerStyle      = MarkerStyle.Circle;

            // Set Doughnut radius percentage
            top10biggestChangeChart.Series[0]["DoughnutRadius"] = "90";

            //Daily Market data
            Market_DataDailyChange(topCodes);
        }
Exemplo n.º 6
0
        private databases.tmpDS.dataVarrianceDataTable Market_DataDailyChange(StringCollection codes)
        {
            databases.baseDS.lastPriceDataRow       lastPriceRowOpen, lastPriceRowClose;
            databases.baseDS.lastPriceDataDataTable openTbl  = DataAccess.Libs.myLastDailyOpenPrice;
            databases.baseDS.lastPriceDataDataTable closeTbl = DataAccess.Libs.myLastDailyClosePrice;
            databases.tmpDS.dataVarrianceRow        varrianceRow;
            databases.tmpDS.dataVarrianceDataTable  tbl = new databases.tmpDS.dataVarrianceDataTable();
            for (int idx = 0; idx < codes.Count; idx++)
            {
                lastPriceRowOpen  = openTbl.FindBystockCode(codes[idx]);
                lastPriceRowClose = closeTbl.FindBystockCode(codes[idx]);
                if (lastPriceRowOpen == null || lastPriceRowClose == null)
                {
                    continue;
                }
                decimal closePrice = lastPriceRowClose.value;
                decimal openPrice  = lastPriceRowOpen.value;
                if (openPrice == 0 || closePrice == 0)
                {
                    continue;
                }


                varrianceRow = tbl.NewdataVarrianceRow();
                databases.AppLibs.InitData(varrianceRow);
                varrianceRow.code    = codes[idx];
                varrianceRow.val1    = openPrice;
                varrianceRow.val2    = closePrice;
                varrianceRow.value   = (closePrice - openPrice);
                varrianceRow.percent = ((closePrice - openPrice) / openPrice) * 100;

                //DataRowView[] foundRows = alertView.FindRows(codes[idx]);
                //if (foundRows.Length > 0)
                //{
                //    varrianceRow.notes = (foundRows[0].Row as databases.baseDS.tradeAlertRow).msg;
                //}
                tbl.AdddataVarrianceRow(varrianceRow);
            }
            return(tbl);
        }
Exemplo n.º 7
0
        public void RefreshData()
        {
            try
            {
                databases.tmpDS.dataVarrianceDataTable tbl = DataAccess.Libs.GetPriceVarrianceWeekly(4);
                decimal[] yValues = new decimal[tbl.Count];
                string[]  xValues = new string[tbl.Count];
                for (int idx = 0; idx < tbl.Count; idx++)
                {
                    yValues[idx] = tbl[idx].percent;
                    xValues[idx] = tbl[idx].code;
                }

                // Populate series data
                vnIdxChart.Series["Default"].Points.DataBindXY(xValues, yValues);

                // Set Doughnut chart type
                vnIdxChart.Series["Default"].ChartType = SeriesChartType.Pie;

                // Set labels style
                vnIdxChart.Series["Default"]["PieLabelStyle"] = "Inside";

                // Set Doughnut radius percentage
                vnIdxChart.Series["Default"]["DoughnutRadius"] = "99";

                // Explode data point with label "Italy"
                vnIdxChart.Series["Default"].Points[yValues.Length - 1]["Exploded"] = "true";

                // Enable 3D
                vnIdxChart.ChartAreas["Default"].Area3DStyle.Enable3D = true;

                // Set drawing style
                vnIdxChart.Series["Default"]["PieDrawingStyle"] = "SoftEdge";
            }
            catch (Exception er)
            {
                this.ShowError(er);
            }
        }