/// <summary> /// 根据公猪的类型id得到所有的公猪编号和名字 /// </summary> /// <returns>所有的公猪编号和名字</returns> public string GetMaleParentName() { var pigservice = new PigService(); var pigtypeservice = new PigTypeService(); try { long maleparentid = pigtypeservice.FindByName("公猪").Id; return pigservice.GetPigNumberAndNameByPigType(maleparentid); } catch (Exception) { return null; } }