Exemplo n.º 1
0
        private void backgroundWorker报价_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            switch (e.ProgressPercentage)
            {
            case 0:
                this.toolStripStatusLabel时间.Text = DateTime.Now.ToString("HH:mm:ss");

                break;

            case 1:
                AASClient.AASServiceReference.DbDataSet.平台用户DataTable 平台用户DataTable1 = e.UserState as AASClient.AASServiceReference.DbDataSet.平台用户DataTable;
                Tool.RefreshDrcjDataTable(Program.serverDb.平台用户, 平台用户DataTable1, new string[] { "用户名" });
                Program.Current平台用户 = Program.serverDb.平台用户.First(r => r.用户名 == Program.Current平台用户.用户名);
                break;

            case 2:
                AASClient.AASServiceReference.DbDataSet.额度分配DataTable TradeLimitDataTable = e.UserState as AASClient.AASServiceReference.DbDataSet.额度分配DataTable;
                Tool.RefreshDrcjDataTable(Program.serverDb.额度分配, TradeLimitDataTable, new string[] { "证券代码" });

                foreach (HqForm HqForm1 in this.hqForm)
                {
                    HqForm1.comboBox代码.AutoCompleteCustomSource.Clear();

                    foreach (AASClient.AASServiceReference.DbDataSet.额度分配Row 交易额度Row1 in Program.serverDb.额度分配)
                    {
                        HqForm1.comboBox代码.AutoCompleteCustomSource.Add(string.Format("{0} {1} {2}", 交易额度Row1.证券代码, 交易额度Row1.拼音缩写, 交易额度Row1.证券名称));
                        HqForm1.comboBox代码.AutoCompleteCustomSource.Add(string.Format("{0} {1} {2}", 交易额度Row1.拼音缩写, 交易额度Row1.证券代码, 交易额度Row1.证券名称));
                    }
                }
                break;

            case 3:

                break;

            case 4:
                AASClient.AASServiceReference.JyDataSet.成交DataTable 成交DataTable1 = e.UserState as AASClient.AASServiceReference.JyDataSet.成交DataTable;
                Tool.RefreshDrcjDataTable(Program.jyDataSet.成交, 成交DataTable1, new string[] { "组合号", "委托编号", "成交编号" });
                break;

            case 5:
                RefreshOrder(e);

                break;

            case 6:
                AASClient.AASServiceReference.DbDataSet.订单DataTable 订单DataTable1 = e.UserState as AASClient.AASServiceReference.DbDataSet.订单DataTable;
                Tool.RefreshDrcjDataTable(Program.serverDb.订单, 订单DataTable1, new string[] { "组合号", "证券代码" });
                break;

            case 7:
                AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable 已平仓订单DataTable1 = e.UserState as AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable;
                Program.serverDb.已平仓订单.Clear();
                Program.serverDb.已平仓订单.Merge(已平仓订单DataTable1);

                Refresh业绩();
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        private void backgroundWorker报价_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            switch (e.ProgressPercentage)
            {
            case 0:
                this.toolStripStatusLabel时间.Text = DateTime.Now.ToString("HH:mm:ss");
                break;

            case 1:
                AASClient.AASServiceReference.DbDataSet.平台用户DataTable 平台用户DataTable1 = e.UserState as AASClient.AASServiceReference.DbDataSet.平台用户DataTable;
                Tool.RefreshDrcjDataTable(Program.serverDb.平台用户, 平台用户DataTable1, new string[] { "用户名" });
                Program.Current平台用户 = Program.serverDb.平台用户.First(r => r.用户名 == Program.Current平台用户.用户名);
                break;

            case 2:
                AASClient.AASServiceReference.DbDataSet.额度分配DataTable TradeLimitDataTable = e.UserState as AASClient.AASServiceReference.DbDataSet.额度分配DataTable;
                Tool.RefreshDrcjDataTable(Program.serverDb.额度分配, TradeLimitDataTable, new string[] { "证券代码" });

                foreach (HqForm HqForm1 in this.hqForm)
                {
                    HqForm1.comboBox代码.AutoCompleteCustomSource.Clear();

                    foreach (AASClient.AASServiceReference.DbDataSet.额度分配Row 交易额度Row1 in Program.serverDb.额度分配)
                    {
                        HqForm1.comboBox代码.AutoCompleteCustomSource.Add(string.Format("{0}", 交易额度Row1.证券代码));
                    }
                }
                break;

            case 3:

                break;

            case 4:
                AASClient.AASServiceReference.JyDataSet.成交DataTable 成交DataTable1 = e.UserState as AASClient.AASServiceReference.JyDataSet.成交DataTable;
                Tool.RefreshDrcjDataTable(Program.jyDataSet.成交, 成交DataTable1, new string[] { "组合号", "委托编号", "成交编号" });
                break;

            case 5:
                RefreshOrder(e);

                break;

            case 6:
                AASClient.AASServiceReference.DbDataSet.订单DataTable 订单DataTable1 = e.UserState as AASClient.AASServiceReference.DbDataSet.订单DataTable;
                foreach (AASClient.AASServiceReference.DbDataSet.订单Row 订单Row1 in 订单DataTable1)
                {
                    if (Program.HqDataTable.ContainsKey(订单Row1.证券代码))
                    {
                        DataTable DataTable1 = Program.HqDataTable[订单Row1.证券代码];
                        DataRow   DataRow1   = DataTable1.Rows[0];
                        decimal   XJ         = decimal.Parse((DataRow1["现价"] as string));
                        decimal   ZS         = decimal.Parse((DataRow1["昨收"] as string));
                        订单Row1.当前价位 = Math.Round((XJ == 0 ? ZS : XJ), 8, MidpointRounding.AwayFromZero);


                        //订单Row1.刷新浮动盈亏(Program.Current平台用户.手续费率);
                        订单Row1.刷新浮动盈亏();
                    }
                }
                Tool.RefreshDrcjDataTable(Program.serverDb.订单, 订单DataTable1, new string[] { "组合号", "证券代码" });
                break;

            case 7:
                AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable 已平仓订单DataTable1 = e.UserState as AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable;
                Program.serverDb.已平仓订单.Clear();
                Program.serverDb.已平仓订单.Merge(已平仓订单DataTable1);


                AASClient.AASServiceReference.JyDataSet.业绩统计DataTable 业绩统计DataTable2 = this.Generate业绩统计();
                Tool.RefreshDrcjDataTable(Program.jyDataSet.业绩统计, 业绩统计DataTable2, new string[] { "证券代码" });
                break;

            default:
                break;
            }
        }
