public static List <Data_PushBBVA.NotificationUser> ListSetting(string rut) { string sql = @"SELECT NTU.status, NT.title, NT.idNotificationType FROM dbo.Users U, dbo.NotificationType NT, dbo.User_NotificationType NTU WHERE NT.idNotificationType = NTU.idNotificationType AND NTU.idUser = U.idUser AND U.rut = @rut"; using (SqlConnection conn = new SqlConnection(connectionString: conex)) { List <Data_PushBBVA.NotificationUser> Setting = new List <Data_PushBBVA.NotificationUser>(); SqlCommand command = new SqlCommand(sql, conn); command.Parameters.AddWithValue("@rut", rut); conn.Open(); SqlDataAdapter daAdaptador = new SqlDataAdapter(command); DataSet dtDatos = new DataSet(); daAdaptador.Fill(dtDatos); foreach (DataRow _dr in dtDatos.Tables[0].Rows) { Data_PushBBVA.NotificationUser setting = new Data_PushBBVA.NotificationUser(); setting.status = _dr[0].ToString(); setting.title = _dr[1].ToString(); setting.idNotificationType = int.Parse(_dr[2].ToString()); Setting.Add(setting); } return(Setting); } }
public static List<Data_PushBBVA.NotificationUser> ListSetting(string rut) { string sql = @"SELECT NTU.status, NT.title, NT.idNotificationType FROM dbo.Users U, dbo.NotificationType NT, dbo.User_NotificationType NTU WHERE NT.idNotificationType = NTU.idNotificationType AND NTU.idUser = U.idUser AND U.rut = @rut"; using (SqlConnection conn = new SqlConnection(connectionString: conex)) { List<Data_PushBBVA.NotificationUser> Setting = new List<Data_PushBBVA.NotificationUser>(); SqlCommand command = new SqlCommand(sql, conn); command.Parameters.AddWithValue("@rut", rut); conn.Open(); SqlDataAdapter daAdaptador = new SqlDataAdapter(command); DataSet dtDatos = new DataSet(); daAdaptador.Fill(dtDatos); foreach (DataRow _dr in dtDatos.Tables[0].Rows) { Data_PushBBVA.NotificationUser setting = new Data_PushBBVA.NotificationUser(); setting.status = _dr[0].ToString(); setting.title = _dr[1].ToString(); setting.idNotificationType = int.Parse(_dr[2].ToString()); Setting.Add(setting); } return Setting; } }