Example #1
0
        public GetirCalisanRaporBirYanitViewModel GetirCalisanRaporBir(GetirCalisanRaporBirIstekViewModel istek)
        {
            try
            {
                GetirCalisanRaporBirYanit          servisYanit = null;
                GetirCalisanRaporBirIstek          servisIstek = null;
                GetirCalisanRaporBirYanitViewModel yanit       = new GetirCalisanRaporBirYanitViewModel(false);
                int kullaniciId = int.MinValue;
                List <CalisanRaporBirViewModel> vmListe = null;

                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();
                }

                servisIstek = new GetirCalisanRaporBirIstek(kullaniciId);

                servisYanit = this._calisanServis.GetirCalisanRaporBir(servisIstek);

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

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

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

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

                yanit = new GetirCalisanRaporBirYanitViewModel(vmListe);

                return(yanit);
            }
            catch (Exception hata)
            {
                this._hataServis.YazHata(hata);
                return(new GetirCalisanRaporBirYanitViewModel(hata));
            }
        }
        public GetirCalisanRaporBirYanit GetirCalisanRaporBir(GetirCalisanRaporBirIstek istek)
        {
            try
            {
                IEnumerable <BirimViewModel> birimListe = null;
                BirimServis birimServis         = new BirimServis();
                GetirCalisanRaporBirYanit yanit = new GetirCalisanRaporBirYanit(false);
                int kullaniciId = int.MinValue;
                IEnumerable <CalisanRaporBir> calisanRaporBirListe = new List <CalisanRaporBir>();

                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();
                }

                birimListe = birimServis.getirBirimKullanicininGorebilecegi(kullaniciId);

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

                calisanRaporBirListe = this._gorevlendirmeIsKurali.GetirCalisanRaporBir(birimListe);

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

                yanit = new GetirCalisanRaporBirYanit(calisanRaporBirListe);

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