コード例 #1
0
        private bool ekleOgrenim(int kullaniciId, int calisanId, int ogrenimDurumuId, int universiteId)
        {
            try
            {
                EkleKisiOgrenimYanit yanit = null;
                EkleKisiOgrenimIstek istek = null;

                istek = new EkleKisiOgrenimIstek(kullaniciId, calisanId, ogrenimDurumuId, universiteId);

                yanit = this._ogrenimServis.EkleKisiOgrenim(istek);

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

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

                return(yanit.BasariliMi);
            }
            catch (Exception hata)
            {
                throw hata;
            }
        }
コード例 #2
0
        public EkleKisiOgrenimYanit EkleKisiOgrenim(EkleKisiOgrenimIstek istek)
        {
            try
            {
                EkleKisiOgrenimYanit yanit = new EkleKisiOgrenimYanit(false);
                KisiOgrenim          ogrenim = null;
                int calisanId, ogrenimDurumuId, universiteId, sonucId = int.MinValue;

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

                calisanId = istek.CalisanId ?? int.MinValue;

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

                ogrenimDurumuId = istek.OgrenimDurumuId ?? int.MinValue;

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

                universiteId = istek.UniversiteId ?? int.MinValue;

                ogrenim = new KisiOgrenim(calisanId, ogrenimDurumuId, universiteId);

                sonucId = this._ogrenimIsKurali.EkleveDonKisiOgrenim(ogrenim);

                if (sonucId == int.MinValue)
                {
                    throw new IslemBasarisizHatasi();
                }

                yanit = new EkleKisiOgrenimYanit(sonucId);

                return(yanit);
            }
            catch (ArgumentException hata)
            {
                return(new EkleKisiOgrenimYanit(hata));
            }
            catch (IslemBasarisizHatasi hata)
            {
                this._hataServis.YazHata(hata);
                return(new EkleKisiOgrenimYanit(hata));
            }
            catch (Exception hata)
            {
                this._hataServis.YazHata(hata);
                return(new EkleKisiOgrenimYanit(hata));
            }
        }