public IlklendirCalisanGorevlendirmeYanit IlklendirCalisanGorevlendirme(IlklendirCalisanGorevlendirmeIstek istek) { try { Calisan calisani = null; CalisanGorevlendirme gorevi = null; IEnumerable <BirimViewModel> birimListe = new List <BirimViewModel>(); IEnumerable <Gorevi> gorevListe = new List <Gorevi>(); IEnumerable <IlViewModel> ilListe = new List <IlViewModel>(); IlklendirCalisanGorevlendirmeYanit yanit = new IlklendirCalisanGorevlendirmeYanit(false); bool getirilsinMiSadeceResmiGorevler = true; KurumCografyaServis kurumCografya = new KurumCografyaServis(); bool getirilsinMiTumu = true; if (!this._kontrol.uygunMu(istek)) { yanit.IsaretleGecemediIlkKontrolu(this._kontrol.alHataKodu(istek)); return(yanit); } calisani = this._isGuder.getirCalisan(istek.GorevlendirilecekCalisanId); if (calisani == null) { throw new ApplicationException(); } gorevi = this._isGuder.getirMevcutGorevi(istek.GorevlendirilecekCalisanId, getirilsinMiSadeceResmiGorevler); if (gorevi == null) { throw new ApplicationException(); } birimListe = this._isGuder.getirBirimKullanicininGorebilecegi(istek.KullaniciId); if (birimListe == null) { throw new ApplicationException(); } gorevListe = this._gorevlendirmeIsKurali.GetirGorevListe(getirilsinMiTumu); if (gorevListe == null) { throw new ApplicationException(); } ilListe = kurumCografya.getirIlListe(getirilsinMiTumu); if (ilListe == null) { throw new ApplicationException(); } yanit = new IlklendirCalisanGorevlendirmeYanit(calisani, gorevi, birimListe, gorevListe, ilListe); return(yanit); } catch (Exception hata) { this._hataServis.YazHata(hata); return(new IlklendirCalisanGorevlendirmeYanit(hata)); } }
public IlklendirCalisanGorevlendirmeYanitViewModel IlklendirCalisanGorevlendirme(IlklendirCalisanGorevlendirmeIstekViewModel istek) { try { IlklendirCalisanGorevlendirmeYanitViewModel yanit = new IlklendirCalisanGorevlendirmeYanitViewModel(false); IlklendirCalisanGorevlendirmeYanit servisYanit = null; IlklendirCalisanGorevlendirmeIstek servisIstek = null; int kullaniciId, gorevlendirilecekCalisanId = int.MinValue; CalisanViewModel calisanVm = null; CalisanGorevlendirmeViewModel gorevlendirmeVm = null; IEnumerable <GoreviViewModel> gorevVmListe = null; if (!this._kontrol.uygunMu(istek)) { yanit.IsaretleGecemediIlkKontrolu(this._kontrol.alHataKodu(istek)); return(yanit); } kullaniciId = istek.KullaniciId ?? int.MinValue; gorevlendirilecekCalisanId = istek.GorevlendirilecekCalisanId ?? int.MinValue; servisIstek = new IlklendirCalisanGorevlendirmeIstek(kullaniciId, gorevlendirilecekCalisanId); servisYanit = this._gorevlendirmeServis.IlklendirCalisanGorevlendirme(servisIstek); if (servisYanit == null) { throw new ApplicationException(); } if (!servisYanit.BasariliMi) { throw new ApplicationException(); } calisanVm = this._cevir.cevir(servisYanit.Calisani); if (calisanVm == null) { throw new ApplicationException(); } gorevlendirmeVm = this._cevir.cevir(servisYanit.MevcutGorevi); if (gorevlendirmeVm == null) { throw new ApplicationException(); } gorevVmListe = this._cevir.cevir(servisYanit.GorevListe.ToList()); if (gorevVmListe == null) { throw new ApplicationException(); } yanit = new IlklendirCalisanGorevlendirmeYanitViewModel(calisanVm, gorevlendirmeVm, servisYanit.BirimListe, gorevVmListe, servisYanit.IlListe); return(yanit); } catch (Exception) { throw; } }