예제 #1
0
        public string SavePartCheckMatchRule(PartCheckMatchRuleDef item)
        {
            string result = "";
            try
            {

                IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
                PartCheckMatchRule newItem = new PartCheckMatchRule();
                newItem.ContainCheckBit = Int32.Parse(item.ContainCheckBit);
                newItem.PartCheckID = Int32.Parse(item.PartCheckID);
                newItem.PartPropertyExp = item.PartPropertyExp;
                newItem.PnExp = item.PnExp;
                newItem.RegExp = item.RegExp;
                newItem.ID = Int32.Parse(item.ID);
                newItem.Editor = item.Editor;
                newItem.Udt = DateTime.Now;

                DataTable existList = itemRepository.GetExistPartCheckMatchRule(newItem.RegExp, newItem.PartPropertyExp, newItem.PnExp,newItem.PartCheckID, newItem.ID);
                if (existList != null && existList.Rows.Count > 0)
                {
                    //已经存在具有相同RegExp、PartPropertyExp、PnExp和PartCheckID的记录
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT036", erpara);
                    throw ex;
                }

                itemRepository.SavePartCheckMatchRule(newItem);
                result = newItem.ID.ToString();
            }
            catch (Exception)
            {
                throw;
            }

            return result;
        }
예제 #2
0
 //删除一条PartCheckMatchRule
 //DELETE FROM [IMES_GetData].[dbo].[PartCheckMatchRule]
 //      WHERE ID=id
 public void DeletePartCheckMatchRule(PartCheckMatchRuleDef item)
 {
     try
     {
         IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
         PartCheckMatchRule newItem = new PartCheckMatchRule();
         newItem.ID = Int32.Parse(item.ID);
         itemRepository.DeletePartCheckMatchRule(newItem);
     }
     catch (Exception)
     {
         throw;
     }  
 }