Пример #1
0
        public GiamSatThietBi2Cot GetListGiamSatThietBi(GiamSatInput input)
        {
            var lsThietBi = _repository.GetAll()
                            .WhereIf(input.iddonvi != 0, x => x.TRAM.IDDONVI == input.iddonvi)
                            .WhereIf(input.idtram != 0, x => x.IDTRAM == input.idtram)
                            .WhereIf(input.idthietbi != 0, x => x.Id == input.idtram)
                            .ToList().MapTo <List <DM_ThietBiDto> >();
            GiamSatThietBi2Cot    result = new GiamSatThietBi2Cot();
            List <GiamSatThietBi> cot1   = new List <GiamSatThietBi>();
            List <GiamSatThietBi> cot2   = new List <GiamSatThietBi>();

            if (lsThietBi.Count > 0)
            {
                for (var i = 0; i < lsThietBi.Count; i++)
                {
                    if (i % 2 == 0)
                    {
                        GiamSatThietBi giamsat = new GiamSatThietBi();
                        giamsat.thietbi    = lsThietBi[i];
                        giamsat.lsThongTin = _thongTin_ThietBiService.GetThongTinQuanLyByIdThietBi(lsThietBi[i].Id);
                        cot2.Add(giamsat);
                    }
                    else
                    {
                        GiamSatThietBi giamsat = new GiamSatThietBi();
                        giamsat.thietbi    = lsThietBi[i];
                        giamsat.lsThongTin = _thongTin_ThietBiService.GetThongTinQuanLyByIdThietBi(lsThietBi[i].Id);
                        cot1.Add(giamsat);
                    }
                }
            }
            result.cot1 = cot1;
            result.cot2 = cot2;
            return(result);
        }
Пример #2
0
 public GiamSatThietBi GetGiamSatThietBiById(long id)
 {
     if (id > 0)
     {
         GiamSatThietBi result = new GiamSatThietBi();
         result.thietbi    = _repository.Get(id).MapTo <DM_ThietBiDto>();
         result.lsThongTin = _thongTin_ThietBiService.GetThongTinQuanLyByIdThietBi(id);
         return(result);
     }
     else
     {
         return(null);
     }
 }