Exemplo n.º 1
0
 protected void lnkEkle_Click(object sender, EventArgs e)
 {
     Brand b = new Brand();
     b.BrandText = txtBrandName.Text;
     b.Insert();
     Response.Redirect("../index.aspx");
 }
Exemplo n.º 2
0
        // Select

        public List<Brand> GetAll() 
        {
            List<Brand> brands = new List<Brand>();

            String sql = "select * from Brands";
            SqlCommand cmd = new SqlCommand(sql, cnn);
            cnn.Open();

            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read()) 
            {
                //int id = reader.GetInt32(0);
                //String brandText = reader.["BrandText"].ToString();

                Brand b = new Brand();
                b.Id = reader.GetInt32(0);
                b.BrandText = reader["BrandText"].ToString();

                brands.Add(b);

                
            }
            cnn.Close();
            return brands;
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Brand brand = new Brand();
     List<Brand> allbrand = brand.GetAll();
     rptBrand.DataSource = allbrand;
     rptBrand.DataBind();
 }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int Id = int.Parse(Request.QueryString["Id"].ToString());

            Session["Id"] = Id;
            Brand b = new Brand(Id);
            lblBrand.Text = b.BrandText;

        }
Exemplo n.º 5
0
 protected void lnkSakla_Click(object sender, EventArgs e)
 {
     int Id = int.Parse(Session["Id"].ToString());
     String txtYeniMarka = txtBrandName.Text;
     Brand b = new Brand(Id);
     b.BrandText = txtYeniMarka;
     b.Save();
     Response.Redirect("List.aspx");
 }
Exemplo n.º 6
0
        protected void lnkEvet_Click(object sender, EventArgs e)
        {
            int Id = int.Parse(Session["Id"].ToString());

            Brand b = new Brand(Id);
            b.Delete();
           
            Response.Redirect("List.aspx");

        }
Exemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) { 
         // Sakla butonuna basılıp gelinmiş
     }
     else
     {
         // Sayfa yüklenmiş.
         int Id = int.Parse(Request.QueryString["Id"].ToString());
         Session["Id"] = Id;
         Brand b = new Brand(Id);
         txtBrandName.Text = b.BrandText;
     }
 }