Ejemplo n.º 1
0
        private List<PortiaTrade> getConfirmTrades(List<PortiaTrade> trades)
        {
            List<PortiaTrade> confirms = new List<PortiaTrade>();
            int i = 1;
            foreach (PortiaTrade p in trades)
            {
                string str = p.ConfirmId.ToString();
                if (str != null && str.Length > 0)
                {
                   
                            PortiaTrade pt = new PortiaTrade();
                            pt.Broker = "MyBroker";
                            pt.BrokerNum ="1";
                            pt.Cusip = "45678907";
                            pt.ParentId = Convert.ToInt32(p.Id);
                            pt.Id = i++;
                            confirms.Add(pt);
                        
                    }
                
            }
            //using (MySqlConnection con = new MySqlConnection(ConnStr))
            //using (MySqlCommand cmd = new MySqlCommand(Constants.InsertMCMFilteredQuery, con) { CommandType = CommandType.Text })
            //{
            //    con.Open();
            //    try
            //    {
            //        using (MySqlDataReader reader = cmd.ExecuteReader())
            //        {
            //            while (reader.Read())
            //            {
            //                PortiaTrade newPortiaTrade = new PortiaTrade(reader["id"].ToString(),
            //                                                    reader["tran_#"].ToString(),
            //                                                    reader["portfolio"].ToString(),
            //                                                    reader["security_nm"].ToString(),
            //                                                    reader["cusip"].ToString(),
            //                                                    reader["tran_type"].ToString(),
            //                                                    reader["trade_date"].ToString(),
            //                                                    reader["settle_date"].ToString(),
            //                                                    reader["broker"].ToString(),
            //                                                    reader["broker_number"].ToString(),
            //                                                    reader["quantity"].ToString(),
            //                                                    reader["price"].ToString(),
            //                                                    reader["net_amount"].ToString(),
            //                                                    reader["interest"].ToString(),
            //                                                    reader["principal_amount"].ToString());
            //                newPortiaTrade.ConfirmId = Convert.ToInt32(reader["confirm_id"].ToString());
            //                trades.Add(newPortiaTrade);
            //            }
            //        }

            //    }
            //    catch (Exception ex)
            //    {
            //        Console.WriteLine(ex);
            //    }
            //}
            trades.AddRange(confirms);
            return trades;
        }
Ejemplo n.º 2
0
 public List<PortiaTrade> GetTrades()
 {
     List<PortiaTrade> trades = new List<PortiaTrade>();
     using (MySqlConnection con = new MySqlConnection(ConnStr))
     using (MySqlCommand cmd = new MySqlCommand(Constants.InsertMCMFilteredQuery, con) { CommandType = CommandType.Text })
     {
         con.Open();
         try
         {
             using (MySqlDataReader reader = cmd.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     PortiaTrade newPortiaTrade = new PortiaTrade(reader["id"].ToString(),
                                                         reader["tran_#"].ToString(),
                                                         reader["portfolio"].ToString(),
                                                         reader["security_nm"].ToString(),
                                                         reader["cusip"].ToString(),
                                                         reader["tran_type"].ToString(),
                                                         reader["trade_date"].ToString(),
                                                         reader["settle_date"].ToString(),
                                                         reader["broker"].ToString(),
                                                         reader["broker_number"].ToString(),
                                                         reader["quantity"].ToString(),
                                                         reader["price"].ToString(),
                                                         reader["net_amount"].ToString(),
                                                         reader["interest"].ToString(),
                                                         reader["principal_amount"].ToString());
                     newPortiaTrade.ConfirmId = Convert.ToInt32(reader["confirm_id"].ToString());
                     trades.Add(newPortiaTrade);
                 }
             }
             
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
         }
     }
     return getConfirmTrades(trades);
 }