示例#1
0
 public ExecutionReport(ExecType execType, OrderStatus orderStatus)
     : base(MessageType.ExecutionReport)
 {
     ExecTransType = ExecTransType.New;
     ExecType      = execType;
     OrderStatus   = orderStatus;
 }
示例#2
0
        private object Execute(string sql, dynamic parameters, ExecType execType, CommandType commandType, int commandTimeOut)
        {
            object _result = null;

            using (DbConnection connection = ConnectionFactory.Instance.Create(Config.ConnectionType, Config.ConnectionString))
            {
                connection.Open();
                using (DbCommand command = connection.CreateCommand())
                {
                    command.CommandText    = sql;
                    command.CommandType    = commandType;
                    command.CommandTimeout = commandTimeOut;

                    SetParameters(command, parameters);

                    RaisePreExecute(connection, command);

                    if (execType == ExecType.Scalar)
                    {
                        _result = command.ExecuteScalar();
                    }
                    else
                    {
                        command.ExecuteNonQuery();
                    }
                }
                connection.Close();
            }
            return(_result);
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the ExecutionReport class.
 /// </summary>
 /// <param name="type">A trade direction. Possible values include:
 /// 'Unknown', 'Buy', 'Sell'</param>
 /// <param name="time">Transaction time</param>
 /// <param name="price">An actual price of the execution or
 /// order</param>
 /// <param name="volume">Trade volume</param>
 /// <param name="fee">Execution fee</param>
 /// <param name="success">Indicates that operation was
 /// successful</param>
 /// <param name="executionStatus">Current status of the order. Possible
 /// values include: 'Unknown', 'Fill', 'PartialFill', 'Cancelled',
 /// 'Rejected', 'New', 'Pending'</param>
 /// <param name="failureType">Possible values include: 'None',
 /// 'Unknown', 'ExchangeError', 'ConnectorError',
 /// 'InsufficientFunds'</param>
 /// <param name="orderType">A type of the order. Possible values
 /// include: 'Unknown', 'Market', 'Limit'</param>
 /// <param name="execType">A type of the execution. ExecType = Trade
 /// means it is an execution, otherwise it is an order. Possible values
 /// include: 'Unknown', 'New', 'PartialFill', 'Fill', 'DoneForDay',
 /// 'Cancelled', 'Replace', 'PendingCancel', 'Stopped', 'Rejected',
 /// 'Suspended', 'PendingNew', 'Calculated', 'Expired', 'Restarted',
 /// 'PendingReplace', 'Trade', 'TradeCorrect', 'TradeCancel',
 /// 'OrderStatus'</param>
 /// <param name="clientOrderId">A client assigned ID of the
 /// order</param>
 /// <param name="exchangeOrderId">An exchange assigned ID of the
 /// order</param>
 /// <param name="instrument">An instrument description</param>
 /// <param name="feeCurrency">Fee currency</param>
 /// <param name="message">An arbitrary message from the exchange
 /// related to the execution|order</param>
 public ExecutionReport(
     TradeType type,
     DateTime time,
     double price,
     double volume,
     double fee,
     bool success,
     OrderExecutionStatus executionStatus,
     OrderStatusUpdateFailureType failureType,
     OrderType orderType,
     ExecType execType,
     string clientOrderId   = null,
     string exchangeOrderId = null,
     Instrument instrument  = null,
     string feeCurrency     = null,
     string message         = null)
 {
     this.ClientOrderId   = clientOrderId;
     this.ExchangeOrderId = exchangeOrderId;
     this.Instrument      = instrument;
     this.Type            = type;
     this.Time            = time;
     this.Price           = price;
     this.Volume          = volume;
     this.Fee             = fee;
     this.FeeCurrency     = feeCurrency;
     this.Success         = success;
     this.ExecutionStatus = executionStatus;
     this.FailureType     = failureType;
     this.Message         = message;
     this.OrderType       = orderType;
     this.ExecType        = execType;
 }
示例#4
0
 public void SetPositionStatusFromExecution(ExecType execType)
 {
     if (execType == ExecType.New)
     {
         PosStatus = PositionStatus.New;
     }
     else if (execType == ExecType.DoneForDay)
     {
         PosStatus = PositionStatus.DoneForDay;
     }
     else if (execType == ExecType.Canceled)
     {
         PosStatus = PositionStatus.Canceled;
     }
     else if (execType == ExecType.Replaced)
     {
         PosStatus = PositionStatus.Replaced;
     }
     else if (execType == ExecType.PendingCancel)
     {
         PosStatus = PositionStatus.PendingCancel;
     }
     else if (execType == ExecType.Stopped)
     {
         PosStatus = PositionStatus.Stopped;
     }
     else if (execType == ExecType.Rejected)
     {
         PosStatus = PositionStatus.Rejected;
     }
     else if (execType == ExecType.Suspended)
     {
         PosStatus = PositionStatus.Suspended;
     }
     else if (execType == ExecType.PendingNew)
     {
         PosStatus = PositionStatus.PendingNew;
     }
     else if (execType == ExecType.Calculated)
     {
         PosStatus = PositionStatus.Calculated;
     }
     else if (execType == ExecType.Expired)
     {
         PosStatus = PositionStatus.Expired;
     }
     else if (execType == ExecType.PendingReplace)
     {
         PosStatus = PositionStatus.PendingReplace;
     }
     else if (execType == ExecType.Trade)
     {
         PosStatus = LeavesQty == 0 ? PositionStatus.Filled : PositionStatus.PartiallyFilled;
     }
     else if (execType == ExecType.Unknown)
     {
         PosStatus = PositionStatus.Unknown;
     }
 }
示例#5
0
 public ExecTemplate(ExecType templ, string name, string first_path, string exe_pat, string opts = "")
 {
     this.templ   = templ;
     this.name    = name;
     this.exe_pat = exe_pat;
     this.paths   = new string[] { first_path };
     this.opts    = opts;
 }
示例#6
0
 public ToAddElement(string[] buts, string element, ExecType type, ExecutorType executorType, bool tag = true)
 {
     this.buts         = buts;
     this.element      = element;
     this.type         = type;
     this.executorType = executorType;
     this.tag          = tag;
 }
示例#7
0
 public QueryBase(SqlConnection _sqlConnection,
                  fCompleter _completer,
                  ExecType _type)
 {
     sqlConnection = _sqlConnection;
     completer     = _completer;
     type          = _type;
 }
示例#8
0
 public ExecTemplate(ExecType templ, string name, string[] paths, string exe_pat, string opts = "")
 {
     this.templ   = templ;
     this.name    = name;
     this.exe_pat = exe_pat;
     this.paths   = paths;
     this.opts    = opts;
 }
示例#9
0
 /// <summary>
 /// 相关存储过程调用(调用前请构建好参数)
 /// </summary>
 /// <param name="procName">存储过程名</param>
 /// <param name="errStrPoint">标识错误信息(便于定位错误,如果出错会加载在错误信息之前)</param>
 /// <param name="execType">调用存储过程类别(默认为ExecType.DoExecuteNonQuery的操作)</param>
 public void DoWork(string procName, string errStrPoint = "", ExecType execType = ExecType.DoExecuteNonQuery)
 {
     switch (execType)
     {
     case ExecType.DoExecuteNonQuery:
         DoExecuteNonQueryInWork(procName, errStrPoint);
         break;
     }
 }
示例#10
0
        /// <summary>
        /// Stops m_Process from running. No-op if already stopped.
        /// </summary>
        /// <param name="type">stop type (crashed / normal close)</param>
        public void Stop(ExecType type)
        {
            if (m_Process != null)
            {
                // do not raise events if we are stopping
                m_Process.EnableRaisingEvents = false;
                m_Process.Exited -= OnProcessCrashed;

                try
                {
                    // Step 1. Ask window to close by sending WM_CLOSE
                    if (HasWindow)
                    {
                        m_Process.CloseMainWindow();
                        m_Process.WaitForExit(1000);
                    }

                    // Step 2. Ask C# Kill API to handle it
                    if (!m_Process.HasExited)
                    {
                        Logger.ProcessRunner.Warn("Failed to close with WM_CLOSE");
                        m_Process.Kill();
                        m_Process.WaitForExit(1000);
                    }

                    // Step 3. task kill that mo-fo, fo-sho
                    if (!m_Process.HasExited)
                    {
                        Logger.ProcessRunner.Warn("Failed to close with Kill API");
                        ExecuteScript("taskkill",
                                      string.Format("/F /T /IM {0}.exe", m_Process.ProcessName), true);
                    }

                    m_Process.Dispose();
                    m_Process = null;
                }
                catch (Exception ex)
                {
                    Logger.ProcessRunner.ErrorFormat("Error shutting down the process: {0}",
                                                     ex.Message);
                }
            }

            if (!String.IsNullOrWhiteSpace(m_CachedName))
            {
                if (Process.GetProcessesByName(m_CachedName).Length > 0)
                {
                    Logger.ProcessRunner.Warn("A leftover process found with the cached name.");

                    ExecuteScript("taskkill",
                                  string.Format("/F /T /IM {0}.exe", m_CachedName), true);
                }
            }

            OnProcessStopped(type);
        }
示例#11
0
        //! @cond
        private void OnProcessStarted(ExecType type)
        {
            m_Monitoring = true;
            m_CachedName = m_Process.ProcessName;

            if (ProcessStarted != null)
            {
                ProcessStarted(type);
            }
        }
示例#12
0
 public TimedTask(string deviceId, int portNumber, bool enabled, string taskId, ExecType execType, ExecAction execAction, int executed, LoopType loopType, Moment moment, string loopMonent)
     : this()
 {
     DeviceId   = deviceId;
     PortNumber = portNumber;
     Enabled    = enabled;
     TaskId     = taskId;
     ExecType   = execType;
     ExecAction = execAction;
     Executed   = executed;//未执行 执行中 已执行
     LoopType   = loopType;
     Moment     = moment;
     LoopMonent = loopMonent;
 }
示例#13
0
        // ExecCropAndAnalize
        private void ExecCropAndAnalizeAll(ExecType type)
        {
            // Refresh Data
            InitData_ResultTypeInfo();
            InitData_AnalyzeResultInfo();

            // Refresh UI
            RefreshUI_ResultTypeInfo();
            RefreshUI_AnalyzeResultInfo();

            Util.Log("===============ExecCropAndAnalizeAll Start===============");

            backWorkerExec.RunWorkerAsync(type);
        }
示例#14
0
        /// <summary>
        /// Creates an executive of the built-in type specified by the provided enumeration.
        /// </summary>
        /// <param name="execType">Type of the execute.</param>
        /// <param name="guid">The unique identifier.</param>
        /// <returns>IExecutive.</returns>
        public IExecutive CreateExecutive(ExecType execType, Guid guid)
        {
            switch (execType)
            {
            case ExecType.FullFeatured:
                return(CreateExecutive(typeof(Highpoint.Sage.SimCore.Executive).FullName, guid));

            case ExecType.SingleThreaded:
                return(CreateExecutive(typeof(Highpoint.Sage.SimCore.ExecutiveFastLight).FullName, guid));

            default:
                throw new ApplicationException("Attempt to create an instance of an unsupported executive (" + execType + ").");
            }
        }
示例#15
0
        private object Execute(TCOMMAND commandObject, ExecType execType)
        {
            Init();

            object _result = null;

            using (DbConnection connection = ConnectionFactory.Instance.Create(Config.ConnectionTypeName, Config.ConnectionString))
            {
                connection.Open();
                _result = Execute(connection, null, commandObject, execType);
                connection.Close();
            }
            return(_result);
        }
        private void ReportOrder(OrderField order, ExecType execType, OrderStatus newStatus, int errorId = 0, int rawErrorId = 0, string text = "")
        {
            order.Status = newStatus;
            var report = order.Clone();

            report.ExecType = execType;
            if (!string.IsNullOrEmpty(text))
            {
                report.XErrorID   = errorId;
                report.RawErrorID = rawErrorId;
                report.SetText(text);
            }
            _client.Spi.ProcessRtnOrder(report);
        }
示例#17
0
        protected override void Read(FixMessage msg)
        {
            this.clOrdId     = (msg[11] != null) ? msg[11].Value : "";
            this.orderId     = (msg[37] != null) ? msg[37].Value : "";
            this.orderStatus = msg[39] != null?GetOrderStatus(msg[39].Value) : OrderStatus.NotFilled;

            if (msg[150] != null)
            {
                this.execType = GetExecType(msg[150].Value);
            }
            else
            {
                this.execType = ExecType.Unknown;
            }
        }
示例#18
0
        public ExecutionReport(ExecType execType, OrderStatus orderStatus, Order order, OrderInfo orderInfo)
            : base(MessageType.ExecutionReport)
        {
            OrderId                  = orderInfo.OrderId;
            ClientOrderId            = orderInfo.ClientId;
            PreviousClientOrderId    = orderInfo.PreviousClientId;
            CorrelationClientOrderId = orderInfo.CorrelationClientId;

            SecurityId   = order.Security.Id.ToString();
            SecurityType = order.Security.Type;
            Product      = order.Security.Product;
            Contract     = order.Security.Contract;

            OrderType   = order.Type;
            TimeInForce = order.TimeInForce;
            ExpireDate  = order.ExpireDate;

            Side = order.Side;

            Price     = order.Price;
            StopPrice = order.StopPrice;

            Quantity           = order.Quantity;
            MinQuantity        = order.MinQuantity;
            MaxVisibleQuantity = order.MaxVisibleQuantity;

            TransactTime = DateTime.UtcNow;

            SelfMatchPreventionId          = order.SelfMatchId;
            SelfMatchPreventionInstruction = order.SelfMatchMode;

            Account = orderInfo.Account;

            IsManualOrder = orderInfo.IsManual;
            CustomerOrderHandlingInstruction = Cme.CustomerOrderHandlingInstruction.AlgoEngine;
            PreTradeAnonymity = false;

            ExecTransType = ExecTransType.New;
            ExecType      = execType;
            ExecutionId   = Guid.NewGuid().ToString();

            OrderStatus        = orderStatus;
            AverageFilledPrice = 0;
            FilledQuantity     = order.FilledQuantity;
            RemainingQuantity  = order.RemainingQuantity;
        }
示例#19
0
        internal void OnExecutionReport(ExecutionReport report)
        {
            Order       order  = report.order;
            OrderStatus status = order.status;

            order.OnExecutionReport(report);
            if (status != order.status)
            {
                this.framework.eventServer.OnOrderStatusChanged(order);
            }
            ExecType execType = report.ExecType;

            switch (execType)
            {
            case ExecType.ExecTrade:
                if (order.status == OrderStatus.PartiallyFilled)
                {
                    this.framework.eventServer.OnOrderPartiallyFilled(order);
                    return;
                }
                this.framework.eventServer.OnOrderFilled(order);
                this.framework.eventServer.OnOrderDone(order);
                this.ProcessOCA(order);
                return;

            case ExecType.ExecPendingCancel:
                break;

            case ExecType.ExecCancelled:
                this.framework.eventServer.OnOrderCancelled(order);
                this.framework.eventServer.OnOrderDone(order);
                this.ProcessOCA(order);
                return;

            default:
                if (execType != ExecType.ExecReplace)
                {
                    return;
                }
                this.framework.eventServer.OnOrderReplaced(order);
                break;
            }
        }
 /// <summary>
 /// Initializes a new instance of the ExecutionReport class.
 /// </summary>
 /// <param name="type">A trade direction. Possible values include:
 /// 'Unknown', 'Buy', 'Sell'</param>
 /// <param name="time">Transaction time</param>
 /// <param name="price">An actual price of the execution or
 /// order</param>
 /// <param name="volume">Trade volume</param>
 /// <param name="fee">Execution fee</param>
 /// <param name="success">Indicates that operation was
 /// successful</param>
 /// <param name="executionStatus">Current status of the order. Possible
 /// values include: 'Unknown', 'Fill', 'PartialFill', 'Cancelled',
 /// 'Rejected', 'New', 'Pending'</param>
 /// <param name="failureType">Possible values include: 'None',
 /// 'Unknown', 'ExchangeError', 'ConnectorError',
 /// 'InsufficientFunds'</param>
 /// <param name="orderType">A type of the order. Possible values
 /// include: 'Unknown', 'Market', 'Limit'</param>
 /// <param name="execType">A type of the execution. ExecType = Trade
 /// means it is an execution, otherwise it is an order. Possible values
 /// include: 'Unknown', 'New', 'PartialFill', 'Fill', 'DoneForDay',
 /// 'Cancelled', 'Replace', 'PendingCancel', 'Stopped', 'Rejected',
 /// 'Suspended', 'PendingNew', 'Calculated', 'Expired', 'Restarted',
 /// 'PendingReplace', 'Trade', 'TradeCorrect', 'TradeCancel',
 /// 'OrderStatus'</param>
 /// <param name="clientOrderId">A client assigned ID of the
 /// order</param>
 /// <param name="exchangeOrderId">An exchange assigned ID of the
 /// order</param>
 /// <param name="instrument">An instrument description</param>
 /// <param name="feeCurrency">Fee currency</param>
 /// <param name="message">An arbitrary message from the exchange
 /// related to the execution|order</param>
 public ExecutionReport(TradeType type, System.DateTime time, double price, double volume, double fee, bool success, OrderExecutionStatus executionStatus, OrderStatusUpdateFailureType failureType, OrderType orderType, ExecType execType, string clientOrderId = default(string), string exchangeOrderId = default(string), Instrument instrument = default(Instrument), string feeCurrency = default(string), string message = default(string))
 {
     ClientOrderId   = clientOrderId;
     ExchangeOrderId = exchangeOrderId;
     Instrument      = instrument;
     Type            = type;
     Time            = time;
     Price           = price;
     Volume          = volume;
     Fee             = fee;
     FeeCurrency     = feeCurrency;
     Success         = success;
     ExecutionStatus = executionStatus;
     FailureType     = failureType;
     Message         = message;
     OrderType       = orderType;
     ExecType        = execType;
     CustomInit();
 }
示例#21
0
        //35=8
        public override void onMessage(QuickFix42.ExecutionReport message, SessionID session)
        {
            ExecType et   = message.getExecType();
            char     type = et.getValue();

            switch (type)
            {
            case 'A':
                OrdStatus ordS   = message.getOrdStatus();
                char      status = ordS.getValue();
                //if status == 'A'
                //order acknowledgement
                break;

            case '0':
            case 'B':
            case 'F':
                break;
            }
        }
示例#22
0
 public ExecutionReport(ExecutionReport report)
 {
     this.dateTime    = report.dateTime;
     this.instrument  = report.instrument;
     this.currencyId  = report.currencyId;
     this.execType    = report.execType;
     this.ordType     = report.ordType;
     this.side        = report.side;
     this.timeInForce = report.timeInForce;
     this.ordStatus   = report.ordStatus;
     this.order       = report.order;
     this.commandID   = report.commandID;
     this.lastPx      = report.lastPx;
     this.avgPx       = report.avgPx;
     this.ordQty      = report.ordQty;
     this.cumQty      = report.cumQty;
     this.lastQty     = report.lastQty;
     this.leavesQty   = report.leavesQty;
     this.price       = report.price;
     this.stopPx      = report.stopPx;
     this.commission  = report.commission;
 }
示例#23
0
        public string getExecType(ExecType e)
        {
            switch (e.getValue())
            {
            case '0':
                return("NEW");

            case '1':
                return("PARTIAL_FILL");

            case '2':
                return("FILLED");

            case '4':
                return("CANCELLED");

            case '5':
                return("REPLACED");

            case '6':
                return("PENDING_CANCEL");

            case '8':
                return("REJECTED");

            case 'A':
                return("PENDING_NEW");

            case 'C':
                return("EXPIRED");

            case 'D':
                return("RESTATED");

            case 'E':
                return("PENDING_REPLACE");
            }
            return(null);
        }
示例#24
0
        private void OnProcessStopped(ExecType type)
        {
            m_Monitoring = false;

            if (type == ExecType.Crashed)
            {
                ExecuteScript(m_CrashScript, string.Empty, false);

                Task.Delay(new TimeSpan(0, 0, DelaySeconds))
                .ContinueWith((fn) => {
                    if (!m_Monitoring)
                    {
                        Start(ExecType.Crashed);
                    }
                });
            }

            if (ProcessStopped != null)
            {
                ProcessStopped(type);
            }
        }
示例#25
0
        public void Exec(ExecType type)
        {
            if (type == ExecType.OnDestroy)
            {
                destroyWhenDone = true;
            }

            if (Util.IsNull(Graph))
            {
                return;
            }

            if (yields == null)
            {
                yields = new List <IEnumerator <Yield> >();
            }

            foreach (var from in entryPoints[type])
            {
                // Initialize the scope
                var scope = new GraphScope();
                Eval(from.GetNode(Graph), scope);

                // Start Execution
                foreach (var to in Graph.Links.HasSocketAsSource(from))
                {
                    var yield = Exec(from, to, scope);
                    while (yield.MoveNext())
                    {
                        // Check if execution is delayed
                        if (!yield.Current.Finished)
                        {
                            yields.Add(yield);
                            break;
                        }
                    }
                }
            }
        }
示例#26
0
        public ExecDialog(ExecType templ)
        {
            InitializeComponent();
            //Localizer.Current.Apply(toolTip1, this);

            switch (templ)
            {
            case ExecType.SSH_TERM:
                DescriptionLabel.Text = "select terminal application for SSH (Secure Shell) connection.";
                Text = "UpASAP: SSH";
                break;

            case ExecType.WEB_BROWSER:
                DescriptionLabel.Text = "select web browser.";
                Text = "UpASAP: web browser";
                break;

            case ExecType.HTML_EDITOR:
                DescriptionLabel.Text = "select HTML editor.";
                Text = "UpASAP: HTML editor";
                break;
            }

            if (File.Exists(templates_filename))
            {
                try {
                    var serializer = new System.Xml.Serialization.XmlSerializer(typeof(List <ExecTemplate>), new Type[] { typeof(ExecTemplate) });
                    using (var sr = new StreamReader(templates_filename)) {
                        var data = (List <ExecTemplate>)serializer.Deserialize(sr);
                    }
                } catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }
            }

            TemplateCombo.Items.Clear();
            TemplateCombo.Items.AddRange(templates.Where(x => x.templ == templ).ToArray());
        }
