public int AddLightStationItem(IMES.DataModel.LightStDef def) { int id=0; try { IList<FaPaLightstInfo> infLst=itemRepository.CheckFaPaLightStationExist(def.iecpn, def.family, def.sation); if (infLst.Count>0) { List<string> param = new List<string>(); FisException fe = new FisException("DMT133", param); throw fe; } else { FaPaLightstInfo info = new FaPaLightstInfo(); PO2VO(def, info); itemRepository.AddFaPaLightStationItem(info); id = info.id; } } catch(Exception) { throw; } return id; }
private static void PO2VO(IMES.DataModel.LightStDef def, FaPaLightstInfo info) { info.id = def.id; info.pno = def.iecpn; info.stn = def.sation; info.family = def.family; info.editor = def.editor; info.cdt = Convert.ToDateTime(def.cdt); info.udt = Convert.ToDateTime(def.udt); }
public void UpdateLightStationItem(IMES.DataModel.LightStDef def, int id) { try { IList<FaPaLightstInfo> infLst = itemRepository.CheckFaPaLightStationExist(def.iecpn, def.family, def.sation); if (infLst!=null&&infLst.Count>0) { FaPaLightstInfo info = infLst[0]; if (info.id != id) { List<string> param = new List<string>(); FisException fe = new FisException("DMT133", param); throw fe; } } FaPaLightstInfo vo = new FaPaLightstInfo(); PO2VO(def,vo); itemRepository.UpdateFaPaLightStationItem(vo); } catch(Exception) { throw; } }