Example #1
0
 private void hesabımıSilToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Emin misiniz", "Hesap Sil", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         Baglanti baglanti = new Baglanti();
         try
         {
             baglanti.sorguCalistir($"Delete from tblKullanicilar where kullaniciId='{kullaniciId}'");
             toolStripButtonCikis.PerformClick();
             MessageBox.Show("Hesabınız silindi");
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.Message);
         }
     }
 }
Example #2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var      senderGrid = (DataGridView)sender;
            Baglanti baglanti   = new Baglanti();
            int      id         = Convert.ToInt32(senderGrid.Rows[e.RowIndex].Cells[3].Value);

            if (e.ColumnIndex == 4 && e.RowIndex >= 0)
            {
                if (e.RowIndex == kullaniciRowIndex)
                {
                    MessageBox.Show("Kendinizi Silemezsiniz");
                }
                else
                {
                    if (MessageBox.Show("Emin misiniz Bu işlem geri alınamaz", "Kullanıcı Silme",
                                        MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        baglanti.sorguCalistir($"delete from tblKullanicilar where kullaniciID='{id}'");
                        dataGridDoldur();
                    }
                }
            }
            else if (senderGrid.Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn && e.RowIndex >= 0)
            {
                if (e.RowIndex == kullaniciRowIndex)
                {
                    MessageBox.Show("Kendi yetkinizi değiştiremezsiniz ");
                }
                else
                {
                    if (MessageBox.Show("Yetki Değişikliğini Onaylıyor musunuz?", "Yetki Değişikliği",
                                        MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        senderGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value =
                            !(bool)senderGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                        baglanti.sorguCalistir(
                            $"update tblKullanicilar set Admin='{senderGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value}' where kullaniciID='{id}'");
                    }
                    else
                    {
                        dataGridView1.RefreshEdit();
                    }
                }
            }
        }
Example #3
0
        void yorumlariEkle()
        {
            flp.Controls.Clear();
            Baglanti   baglanti = new Baglanti();
            SqlCommand cmd      = new SqlCommand();
            string     sorgu    = $"select * from YorumListele where FilmID='{filmId}'";

            baglanti.sorguCalistir(sorgu, ref cmd);
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Panel panel = new Panel();
                panelDoldur(dr, ref panel);
                flp.Controls.Add(panel);
            }
            baglanti.baglantiKapat();
        }
Example #4
0
        private void şifreDeğiştirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string yeniSifre = Interaction.InputBox("Yeni Şifre", "Şifre Değiştir", "");

            if (yeniSifre != "")
            {
                try
                {
                    Baglanti baglanti = new Baglanti();
                    baglanti.sorguCalistir($"update tblLogin set Sifre='{yeniSifre}' where KullaniciId='{kullaniciId}'");
                    MessageBox.Show("başarılı");
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }
                MessageBox.Show(yeniSifre);
            }
        }
Example #5
0
 private void btnGonder_Click(object sender, EventArgs e)
 {
     if (richTextBoxYazYrm.Text != "")
     {
         try
         {
             Baglanti baglanti = new Baglanti();
             string   sorgu    = $"YorumEkle '{kullaniciId}','{richTextBoxYazYrm.Text}','{filmId}'";
             baglanti.sorguCalistir(sorgu);
             YorumListele yorumListele = new YorumListele(filmId, kullaniciId, flowLayoutPanel1, label, admin);
             richTextBoxYazYrm.Text = "";
             int sayi = (Convert.ToInt32(this.label.Text));
             this.label.Text = (++sayi).ToString();
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.Message);
         }
     }
 }
Example #6
0
        private void liste(string kategori)
        {
            Baglanti   baglanti = new Baglanti();
            SqlCommand cmd      = new SqlCommand();
            string     sorgu    = $"select * from FilmListele where KategoriAdi='{kategori}'";

            baglanti.sorguCalistir(sorgu, ref cmd);
            SqlDataReader   dr = cmd.ExecuteReader();
            FlowLayoutPanel fr = new FlowLayoutPanel();

            while (dr.Read())
            {
                Panel panel = new Panel();
                flpDoldur(fr);
                panelDoldur(ref panel, dr);
                fr.Controls.Add(panel);
                fr.Tag = dr["KategoriAdi"];
            }
            baglanti.baglantiKapat();
            Flp.Add(fr);
        }
