Ejemplo n.º 1
0
        public static DataTable GetDescendantDataByService(String parentCode, MacroDataType type)
        {
            DataTable table = new DataTable();

            try
            {
                String  str = String.Join(",", MongoDBConstant.TreeColumnFileds[type]);
                DataSet dataFromIndicatorServer = GetDataFromIndicatorServer(MongoDBConstant.DictTreeCmd[type], new object[] { parentCode, str });
                if (dataFromIndicatorServer == null)
                {
                    return(table);
                }
                if (dataFromIndicatorServer.Tables.Count == 0)
                {
                    return(table);
                }
                if (dataFromIndicatorServer.Tables[0].Rows.Count == 0)
                {
                    return(table);
                }
                table = dataFromIndicatorServer.Tables[0].Copy();
            }
            catch (Exception exception)
            {
                //EMLoggerHelper.Write(exception);
            }
            return(table);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 下拉列表选中改变事件
        /// </summary>
        /// <param name="sender">调用者</param>
        private void SelectedIndexChanged(object sender)
        {
            String        text = m_cbMacIndustry.SelectedText;
            MacroDataType type = (MacroDataType)Enum.Parse(typeof(MacroDataType), text);

            LoadType(type);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取宏观数据
        /// </summary>
        /// <param name="code"></param>
        /// <param name="macIndustyType"></param>
        /// <returns></returns>
        public static DataTable GetMacIndustyData(String code, String macIndustyType)
        {
            MacroDataType type = (MacroDataType)Enum.Parse(typeof(MacroDataType), macIndustyType);

            String[]  ids = new String[] { code };
            DataSet   ds  = MongoRetriver.GetMutiIndicatorValuesFromService(ids, type);
            DataTable dt  = ds.Tables[0];

            return(dt);
        }
Ejemplo n.º 4
0
 public static void GetMutiIndicatorValuesFromService(String[] macroIDList, MacroDataType treeType, DealWithReturnData ActionAfterGetValueData)
 {
     try
     {
         String  str                     = String.Join(",", macroIDList);
         String  formatCommond           = MongoDBConstant.DicCommand[treeType];
         DataSet dataFromIndicatorServer = GetDataFromIndicatorServer(formatCommond, new object[] { str, DataCenter.UserID });
         ActionAfterGetValueData(dataFromIndicatorServer);
     }
     catch (Exception exception)
     {
         //EMLoggerHelper.Write(exception);
         ActionAfterGetValueData(null);
     }
 }
Ejemplo n.º 5
0
        public static DataTable GetListData(String[] macroIDs, MacroDataType type)
        {
            DataTable               table  = new DataTable();
            DataTransmission        item   = null;
            List <DataTransmission> dtList = null;

            try
            {
                item         = new DataTransmission();
                item.Filters = new List <Expression>(2);
                item.Filters.Add(Expression.In("STR_MACROID", macroIDs));
                item.Filters.Add(Expression.Eq("STR_FLAG", "0"));
                item.DataSource = MongoDBConstant.DicTreeSource[type];
                item.MaxResult  = 0x7fffffff;
                item.Fields     = new String[] { "STR_MACROID", "STR_STARTDATE", "STR_ENDDATE", "STR_GXDATE" };
                dtList          = new List <DataTransmission>(1);
                dtList.Add(item);
                table = _uniqueQuery.Query(dtList).Tables[0];
            }
            catch (Exception exception)
            {
                //EMLoggerHelper.Write(exception);
            }
            finally
            {
                if (item != null)
                {
                    if ((item.Fields != null) && (item.Fields.Length > 0))
                    {
                        Array.Clear(item.Fields, 0, item.Fields.Length);
                        item.Fields = null;
                    }
                    item.Clear();
                    item = null;
                }
                if (dtList != null)
                {
                    dtList.Clear();
                    dtList = null;
                }
            }
            return(table);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 加载指标
        /// </summary>
        /// <param name="type">类型</param>
        private void LoadType(MacroDataType type)
        {
            m_tvMacIndustry.ClearNodes();
            m_tvMacIndustry.Update();
            DataTable treeData = LocalDataRetriver.GetTreeCategoryTableFromFile(type);
            DataView  dv       = treeData.DefaultView;

            dv.Sort = "STR_MACROCODE ASC";
            Dictionary <String, TreeNodeA> nodesMap = new Dictionary <String, TreeNodeA>();

            foreach (DataRowView dRow in dv)
            {
                DataRow row        = dRow.Row;
                String  code       = row[0].ToString();
                String  parentCode = row[1].ToString();
                String  name       = row[2].ToString();
                if (nodesMap.ContainsKey(parentCode))
                {
                    TreeNodeA treeNode = new TreeNodeA();
                    treeNode.Name            = code;
                    treeNode.Style           = new GridCellStyle();
                    treeNode.Style.ForeColor = COLOR.ARGB(255, 255, 255);
                    treeNode.Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                    treeNode.Text            = name;
                    nodesMap[parentCode].AppendNode(treeNode);
                    nodesMap[code] = treeNode;
                }
                else
                {
                    TreeNodeA treeNode = new TreeNodeA();
                    treeNode.Name            = code;
                    treeNode.Text            = name;
                    treeNode.Style           = new GridCellStyle();
                    treeNode.Style.ForeColor = COLOR.ARGB(255, 255, 255);
                    treeNode.Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                    m_tvMacIndustry.AppendNode(treeNode);
                    nodesMap[code] = treeNode;
                }
            }
            m_tvMacIndustry.Update();
            m_tvMacIndustry.Invalidate();
        }
Ejemplo n.º 7
0
        public static DataTable GetTreeCategoryTableFromFile(MacroDataType treeType)
        {
            DataTable table = null;

            try
            {
                String str  = MongoDBConstant.DicTreeSource[treeType];
                String path = Path.Combine(LocalStorageRootDir, str);
                if (!File.Exists(path))
                {
                    //EMLoggerHelper.Write("File name '{0}' have not been found(path:'{1}')!", new object[] { str, path });
                    return(null);
                }
                table = JSONHelper.DeserializeObject <DataSet>(File.ReadAllText(path)).Tables[0];
            }
            catch (Exception exception)
            {
                //EMLoggerHelper.Write(exception);
            }
            return(table);
        }
Ejemplo n.º 8
0
 public static bool ShowFunctionExportButton(MacroDataType type)
 {
     return(MacroDataType.Rate != type);
 }
Ejemplo n.º 9
0
        public static DataSet GetExcelMutiIndicatorValuesFromService(String[] macroIDList, MacroDataType treeType)
        {
            DataSet dataFromIndicatorServer = new DataSet();

            try
            {
                String str = String.Join(",", macroIDList);
                new Stopwatch();
                String formatCommond = "$-edb\r\n$indicateupdate(name={0})\r\n";
                dataFromIndicatorServer = GetDataFromIndicatorServer(formatCommond, new object[] { str, DataCenter.UserID });
            }
            catch (Exception exception)
            {
                MessageBox.Show(String.Format("{0}{1}{2}", exception.Message, Environment.NewLine, exception.StackTrace));
            }
            return(dataFromIndicatorServer);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 单元格双击事件
        /// </summary>
        /// <param name="sender">调用者</param>
        /// <param name="cell">单元格</param>
        /// <param name="mp">坐标</param>
        /// <param name="button">按钮</param>
        /// <param name="clicks">点击次数</param>
        /// <param name="delta">滚轮值</param>
        private void GridCellClick(object sender, GridCell cell, POINT mp, MouseButtonsA button, int clicks, int delta)
        {
            TreeNodeA tn = cell as TreeNodeA;

            if (tn.m_nodes.Count == 0)
            {
                if (tn.Tag == null)
                {
                    try
                    {
                        MacroDataType type = (MacroDataType)Enum.Parse(typeof(MacroDataType), m_cbMacIndustry.Text);
                        DataTable     dt   = MongoRetriver.GetDescendantDataByService(tn.Name, type);
                        foreach (DataRow row in dt.Rows)
                        {
                            if (row[0].ToString().Length > 0 && row[3].ToString().Length > 0)
                            {
                                TreeNodeA node = new TreeNodeA();
                                node.Tag             = "2";
                                node.Style           = new GridCellStyle();
                                node.Style.ForeColor = COLOR.ARGB(255, 255, 80);
                                node.Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                                node.Text            = row["STR_MACRONAME"].ToString();
                                node.Name            = row[0].ToString();
                                tn.AppendNode(node);
                            }
                        }
                        tn.Tag = "1";
                        m_tvMacIndustry.Update();
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else if (tn.Tag.ToString() == "2")
                {
                    m_gridMacIndustry.ClearRows();
                    m_fundCurve.Clear();
                    FundCurveData  data  = new FundCurveData();
                    XAxisPointData xdata = new XAxisPointData();
                    Dictionary <String, YAxisCurveData> yDatas = new Dictionary <String, YAxisCurveData>();
                    YAxisStyle ySyle  = new YAxisStyle();
                    YAxisStyle ySyle1 = new YAxisStyle();
                    YAxisStyle ySyle2 = new YAxisStyle();
                    XAxisStyle xStyle = new XAxisStyle();
                    xStyle.XAxisType     = XAxisType.Date;
                    data.ChartTitle      = "每日进展";
                    xStyle.XAxisTitle    = "时间";
                    data.BackgroundColor = Color.Black;
                    DataTable      dt    = GetMacIndustyData(tn.Name, m_cbMacIndustry.Text);
                    YAxisCurveData yData = new YAxisCurveData();
                    yData.YPointValues = new List <double>();
                    yData.LineWidth    = 3;
                    yData.Text         = xdata.Text;
                    yData.ShowCycle    = true;
                    data.LstYAxisPointDatas.Add(yData);
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr[0].ToString().Length > 0 && dr[1].ToString().Length > 0)
                        {
                            GridRow row = new GridRow();
                            m_gridMacIndustry.AddRow(row);
                            DateTime date = Convert.ToDateTime(dr[0]);
                            row.AddCell("colN1", new GridStringCell(date.ToString("yyyy-MM-dd")));
                            row.AddCell("colN2", new GridStringCell(dr[1].ToString()));
                            row.GetCell("colN1").Style           = new GridCellStyle();
                            row.GetCell("colN1").Style.ForeColor = COLOR.ARGB(255, 255, 80);
                            row.GetCell("colN1").Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                            row.GetCell("colN2").Style           = new GridCellStyle();
                            row.GetCell("colN2").Style.ForeColor = COLOR.ARGB(255, 80, 80);
                            row.GetCell("colN2").Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                        }
                    }
                    int rowsSize = dt.Rows.Count;
                    for (int i = rowsSize - 1; i >= 0; i--)
                    {
                        DataRow dr = dt.Rows[i];
                        if (dr[0].ToString().Length > 0 && dr[1].ToString().Length > 0)
                        {
                            GridRow row = new GridRow();
                            m_gridMacIndustry.AddRow(row);
                            DateTime date = Convert.ToDateTime(dr[0]);
                            xdata.Value = date.Year * 10000 + date.Month * 100 + date.Day;
                            xdata.Text  = date.ToString("yyyyMMdd");
                            data.LstXAxisPointDatas.Add(xdata);
                            yData.YPointValues.Add(CStr.ConvertStrToDouble(dr[1].ToString()));
                        }
                    }
                    data.XAxisStyle        = xStyle;
                    ySyle.YAxisTitleAlign  = YAxisTitleAlign.Middle;
                    ySyle1.YAxisTitleAlign = YAxisTitleAlign.Middle;
                    ySyle2.YAxisTitleAlign = YAxisTitleAlign.Middle;
                    xStyle.XAxisTitleAlign = XAxisTitleAlign.Center;
                    data.LstYAxisStyle.Add(ySyle);
                    data.LstYAxisStyle.Add(ySyle1);
                    data.LstYAxisStyle.Add(ySyle2);
                    m_fundCurve.FundCurveData = data;
                    m_gridMacIndustry.Update();
                    m_gridMacIndustry.Invalidate();
                }
            }
        }