public DataObject.Role GetUserRole(int UserId, string Serial) { DataObject.Role role = null; using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "[Security].[GetUserRole] '{0}','{1}'"; using (SqlCommand command = new SqlCommand(string.Format(query, UserId, Serial), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { role = new DataObject.Role(); while (reader.Read()) { role.Id = int.Parse(reader.GetValue(0).ToString()); role.Name = reader.GetValue(1).ToString(); role.Description = reader.GetValue(2).ToString(); role.SmartCloudSerial = reader.GetValue(3).ToString(); } } } } return(role); }
public DataObject.Role GetUserRole(int UserId, string Serial) { DataObject.Role role = null; using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "[Security].[GetUserRole] '{0}','{1}'"; using (SqlCommand command = new SqlCommand(string.Format(query, UserId, Serial), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { role = new DataObject.Role(); while (reader.Read()) { role.Id = int.Parse(reader.GetValue(0).ToString()); role.Name = reader.GetValue(1).ToString(); role.Description = reader.GetValue(2).ToString(); role.SmartCloudSerial = reader.GetValue(3).ToString(); } } } } return role; }