Example #1
0
        private void ListView2_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                textBox29.Clear();
                textBox18.Clear();
                comboBox2.SelectedIndex = -1;
                textBox17.Clear();
                textBox15.Clear();
                textBox12.Clear();
                textBox11.Clear();


                textBox29.Text = listView2.SelectedItems[0].SubItems[1].Text;
                textBox18.Text = listView2.SelectedItems[0].SubItems[2].Text;
                textBox17.Text = listView2.SelectedItems[0].SubItems[4].Text;
                textBox15.Text = listView2.SelectedItems[0].SubItems[5].Text;
                textBox12.Text = listView2.SelectedItems[0].SubItems[6].Text;
                textBox11.Text = listView2.SelectedItems[0].SubItems[7].Text;

                Product urun = DalProduct.GetProduct(Convert.ToInt32(textBox29.Text));

                comboBox2.SelectedValue = urun.CategoryID;
            }
            catch (Exception)
            {
            }
        }
Example #2
0
        private void Button15_Click(object sender, EventArgs e)
        {
            try
            {
                var urunID        = Convert.ToInt32(listView5.SelectedItems[0].SubItems[1].Text);
                var satilacakUrun = DalProduct.GetProduct(urunID);

                var EmptyArea = EmptyTextBoxControl(groupBox18);
                if (EmptyArea)
                {
                    MessageBox.Show("Eksik bilgi girdiniz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    if (satilacakUrun.Count >= Convert.ToInt32(textBox26.Text))
                    {
                        var newSale = new Sale();

                        newSale.ProductID  = satilacakUrun.ProductID;
                        newSale.DateSold   = DateTime.Now.Date;
                        newSale.CustomerID = (int)comboBox4.SelectedValue;
                        newSale.UserID     = Form1.LoggedInUser.UserID;
                        newSale.SoldUnit   = Convert.ToInt32(textBox26.Text);

                        var sorgu = DalSale.CUD(newSale, System.Data.Entity.EntityState.Added);

                        if (sorgu)
                        {
                            satilacakUrun.Count -= Convert.ToInt32(textBox26.Text);
                            DalProduct.CUD(satilacakUrun, System.Data.Entity.EntityState.Modified);

                            GuncelleSatilacakListe();
                            MessageBox.Show("Ürün satıldı.", "İşlem Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Satış gerçekleşmedi.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Stoklarda bu kadar ürün yok.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Example #3
0
        private void ListView5_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                groupBox18.Visible = true;

                var urunID        = Convert.ToInt32(listView5.SelectedItems[0].SubItems[1].Text);
                var satilacakUrun = DalProduct.GetProduct(urunID);

                textBox25.Text = satilacakUrun.ProductName;
                textBox26.Text = satilacakUrun.Count.ToString();
            }
            catch (Exception)
            {
            }
        }