コード例 #1
0
        protected void btKaydet_Click1(object sender, EventArgs e)
        {
            int           id     = Convert.ToInt32(Request.QueryString["id"]);
            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=ajans;Integrated Security=true;");

            baglan.Open();
            string filename = "";

            if (FileResim.HasFile)
            {
                filename = DateTime.Now.ToString("dd/MM/yyyy hh/mm/ss") + Path.GetFileName(FileResim.FileName);
                FileResim.SaveAs(Server.MapPath("~/resimler/proje/") + filename);
                SqlCommand komut = new SqlCommand("update projeler set ad=@ad,aciklama=@acıklama,resim=@resimi,tarih=@tarihi,kategoriId=@kategorisi where id=" + id, baglan);
                komut.Parameters.Add("@ad", SqlDbType.Text).Value        = txtad.Text;
                komut.Parameters.Add("@acıklama", SqlDbType.Text).Value  = txtaciklama.Text;
                komut.Parameters.Add("@resimi", SqlDbType.Text).Value    = filename;
                komut.Parameters.Add("@kategorisi", SqlDbType.Int).Value = drpKategori.SelectedValue;
                komut.Parameters.Add("@tarihi", SqlDbType.Date).Value    = txttarih.Text;
                komut.ExecuteNonQuery();
            }
            else
            {
                SqlCommand komut = new SqlCommand("update projeler set ad=@ad,aciklama=@acıklama,tarih=@tarihi,kategoriId=@kategorisi where id=" + id, baglan);
                komut.Parameters.Add("@ad", SqlDbType.Text).Value        = txtad.Text;
                komut.Parameters.Add("@acıklama", SqlDbType.Text).Value  = txtaciklama.Text;
                komut.Parameters.Add("@kategorisi", SqlDbType.Int).Value = drpKategori.SelectedValue;
                komut.Parameters.Add("@tarihi", SqlDbType.Date).Value    = txttarih.Text;
                komut.ExecuteNonQuery();
            }

            baglan.Close();

            Response.Redirect("ProjeListele.aspx");
            Response.End();
        }
コード例 #2
0
        protected void btKaydet_Click(object sender, EventArgs e)
        {
            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=ajans;Integrated Security=true;");

            baglan.Open();

            string filename = "";

            if (FileResim.HasFile)
            {
                filename = DateTime.Now.ToString("dd/MM/yyyy hh/mm/ss") + Path.GetFileName(FileResim.FileName);
                FileResim.SaveAs(Server.MapPath("~/resimler/calisan/") + filename);
            }


            SqlCommand komut = new SqlCommand("insert into calısanlar(ad,soyad,unvan,resim,facebookLink,twitterLink,instagramLink)values(@adi,@soyadi,@unvani,@resimi,@facebookLinki,@twitterLinki,@instagramLinki)", baglan);

            komut.Parameters.Add("@adi", SqlDbType.Text).Value            = Txtad.Text;
            komut.Parameters.Add("@soyadi", SqlDbType.Text).Value         = txtSoyad.Text;
            komut.Parameters.Add("@unvani", SqlDbType.Text).Value         = txtunvan.Text;
            komut.Parameters.Add("@resimi", SqlDbType.Text).Value         = filename;
            komut.Parameters.Add("@facebookLinki", SqlDbType.Text).Value  = txtface.Text;
            komut.Parameters.Add("@twitterLinki", SqlDbType.Text).Value   = txtwit.Text;
            komut.Parameters.Add("@instagramLinki", SqlDbType.Text).Value = txtInst.Text;
            komut.ExecuteNonQuery();
            Response.Redirect("CalısanListele.aspx");
            Response.End();
        }
コード例 #3
0
        protected void btKaydet_Click(object sender, EventArgs e)
        {
            string baslik = Txtbaslik.Text;

            string aciklama = txtaciklama.Text;

            int duzenlencekId = Convert.ToInt32(Request.QueryString["id"]);


            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=ajans;Integrated Security=true;");

            baglan.Open();

            string filename = "";

            if (FileResim.HasFile)
            {
                filename = DateTime.Now.ToString("dd/MM/yyyy hh/mm/ss") + Path.GetFileName(FileResim.FileName);
                FileResim.SaveAs(Server.MapPath("~/resimler/hizmetler/") + filename);
                string islemcik = Request.QueryString["islem"];

                SqlCommand komut1 = new SqlCommand(String.Format("Update hizmetler Set baslik='{0}',acıklama ='{1}',resim='{2}' where id={3}", baslik, aciklama, filename, duzenlencekId), baglan);
                komut1.ExecuteNonQuery();
            }

            else
            {
                SqlCommand komut1 = new SqlCommand(String.Format("Update hizmetler Set baslik='{0}',acıklama ='{1}' where id={2}", baslik, aciklama, duzenlencekId), baglan);

                komut1.ExecuteNonQuery();
            }
            Response.Redirect("HizmetListele.aspx");
            Response.End();
        }
