Пример #1
0
        public static List <Data_PushBBVA.Notification> ListNotification(string type)
        {
            string sql = @"SELECT N.idNotification, N.status, NT.idNotificationType ,  N.creation, N.delivery, U.firstName, U.lastName, U.rut, NT.title, NT.text, D.token, P.description 
                            FROM dbo.Notification N, dbo.Users U, dbo.NotificationType NT, dbo.Device D, dbo.Plataform P
                            WHERE P.idPlataform = D.idPlataform  AND D.idDevice = N.idDevice AND NT.idNotificationType = N.idNotificationType AND N.idUser = U.idUser AND N.status = @type";


            using (SqlConnection conn = new SqlConnection(connectionString: conex))
            {
                List <Data_PushBBVA.Notification> notification = new List <Data_PushBBVA.Notification>();

                SqlCommand command = new SqlCommand(sql, conn);


                command.Parameters.AddWithValue("@type", type);

                conn.Open();

                SqlDataAdapter daAdaptador = new SqlDataAdapter(command);
                DataSet        dtDatos     = new DataSet();
                daAdaptador.Fill(dtDatos);

                foreach (DataRow _dr in dtDatos.Tables[0].Rows)
                {
                    Data_PushBBVA.Notification Notifi = new Data_PushBBVA.Notification();
                    Notifi.idNotification = int.Parse(_dr[0].ToString());
                    Notifi.name           = _dr[5].ToString() + " " + _dr[6].ToString();
                    Notifi.create         = DateTime.Parse(_dr[3].ToString());
                    Notifi.delivery       = DateTime.Parse(_dr[4].ToString());
                    Notifi.tipo           = _dr[2].ToString();
                    Notifi.rut            = _dr[7].ToString();
                    Notifi.text           = _dr[9].ToString();
                    Notifi.title          = _dr[8].ToString();
                    Notifi.token          = _dr[10].ToString();
                    Notifi.plataform      = _dr[11].ToString();


                    notification.Add(Notifi);
                }


                return(notification);
            }
        }
Пример #2
0
        public static List<Data_PushBBVA.Notification> ListNotification(string type)
        {
            string sql = @"SELECT N.idNotification, N.status, NT.idNotificationType ,  N.creation, N.delivery, U.firstName, U.lastName, U.rut, NT.title, NT.text, D.token, P.description
                            FROM dbo.Notification N, dbo.Users U, dbo.NotificationType NT, dbo.Device D, dbo.Plataform P
                            WHERE P.idPlataform = D.idPlataform  AND D.idDevice = N.idDevice AND NT.idNotificationType = N.idNotificationType AND N.idUser = U.idUser AND N.status = @type";

             using (SqlConnection conn = new SqlConnection(connectionString: conex))
             {

                    List<Data_PushBBVA.Notification> notification = new List<Data_PushBBVA.Notification>();

                     SqlCommand command = new SqlCommand(sql, conn);

                     command.Parameters.AddWithValue("@type", type);

                     conn.Open();

                     SqlDataAdapter daAdaptador = new SqlDataAdapter(command);
                     DataSet dtDatos = new DataSet();
                     daAdaptador.Fill(dtDatos);

                     foreach (DataRow _dr in dtDatos.Tables[0].Rows)
                     {
                         Data_PushBBVA.Notification Notifi = new Data_PushBBVA.Notification();
                         Notifi.idNotification = int.Parse(_dr[0].ToString());
                         Notifi.name = _dr[5].ToString() + " " + _dr[6].ToString();
                         Notifi.create = DateTime.Parse(_dr[3].ToString());
                         Notifi.delivery = DateTime.Parse(_dr[4].ToString());
                         Notifi.tipo = _dr[2].ToString();
                         Notifi.rut = _dr[7].ToString();
                         Notifi.text = _dr[9].ToString();
                         Notifi.title = _dr[8].ToString();
                         Notifi.token = _dr[10].ToString();
                         Notifi.plataform = _dr[11].ToString();

                         notification.Add(Notifi);
                     }

                     return notification;

             }
        }