コード例 #1
0
        public static string processString(string expression)
        {
            StockReport stockReport = StockReport.getInstance();

            string[] arr    = expression.Split(':');
            string   first  = arr[0];
            string   method = first.Split('_')[1];

            object[] arrParams = new object[arr.Length - 1];
            for (int i = 1; i < arr.Length; i++)
            {
                arrParams[i - 1] = arr[i];
            }
            string result = "###";

            try
            {
                result = ReflectionUtils.GetMethod(stockReport, method, arrParams) as string;
            }
            catch (Exception)
            {
                return("Undefined");
            }
            return(result);
        }
コード例 #2
0
 public static StockReport getInstance()
 {
     if (instance == null)
     {
         instance = new StockReport();
     }
     return(instance);
 }
コード例 #3
0
ファイル: StockReport.cs プロジェクト: oghenez/trade-software
        public static StockReport getInstance()
        {
            if (instance==null)
            {
	             instance = new StockReport();
            }
            return instance;
        }
コード例 #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);
        }