public SorgulaCalisanYanit SorgulaCalisan(SorgulaCalisanIstek istek)
        {
            try
            {
                SorgulaCalisanYanit   yanit        = new SorgulaCalisanYanit(false);
                IEnumerable <Calisan> calisanListe = null;

                if (!this._kontrol.uygunMu(istek))
                {
                    yanit.IsaretleGecemediIlkKontrolu(this._kontrol.alHataKodu(istek));
                    return(yanit);
                }

                calisanListe = this._calisanIsKurali.SorgulaCalisan(istek.SorguSozcesi);

                if (calisanListe == null)
                {
                    throw new IslemBasarisizHatasi();
                }

                yanit = new SorgulaCalisanYanit(calisanListe);

                return(yanit);
            }
            catch (IslemBasarisizHatasi hata)
            {
                this._hataServis.YazHata(hata);
                return(new SorgulaCalisanYanit(hata));
            }
            catch (Exception hata)
            {
                this._hataServis.YazHata(hata);
                return(new SorgulaCalisanYanit(hata));
            }
        }
Exemplo n.º 2
0
        public SorgulaCalisanYanitViewModel SorgulaCalisan(SorgulaCalisanIstekViewModel istek)
        {
            try
            {
                SorgulaCalisanYanitViewModel yanit      = new SorgulaCalisanYanitViewModel(false);
                SorgulaCalisanYanit          modelYanit = null;
                SorgulaCalisanIstek          modelistek = null;
                int kullaniciId = int.MinValue;
                List <CalisanViewModel> vmListe = new List <CalisanViewModel>();

                if (!this._kontrol.uygunMu(istek))
                {
                    yanit.IsaretleGecemediIlkKontrolu(this._kontrol.alHataKodu(istek));
                    return(yanit);
                }

                kullaniciId = istek.KullaniciId ?? int.MinValue;

                if (kullaniciId == int.MinValue)
                {
                    throw new ArgumentException();
                }

                modelistek = new SorgulaCalisanIstek(kullaniciId, istek.SorguSozcesi);

                modelYanit = this._calisanServis.SorgulaCalisan(modelistek);

                if (modelYanit == null)
                {
                    throw new ApplicationException();
                }

                if (!modelYanit.BasariliMi)
                {
                    throw new ApplicationException();
                }

                vmListe = this._cevir.cevir(modelYanit.Liste.ToList());

                if (vmListe == null)
                {
                    throw new ApplicationException();
                }

                yanit = new SorgulaCalisanYanitViewModel(vmListe);

                return(yanit);
            }
            catch (Exception hata)
            {
                this._hataServis.YazHata(hata);
                return(new SorgulaCalisanYanitViewModel(hata));
            }
        }