/// <summary> /// /// </summary> /// <param name="SecurityID"></param> /// <returns></returns> internal List<Business.IAgentSecurity> GetIAgentSecurityBySecurityID(int SecurityID) { List<Business.IAgentSecurity> Result = new List<Business.IAgentSecurity>(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.IAgentSecurityTableAdapter adap = new DSTableAdapters.IAgentSecurityTableAdapter(); DS.IAgentSecurityDataTable tbIAgentSecurity = new DS.IAgentSecurityDataTable(); try { conn.Open(); adap.Connection = conn; tbIAgentSecurity = adap.GetIAgentSecurityBySecurityID(SecurityID); if (tbIAgentSecurity != null) { int count = tbIAgentSecurity.Count; for (int i = 0; i < count; i++) { Business.IAgentSecurity newIAgentSecurity = new Business.IAgentSecurity(); newIAgentSecurity.IAgentSecurityID = tbIAgentSecurity[i].IAgentSecurityID; newIAgentSecurity.AgentID = tbIAgentSecurity[i].AgentID; newIAgentSecurity.SecurityID = tbIAgentSecurity[i].SecurityID; double min = 0; double max = 0; double.TryParse(tbIAgentSecurity[i].MinLots, out min); double.TryParse(tbIAgentSecurity[i].MaxLots, out max); newIAgentSecurity.MinLots = min; newIAgentSecurity.MaxLots = max; Result.Add(newIAgentSecurity); } } } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return Result; }
/// <summary> /// /// </summary> /// <param name="IAgentSecurityID"></param> /// <returns></returns> internal Business.IAgentSecurity GetIAgentSecurityByIAgentSecurityID(int IAgentSecurityID) { Business.IAgentSecurity Result = new Business.IAgentSecurity(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.IAgentSecurityTableAdapter adap = new DSTableAdapters.IAgentSecurityTableAdapter(); DS.IAgentSecurityDataTable tbIAgentGroup = new DS.IAgentSecurityDataTable(); try { conn.Open(); adap.Connection = conn; tbIAgentGroup = adap.GetIAgentSecurityByIAgentSecurityID(IAgentSecurityID); if (tbIAgentGroup != null) { Result.IAgentSecurityID = tbIAgentGroup[0].IAgentSecurityID; Result.SecurityID = tbIAgentGroup[0].SecurityID; Result.AgentID = tbIAgentGroup[0].AgentID; double min = 0; double max = 0; double.TryParse(tbIAgentGroup[0].MinLots, out min); double.TryParse(tbIAgentGroup[0].MaxLots, out max); Result.MinLots = min; Result.MaxLots = max; } } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return Result; }