示例#27
0
        private object Execute(DbConnection connection, DbTransaction transaction, string sql, dynamic parameters, ExecType execType, CommandType commandType, int commandTimeOut)
        {
            object _result = null;

            using (DbCommand command = connection.CreateCommand())
            {
                command.CommandText    = sql;
                command.CommandType    = commandType;
                command.CommandTimeout = commandTimeOut;
                command.Transaction    = transaction;

                SetParameters(command, parameters);

                RaisePreExecute(connection, command);

                if (execType == ExecType.Scalar)
                {
                    _result = command.ExecuteScalar();
                }
                else
                {
                    command.ExecuteNonQuery();
                }
            }
            return(_result);
        }
示例#28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v"></param>
 /// <returns></returns>
 public static string ToString(ExecType v)
 {
     return(Enum.GetName(typeof(ExecType), v).ToLowerInvariant());
 }
示例#29
0
    public static char ToFIX(ExecType execType)
    {
      switch (execType)
      {
        case ExecType.New:
          return '0';
        case ExecType.PartialFill:
          return '1';
        case ExecType.Fill:
          return '2';
        case ExecType.DoneForDay:
          return '3';
        case ExecType.Cancelled:
          return '4';
        case ExecType.Replace:
          return '5';
        case ExecType.PendingCancel:
          return '6';
        case ExecType.Stopped:
          return '7';
        case ExecType.Rejected:
          return '8';
        case ExecType.Suspended:
          return '9';
        case ExecType.PendingNew:
          return 'A';
        case ExecType.Calculated:
          return 'B';
        case ExecType.Expired:
          return 'C';
        case ExecType.Restarted:
          return 'D';
        case ExecType.PendingReplace:
          return 'E';
        case ExecType.Trade:
          return 'F';
        case ExecType.TradeCorrect:
          return 'G';
        case ExecType.TradeCancel:
          return 'H';
        case ExecType.OrderStatus:
          return 'I';
        default:
					throw new ArgumentException("unknown: " + ((object) execType).ToString());
      }
    }
