Beispiel #1
0
        private void UrunGunceleForm_Load(object sender, EventArgs e)
        {
            UrunGuncelleFormModel model = new UrunGuncelleFormModel()
            {
                Urun  = _urunService.GetUrunAdedByUrunId(urunId),
                Marka = new Marka(),
            };

            model.Marka = _markaService.GetByMarkaId(model.Urun.MarkaId);


            try
            {
                txtMarkaId.Text   = model.Urun.MarkaId.ToString();
                txtUrunId.Text    = model.Urun.UrunId.ToString();
                txtMarkaAdi.Text  = model.Marka.MarkaAdi.ToString();
                txtUrunIsmi.Text  = model.Urun.UrunAdi.ToString();
                txtUrunAdedi.Text = model.Urun.UrunAded.ToString();

                if (model.Urun.StokDurum == 1)
                {
                    toggleSwitchStokDurum.IsOn = true;
                }
                else
                {
                    toggleSwitchStokDurum.IsOn = false;
                }
            }
            catch
            {
            }
        }
Beispiel #2
0
        private void barBtnZimmetKaydet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ZimmetEkleFormModel model = new ZimmetEkleFormModel();

            model.Urun     = _urunService.GetUrunAdedByUrunId(Convert.ToInt32(cbxUrun.SelectedValue));
            model.Personal = _personalService.GetPersonalByPersonalId(Convert.ToInt32(cbxPersonal.SelectedValue));
            model.Marka    = _markaService.GetByMarkaId(model.Urun.MarkaId);
            model.Zimmet   = new Zimmet();
            var kalanUrunAdet = model.Urun.UrunAded - Convert.ToInt32(spinEditZimmetAded.Value);



            if (kalanUrunAdet >= 0)
            {
                MessageBox.Show("Kalan Aded " + kalanUrunAdet.ToString());
                if (kalanUrunAdet == 0)
                {
                    model.Urun.StokDurum = 0;
                }
                if (_zimmetService.UrunSearch(Convert.ToInt32(cbxUrun.SelectedValue), Convert.ToInt32(cbxPersonal.SelectedValue)) != null)
                {
                    MessageBox.Show("Seçtiğiniz personlin zaten bu üründen zimmetli.Lüten farklı ürün seçin");
                }
                else
                {
                    try
                    {
                        model.Zimmet.ZimmetId     = Convert.ToInt32(txtZimmetId.Text);
                        model.Zimmet.ZimmetAded   = Convert.ToInt32(spinEditZimmetAded.Value);
                        model.Zimmet.ZimmetDurumu = 1;
                        model.Zimmet.MarkaId      = model.Marka.MarkaId;
                        model.Zimmet.UrunId       = model.Urun.UrunId;
                        model.Zimmet.PersonalId   = model.Personal.PersonalId;

                        _zimmetService.Add(model.Zimmet);
                        MessageBox.Show(cbxUrun.Text + "Zimmetlendi ");
                        this.Hide();

                        model.Urun.UrunAded = kalanUrunAdet;
                        _urunService.Update(model.Urun);
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show("En fazla" + model.Urun.UrunAded.ToString() + " aded seçebilirsin");
            }
        }
Beispiel #3
0
        private void barButtonItemAtik_ItemClick(object sender, ItemClickEventArgs e)
        {
            AtikEkleModel model = new AtikEkleModel();

            model.Urun  = _urunService.GetUrunAdedByUrunId(Convert.ToInt32(dgwTakip.CurrentRow.Cells[0].Value));
            model.Marka = _markaService.GetByMarkaId(Convert.ToInt32(dgwTakip.CurrentRow.Cells[1].Value));
            model.Atik  = new Atik();

            if (Convert.ToInt32(dgwTakip.CurrentRow.Cells[5].Value) == 0)
            {
                try
                {
                    _urunService.Delete(model.Urun);
                }
                catch
                {
                    MessageBox.Show("1");
                }
            }
            else
            {
                try
                {
                    model.Atik.AtikId   = _atikService.AtikIdUret();
                    model.Atik.MarkaId  = model.Marka.MarkaId;
                    model.Atik.UrunId   = model.Urun.UrunId;
                    model.Atik.Aciklama = "Çöp";
                    _atikService.Add(model.Atik);
                    MessageBox.Show("Atık işlemi tamamlandı");

                    model.Urun.StokDurum = 0;
                    _urunService.Update(model.Urun);
                    MessageBox.Show("Ürün Güncellendi");
                }
                catch
                {
                    MessageBox.Show("Bişeyler Ters Gitti");
                }
            }
        }