Exemplo n.º 3
0
        private void backgroundWorker报价_DoWork(object sender, DoWorkEventArgs e)
        {
            while (!this.backgroundWorker报价.CancellationPending)
            {
                this.backgroundWorker报价.ReportProgress(0);


                try
                {
                    if (DateTime.Now >= this.LastFetchDay.AddDays(1).AddHours(1))
                    {
                        Program.AASServiceClient.FectchAllTable(Program.Current平台用户.用户名);
                        this.LastFetchDay = DateTime.Today;
                    }



                    成交DataTableChanged 成交DataTableChanged1;
                    if (Program.成交表通知.TryDequeue(out 成交DataTableChanged1))
                    {
                        AASClient.AASServiceReference.JyDataSet.成交DataTable 成交DataTable1 = 成交DataTableChanged1.TableChanged as AASClient.AASServiceReference.JyDataSet.成交DataTable;
                        this.backgroundWorker报价.ReportProgress(4, 成交DataTable1);
                    }


                    委托DataTableChanged 委托DataTableChanged1;
                    if (Program.委托表通知.TryDequeue(out 委托DataTableChanged1))
                    {
                        AASClient.AASServiceReference.JyDataSet.委托DataTable 委托DataTable1 = 委托DataTableChanged1.TableChanged as AASClient.AASServiceReference.JyDataSet.委托DataTable;
                        this.backgroundWorker报价.ReportProgress(5, 委托DataTable1);
                    }

                    平台用户DataTableChanged 平台用户DataTableChanged1;
                    if (Program.平台用户表通知.TryDequeue(out 平台用户DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.平台用户DataTable 平台用户DataTable1 = 平台用户DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.平台用户DataTable;
                        this.backgroundWorker报价.ReportProgress(1, 平台用户DataTable1);
                    }

                    额度分配DataTableChanged 额度分配DataTableChanged1;
                    if (Program.额度分配表通知.TryDequeue(out 额度分配DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.额度分配DataTable 额度分配DataTable1 = 额度分配DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.额度分配DataTable;
                        this.backgroundWorker报价.ReportProgress(2, 额度分配DataTable1);
                    }

                    订单DataTableChanged 订单DataTableChanged1;
                    if (Program.订单表通知.TryDequeue(out 订单DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.订单DataTable 订单DataTable1 = 订单DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.订单DataTable;

                        foreach (AASClient.AASServiceReference.DbDataSet.订单Row 订单Row1 in 订单DataTable1)
                        {
                            if (Program.HqDataTable.ContainsKey(订单Row1.证券代码))
                            {
                                DataTable DataTable1 = Program.HqDataTable[订单Row1.证券代码];
                                DataRow   DataRow1   = DataTable1.Rows[0];
                                decimal   XJ         = decimal.Parse((DataRow1["现价"] as string));
                                decimal   ZS         = decimal.Parse((DataRow1["昨收"] as string));
                                订单Row1.当前价位 = Math.Round((XJ == 0 ? ZS : XJ), L2Api.Get精度(订单Row1.证券代码), MidpointRounding.AwayFromZero);


                                //订单Row1.刷新浮动盈亏(Program.Current平台用户.手续费率);
                                订单Row1.刷新浮动盈亏();
                            }
                        }

                        this.backgroundWorker报价.ReportProgress(6, 订单DataTable1);
                    }

                    已平仓订单DataTableChanged 已平仓订单DataTableChanged1;
                    if (Program.已平仓订单表通知.TryDequeue(out 已平仓订单DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable 已平仓订单DataTable1 = 已平仓订单DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable;
                        this.backgroundWorker报价.ReportProgress(7, 已平仓订单DataTable1);
                    }



                    Notify Notify1;
                    if (Program.交易通知.TryDequeue(out Notify1))
                    {
                        Program.logger.LogJy(Notify1.操作员, Notify1.证券代码, Notify1.证券名称, Notify1.委托编号, Notify1.买卖方向, Notify1.委托数量, Notify1.委托价格, Notify1.信息);
                    }



                    Thread.Sleep(100);
                }
                catch (Exception ex)
                {
                    Program.logger.LogRunning("报价线程异常:{0} {1}", ex.Message, ex.StackTrace);

                    Thread.Sleep(1000);
                }
            }
        }
Exemplo n.º 4
0
        private void backgroundWorker报价_DoWork(object sender, DoWorkEventArgs e)
        {
            while (!this.backgroundWorker报价.CancellationPending)
            {
                this.backgroundWorker报价.ReportProgress(0);

                try
                {
                    if (DateTime.Now >= this.LastFetchDay.AddDays(1).AddHours(1))
                    {
                        Program.AASServiceClient.FectchAllTable(Program.Current平台用户.用户名);
                        this.LastFetchDay = DateTime.Today;
                    }

                    成交DataTableChanged 成交DataTableChanged1;
                    if (Program.成交表通知.TryDequeue(out 成交DataTableChanged1))
                    {
                        AASClient.AASServiceReference.JyDataSet.成交DataTable 成交DataTable1 = 成交DataTableChanged1.TableChanged as AASClient.AASServiceReference.JyDataSet.成交DataTable;
                        this.backgroundWorker报价.ReportProgress(4, 成交DataTable1);
                    }


                    委托DataTableChanged 委托DataTableChanged1;
                    if (Program.委托表通知.TryDequeue(out 委托DataTableChanged1))
                    {
                        AASClient.AASServiceReference.JyDataSet.委托DataTable 委托DataTable1 = 委托DataTableChanged1.TableChanged as AASClient.AASServiceReference.JyDataSet.委托DataTable;
                        this.backgroundWorker报价.ReportProgress(5, 委托DataTable1);
                    }

                    平台用户DataTableChanged 平台用户DataTableChanged1;
                    if (Program.平台用户表通知.TryDequeue(out 平台用户DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.平台用户DataTable 平台用户DataTable1 = 平台用户DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.平台用户DataTable;
                        this.backgroundWorker报价.ReportProgress(1, 平台用户DataTable1);
                    }

                    额度分配DataTableChanged 额度分配DataTableChanged1;
                    if (Program.额度分配表通知.TryDequeue(out 额度分配DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.额度分配DataTable 额度分配DataTable1 = 额度分配DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.额度分配DataTable;
                        this.backgroundWorker报价.ReportProgress(2, 额度分配DataTable1);
                    }

                    订单DataTableChanged 订单DataTableChanged1;
                    if (Program.订单表通知.TryDequeue(out 订单DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.订单DataTable 订单DataTable1 = 订单DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.订单DataTable;
                        this.backgroundWorker报价.ReportProgress(6, 订单DataTable1);
                    }

                    已平仓订单DataTableChanged 已平仓订单DataTableChanged1;
                    if (Program.已平仓订单表通知.TryDequeue(out 已平仓订单DataTableChanged1))
                    {
                        AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable 已平仓订单DataTable1 = 已平仓订单DataTableChanged1.TableChanged as AASClient.AASServiceReference.DbDataSet.已平仓订单DataTable;
                        this.backgroundWorker报价.ReportProgress(7, 已平仓订单DataTable1);
                    }



                    Notify Notify1;
                    if (Program.交易通知.TryDequeue(out Notify1))
                    {
                        Program.logger.LogJy(Notify1.操作员, Notify1.证券代码, Notify1.证券名称, Notify1.委托编号, Notify1.买卖方向, Notify1.委托数量, Notify1.委托价格, Notify1.信息);
                    }



                    Thread.Sleep(100);
                }
                catch (Exception ex)
                {
                    Program.logger.LogRunning("报价线程异常:{0} {1}", ex.Message, ex.StackTrace);

                    Thread.Sleep(1000);
                }
            }
        }