예제 #1
0
        public static ImportLendet GetByID(int id)
        {
            string        sql         = "SELECT * FROM  [dbo].[ImportLendet] where Id=@id";
            SqlConnection _connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

            _connection.Open();
            SqlCommand   x = new SqlCommand(sql, _connection);
            ImportLendet l = new ImportLendet();

            x.Parameters.AddWithValue("@id", id);
            using (var reader = x.ExecuteReader())
            {
                while (reader.Read())
                {
                    l.Id       = reader.GetInt32(0);
                    l.Dega     = reader.GetString(1);
                    l.Viti     = reader.GetInt32(2);
                    l.Lenda    = reader.GetString(3);
                    l.Paraleli = reader.GetString(4);
                    l.Tipi     = reader.GetString(5);
                    l.Pedagog  = reader.GetString(6);
                    l.Kapur    = reader.GetInt32(7);
                    l.IdTipi   = reader.GetInt32(8);
                    l.Zgjedhje = reader.GetInt32(9);
                }
            }
            _connection.Close();
            return(l);
        }
예제 #2
0
        public static List <ImportLendet> GetALL()
        {
            string        sql         = "SELECT * FROM  [dbo].[ImportLendet] ";
            SqlConnection _connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

            _connection.Open();
            SqlCommand          x  = new SqlCommand(sql, _connection);
            List <ImportLendet> IL = new List <ImportLendet>();

            using (var reader = x.ExecuteReader())
            {
                while (reader.Read())
                {
                    ImportLendet l = new ImportLendet();
                    l.Id       = reader.GetInt32(0);
                    l.Dega     = reader.GetString(1);
                    l.Viti     = reader.GetInt32(2);
                    l.Lenda    = reader.GetString(3);
                    l.Paraleli = reader.GetString(4);
                    l.Tipi     = reader.GetString(5);
                    l.Pedagog  = reader.GetString(6);
                    l.Kapur    = reader.GetInt32(7);
                    l.IdTipi   = reader.GetInt32(8);
                    l.Zgjedhje = reader.GetInt32(9);
                    IL.Add(l);
                }
            }
            _connection.Close();
            return(IL);
        }