示例#1
0
 private void button3_Click(object sender, EventArgs e)
 {
     //Kategori Silme Butonu
     if (!String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox3.Text))
     {
         var a = MessageBox.Show(" Silmek istediğinize emin misiniz?", "Bilgilendirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (a == DialogResult.Yes)
         {
             Category cg = HelperCategory.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));
             cg.IsActive = false;
             var b = HelperCategory.CUD(cg, System.Data.Entity.EntityState.Modified);
             if (b.Item2)
             {
                 MessageBox.Show("Silme işlemi başarılı");
             }
             else
             {
                 MessageBox.Show("Silme yapılamadı");
             }
         }
         Yenile();
     }
     else
     {
         MessageBox.Show("Lütfen silinecek kategoriyi seçiniz.");
     }
 }
示例#2
0
 private void Button3_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBox2.Text))
     {
         MessageBox.Show("Alan boş bırakılamaz. Düzenleyip tekrar deneyiniz.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         Category category = HelperCategory.GetCategoryById(Convert.ToInt32(label3.Text));
         category.Name = textBox2.Text;
         var a = HelperCategory.CategoryCUD(category, System.Data.Entity.EntityState.Modified);
         if (a.Item2)
         {
             RefreshTheDatabase();
             textBox2.Clear();
             label3.Text       = null;
             groupBox3.Enabled = false;
             MessageBox.Show("Kategori düzenlendi", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Kategori düzenlenemedi", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
示例#3
0
 private void button4_Click(object sender, EventArgs e)
 {
     //Kategori Düzenleme Butonu
     if (!String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox3.Text))
     {
         Category cg = HelperCategory.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));
         cg.categoryName = textBox2.Text;
         cg.Description  = textBox3.Text;
         var degistir = HelperCategory.CUD(cg, System.Data.Entity.EntityState.Modified);
         if (degistir.Item2)
         {
             MessageBox.Show("Güncelleme başarılı.");
         }
         else
         {
             MessageBox.Show("Güncelleme yapılamadı.");
         }
         Yenile();
     }
     else
     {
         MessageBox.Show("Lütfen tüm alanları doldurunuz.");
     }
     textBox2.Clear();
     textBox3.Clear();
 }
示例#4
0
        private void Film_Load(object sender, EventArgs e)
        {
            if (user.Type == 1)
            {
                groupBox2.Enabled = false;
                button1.Enabled   = false;
            }
            RefreshTheDatabase();
            List <Category> categories = HelperCategory.GetCategoryList();

            comboBox1.DataSource    = categories;
            comboBox1.ValueMember   = "CategoryId";
            comboBox1.DisplayMember = "Name";
            comboBox4.DataSource    = categories;
            comboBox4.ValueMember   = "CategoryId";
            comboBox4.DisplayMember = "Name";
            List <DirectorModel> directorModels = HelperDirector.GetDirectorModelList();

            comboBox2.DataSource    = directorModels;
            comboBox2.ValueMember   = "DirectorId";
            comboBox2.DisplayMember = "FullName";
            comboBox3.DataSource    = directorModels;
            comboBox3.ValueMember   = "DirectorId";
            comboBox3.DisplayMember = "FullName";
        }
示例#5
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            dataGridView1.ClearSelection();
            Category cg = HelperCategory.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));

            textBox2.Text = cg.categoryName;
            textBox3.Text = cg.Description;
        }
示例#6
0
        private void RefreshTheDatabase()
        {
            dataGridView1.Rows.Clear();
            List <Category> categories = HelperCategory.GetCategoryList();

            foreach (var item in categories)
            {
                dataGridView1.Rows.Add(item.CategoryId, item.Name);
            }
        }
示例#7
0
        public void Yenile()
        {
            dataGridView1.Rows.Clear();
            List <Category> categories = HelperCategory.GetList();

            foreach (var item in categories)
            {
                if (item.IsActive == true)
                {
                    dataGridView1.Rows.Add(item.categoryID, item.categoryName, item.Description);
                }
            }
        }
示例#8
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            dataGridView1.ClearSelection();
            Product  p = HelperProduct.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));
            Category c = HelperCategory.GetByID(p.categoryID);
            Supplier s = HelperSupplier.GetByID(p.supplierID);

            textBox2.Text   = p.productName;
            textBox3.Text   = p.unitPrice.ToString();
            textBox4.Text   = p.discount.ToString();
            comboBox2.Text  = s.companyName;
            comboBox3.Text  = c.categoryName;
            button6.Enabled = true;
            button7.Enabled = true;
        }