示例#30
0
 /// <summary>
 /// Converts a ExecType to a string.
 /// </summary>
 /// <returns>A ExecType value.</returns>
 /// <param name="value">The FIX string representation of a ExecType.</param>
 public static string ConvertTo(ExecType messageType)
 {
     return((string)ExecTypeConverter.toTable[messageType]);
 }
示例#31
0
        public dynamic SqlGetData(String StrStoredProcedure, ref List <KeyValuePair <object, object> > ParamList, ExecType executiontype, ReturnDBOperation RetDBoperation, ref int?ReturnSuccess)
        {
            ReturnSuccess = 0;

            datareturn = null;
            try
            {
                if (!string.IsNullOrEmpty(AddConnectionName))
                {
                    conn = new SqlConnection(ConfigurationManager.ConnectionStrings[AddConnectionName].ConnectionString);
                    //new SqlConnection(WebsiteDatabase.ConnectionString(AddConnectionName));
                    //conn = new SqlConnection(AddConnectionName);
                }
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand cmd = new SqlCommand(StrStoredProcedure, conn);

                cmd.CommandType = CommandType.StoredProcedure;

                SqlCommandBuilder.DeriveParameters(cmd);

                if (ParamList != null && ParamList.Count > 0)
                {
                    for (int i = 0; i < cmd.Parameters.Count; i++)
                    {
                        if (ParamList.Exists(p => p.Key.Equals(cmd.Parameters[i].ParameterName)))
                        {
                            cmd.Parameters[i].Value = ParamList.Find(p => p.Key.Equals(cmd.Parameters[i].ParameterName)).Value;
                        }
                    }
                }

                // for Return parameter
                SqlParameter paramreturn = new SqlParameter();
                paramreturn.ParameterName = "@ReturnValue";
                paramreturn.SqlDbType     = SqlDbType.Int;
                //paramreturn.SqlDbType = SqlDbType.Char;
                paramreturn.Direction = ParameterDirection.ReturnValue;
                paramreturn.Value     = ReturnSuccess;
                cmd.Parameters.Add(paramreturn);


                switch (executiontype)
                {
                case ExecType.Scalar:     // Execute scalar
                    object objexecscalar = cmd.ExecuteScalar();
                    if (objexecscalar != null)
                    {
                        datareturn = objexecscalar.ToString();
                    }

                    ReturnSuccess = Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value);
                    break;

                case ExecType.Dynamic:
                    SqlDataAdapter adpNew = new SqlDataAdapter(cmd);
                    switch (RetDBoperation)
                    {
                    case ReturnDBOperation.DataSet:
                        ReturnSuccess = 1;
                        DataSet objds = new DataSet();
                        adpNew.Fill(objds);
                        datareturn    = objds;
                        ReturnSuccess = Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value);
                        break;

                    case ReturnDBOperation.DataTable:
                        ReturnSuccess = 1;
                        DataTable dt = new DataTable();
                        adpNew.Fill(dt);
                        datareturn    = dt;
                        ReturnSuccess = Convert.ToInt32(cmd.Parameters["@RETURN_VALUE"].Value);
                        //ReturnSuccess = Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value);
                        break;

                    case ReturnDBOperation.InUpDel:
                        ReturnSuccess = 1;
                        try
                        {
                            cmd.ExecuteNonQuery();
                            ReturnSuccess = Convert.ToInt32(cmd.Parameters["@RETURN_VALUE"].Value);         //Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value);
                            datareturn    = ReturnSuccess;
                        }
                        catch (Exception ex)
                        {
                            ReturnSuccess = -1;
                            throw ex;
                        }
                        finally
                        {
                        }

                        //if (ParamList != null && ParamList.Count > 0)
                        //{
                        //    for (int i = 0; i < cmd.Parameters.Count; i++)
                        //    {
                        //        if (ParamList.Exists(p => p.Key.Equals(cmd.Parameters[i].ParameterName)))
                        //        {
                        //            if (cmd.Parameters[i].Direction == ParameterDirection.InputOutput)
                        //            {
                        //                ParamList[i].Key. = "";
                        //                ParamList.Find(p => p.Key.Equals(cmd.Parameters[i].ParameterName)).Value = cmd.Parameters[i].Value;
                        //            }
                        //            //cmd.Parameters[i].Value = ParamList.Find(p => p.Key.Equals(cmd.Parameters[i].ParameterName)).Value;
                        //        }
                        //    }
                        //}
                        //DataTable dt = new DataTable();
                        //adpNew.Fill(dt);
                        //datareturn = dt;
                        break;
                    }
                    break;

                default:
                    SqlDataAdapter adp = new SqlDataAdapter(cmd);
                    DataSet        ds  = new DataSet();
                    adp.Fill(ds);
                    datareturn    = ds;
                    ReturnSuccess = Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value);
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.Log("Exception Source : " + ex.TargetSite + " Message : " + ex.Message);
                //ReturnSuccess = ex.GetHashCode();
                //datareturn = "Exception Source : " + ex.TargetSite + " Message : " + ex.Message;
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }

            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
            return(datareturn);
        }
示例#32
0
		public ExecutionReport(ExecutionReport report)
		{
			this.dateTime = report.dateTime;
			this.instrument = report.instrument;
			this.currencyId = report.currencyId;
			this.execType = report.execType;
			this.ordType = report.ordType;
			this.side = report.side;
			this.timeInForce = report.timeInForce;
			this.ordStatus = report.ordStatus;
			this.order = report.order;
			this.commandID = report.commandID;
			this.lastPx = report.lastPx;
			this.avgPx = report.avgPx;
			this.ordQty = report.ordQty;
			this.cumQty = report.cumQty;
			this.lastQty = report.lastQty;
			this.leavesQty = report.leavesQty;
			this.price = report.price;
			this.stopPx = report.stopPx;
			this.commission = report.commission;
		}