public CxProfile GetCxInfoByEngAliasView(String EngAlias) { CxProfile cxProfile = null; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand("[dbo].[GetCxInfoByEngAlias]", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@EngAlias", EngAlias)); command.Connection.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.ReadAsync().Result) { cxProfile = new CxProfile(reader.GetString(0), reader.GetDouble(1), reader.GetString(2), reader.GetString(3)); reader.Close(); command.Dispose(); return(cxProfile); } } reader.Close(); command.Dispose(); } return(cxProfile); }
public static CxProfile GetCustomerInfo(Guid CustomerId) { CxProfile cxProfile = null; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand("[dbo].[GetCustomerInfo]", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@CxID", CustomerId)); command.Connection.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { cxProfile = new CxProfile(reader.GetGuid(0), reader.GetString(1), reader.GetString(2), reader.GetDouble(3), reader.GetString(4), reader.GetString(5), reader.GetDouble(6)); } return(cxProfile); } reader.Close(); command.Dispose(); } return(cxProfile); }