コード例 #1
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");
            }
        }
コード例 #2
0
        private void PersonalGuncelle_Load(object sender, EventArgs e)
        {
            PersonelGuncelleFormModel model = new PersonelGuncelleFormModel();

            model.Personal = _personalService.GetPersonalByPersonalId(personalId);
            model.Kisi     = _kisiService.GetKisiById(model.Personal.KisiId);


            try
            {
                txtPersonalId.Text    = model.Personal.PersonalId.ToString();
                txtIsim.Text          = model.Personal.Adi;
                txtSoyIsim.Text       = model.Personal.Soyadi;
                txtTcNo.Text          = model.Personal.KisiId.ToString();
                txtBolumId.Text       = model.Personal.BolumId.ToString();
                txtSifre.Text         = model.Personal.Sifre.ToString();
                myEmailTextEdit1.Text = model.Personal.Mail;
            }
            catch
            {
            }
        }