コード例 #4
0
        protected void btKaydet_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);

            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=ajans;Integrated Security=true;");

            baglan.Open();



            string filename = "";

            if (FileResim.HasFile)
            {
                filename = DateTime.Now.ToString("dd/MM/yyyy hh/mm/ss") + Path.GetFileName(FileResim.FileName);


                FileResim.SaveAs(Server.MapPath("~/resimler/calisan/") + filename);
                SqlCommand komut1 = new SqlCommand("update calısanlar Set ad=@adi,soyad=@soyadi,unvan=@unvani,resim=@resimi,instagramLink=@instagramLinki,facebookLink=@facebookLinki,twitterLink=@twitterLinki where id=" + id, baglan);
                komut1.Parameters.Add("@adi", SqlDbType.Text).Value            = Txtad.Text;
                komut1.Parameters.Add("@soyadi", SqlDbType.Text).Value         = txtSoyad.Text;
                komut1.Parameters.Add("@unvani", SqlDbType.Text).Value         = txtunvan.Text;
                komut1.Parameters.Add("@resimi", SqlDbType.Text).Value         = filename;
                komut1.Parameters.Add("@facebookLinki", SqlDbType.Text).Value  = txtface.Text;
                komut1.Parameters.Add("@twitterLinki", SqlDbType.Text).Value   = txtwit.Text;
                komut1.Parameters.Add("@instagramLinki", SqlDbType.Text).Value = txtInst.Text;

                komut1.ExecuteNonQuery();
            }
            else
            {
                SqlCommand komut1 = new SqlCommand("update calısanlar Set ad=@adi,soyad=@soyadi,unvan=@unvani,instagramLink=@instagramLinki,facebookLink=@facebookLinki,twitterLink=@twitterLinki where id=" + id, baglan);
                komut1.Parameters.Add("@adi", SqlDbType.Text).Value            = Txtad.Text;
                komut1.Parameters.Add("@soyadi", SqlDbType.Text).Value         = txtSoyad.Text;
                komut1.Parameters.Add("@unvani", SqlDbType.Text).Value         = txtunvan.Text;
                komut1.Parameters.Add("@facebookLinki", SqlDbType.Text).Value  = txtface.Text;
                komut1.Parameters.Add("@twitterLinki", SqlDbType.Text).Value   = txtwit.Text;
                komut1.Parameters.Add("@instagramLinki", SqlDbType.Text).Value = txtInst.Text;

                komut1.ExecuteNonQuery();
            }


            Response.Redirect("CalısanListele.aspx");
            Response.End();
        }
コード例 #5
0
        protected void btKaydet_Click(object sender, EventArgs e)
        {
            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=ajans;Integrated Security=true;");

            baglan.Open();
            string filename = "";

            if (FileResim.HasFile)
            {
                filename = DateTime.Now.ToString("dd/MM/yyyy hh/mm/ss") + Path.GetFileName(FileResim.FileName);
                FileResim.SaveAs(Server.MapPath("~/resimler/hizmetler/") + filename);
            }

            SqlCommand komut = new SqlCommand("insert into hizmetler(baslik,acıklama,resim)values(@baslık,@acıklama,@resimi)", baglan);

            komut.Parameters.Add("@baslık", SqlDbType.Text).Value   = Txtbaslik.Text;
            komut.Parameters.Add("@acıklama", SqlDbType.Text).Value = txtaciklama.Text;
            komut.Parameters.Add("@resimi", SqlDbType.Text).Value   = filename;
            komut.ExecuteNonQuery();
            Response.Redirect("HizmetListele.aspx");
            Response.End();
        }
