public void FamilyRegistration() { var lst = new List <Shadowinfo>(); lst.Add(new Shadowinfo() { LineId = this, Family = this }); if (ParentLine != null)//non Root insert { //Get Parent family foreach (LineShadow sh in this.ParentLine.LineShadowLines) { lst.Add(new Shadowinfo() { LineId = sh.LineId, Family = sh.Family }); } } //Loop for each pairs and try insert if not alredy existed foreach (var item in lst) { var dbLine = Session.FindObject <LineShadow>(CriteriaOperator.Parse("[LineId] = ? AND [Family] = ? ", item.LineId, item.Family)); if (dbLine == null) { dbLine = new LineShadow(Session) { LineId = item.LineId, Family = item.Family }; dbLine.Save(); } } }
public List <Line> GetLineShadowLines() { List <Line> retList = new List <Line>(); var lst = LineShadow.Split('-'); foreach (string item in lst) { long lineOid; if (long.TryParse(item.Trim(), out lineOid)) { var line = Session.GetObjectByKey <Line>(lineOid); if (line != null) { retList.Add(line); } } } return(retList); }