예제 #1
0
 public virtual void UpdateDiaDiem(DiaDiem _item)
 {
     if (_item == null)
     {
         throw new ArgumentNullException("DiaDiem");
     }
     _item.TenKhongDau = CVCommon.convertToUnSign(_item.Ten);
     _diadiemRepository.Update(_item);
 }
예제 #2
0
        public List <DiaDiem> DiaDiemSearch(string keyword = "", int top = 20)
        {
            var query = _diadiemRepository.Table;

            if (!String.IsNullOrWhiteSpace(keyword))
            {
                var keywordkodau = CVCommon.convertToUnSign(keyword);
                query = query.Where(c => c.Ten.Contains(keyword) || c.TenKhongDau.Contains(keywordkodau));
            }

            query = query.OrderBy(c => c.Id);
            return(query.Take(top).ToList());
        }
예제 #3
0
        public virtual PagedList <DiaDiem> GetAllDiaDiem(string tendiadiem = "",
                                                         int pageIndex     = 0,
                                                         int pageSize      = int.MaxValue)
        {
            var query = _diadiemRepository.Table;

            if (!String.IsNullOrWhiteSpace(tendiadiem))
            {
                var tenkhongdau = CVCommon.convertToUnSign(tendiadiem);
                query = query.Where(c => c.Ten.Contains(tendiadiem) || c.TenKhongDau.Contains(tenkhongdau));
            }

            query = query.OrderBy(c => c.Id);
            return(new PagedList <DiaDiem>(query, pageIndex, pageSize));
        }
예제 #4
0
        private void InsertOrUpdateDiaDiem(int nguonid, ENLoaiDiaDiem loai, string ten)
        {
            var item = GetDiaDiem(nguonid, loai);

            item.Ten         = ten;
            item.TenKhongDau = CVCommon.convertToUnSign(ten);
            if (item.Id > 0)
            {
                _diadiemRepository.Update(item);
            }
            else
            {
                _diadiemRepository.Insert(item);
            }
        }