public override void UpdateNodes() { DeliveryPoint deliveryPointAlias = null; Counterparty counterpartyAlias = null; ClientDeliveryPointVMNode resultAlias = null; ContactAndPhonesView contactAlias = null; var deliveryPointslist = UoW.Session.QueryOver <DeliveryPoint> (() => deliveryPointAlias) .JoinAlias(c => c.Counterparty, () => counterpartyAlias) .JoinAlias(c => c.ContactAndPhones, () => contactAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .Where(() => counterpartyAlias.Id == Counterparty.Id) .SelectList(list => list .SelectGroup(() => deliveryPointAlias.Id).WithAlias(() => resultAlias.Id) .Select(() => deliveryPointAlias.CompiledAddress).WithAlias(() => resultAlias.CompiledAddress) .Select(() => deliveryPointAlias.Comment).WithAlias(() => resultAlias.Comment) .Select(() => deliveryPointAlias.IsActive).WithAlias(() => resultAlias.IsActive) .Select(Projections.SqlFunction( new SQLFunctionTemplate(NHibernateUtil.String, "GROUP_CONCAT( ?1 SEPARATOR ?2)"), NHibernateUtil.String, Projections.Property(() => contactAlias.PostNameAndPhones), Projections.Constant("\n")) ).WithAlias(() => resultAlias.Contacts) ) .TransformUsing(Transformers.AliasToBean <ClientDeliveryPointVMNode> ()) .List <ClientDeliveryPointVMNode> (); SetItemsSource(deliveryPointslist); }
public override void UpdateNodes() { DeliveryPoint deliveryPointAlias = null; Counterparty counterpartyAlias = null; DeliveryPointVMNode resultAlias = null; ContactAndPhonesView contactAlias = null; var pointsQuery = UoW.Session.QueryOver <DeliveryPoint>(() => deliveryPointAlias); if (Filter.RestrictOnlyNotFoundOsm) { pointsQuery.Where(x => x.FoundOnOsm == false); } var deliveryPointslist = pointsQuery .JoinAlias(c => c.Counterparty, () => counterpartyAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(c => c.ContactAndPhones, () => contactAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .SelectList(list => list .SelectGroup(() => deliveryPointAlias.Id).WithAlias(() => resultAlias.Id) .Select(() => deliveryPointAlias.CompiledAddress).WithAlias(() => resultAlias.CompiledAddress) .Select(() => deliveryPointAlias.FoundOnOsm).WithAlias(() => resultAlias.FoundOnOsm) .Select(() => deliveryPointAlias.IsFixedInOsm).WithAlias(() => resultAlias.FixedInOsm) .Select(() => deliveryPointAlias.IsActive).WithAlias(() => resultAlias.IsActive) .Select(() => counterpartyAlias.FullName).WithAlias(() => resultAlias.Client) .Select(Projections.SqlFunction( new SQLFunctionTemplate(NHibernateUtil.String, "GROUP_CONCAT( ?1 SEPARATOR ?2)"), NHibernateUtil.String, Projections.Property(() => contactAlias.NameAndPhones), Projections.Constant("\n")) ).WithAlias(() => resultAlias.Contacts) ) .TransformUsing(Transformers.AliasToBean <DeliveryPointVMNode> ()) .List <DeliveryPointVMNode> (); SetItemsSource(deliveryPointslist); }