示例#1
0
        public bool Add(OrderRow order)
        {
            string sql = string.Format("insert into {0}({1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}) VALUES(@{1}, @{2}, @{3}, @{4}, @{5}, @{6}, @{7}, @{8}, @{9}, @{10}, @{11}, @{12}, @{13}, @{14}, @{15}, @{16}, @{17}, @{18}, @{19}, @{20}, @{21}, @{22}, @{23}, @{24}, @{25}, @{26}, @{27}, @{28}, @{29}, @{30});", T_TableName,
                OrderRow.C_trade_date,
                OrderRow.C_order_id,
                OrderRow.C_security_id,
                OrderRow.C_direction,
                OrderRow.C_volume,
                OrderRow.C_multiplier,
                OrderRow.C_side,
                OrderRow.C_price,
                OrderRow.C_order_type,
                OrderRow.C_order_status,
                OrderRow.C_order_status_msg,
                OrderRow.C_original_volume,
                OrderRow.C_turn_over,
                OrderRow.C_front_id,
                OrderRow.C_session_id,
                OrderRow.C_local_order_id,
                OrderRow.C_xmdm,
                OrderRow.C_zcdy,
                OrderRow.C_zhdm,
                OrderRow.C_policy_id,
                OrderRow.C_trading_route,
                OrderRow.C_seat_id,
                OrderRow.C_client_id,
                OrderRow.C_sys_order_date,
                OrderRow.C_sys_order_settlement_id,
                OrderRow.C_sys_order_id,
                OrderRow.C_create_user_id,
                OrderRow.C_create_time,
                OrderRow.C_update_user_id,
                OrderRow.C_update_time);

            MySqlParameter[] parameters = new MySqlParameter[]{
                new MySqlParameter(string.Format("@{0}", OrderRow.C_trade_date), order.Trade_Date),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_order_id), order.Order_Id),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_security_id), order.Security_Id),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_direction), order.Direction), 
                new MySqlParameter(string.Format("@{0}", OrderRow.C_volume), order.Volume),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_multiplier), order.Multiplier),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_side), order.Side),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_price), order.Price),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_order_type), order.Order_Type),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_order_status), order.Order_Status),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_order_status_msg), order.Order_Status_Msg),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_original_volume), order.Original_Volume),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_turn_over), order.Turn_Over),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_front_id), order.Front_Id), 
                new MySqlParameter(string.Format("@{0}", OrderRow.C_session_id), order.Session_Id),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_local_order_id), order.Local_Order_Id),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_xmdm), order.Xmdm),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_zcdy), order.Zcdy),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_zhdm), order.Zhdm),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_policy_id), order.Policy_Id),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_trading_route), order.Trading_Route),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_seat_id), order.Seat_Id),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_client_id), order.Client_Id), 
                new MySqlParameter(string.Format("@{0}", OrderRow.C_sys_order_date), order.Sys_Order_Date),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_sys_order_settlement_id), order.Sys_Order_Settlement_Id),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_sys_order_id), order.Sys_Order_Id),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_create_user_id), order.Create_User_Id), 
                new MySqlParameter(string.Format("@{0}", OrderRow.C_create_time), order.Create_Time), 
                new MySqlParameter(string.Format("@{0}", OrderRow.C_update_user_id), order.Update_User_Id),
                new MySqlParameter(string.Format("@{0}", OrderRow.C_update_time), order.Update_Time),
            };

            return this.ExecuteNonQuery(sql, parameters) > 0;
        }
示例#2
0
        public OrderRow GetOrderRow(OrderRow_LH row)
        {
            OrderRow order = new OrderRow();

            order.Trade_Date = row.CrtDate != null ? row.CrtDate.Value.ToString("yyyyMMdd") : null;
            order.Order_Id = row.orderno.ToString();
            order.Security_Id = this.ConvertSecurityId(row);
            order.Direction = this.GetDirection(row);
            order.Volume = row.OrderNum;
            order.Multiplier = row.mUnitnum;
            order.Side = this.GetSideState(row);
            order.Price = row.OrderPr;
            order.Order_Type = row.OpenOrClose;
            //order.Order_Status = ;
            //order.Order_Status_Msg;
            //order.Original_Volume;
            //order.Turn_Over;
            //order.Front_Id;
            //order.Session_Id = ;
            //order.Local_Order_Id;
            order.Xmdm = row.xmdm;
            //order.Zcdy = ;
            //order.Zhdm = row.zmdm.ToString();
            order.Policy_Id = row.PolicyId;
            //order.Trading_Route;
            //order.Seat_Id;
            //order.Client_Id;
            //order.Sys_Order_Date;
            //order.Sys_Order_Settlement_Id;
            //order.Sys_Order_Id;
            //order.Create_User_Id;
            //order.Create_Iime;
            //order.Update_User_Id;
            //order.Update_Time;

            return order;
        }