/// <summary> /// 添加新工厂 /// </summary> /// <param name="plant"></param> /// <returns></returns> public int addABiPlant(ABiPlant plant) { VPDAL.ABi_Plant obj = new VPDAL.ABi_Plant(); obj.PlantName = plant.PlantName; obj.PlantCode = plant.PlantCode; dbContent.ABi_Plant.AddObject(obj); return dbContent.SaveChanges(); }
public static ABiPlant FromABi_Plant(VPDAL.ABi_Plant pl) { ABiPlant obj = new ABiPlant(); obj.ABi_Plant_ID = pl.ABi_Plant_ID.ToString(); obj.PlantCode = pl.PlantCode; obj.PlantName = pl.PlantName; return obj; }
/// <summary> /// 更新公司 /// </summary> /// <param name="company"></param> /// <returns></returns> public int updateABiPlant(ABiPlant palnt) { int id = Convert.ToInt32(palnt.ABi_Plant_ID); var obj = dbContent.ABi_Plant.FirstOrDefault(o => o.ABi_Plant_ID == id); if (obj != null) { obj.PlantCode = String.IsNullOrEmpty(palnt.PlantCode) ? obj.PlantCode : palnt.PlantCode; obj.PlantName = String.IsNullOrEmpty(palnt.PlantName) ? obj.PlantName : palnt.PlantName; return dbContent.SaveChanges(); } return 0; }