コード例 #1
0
        public void se_get_ipo_data()
        {
            int cc = cmbTargetWeight.Text == "Global" ? -1 : _countryCode;


            try
            {
                ThreadPool.QueueUserWorkItem(
                    delegate(object eventArg)
                {
                    //decimal amount = Convert.ToDecimal(this.TXTHarvestamount.Value);
                    IHierarchyViewerServiceContract DBService = this.CreateServiceClient();
                    ApplicationMessageList messages           = null;


                    DataSet IPOData = new DataSet();



                    IHierarchyViewerServiceContract dbService = this.CreateServiceClient();
                    IPOData = dbService.se_get_ipo_data(
                        m_intAccountID,
                        cc,
                        _weight,
                        _midPrice,
                        _highPrice,
                        out messages);

                    // this.AccountHeader.DataContext = AccountHeader;



                    if (IPOData.Tables.Count > 0)
                    {
                        Dispatcher.BeginInvoke(new Action(() =>
                        {
                            this.IpoData.ItemsSource = IPOData.Tables[0];
                        }), System.Windows.Threading.DispatcherPriority.Normal);
                    }
                    else
                    {
                        Dispatcher.BeginInvoke(new Action(() => { this.IpoData.ItemsSource = null; }), System.Windows.Threading.DispatcherPriority.Normal);
                    }
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public void HierarchyList()
        {
            // this.cmboHierarchy.SelectedItem = -1;
            this.cmboHierarchy.Items.Clear();
            int count = -1;

            ThreadPool.QueueUserWorkItem(
                delegate(object eventArg)
            {
                ApplicationMessageList messages = null;



                DataSet ds       = _viewModel.DBService.se_get_hierarchy(out messages);
                DataSet dsSector = new DataSet();



                foreach (DataTable table in ds.Tables)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        object item         = row["name"];
                        object hierarchy_id = row["hierarchy_id"];

                        Dispatcher.BeginInvoke(new Action(() =>
                        {
                            cmboHierarchy.Items.Add(new ComboBoxItem(Convert.ToString(item), Convert.ToInt64(hierarchy_id)));

                            count = count + 1;

                            if (_hierarchyName == Convert.ToString(item))
                            {
                                this.cmboHierarchy.SelectedIndex = count;
                            }
                        }), System.Windows.Threading.DispatcherPriority.Normal);
                    }
                }


                //this.DataContext = _view;
            });
        }
コード例 #3
0
        public void GaugeTypeList()
        {
            // this.cmboHierarchy.SelectedItem = -1;
            this.cmboGaugeType.Items.Clear();
            int count = -1;

            ThreadPool.QueueUserWorkItem(
                delegate(object eventArg)
            {
                ApplicationMessageList messages = null;

                DataSet ds = _viewModel._viewerModel.DBService.se_get_gauge_type(out messages);

                foreach (DataTable table in ds.Tables)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        object gauge_type    = row["gauge_type"];
                        object gauge_type_id = row["gauge_type_id"];

                        Dispatcher.BeginInvoke(new Action(() =>
                        {
                            cmboGaugeType.Items.Add(new ComboBoxItem(Convert.ToString(gauge_type), Convert.ToInt32(gauge_type_id)));

                            count = count + 1;

                            if (_viewModel._viewerModel.Parameters.GuageType.ToString() == Convert.ToString(gauge_type))
                            {
                                this.cmboGaugeType.SelectedIndex = count;
                            }
                        }), System.Windows.Threading.DispatcherPriority.Normal);
                    }
                }


                //this.DataContext = _view;
            });
        }
コード例 #4
0
        public void CreateOrders()
        {
            int count = 0;



            IpoData.SelectAll();
            GridColumn colOnhold = IpoData.Columns["Inc"];

            foreach (DataRowView row in IpoData.SelectedItems)
            {
                //open the accounts

                ApplicationMessageList          messages  = null;
                IHierarchyViewerServiceContract dbService = this.CreateServiceClient();
                decimal selectedQTY;

                //Boolean isc = Convert.ToBoolean(row["Inc"]);
                //string isa = Convert.ToString(row["Inc"]);

                //string _on_hold = IpoData.GetCellValue(count, colOnhold).ToString();

                bool chk = Convert.ToBoolean(IpoData.GetCellValue(count, "Inc"));



                if (chk == true)
                {
                    if (rdoMidPrice.IsChecked == true)
                    {
                        selectedQTY = Convert.ToDecimal(row["Share Esitmate of Mid Offer Price"]);
                    }
                    else
                    {
                        selectedQTY = Convert.ToDecimal(row["Share Esitmate of High Offer Price"]);
                    }



                    if (selectedQTY > 0)
                    {
                        count = count + 1;
                        dbService.se_create_orders_ipo(
                            m_intSecurityID,
                            Convert.ToInt32(row["Account_id"]),
                            selectedQTY,

                            out messages);
                    }
                }
            }
            string LABEL = string.Format("You have created {0} orders.", count);


            //update



            //RefreshReport("Tools", "Refresh Database");
            //RefreshReport("View", "Refresh");

            System.Windows.MessageBox.Show(LABEL, "Orders Created", MessageBoxButton.OK, MessageBoxImage.Information);
        }
