/// <summary> /// 删除一条ICASA的记录数据 /// </summary> /// <param name="?">string id</param> public void DeleteICASAInfo(string id) { try { ICASADef fAFloatLocation = new ICASADef(); ILCMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<ILCMRepository>(); UnitOfWork uow = new UnitOfWork(); itemRepository.DeleteICASAInfoDefered(uow, int.Parse(id)); uow.Commit(); } catch (Exception) { throw; } }
/// <summary> /// 保存一条ICASA的记录数据(Add) /// </summary> /// <param name="Object">ICASADef item</param> public string AddICASAInfo(ICASAInfo item) { FisException ex; List<string> paraError = new List<string>(); try { ILCMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<ILCMRepository>(); UnitOfWork uow = new UnitOfWork(); ICASADef iCASADefs = itemRepository.GetICASAInfoByVC(item.vc); if (iCASADefs != null) { //要添加的数据已经存在 ex = new FisException("DMT095", paraError); throw ex; } ICASADef iCASADef = new ICASADef(); iCASADef.vc = item.vc; iCASADef.av = item.av; iCASADef.anatel1 = item.anatel1; iCASADef.anatel2 = item.anatel2; iCASADef.icasa = item.icasa; iCASADef.edit = item.edit; iCASADef.cdt = DateTime.Now; iCASADef.udt = DateTime.Now; itemRepository.AddICASAInfoDefered(uow, iCASADef); uow.Commit(); iCASADef = itemRepository.GetICASAInfoByVC(item.vc); return iCASADef.id.ToString(); } catch (Exception) { throw; } }
/// <summary> /// 保存一条ICASA的记录数据(Add) /// </summary> /// <param name="Object">ICASADef item</param> public void UpdateICASAInfo(ICASAInfo item, string itemId) { FisException ex; List<string> paraError = new List<string>(); try { ILCMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<ILCMRepository>(); UnitOfWork uow = new UnitOfWork(); //当前信息是否存在 if (itemRepository.GetICASAInfoById(int.Parse(itemId)) == null) { //要更新的原始数据已被删除 ex = new FisException("DMT082", paraError); throw ex; } ICASADef iCASADefs = itemRepository.GetICASAInfoByVC(item.vc); if (iCASADefs != null) { //判断非当前记录和要更新的数据是否有重复 if (iCASADefs.id != int.Parse(itemId)) { //要更新的数据已经存在于其他记录 ex = new FisException("DMT095", paraError); throw ex; } } ICASADef iCASADef = new ICASADef(); iCASADef.vc = item.vc; iCASADef.av = item.av; iCASADef.anatel1 = item.anatel1; iCASADef.anatel2 = item.anatel2; iCASADef.icasa = item.icasa; iCASADef.edit = item.edit; itemRepository.UpdateICASAInfoDefered(uow, iCASADef, int.Parse(itemId)); uow.Commit(); } catch (Exception) { throw; } }