Example #7
0
        bool kayit()
        {
            Baglanti   baglanti = new Baglanti();
            string     sorgu    = $"KullaniciKayit ";
            SqlCommand cmd      = new SqlCommand();

            try
            {
                baglanti.sorguCalistir(sorgu, ref cmd);
                cmd.Parameters.AddWithValue("@KullaniciAdi", txtNick.Text);
                cmd.Parameters.AddWithValue("@Sifre", txtSifre.Text);
                if (resim != null)
                {
                    cmd.Parameters.AddWithValue("@Gorsel", resim);
                }
                else
                {
                    cmd.Parameters.Add("@Gorsel", SqlDbType.Image, 0).Value = DBNull.Value;
                }
                cmd.CommandType = CommandType.StoredProcedure;
                var returnParameter = cmd.Parameters.Add("@ReturnVal", SqlDbType.Int);
                returnParameter.Direction = ParameterDirection.ReturnValue;
                cmd.ExecuteNonQuery();
                var result = returnParameter.Value;
                if (!Convert.ToBoolean(result))
                {
                    MessageBox.Show("Kullanıcı adı var");
                    return(false);
                }
                cmd.Parameters.Clear();
                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);

                return(false);
            }
        }
Example #8
0
        private void btnGiris_Click(object sender, EventArgs e)
        {
            Baglanti   baglanti = new Baglanti();
            SqlCommand cmd      = new SqlCommand();
            string     sorgu    = $"GirisProc '{txtNick.Text}'";

            baglanti.sorguCalistir(sorgu, ref cmd);
            SqlDataReader dr           = cmd.ExecuteReader();
            bool          nickKontrol  = false;
            bool          sifreKontrol = false;

            while (dr.Read())
            {
                nickKontrol = true;
                if (txtSifre.Text == dr["Sifre"].ToString())
                {
                    sifreKontrol = true;
                    bool admin = false;
                    if (dr["Admin"] != DBNull.Value && Convert.ToBoolean(dr["Admin"]))
                    {
                        admin = true;
                    }

                    this.Hide();
                    FrmFilmListe frmFilmListe = new FrmFilmListe(Convert.ToInt32(dr["kullaniciID"]), admin);
                    frmFilmListe.Show();
                }
            }

            if (!nickKontrol)
            {
                MessageBox.Show("Kullanıcı adı hatalı");
            }
            else if (!sifreKontrol)
            {
                MessageBox.Show("Şifre hatalı");
            }
        }
