private void ExportDate(int year)
        {
            var label = new List <string>();
            var times = new List <DateTime>();

            if (year == DateTime.Now.Year)
            {
                for (int i = 1; i <= DateTime.Now.Month; ++i)
                {
                    label.Add(string.Format("{0}年{1}月", year, i));
                    times.Add(new DateTime(year, i, 1));
                }
            }
            else
            {
                for (int i = 1; i <= 12; ++i)
                {
                    label.Add(string.Format("{0}年{1}月", year, i));
                    times.Add(new DateTime(year, i, 1));
                }
            }

            var dlg = new ExportExcel2Dlg(label, m_model);

            dlg.StartPosition = FormStartPosition.CenterParent;
            dlg.GetCellStr   += GetCellStr;

            for (int i = 0; i < times.Count; ++i)
            {
                var r = new Dictionary <string, object>();
                r["datepoint"] = times[i];
                dlg.ALL_SERVERS.Add((all) => {
                    var dic = new Dictionary <string, object>();
                    var d1  = DataStatistic.MonthStatistic1(r).Result;
                    var d2  = DataStatistic.MonthStatistic2(r).Result;
                    var d3  = DataStatistic.MonthStatistic3(r).Result;
                    var d4  = DataStatistic.MonthStatistic4(r).Result;
                    var d5  = DataStatistic.MonthStatistic5(r).Result;
                    Commons.DictionaryAddResult(dic, d1);
                    Commons.DictionaryAddResult(dic, d2);
                    Commons.DictionaryAddResult(dic, d3);
                    Commons.DictionaryAddResult(dic, d4);
                    Commons.DictionaryAddResult(dic, d5);
                    all.Add(dic);
                });
            }
            dlg.ShowDialog();
        }
