private void DeleteDiaDiem(int nguonid, ENLoaiDiaDiem loai) { var diadiem = GetDiaDiem(nguonid, ENLoaiDiaDiem.BenXe); if (diadiem.Id > 0) { _diadiemRepository.Delete(diadiem); } }
/// <summary> /// Lay id tu danh muc dia diem /// </summary> /// <param name="nguonid"></param> /// <param name="loai"></param> /// <returns></returns> private int GetDiaDiemId(int nguonid, ENLoaiDiaDiem loai) { var diadiem = _DiaDiemRepository.Table.Where(c => c.NguonId == nguonid && c.LoaiId == (int)loai); if (diadiem.Count() > 0) { return(diadiem.First().Id); } return(0); }
private DiaDiem GetDiaDiem(int nguonid, ENLoaiDiaDiem loai) { var item = _diadiemRepository.Table.Where(c => c.NguonId == nguonid && c.LoaiId == (int)loai).First(); if (item == null) { item = new DiaDiem(); item.NguonId = nguonid; item.Loai = loai; } return(item); }
private DiaDiem GetDiaDiem(int nguonid, ENLoaiDiaDiem loai) { var item = _diadiemRepository.Table.Where(c => c.NguonId == nguonid && c.LoaiId == (int)loai); if (item.Count() == 0) { var dd = new DiaDiem(); dd.NguonId = nguonid; dd.Loai = loai; return(dd); } return(item.First()); }
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); } }
private void InsertOrUpdateDiaDiem(int nguonid, ENLoaiDiaDiem loai, string ten) { var item = GetDiaDiem(nguonid, loai); if (loai == ENLoaiDiaDiem.BenXe) { ten = "Bến xe " + ten; } item.Ten = ten; if (item.Id > 0) { UpdateDiaDiem(item); } else { InsertDiaDiem(item); } }