Esempio n. 1
0
        public static stok_depo Ver_Depo(ref otosisdbEntities dbModel, int DepoID)
        {
            stok_depo depo = null;

            depo = (from abc in dbModel.stok_depo
                    where abc.DepoID == DepoID
                    select abc).FirstOrDefault();

            if (depo != null)
            {
                dbModel.Refresh(RefreshMode.StoreWins, depo);
            }

            return(depo);
        }
Esempio n. 2
0
        void Yukle_Depo(int _DepoID)
        {
            if (_Yukleme)
            {
                return;
            }
            try
            {
                Temizle_Depo();
                YeniKayit = false;

                if (depo != null && depo.EntityState != EntityState.Detached)
                {
                    dbModel.Detach(depo);
                }
                depo = null;
                depo = Isler.Stok.Ver_Depo(ref dbModel, _DepoID);
                if (depo == null)
                {
                    return;
                }

                txtDepoID.Text     = depo.DepoID.ToString();
                txtDepoAd.Text     = depo.DepoAd;
                chkKilitli.Checked = depo.Kilitli;

                memoAciklama.Text = depo.Aciklama;
                memoLokasyon.Text = depo.Lokasyon;

                ucKayitBilgi1.Yukle(depo.KayitKullaniciID, depo.KayitZaman, depo.DuzenKullaniciID, depo.DuzenZaman);
            }
            catch (Exception hata)
            {
                XtraMessageBox.Show("Depo Bilgileri Getirilirken Bir Hata Oluştu.\n\nHata:\n" + hata.Message, "Hata",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
        void Kaydet()
        {
            if (YeniKayit && !Genel.Yetkilerim.Contains(22))
            {
                Genel.Yetki_Uyari(22);
                return;
            }
            else if (!YeniKayit && !Genel.Yetkilerim.Contains(23))
            {
                Genel.Yetki_Uyari(23);
                return;
            }
            try
            {
                #region Kontroller
                if (string.IsNullOrEmpty(txtDepoAd.Text.Trim()))
                {
                    XtraMessageBox.Show("Depo Adı Boş Bırakılamaz.", "Eksik Alan",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtDepoAd.Focus(); txtDepoAd.Select();
                    return;
                }

                if (YeniKayit && Isler.Stok.Varmi_DepoAdi(txtDepoAd.Text))
                {
                    XtraMessageBox.Show("Bu Depo Adı Daha Önce Kullanılmış\nLütfen Farklı Bir Depo Adı Yazınız.", "Aynı Değer",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtDepoAd.Focus(); txtDepoAd.Select();
                    return;
                }
                else if (!YeniKayit && txtDepoAd.Text != depo.DepoAd && Isler.Stok.Varmi_DepoAdi(txtDepoAd.Text, depo.DepoAd))
                {
                    XtraMessageBox.Show("Bu Depo Adı Daha Önce Kullanılmış\nLütfen Farklı Bir Depo Adı Yazınız.", "Aynı Değer",
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtDepoAd.Focus(); txtDepoAd.Select();
                    return;
                }
                #endregion

                if (YeniKayit)
                {
                    if (XtraMessageBox.Show("Depo Aşağıdaki Şirket Üzerine Açılak:\n\n"
                                            + "Şirket No : " + Genel.AktifSirket.SirketID.ToString()
                                            + "\nŞirket Adı : " + Genel.AktifSirket.KisaAd, "Depo Ekleme Onay",
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                    if (depo != null && depo.EntityState != EntityState.Detached)
                    {
                        dbModel.Detach(depo);
                    }
                    depo          = null;
                    depo          = new stok_depo();
                    depo.SirketID = Genel.AktifSirket.SirketID;
                }

                #region Aktarma
                depo.Aciklama = memoAciklama.Text;
                depo.DepoAd   = txtDepoAd.Text;
                depo.Kilitli  = chkKilitli.Checked;
                depo.Lokasyon = memoLokasyon.Text;
                #endregion

                #region Kayıt
                if (YeniKayit)
                {
                    depo.KayitKullaniciID = Genel.AktifKullanici.KullaniciID;
                    depo.KayitZaman       = DateTime.Now;

                    dbModel.AddTostok_depo(depo);
                }
                else
                {
                    depo.DuzenKullaniciID = Genel.AktifKullanici.KullaniciID;
                    depo.DuzenZaman       = DateTime.Now;
                }

                dbModel.SaveChanges();

                Genel.AlertMesaj.Show(Genel.AnaEkran, "İşlem Başarılı", "Depo Başarılı Bir Şekilde Kaydedilmiştir.", null,
                                      ResOtoSis.mark_blue);

                Ara();
                #endregion
            }
            catch (Exception hata)
            {
                XtraMessageBox.Show("Depo Kayıdı Yapılırken Bir Hata Oluştu.\n\nHata:\n" + hata.Message, "Hata",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }