/// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        internal List<Business.PriceAlert> GetAllAlert()
        {
            List<Business.PriceAlert> Result = new List<Business.PriceAlert>();
            System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection);
            DSTableAdapters.AlertTableAdapter adap = new DSTableAdapters.AlertTableAdapter();
            DS.AlertDataTable tbAlert = new DS.AlertDataTable();

            try
            {
                conn.Open();
                adap.Connection = conn;
                tbAlert = adap.GetData();

                if (tbAlert != null)
                {
                    int count = tbAlert.Count;
                    for (int i = 0; i < count; i++)
                    {
                        Business.PriceAlert newAlert = new Business.PriceAlert();
                        newAlert.ID = tbAlert[i].ID;
                        newAlert.Email = tbAlert[i].Email;
                        newAlert.PhoneNumber = tbAlert[i].PhoneNumber;
                        newAlert.Value = tbAlert[i].Value;
                        newAlert.IsEnable = tbAlert[i].IsEnable;
                        newAlert.DateActive = tbAlert[i].DateActive;
                        newAlert.DateCreate = tbAlert[i].DateCreate;
                        newAlert.Iterations = tbAlert[i].Iterations;
                        newAlert.InvestorID = tbAlert[i].InvestorID;
                        newAlert.Notification = tbAlert[i].Notification;
                        newAlert.TickOnline = new Business.Tick();
                        newAlert.TickOnline.Ask = tbAlert[i].Ask;
                        newAlert.TickOnline.Bid = tbAlert[i].Bid;
                        newAlert.TickOnline.SymbolName = tbAlert[i].Symbol;
                        newAlert.Symbol = tbAlert[i].Symbol;
                        #region Condition & Action
                        Business.ActionAlert newAlertAction = new Business.ActionAlert();
                        switch (tbAlert[i].Action)
                        {
                            case "Email":
                                newAlertAction = Business.ActionAlert.Email;
                                break;
                            case "SMS":
                                newAlertAction = Business.ActionAlert.SMS;
                                break;
                            case "Sound":
                                newAlertAction = Business.ActionAlert.Sound;
                                break;
                        }
                        newAlert.AlertAction = newAlertAction;
                        Business.ConditionAlert newAlertCondition = new Business.ConditionAlert();
                        switch (tbAlert[i].Condtion)
                        {
                            case "LargerAsk":
                                newAlertCondition = Business.ConditionAlert.LargerAsk;
                                break;
                            case "LargerBid":
                                newAlertCondition = Business.ConditionAlert.LargerBid;
                                break;
                            case "LargerHighAsk":
                                newAlertCondition = Business.ConditionAlert.LargerHighAsk;
                                break;
                            case "LargerHighBid":
                                newAlertCondition = Business.ConditionAlert.LargerHighBid;
                                break;
                            case "SmallerAsk":
                                newAlertCondition = Business.ConditionAlert.SmallerAsk;
                                break;
                            case "SmallerBid":
                                newAlertCondition = Business.ConditionAlert.SmallerBid;
                                break;
                            case "SmallerLowAsk":
                                newAlertCondition = Business.ConditionAlert.SmallerLowAsk;
                                break;
                            case "SmallerLowBid":
                                newAlertCondition = Business.ConditionAlert.SmallerLowBid;
                                break;
                        }
                        newAlert.AlertCondition = newAlertCondition;
                        #endregion

                        for (int j = 0; j < Business.Market.SymbolList.Count; j++)
                        {
                            if (Business.Market.SymbolList[j].AlertQueue == null)
                            {
                                Business.Market.SymbolList[j].AlertQueue = new List<Business.PriceAlert>();
                            }
                            if (Business.Market.SymbolList[j].Name == newAlert.Symbol)
                            {
                                Business.Market.SymbolList[j].AlertQueue.Add(newAlert);
                                break;
                            }
                        }
                        for (int j = 0; j < Business.Market.InvestorList.Count; j++)
                        {
                            if (Business.Market.InvestorList[j].AlertQueue == null)
                            {
                                Business.Market.InvestorList[j].AlertQueue = new List<Business.PriceAlert>();
                            }
                            if (Business.Market.InvestorList[j].InvestorID == newAlert.InvestorID)
                            {
                                Business.Market.InvestorList[j].AlertQueue.Add(newAlert);
                                break;
                            }
                        }

                        Result.Add(newAlert);
                    }
                }
            }
            catch (Exception ex)
            {
                return null;
            }
            finally
            {
                adap.Connection.Close();
                conn.Close();
            }

            return Result;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="AlertID"></param>
        /// <returns></returns>
        internal Business.PriceAlert GetAlertByAlertID(int AlertID)
        {
            Business.PriceAlert newAlert = new Business.PriceAlert();
            System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection);
            DSTableAdapters.AlertTableAdapter adap = new DSTableAdapters.AlertTableAdapter();
            DS.AlertDataTable tbAlert = new DS.AlertDataTable();
            try
            {
                conn.Open();
                adap.Connection = conn;
                tbAlert = adap.GetAlertByID(AlertID);
                if (tbAlert != null)
                {
                    newAlert.ID = tbAlert[0].ID;
                    newAlert.Email = tbAlert[0].Email;
                    newAlert.PhoneNumber = tbAlert[0].PhoneNumber;
                    newAlert.Value = tbAlert[0].Value;
                    newAlert.IsEnable = tbAlert[0].IsEnable;
                    newAlert.DateActive = tbAlert[0].DateActive;
                    newAlert.DateCreate = tbAlert[0].DateCreate;
                    newAlert.Iterations = tbAlert[0].Iterations;
                    newAlert.InvestorID = tbAlert[0].InvestorID;
                    newAlert.Notification = tbAlert[0].Notification;
                    newAlert.TickOnline = new Business.Tick();
                    newAlert.TickOnline.Ask = tbAlert[0].Ask;
                    newAlert.TickOnline.Bid = tbAlert[0].Bid;
                    newAlert.TickOnline.SymbolName = tbAlert[0].Symbol;
                    newAlert.Symbol = tbAlert[0].Symbol;
                    Business.ActionAlert newAlertAction = new Business.ActionAlert();
                    switch (tbAlert[0].Action)
                    {
                        case "Email":
                            newAlertAction = Business.ActionAlert.Email;
                            break;
                        case "SMS":
                            newAlertAction = Business.ActionAlert.SMS;
                            break;
                        case "Sound":
                            newAlertAction = Business.ActionAlert.Sound;
                            break;
                    }
                    newAlert.AlertAction = newAlertAction;
                    Business.ConditionAlert newAlertCondition = new Business.ConditionAlert();
                    switch (tbAlert[0].Condtion)
                    {
                        case "LargerAsk":
                            newAlertCondition = Business.ConditionAlert.LargerAsk;
                            break;
                        case "LargerBid":
                            newAlertCondition = Business.ConditionAlert.LargerBid;
                            break;
                        case "LargerHighAsk":
                            newAlertCondition = Business.ConditionAlert.LargerHighAsk;
                            break;
                        case "LargerHighBid":
                            newAlertCondition = Business.ConditionAlert.LargerHighBid;
                            break;
                        case "SmallerAsk":
                            newAlertCondition = Business.ConditionAlert.SmallerAsk;
                            break;
                        case "SmallerBid":
                            newAlertCondition = Business.ConditionAlert.SmallerBid;
                            break;
                        case "SmallerLowAsk":
                            newAlertCondition = Business.ConditionAlert.SmallerLowAsk;
                            break;
                        case "SmallerLowBid":
                            newAlertCondition = Business.ConditionAlert.SmallerLowBid;
                            break;
                    }

                    newAlert.AlertCondition = newAlertCondition;
                }
            }
            catch (Exception ex)
            {
                return null;
            }
            finally
            {
                adap.Connection.Close();
                conn.Close();
            }
            return newAlert;
        }