コード例 #5
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        //private void backgroundWorker_DoWork()
        {
            int errorCount   = 0;
            int warningCount = 0;

            ProposedOrderList proposedOrderList = new ProposedOrderList();

            proposedOrderList.AddRange(from ProposedOrdersDataSet.ProposedOrdersPasteRow row in borders.Rows
                                       select new ProposedOrder
            {
                PromptSymbol     = row.PromptSymbol,
                ProposedValue    = row.ProposedValue,
                SideMnemonic     = row.SideMnemonic,
                AccountShortName = row.AccountShortName,
                //Broker = "",//row.Broker,
                //UserField1 = "",// row.UserField1,
                //UserField2 = "",// row.UserField2,
                //UserField8 = "",// row.UserField8,
                id = row.id
            });

            try
            {
                ApplicationMessageList    messageList;
                ApplicationMessageList    messageListWarn = new ApplicationMessageList();
                SalesToolsServiceContract contract        = TransportManagerProxyFactory <SalesToolsServiceContract> .GetReusableInstance("SalesTools");

                ProposedOrderErrorList errorList = contract.AddProposed(proposedOrderList, localPropAllorNone, out messageList);
                // addInBase.MessageService.LogMessagesFromBackgroundThread(messageList);
                foreach (ProposedOrderError proposedOrderError in errorList)
                {
                    DataView view = borders.AsDataView();
                    view.Sort = "id";
                    int j = view.Find(proposedOrderError.id);
                    view[j]["ErrorString"] = proposedOrderError.error;
                    if (!string.IsNullOrEmpty(proposedOrderError.error))
                    {
                        CompareInfo compareInfo = CultureInfo.CurrentCulture.CompareInfo;
                        if (compareInfo.IsPrefix(proposedOrderError.error, "WARNING", CompareOptions.IgnoreCase))
                        {
                            warningCount++;
                            messageListWarn.Add(new ApplicationMessage(proposedOrderError.error, ApplicationMessageType.Warning));
                        }
                        else
                        {
                            errorCount++;
                        }
                    }
                }

                // remove successfully imported rows
                if (errorCount == 0 || (errorCount > 0 && !localPropAllorNone))
                {
                    foreach (ProposedOrderError proposedOrderError in from proposedOrderError in errorList
                             where proposedOrderError.proposed_order_id != 0
                             select proposedOrderError)
                    {
                        DataView view = borders.AsDataView();
                        view.Sort = "id";
                        int j = view.Find(proposedOrderError.id);
                        statusWindow.Dispatcher.Invoke(new Action(() => view.Delete(j)));
                    }
                }
                //    addInBase.MessageService.LogMessagesFromBackgroundThread(messageListWarn);
            }
            catch (Exception ex)
            {
                ApplicationMessageList list = new ApplicationMessageList {
                    new ApplicationMessage(ex, ApplicationMessageType.ErrorNoPopup)
                };
                // addInBase.MessageService.LogMessagesFromBackgroundThread(list);
                throw ex;
            }
            statusWindow.Dispatcher.BeginInvoke(new Action(() => statusWindow.StatusText =
                                                               string.Format(
                                                                   "Order Import Complete\r\n\r\nTotal attempted {0}\r\nErrors {1}\r\nWarnings {2}\r\n\r\nTotal Imported {3}",
                                                                   proposedOrderList.Count,
                                                                   errorCount,
                                                                   warningCount,
                                                                   !localPropAllorNone
                                                                         ? proposedOrderList.Count - errorCount
                                                                         : ((errorCount == 0) ? proposedOrderList.Count : 0))));
        }