コード例 #6
0
        protected void btnKaydet_Click(object sender, EventArgs e)
        {
            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=kantin;Integrated Security=true;");

            baglan.Open();



            int id = Convert.ToInt32(Request.QueryString["id"]);

            string filename = "";

            if (FileResim.HasFile)
            {
                filename = DateTime.Now.ToString("dd/MM/yyyy hh/mm/ss") + Path.GetFileName(FileResim.FileName);
                FileResim.SaveAs(Server.MapPath("~/resimler/urun/") + filename);
                SqlCommand komut = new SqlCommand("Update ürünler set ad=@adi ,kategoriId=@kategori,stok=@stok,fiyat=@fiyat,resim=@resim where id=" + id, baglan);
                komut.Parameters.Add("@adi", SqlDbType.Text).Value       = txturun.Text;
                komut.Parameters.Add("@kategori", SqlDbType.Int).Value   = drpKtgr.SelectedValue;
                komut.Parameters.Add("@stok", SqlDbType.Int).Value       = txtstok.Text;
                komut.Parameters.Add("@fiyat", SqlDbType.Int).Value      = txtfiyat.Text;
                komut.Parameters.Add("@resim", SqlDbType.NVarChar).Value = filename;
                komut.ExecuteNonQuery();
            }
            else
            {
                SqlCommand komut = new SqlCommand("Update ürünler set ad=@adi ,kategoriId=@kategori,stok=@stok,fiyat=@fiyat where id=" + id, baglan);
                komut.Parameters.Add("@adi", SqlDbType.Text).Value       = txturun.Text;
                komut.Parameters.Add("@kategori", SqlDbType.Int).Value   = drpKtgr.SelectedValue;
                komut.Parameters.Add("@stok", SqlDbType.Int).Value       = txtstok.Text;
                komut.Parameters.Add("@fiyat", SqlDbType.NVarChar).Value = txtfiyat.Text;
                komut.ExecuteNonQuery();
            }


            Response.Redirect("UrunListele.aspx");
            Response.End();
        }
コード例 #7
0
        protected void btKaydet_Click(object sender, EventArgs e)
        {
            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=ajans;Integrated Security=true;");

            baglan.Open();
            string filename = "";

            if (FileResim.HasFile)
            {
                filename = DateTime.Now.ToString("dd/MM/yyyy hh/mm/ss") + Path.GetFileName(FileResim.FileName);
                FileResim.SaveAs(Server.MapPath("~/resimler/proje/") + filename);
            }
            SqlCommand komut = new SqlCommand("insert into projeler(ad,aciklama,resim,tarih,kategoriId)values(@ad,@acıklama,@resimi,@tarihi,@kategorisi)", baglan);

            komut.Parameters.Add("@ad", SqlDbType.Text).Value        = txtAd.Text;
            komut.Parameters.Add("@acıklama", SqlDbType.Text).Value  = txtaciklama.Text;
            komut.Parameters.Add("@resimi", SqlDbType.Text).Value    = filename;
            komut.Parameters.Add("@kategorisi", SqlDbType.Int).Value = drpKategori.SelectedValue;
            komut.Parameters.Add("@tarihi", SqlDbType.Date).Value    = txttarih.Text;
            komut.ExecuteNonQuery();
            Response.Redirect("ProjeListele.aspx");
            Response.End();
        }
コード例 #8
0
        protected void btnKaydet_Click(object sender, EventArgs e)
        {
            SqlConnection baglan = new SqlConnection("Server=DESKTOP-6GBHM2T\\SQLEXPRESS;Database=kantin;Integrated Security=true;");

            baglan.Open();
            string filename = "";

            if (FileResim.HasFile)
            {
                filename = DateTime.Now.ToString("dd/MM/yyyy hh/mm/ss") + Path.GetFileName(FileResim.FileName);
                FileResim.SaveAs(Server.MapPath("~/resimler/urun/") + filename);
            }
            SqlCommand komut = new SqlCommand("insert into ürünler(ad,kategoriId,stok,fiyat,resim)values(@adi,@kategori,@stok,@fiyat,@resimi)", baglan);

            komut.Parameters.Add("@adi", SqlDbType.Text).Value        = txturun.Text;
            komut.Parameters.Add("@stok", SqlDbType.Int).Value        = txtstok.Text;
            komut.Parameters.Add("@fiyat", SqlDbType.Int).Value       = txtfiyat.Text;
            komut.Parameters.Add("@resimi", SqlDbType.NVarChar).Value = filename;
            komut.Parameters.Add("@kategori", SqlDbType.Int).Value    = drpKtgr.SelectedValue;
            komut.ExecuteNonQuery();
            baglan.Close();
            Response.Redirect("UrunListele.aspx");
            Response.End();
        }