Example #9
0
        void panelDoldur(ref Panel panel, SqlDataReader dr)
        {
            panel.Controls.Clear();
            Button      btnBegen     = new Button();
            Button      btnYorum     = new Button();
            Button      btnSil       = new Button();
            PictureBox  pictureBox1  = new PictureBox();
            RichTextBox richTextBox1 = new RichTextBox();
            Label       label1       = new Label();
            Label       label        = new Label();
            Label       lblFilmAdi   = new Label();
            Label       lblYonetmen  = new Label();

            panel.SuspendLayout();
            ((ISupportInitialize)(pictureBox1)).BeginInit();
            //
            // panel
            //
            panel.AutoScroll = true;
            panel.Controls.Add(btnYorum);
            panel.Controls.Add(btnBegen);
            panel.Controls.Add(richTextBox1);
            panel.Controls.Add(pictureBox1);
            panel.Controls.Add(label1);
            panel.Controls.Add(label);
            panel.Controls.Add(btnSil);
            panel.Controls.Add(lblFilmAdi);
            panel.Controls.Add(lblYonetmen);
            panel.Size      = new Size(268, 388);
            panel.BackColor = Color.Gray;
            //
            //lblFilmAdi
            //
            lblFilmAdi.AutoSize  = true;
            lblFilmAdi.Text      = "Film adı: " + dr["FilmAdi"];
            lblFilmAdi.ForeColor = Color.White;
            lblFilmAdi.Font      = new Font("Times New Roman", 10.2F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(162)));
            lblFilmAdi.Location  = new Point(panel.Width / 2 - lblFilmAdi.Width / 2, 221);
            //
            //lblYonetmen
            //
            lblYonetmen.AutoSize  = true;
            lblYonetmen.Text      = "Yönetmen adı: " + dr["Ad"];
            lblYonetmen.ForeColor = Color.White;
            lblYonetmen.Font      = new Font("Times New Roman", 10.2F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(162)));
            lblYonetmen.Location  = new Point(panel.Width / 2 - lblYonetmen.Width / 2, 221 + lblFilmAdi.Height);
            //
            // richTextBox1
            //
            richTextBox1.Location = new Point(39, 221 + lblFilmAdi.Height + lblYonetmen.Height);
            richTextBox1.ReadOnly = true;
            richTextBox1.Size     = new Size(189, 99 - (lblFilmAdi.Height + lblYonetmen.Height));
            richTextBox1.Text     = dr["FilmInfo"].ToString();
            //
            //btnSil
            //
            btnSil.Location              = new Point(240, 0);
            btnSil.Size                  = new Size(30, 26);
            btnSil.BackColor             = Color.Gray;
            btnSil.Visible               = false;
            btnSil.Click                += new EventHandler(btnSil_Click);
            btnSil.Tag                   = Convert.ToInt32(dr["FilmID"]);
            btnSil.BackgroundImage       = Properties.Resources.times_circle_solid;
            btnSil.BackgroundImageLayout = ImageLayout.Zoom;
            if (admin)
            {
                btnSil.Visible = true;
            }
            //
            // btnYorum
            //
            btnYorum.BackgroundImage       = Properties.Resources.comment_regular;
            btnYorum.BackgroundImageLayout = ImageLayout.Zoom;
            btnYorum.Location = new Point(173, 326);
            btnYorum.Size     = new Size(30, 26);
            btnYorum.UseVisualStyleBackColor = true;
            btnYorum.Click += new EventHandler(this.btnYorum_Click);
            BtnBilgi yorum = new BtnBilgi();

            yorum.FilmId      = Convert.ToInt32(dr["FilmID"]);
            yorum.KullaniciID = kullaniciId;
            yorum.Label       = label;
            btnYorum.Tag      = yorum;
            //
            // btnBegen
            //
            Baglanti   baglanti = new Baglanti();
            SqlCommand cmd      = new SqlCommand();

            baglanti.sorguCalistir($"select *from tblLikes where kullaniciID='{kullaniciId}' and FilmID={dr["FilmID"]}", ref cmd);
            SqlDataReader dr2   = cmd.ExecuteReader();
            bool          begen = false;

            while (dr2.Read())
            {
                begen = Convert.ToBoolean(dr2["Begendi"]);
            }
            baglanti.baglantiKapat();
            btnBegen.BackgroundImage       = Properties.Resources.e6925a934d0c279e4bd98e2ddff557ee;
            btnBegen.BackgroundImageLayout = ImageLayout.Zoom;
            btnBegen.Location = new Point(39, 326);
            btnBegen.Size     = new Size(30, 26);
            btnBegen.UseVisualStyleBackColor = true;
            if (begen)
            {
                btnBegen.BackColor = Color.Red;
            }
            else
            {
                btnBegen.BackColor = Color.AliceBlue;
            }
            btnBegen.FlatStyle = FlatStyle.Flat;
            BtnBilgi begeni = new BtnBilgi();

            begeni.FilmId      = Convert.ToInt32(dr["FilmID"]);
            begeni.KullaniciID = kullaniciId;
            begeni.Label       = label1;
            btnBegen.Tag       = begeni;
            btnBegen.Click    += new EventHandler(this.btnBegen_Click);
            //
            // pictureBox1
            //
            pictureBox1.Location = new Point(39, 12);
            pictureBox1.Size     = new Size(189, 203);
            pictureBox1.TabIndex = 0;
            pictureBox1.TabStop  = false;
            pictureBox1.BackgroundImageLayout = ImageLayout.Zoom;
            pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
            if (dr["Gorsel"] != DBNull.Value)
            {
                pictureBox1.Image = Bitmap.FromStream(new MemoryStream((byte[])dr["Gorsel"]));
            }
            //
            // label1
            //
            label1.AutoSize = true;
            label1.Font     = new Font("Microsoft Sans Serif", 10.2F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(162)));
            label1.Location = new Point(35, 355);
            label1.Size     = new Size(63, 20);
            label1.TabIndex = 5;
            Baglanti   baglanti2 = new Baglanti();
            SqlCommand cmd2      = new SqlCommand();

            baglanti2.sorguCalistir($"select count(*) as begeniSayisi from tblLikes where FilmID='{dr["FilmID"]}' and Begendi=1", ref cmd2);
            SqlDataReader dataReader = cmd2.ExecuteReader();

            while (dataReader.Read())
            {
                label1.Text = dataReader["begeniSayisi"].ToString();
            }
            baglanti.baglantiKapat();
            //
            // label
            //
            label.AutoSize = true;
            label.Font     = new Font("Microsoft Sans Serif", 10.2F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(162)));
            label.Location = new Point(170, 355);
            label.Size     = new Size(63, 20);
            Baglanti   baglanti3 = new Baglanti();
            SqlCommand cmd3      = new SqlCommand();

            baglanti3.sorguCalistir($"select count(*) as yorumSayisi from tblYorumlar where FilmID='{dr["FilmID"]}'", ref cmd3);
            SqlDataReader dataReader2 = cmd3.ExecuteReader();

            while (dataReader2.Read())
            {
                label.Text = dataReader2["yorumSayisi"].ToString();
            }
            baglanti2.baglantiKapat();
        }