/// <summary> /// /// </summary> /// <param name="IGroupSecurityID"></param> /// <returns></returns> internal List<Business.ParameterItem> GetIGroupSecurityConfigByIGroupSecurity(int IGroupSecurityID) { List<Business.ParameterItem> Result = new List<Business.ParameterItem>(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.IGroupSecurityConfigTableAdapter adap = new DSTableAdapters.IGroupSecurityConfigTableAdapter(); DS.IGroupSecurityConfigDataTable tbIGroupSecurityConfig = new DS.IGroupSecurityConfigDataTable(); try { conn.Open(); adap.Connection = conn; tbIGroupSecurityConfig = adap.GetIGroupSecurityConfigByIGroupSecurity(IGroupSecurityID); if (tbIGroupSecurityConfig != null) { int count = tbIGroupSecurityConfig.Count; for (int i = 0; i < count; i++) { Business.ParameterItem newParameterItem = new Business.ParameterItem(); newParameterItem.ParameterItemID = tbIGroupSecurityConfig[i].IGroupSecurityConfigID; newParameterItem.SecondParameterID = tbIGroupSecurityConfig[i].IGroupSecurityID; newParameterItem.Name = tbIGroupSecurityConfig[i].Name; newParameterItem.Code = tbIGroupSecurityConfig[i].Code; newParameterItem.BoolValue = tbIGroupSecurityConfig[i].BoolValue; newParameterItem.StringValue = tbIGroupSecurityConfig[i].StringValue; newParameterItem.NumValue = tbIGroupSecurityConfig[i].NumValue; newParameterItem.DateValue = tbIGroupSecurityConfig[i].DateValue; Result.Add(newParameterItem); } } } catch (Exception ex) { return null; } finally { adap.Connection.Close(); conn.Close(); } return Result; }
/// <summary> /// /// </summary> /// <returns></returns> internal List<Business.IGroupSecurity> GetAllIGroupSecurity() { List<Business.IGroupSecurity> Result = new List<Business.IGroupSecurity>(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(DBConnection.DBConnection.Connection); DSTableAdapters.IGroupSecurityTableAdapter adap = new DSTableAdapters.IGroupSecurityTableAdapter(); DSTableAdapters.IGroupSecurityConfigTableAdapter adapIGroupSecurityConfig = new DSTableAdapters.IGroupSecurityConfigTableAdapter(); DS.IGroupSecurityDataTable tbIGroupSecurity = new DS.IGroupSecurityDataTable(); DS.IGroupSecurityConfigDataTable tbIGroupSecurityConfig = new DS.IGroupSecurityConfigDataTable(); try { conn.Open(); adap.Connection = conn; adapIGroupSecurityConfig.Connection = conn; tbIGroupSecurity= adap.GetData(); if (tbIGroupSecurity != null) { int count = tbIGroupSecurity.Count; for (int i = 0; i < count; i++) { Business.IGroupSecurity newIGroupSymbol = new Business.IGroupSecurity(); newIGroupSymbol.IGroupSecurityID = tbIGroupSecurity[i].IGroupSecurityID; newIGroupSymbol.InvestorGroupID = tbIGroupSecurity[i].InvestorGroupID; newIGroupSymbol.SecurityID = tbIGroupSecurity[i].SecurityID; tbIGroupSecurityConfig = adapIGroupSecurityConfig.GetIGroupSecurityConfigByIGroupSecurity(tbIGroupSecurity[i].IGroupSecurityID); //newIGroupSymbol.IGroupSecurityConfig = DBWIGroupSecurity.DBWIGroupSecurityConfigInstance.GetIGroupSecurityConfigByIGroupSecurity(tbIGroupSecurity[i].IGroupSecurityID); if (tbIGroupSecurityConfig != null) { int countIGroupSecurityConfig = tbIGroupSecurityConfig.Count; for (int j = 0; j < countIGroupSecurityConfig; j++) { Business.ParameterItem newParameter = new Business.ParameterItem(); newParameter.BoolValue = tbIGroupSecurityConfig[j].BoolValue; newParameter.Code = tbIGroupSecurityConfig[j].Code; newParameter.DateValue = tbIGroupSecurityConfig[j].DateValue; newParameter.NumValue = tbIGroupSecurityConfig[j].NumValue; newParameter.ParameterItemID = tbIGroupSecurityConfig[j].IGroupSecurityConfigID; newParameter.SecondParameterID = tbIGroupSecurityConfig[j].IGroupSecurityID; newParameter.StringValue = tbIGroupSecurityConfig[j].StringValue; if (newIGroupSymbol.IGroupSecurityConfig == null) newIGroupSymbol.IGroupSecurityConfig = new List<Business.ParameterItem>(); newIGroupSymbol.IGroupSecurityConfig.Add(newParameter); } } Result.Add(newIGroupSymbol); } } } catch (Exception ex) { return null; } finally { adap.Connection.Close(); adapIGroupSecurityConfig.Connection.Close(); conn.Close(); } return Result; }