public void DeletePartCheck(PartCheckDef item) { try { IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); PartCheck newItem = new PartCheck(Int32.Parse(item.ID), "", "", "", 0, 0, null); itemRepository.DeletePartCheck(newItem); } catch (Exception) { throw; } }
//检查3列不能重复加入 //如果id==null,忽略[ID]<>'id'条件 //SELECT [ID] // FROM [IMES_GetData].[dbo].[PartCheck] //WHERE [Customer]='customer' AND [PartType]='partType' AND [ValueType]='valueType' //AND [ID]<>id //GetExistPartCheck(String customer, string partType, string valueType, int id); public string AddPartCheck(PartCheckDef item) { string result = ""; try { IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); PartCheck newItem = new PartCheck(0, item.Customer, item.PartType, item.ValueType, Int32.Parse(item.NeedSave), Int32.Parse(item.NeedCheck), null); newItem.Editor = item.Editor; newItem.Cdt = DateTime.Now; newItem.Udt = DateTime.Now; DataTable existList = itemRepository.GetExistPartCheck(newItem.Customer, newItem.PartType, newItem.ValueType); if (existList != null && existList.Rows.Count > 0) { //已经存在具有相同PartType、ValueType和Customer的记录 List<string> erpara = new List<string>(); FisException ex; ex = new FisException("DMT035", erpara); throw ex; } itemRepository.AddPartCheck(newItem); result = newItem.ID.ToString(); } catch (Exception) { throw; } return result; }