public IPOViewerMainWindow(IpoViewerModel view)
        {
            InitializeComponent();

            MTCache               = new MTCacheConnection();
            m_AllAccounts         = MTCache.GetAllAccounts();
            m_AllSecurity1        = MTCache.GetListSecurity(m_intAssetCode);
            m_AllSecurity         = m_AllSecurity1.Tables[0];
            this.txtAccount1.Text = m_strAccountShortName;

            DateTime nowDate = DateTime.Now;

            this.txtdate.Text = Convert.ToString(nowDate.ToString("MM/dd/yyyy"));
            this.DataContext  = view;
        }
        private bool validateSingleAccount(TextBox ourTextBox)
        {
            bool retval = false;

            if (!String.IsNullOrEmpty(ourTextBox.Text))
            {
                try
                {
                    int               defaultAccountId = -1;
                    string            defaultShortName = "";
                    MTCacheConnection MTCache          = new MTCacheConnection();
                    MTCache.ValidateAccountForUser(ourTextBox.Text, out defaultAccountId, out defaultShortName);
                    if (defaultAccountId != -1)
                    {
                        m_intAccountID        = defaultAccountId;
                        m_strAccountShortName = defaultShortName;
                        ourTextBox.Text       = m_strAccountShortName;  // Ensure upcased
                        retval = true;
                    }
                    else
                    {
                        m_intAccountID        = -1;
                        m_strAccountShortName = "";
                        ourTextBox.Text       = "";
                    }
                }
                catch (Exception ex)
                {
                    m_intAccountID        = -1;
                    m_strAccountShortName = "";
                    throw ex;
                }
            }
            else
            {
                m_intAccountID        = -1;
                m_strAccountShortName = "";
                ourTextBox.Text       = "";
            }
            return(retval);
        }
        private bool validateSingleSecurity(System.Windows.Controls.TextBox ourTextBox)
        {
            string assetType = "";
            bool   retval    = false;

            //this.labelSecName.Content = "";
            ;
            if (!String.IsNullOrEmpty(ourTextBox.Text))
            {
                int intRowCount = 0;
                try
                {
                    MTCacheConnection MTCache = new MTCacheConnection();
                    DataSet           ds      = MTCache.GetSecurityInfo(ourTextBox.Text);
                    if (ds.Tables.Count > 0)
                    {
                        intRowCount = ds.Tables[0].Rows.Count;
                    }
                    if (intRowCount >= 1)
                    {
                        if (isAssetValid("Equity"))
                        {
                            m_strSecurityShortName = (string)(ds.Tables[0].Rows[0])["symbol"];
                            ourTextBox.Text        = m_strSecurityShortName;

                            decimal pricelatest = Convert.ToDecimal((ds.Tables[0].Rows[0])["latest"]);
                            _exchangeRate = Convert.ToDecimal((ds.Tables[0].Rows[0])["exchange_rate"]);

                            txtpricelocalhigh.Text = Convert.ToString(Math.Round(pricelatest, 4));
                            txtpricelocalmid.Text  = Convert.ToString(Math.Round(pricelatest, 4));

                            HighPrice = Convert.ToDecimal(Math.Round(pricelatest / _exchangeRate, 4));
                            MidPrice  = Convert.ToDecimal(Math.Round(pricelatest / _exchangeRate, 4));

                            txtpriceusdhigh.Text = Convert.ToString(Math.Round(pricelatest / _exchangeRate, 4));
                            txtpriceusdmid.Text  = Convert.ToString(Math.Round(pricelatest / _exchangeRate, 4));

                            string country = ((string)(ds.Tables[0].Rows[0])["name"]);
                            int    v       = -1;

                            for (int i = 0; i < cmbCountry.Items.Count; i++)
                            {
                                string value = cmbCountry.Items[i].ToString();

                                if (value == country)
                                {
                                    v            = i;
                                    _countryname = country;


                                    _countryCode = Convert.ToInt32((ds.Tables[0].Rows[0])["country_code"]);
                                }
                            }



                            cmbCountry.SelectedIndex = v;



                            // TODO - separate label and content

                            retval = true;
                        }
                        else
                        {
                            retval = false;
                        }
                    }
                }
                catch (Exception ex)
                {
                    // System.Windows.MessageBox.Show(this, "An error has occurred." + System.Environment.NewLine + "Unable to get information about entered security." + System.Environment.NewLine + ex.Message, MSGBOX_TITLE_ERROR, MessageBoxButton.OK);
                    m_intSecurityID = -1;
                }
            }
            else
            {
                m_intSecurityID        = -1;
                m_strSecurityShortName = "";
                ourTextBox.Text        = m_strSecurityShortName;
            }
            return(retval);
        }