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;
            }
        }
        public void CountryList()
        {
            // this.cmboHierarchy.SelectedItem = -1;
            this.cmbCountry.Items.Clear();

            ThreadPool.QueueUserWorkItem(
                delegate(object eventArg)
            {
                IHierarchyViewerServiceContract DBService = this.CreateServiceClient();



                DataSet ds       = DBService.get_list_country();
                DataSet dsSector = new DataSet();



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

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

                            // this.cmboHierarchy.SelectedIndex = 0;
                        }), System.Windows.Threading.DispatcherPriority.Normal);
                    }
                }


                //this.DataContext = _view;
            });
        }
        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);
        }