Exemple #2
0
        private void UpdateTable1(bool initial)
        {
            var allData = new Dictionary <string, object>();

            if (!initial)
            {
                btnSearch.Enabled            = false;
                wbInvestorsInfo.DocumentText = "";
                var r = new Dictionary <string, object>();
                r["datepoint"] = dtpSearchDate.Value.AddDays(1).TruncToStart();
                var dlg = new BatchProcessMultipleServers();
                dlg.StartPosition = FormStartPosition.CenterParent;
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.DailyStatistic1(r)); });
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.DailyStatistic2(r)); });
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.DailyStatistic3(r)); });
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.DailyStatistic4(r)); });
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.DailyStatistic5(r)); });
                dlg.ShowDialog();

                foreach (var d in dlg.AllResult)
                {
                    if (d.IsOk)
                    {
                        Commons.DictionaryAddResult(allData, d);
                    }
                }
            }

            string info = "<p>人数单位:个,金额单位:元</p>";

            info += "<table border=1 cellspacing=0 align=center>";
            for (int row = 0; row < m_allData.Count; ++row)
            {
                info += string.Format("<tr><td {0} {1}><b>&nbsp;{3}</b></td><td {0} {2}>&nbsp;{4}</td> <td {0} {1}><b>&nbsp;{5}</b></td><td {0} {2}>&nbsp;{6}</td></tr>",
                                      "align=center valign=middle", "width=210", "width=110",
                                      m_allData[row].Item1, allData.GetOrDefault <string>(m_allData[row].Item2),
                                      m_allData[row].Item3, allData.GetOrDefault <string>(m_allData[row].Item4));
            }
            info += "</table>";

            info += string.Format(@"<p> </p>
                    <dl><dt>投资注册人数:</dt>
                    <dd>第一次投资时间在{0}的人数</dd></dl>
                    <dl><dt>新增注册人数:</dt>
                    <dd>注册时间在{0}的人数</dd></dl>
                    <dl><dt>提现人数:</dt>
                    <dd>在{0}曾经成功提现的人数(分为投资人和其他两类)</dd></dl>
                    <dl><dt>充值人数:</dt>
                    <dd>在{0}曾经成功充值的人数(分为投资人和其他两类)</dd></dl>
                    <dl><dt>投资人数:</dt>
                    <dd>在{0}曾经成功投资的人数</dd></dl>
                    <dl><dt>提现金额:</dt>
                    <dd>在{0}曾经成功提现的总金额(分为投资人和其他两类)</dd></dl>
                    <dl><dt>充值金额:</dt>
                    <dd>在{0}曾经成功充值的总金额(分为投资人和其他两类)</dd></dl>
                    <dl><dt>投资金额:</dt>
                    <dd>在{0}曾经成功投资的总金额</dd></dl>
                    <dl><dt>债权转让成交金额:</dt>
                    <dd>在{0}曾经成功转让的标价总额</dd></dl>
                    <dl><dt>借款余额:</dt>
                    <dd>新系统截止到统计日期结束的总放款-总还本</dd></dl>"
                                  , "指定日的00:00:00到指定日的23:59:59之间");

            wbInvestorsInfo.DocumentText = info;

            btnSearch.Enabled = true;
        }
        private void UpdateTable(bool initial)
        {
            var allData = new Dictionary <string, object>();

            if (!initial)
            {
                btnSearch.Enabled            = false;
                wbDataStatistic.DocumentText = "";

                var r   = new Dictionary <string, object>();
                var now = dtpSearchDate.Value;
                r["datepoint1"] = new DateTime(now.Year, now.Month, 1).AddDays(-1).TruncToEnd();
                r["datepoint2"] = new DateTime(now.Year, now.Month, 1).AddMonths(1).TruncToStart();
                var dlg = new BatchProcessMultipleServers();
                dlg.StartPosition = FormStartPosition.CenterParent;
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.MonthStatistic1(r)); });
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.MonthStatistic2(r)); });
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.MonthStatistic3(r)); });
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.MonthStatistic4(r)); });
                dlg.ALL_SEVERS.Add(async() => { return(await DataStatistic.MonthStatistic5(r)); });
                dlg.ShowDialog();

                foreach (var d in dlg.AllResult)
                {
                    if (d.IsOk)
                    {
                        Commons.DictionaryAddResult(allData, d);
                    }
                }
            }

            string info = "<p>人数单位:个,金额单位:元</p>";

            info += "<table border=1 cellspacing=0 align=center>";
            for (int row = 0; row < m_model.Count; ++row)
            {
                info += string.Format("<tr><td {0} {1}><b>&nbsp;{3}</b></td><td {0} {2}>&nbsp;{4}</td> <td {0} {1}><b>&nbsp;{5}</b></td><td {0} {2}>&nbsp;{6}</td></tr>",
                                      "align=center valign=middle", "width=220", "width=110",
                                      GetCellStr(m_model[row][0], allData), GetCellStr(m_model[row][1], allData),
                                      GetCellStr(m_model[row][2], allData), GetCellStr(m_model[row][3], allData));
            }
            info += "</table>";

            info += string.Format(@"<p> </p>
                                   <dl><dt>投资注册人数:</dt>
                                   <dd>第一次投资时间在{0}的人数</dd></dl>
                                   <dl><dt>新增注册人数:</dt>
                                   <dd>注册时间在{0}的人数</dd></dl>
                                   <dl><dt>提现人数:</dt>
                                   <dd>在{0}曾经成功提现的人数(分为投资人和其他两类)</dd></dl>
                                   <dl><dt>充值人数:</dt>
                                   <dd>在{0}曾经成功充值的人数(分为投资人和其他两类)</dd></dl>
                                   <dl><dt>投资人数:</dt>
                                   <dd>在{0}曾经成功投资的人数</dd></dl>
                                   <dl><dt>提现金额:</dt>
                                   <dd>在{0}曾经成功提现的总金额(分为投资人和其他两类)</dd></dl>
                                   <dl><dt>充值金额:</dt>
                                   <dd>在{0}曾经成功充值的总金额(分为投资人和其他两类)</dd></dl>
                                   <dl><dt>投资金额:</dt>
                                   <dd>在{0}曾经成功投资的总金额</dd></dl>
                                   <dl><dt>债权转让成交金额:</dt>
                                   <dd>在{0}曾经成功转让的标价总额</dd></dl>
                                   <dl><dt>借款余额:</dt>
                                   <dd>新系统截止到统计月结束的总放款-总还本</dd></dl>", "指定月");

            wbDataStatistic.DocumentText = info;


            btnSearch.Enabled = true;
        }