示例#9
0
 private void Button1_Click(object sender, EventArgs e)
 {
     if (user.Type == 0)
     {
         movie          = HelperMovie.GetMovieById(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));
         label13.Text   = movie.MovieId.ToString();
         textBox4.Text  = movie.Name;
         comboBox4.Text = HelperCategory.GetCategoryById(movie.CategoryId).Name;
         comboBox3.Text = HelperDirector.GetDirectorById(movie.DirectorId).Name;
         textBox6.Text  = movie.Minutes.ToString();
         byte[]       imageBytes = Convert.FromBase64String(movie.Banner);
         MemoryStream ms         = new MemoryStream(imageBytes, 0, imageBytes.Length);
         ms.Write(imageBytes, 0, imageBytes.Length);
         pictureBox2.Image = Image.FromStream(ms, true);
         textBox3.Text     = movie.Description;
         groupBox3.Enabled = true;
     }
 }
示例#10
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Kategori Arama Butonu
            dataGridView1.Rows.Clear();
            List <Category> cg = new List <Category>();

            if (comboBox1.SelectedIndex == 0)
            {
                cg = HelperCategory.GetListByCategoryName(textBox1.Text);
            }
            foreach (var item in cg)
            {
                if (item.IsActive == true)
                {
                    dataGridView1.Rows.Add(item.categoryID, item.categoryName, item.Description);
                }
            }
            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
        }
示例#11
0
        private void FilmDetay_Load(object sender, EventArgs e)
        {
            MovieModel movieModel = new MovieModel();

            movieModel.MovieId     = movie.MovieId;
            movieModel.Name        = movie.Name;
            movieModel.Category    = HelperCategory.GetCategoryById(movie.CategoryId);
            movieModel.Director    = HelperDirector.GetDirectorById(movie.DirectorId);
            movieModel.Description = movie.Description;
            movieModel.Banner      = movie.Banner;
            movieModel.Minutes     = movie.Minutes;
            label2.Text            = movieModel.Name;
            label7.Text            = movieModel.Category.Name;
            label8.Text            = movieModel.Director.Name + " " + movieModel.Director.Surname;
            label9.Text            = movieModel.Minutes.ToString() + "dk";
            label10.Text           = movieModel.Description;
            byte[]       imageBytes = Convert.FromBase64String(movie.Banner.ToString());
            MemoryStream ms         = new MemoryStream(imageBytes, 0, imageBytes.Length);

            ms.Write(imageBytes, 0, imageBytes.Length);
            pictureBox1.Image = Image.FromStream(ms, true);
        }
示例#12
0
        private void ProductForm_Load(object sender, EventArgs e)
        {
            comboBox1.Items.Add("Ürün Ad");
            comboBox1.Items.Add("Satıcı şirket Ad");
            comboBox1.Items.Add("Kategori Ad");
            Yenile();
            var             ff   = HelperCategory.GetList();
            List <Category> temp = new List <Category>();

            foreach (var item in ff)
            {
                if (item.IsActive == true)
                {
                    temp.Add(item);
                }
            }
            comboBox3.DataSource    = temp;
            comboBox3.ValueMember   = "categoryID";
            comboBox3.DisplayMember = "categoryName";

            var             gg    = HelperSupplier.GetList();
            List <Supplier> temp2 = new List <Supplier>();

            foreach (var item in gg)
            {
                if (item.IsActive == true)
                {
                    temp2.Add(item);
                }
            }
            comboBox2.DataSource    = temp2;
            comboBox2.ValueMember   = "supplierID";
            comboBox2.DisplayMember = "companyName";
            textBox2.Clear();
            textBox3.Clear();
            textBox4.Clear();
            button6.Enabled = false;
            button7.Enabled = false;
        }
示例#13
0
 private void button2_Click(object sender, EventArgs e)
 {
     //Kategori Ekleme Butonu
     if (!String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox3.Text))
     {
         if (!HelperCategory.SearchCategoryName(textBox2.Text))
         {
             MessageBox.Show("Aynı kategori adı mevcut. Lütfen kategori adını değiştiriniz.");
         }
         else
         {
             Category cg = new Category()
             {
                 categoryName = textBox2.Text,
                 Description  = textBox3.Text,
                 IsActive     = true
             };
             var ekle = HelperCategory.CUD(cg, System.Data.Entity.EntityState.Added);
             if (ekle.Item2)
             {
                 MessageBox.Show("Kategori ekleme başarılı.");
             }
             else
             {
                 MessageBox.Show("Kategori eklenemedi");
             }
             Yenile();
         }
     }
     else
     {
         MessageBox.Show("Lütfen tüm alanları doldurunuz.");
     }
     textBox2.Clear();
     textBox3.Clear();
 }
示例#14
0
 private void Button2_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBox1.Text))
     {
         MessageBox.Show("Alan boş bırakılamaz. Düzenleyip tekrar deneyiniz.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         Category category = new Category();
         category.Name = textBox1.Text;
         var a = HelperCategory.CategoryCUD(category, System.Data.Entity.EntityState.Added);
         if (a.Item2)
         {
             RefreshTheDatabase();
             textBox1.Clear();
             label3.Text = null;
             MessageBox.Show("Kategori eklendi.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Kategori eklenemedi.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }