private List <ViewDaoTaoLyLich> GetDaoTao(ViewLyLich daotao) { var model = new List <ViewDaoTaoLyLich>(); var result = unitOfWork.QuaTrinhDaoTaoRepository.Get(x => x.IdMaLyLich == daotao.Id.ToString()); if (result.Count() == 0) { var vm = new ViewDaoTaoLyLich(); vm.IdLyLich = daotao.Id; vm.MaLyLich = daotao.MaLyLich; model.Add(vm); return(model); } else { var vm = (from s in result select new ViewDaoTaoLyLich { Id = s.Id, IdLyLich = daotao.Id, MaLyLich = s.IdMaLyLich, MaBacDaoTao = s.MaBacDaoTao, TenBacDaoTao = unitOfWork.HocViRepository.Get(x => x.MaHocVi == s.MaBacDaoTao).FirstOrDefault().TenHocVi, NoiDaoTao = s.NoiDaoTao, ChuyenMon = s.ChuyenMon, NamTotNghiep = s.NamTotNghiep, GhiChu = s.GhiChu }).OrderByDescending(x => x.NamTotNghiep).ToList(); return(vm); } }
private List <ViewCongTacLyLich> GetCongTac(ViewLyLich daotao) { var model = new List <ViewCongTacLyLich>(); var result = unitOfWork.QuaTrinhCongTacRepository.Get(x => x.IdMaLyLich == daotao.Id.ToString()); if (result.Count() == 0) { var vm = new ViewCongTacLyLich(); vm.IdLyLich = daotao.Id; vm.MaLyLich = daotao.MaLyLich; model.Add(vm); return(model); } else { var vm = (from s in result select new ViewCongTacLyLich { Id = s.Id, IdLyLich = daotao.Id, MaLyLich = s.IdMaLyLich, ThoiGian = s.ThoiGian, ViTriCongTac = s.ViTriCongTac, ToChucCongTac = s.ToChucCongTac, DiaChiCongTac = s.DiaChiCongTac, GhiChu = s.GhiChu }).OrderByDescending(x => x.ThoiGian).ToList(); return(vm); } }
private ViewLyLich GetLyLichByID(int id) { var _LyLich = unitOfWork.LyLichRepository.Get(x => x.Id == id).FirstOrDefault(); ViewLyLich viewLyLich = new ViewLyLich(); viewLyLich.Id = _LyLich.Id; viewLyLich.MaLyLich = _LyLich.MaLyLich; viewLyLich.HoVaTen = _LyLich.HoVaTen; viewLyLich.MaHocHam = _LyLich.MaHocHam; viewLyLich.TenHocHam = unitOfWork.HocHamRepository.Get(x => x.MaHocHam == _LyLich.MaHocHam).First().TenHocHam; viewLyLich.NamHocHam = _LyLich.NamHocHam; viewLyLich.MaHocVi = _LyLich.MaHocVi; viewLyLich.TenHocVi = unitOfWork.HocViRepository.Get(x => x.MaHocVi == _LyLich.MaHocVi).First().TenHocVi; viewLyLich.NamHocVi = _LyLich.NamHocVi; viewLyLich.DiaChi = _LyLich.DiaChi; viewLyLich.DienThoai = _LyLich.DienThoai; viewLyLich.DiDong = _LyLich.DiDong; viewLyLich.Fax = _LyLich.Fax; viewLyLich.Email = _LyLich.Email; return(viewLyLich); }
private ViewToChucLyLich GetToChuc(ViewLyLich lylich) { var result = unitOfWork.ToChucRepository.Get(x => x.IdMaLyLich == lylich.Id.ToString()).FirstOrDefault(); if (result == null) { var vm = new ViewToChucLyLich(); vm.IdLyLich = lylich.Id; vm.MaLyLich = lylich.MaLyLich; return(vm); } else { var vm = new ViewToChucLyLich(); vm.Id = result.Id; vm.IdLyLich = lylich.Id; vm.MaLyLich = lylich.MaLyLich; vm.TenToChuc = result.TenToChuc; vm.TenNguoiLanhDao = result.TenNguoiLanhDao; vm.DienThoaiLanhDao = result.DienThoaiLanhDao; vm.DiaChiToChuc = result.DiaChiToChuc; return(vm); } }