private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //setDates();
            if (File.Exists((subPath + "\\" + file)))
            {
                IpoData.RestoreLayoutFromXml(subPath + "\\" + file);
            }


            CountryList();
        }
        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
        {
            //gridTransactions.RestoreLayoutFromXml("c:\\Gridtransactions.xaml");

            // your code goes here

            bool exists = System.IO.Directory.Exists((subPath));

            if (!exists)
            {
                System.IO.Directory.CreateDirectory((subPath));

                IpoData.SaveLayoutToXml(subPath + "\\" + file);
            }
            else
            {
                IpoData.SaveLayoutToXml(subPath + "\\" + file);
            }
        }
        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);
        }