public override void UpdateNodes() { CommentsTemplatesVMNode resultAlias = null; CommentsTemplates commentsTemplatesAlias = null; CommentsGroups commentsGroupsAlias = null; var query = UoW.Session.QueryOver <CommentsTemplates>(() => commentsTemplatesAlias); //if(Filter.RestrictionFineDateStart.HasValue) { // query.Where(() => fineAlias.Date >= Filter.RestrictionFineDateStart.Value); //} var result = query .JoinAlias(() => commentsTemplatesAlias.CommentsTmpGroups, () => commentsGroupsAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .SelectList(list => list .Select(() => commentsTemplatesAlias.Id).WithAlias(() => resultAlias.Id) .Select(() => commentsTemplatesAlias.CommentTemplate).WithAlias(() => resultAlias.CommentTmp) .Select(() => commentsGroupsAlias.Name).WithAlias(() => resultAlias.GroupTmp) ).TransformUsing(Transformers.AliasToBean <CommentsTemplatesVMNode>()) .List <CommentsTemplatesVMNode>(); SetItemsSource(result); }
public override void UpdateNodes() { CommentsVMNode resultAlias = null; Comments commentAlias = null; CommentsGroups commentsGroupsAlias = null; Employee commentsAuthorAlias = null; Counterparty counterpartyAlias = null; DeliveryPoint deliveryPointAlias = null; var UowCounterparty = UoW.RootObject as Counterparty; if (UowCounterparty != null) { var orderBottles = UoW.Session.QueryOver <Comments>(() => commentAlias) .JoinAlias(() => commentAlias.Author, () => commentsAuthorAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(() => commentAlias.CommentsGroups, () => commentsGroupsAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(() => commentAlias.Counterparty, () => counterpartyAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(() => commentAlias.DeliveryPoint, () => deliveryPointAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .SelectList(list => list .Select(() => commentAlias.Id).WithAlias(() => resultAlias.Id) .Select(() => commentsGroupsAlias.Name).WithAlias(() => resultAlias.Group) .Select(() => commentsAuthorAlias.LastName).WithAlias(() => resultAlias.Author) .Select(() => commentAlias.Text).WithAlias(() => resultAlias.Text) .Select(() => commentAlias.CreateDate).WithAlias(() => resultAlias.Date) .Select(() => counterpartyAlias.Name).WithAlias(() => resultAlias.Counteparty) .Select(() => deliveryPointAlias.ShortAddress).WithAlias(() => resultAlias.DeliveryPoint) .Select(() => commentAlias.IsFixed).WithAlias(() => resultAlias.IsFixed) ) .Where(() => counterpartyAlias.Name == UowCounterparty.Name && (commentAlias.AncorPoint == CommentsAncorPoint.Counterparty)) .TransformUsing(Transformers.AliasToBean <CommentsVMNode>()) .List <CommentsVMNode>(); SetItemsSource(orderBottles.ToList()); } var UowDeliveryPoint = UoW.RootObject as DeliveryPoint; if (UowDeliveryPoint != null) { var orderBottles = UoW.Session.QueryOver <Comments>(() => commentAlias) .JoinAlias(() => commentAlias.Author, () => commentsAuthorAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(() => commentAlias.CommentsGroups, () => commentsGroupsAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(() => commentAlias.Counterparty, () => counterpartyAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(() => commentAlias.DeliveryPoint, () => deliveryPointAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .SelectList(list => list .Select(() => commentAlias.Id).WithAlias(() => resultAlias.Id) .Select(() => commentsGroupsAlias.Name).WithAlias(() => resultAlias.Group) .Select(() => commentsAuthorAlias.LastName).WithAlias(() => resultAlias.Author) .Select(() => commentAlias.Text).WithAlias(() => resultAlias.Text) .Select(() => commentAlias.CreateDate).WithAlias(() => resultAlias.Date) .Select(() => counterpartyAlias.Name).WithAlias(() => resultAlias.Counteparty) .Select(() => deliveryPointAlias.ShortAddress).WithAlias(() => resultAlias.DeliveryPoint) .Select(() => commentAlias.IsFixed).WithAlias(() => resultAlias.IsFixed) ) .Where(() => deliveryPointAlias.ShortAddress == UowDeliveryPoint.ShortAddress && (commentAlias.AncorPoint == CommentsAncorPoint.DeliveryPoint || commentAlias.AncorPoint == CommentsAncorPoint.Counterparty)) .TransformUsing(Transformers.AliasToBean <CommentsVMNode>()) .List <CommentsVMNode>(); SetItemsSource(orderBottles.ToList()); } var UowOrder = UoW.RootObject as Order; if (UowOrder != null) { var orderBottles = UoW.Session.QueryOver <Comments>(() => commentAlias) .JoinAlias(() => commentAlias.Author, () => commentsAuthorAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(() => commentAlias.CommentsGroups, () => commentsGroupsAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(() => commentAlias.Counterparty, () => counterpartyAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .JoinAlias(() => commentAlias.DeliveryPoint, () => deliveryPointAlias, NHibernate.SqlCommand.JoinType.LeftOuterJoin) .SelectList(list => list .Select(() => commentAlias.Id).WithAlias(() => resultAlias.Id) .Select(() => commentsGroupsAlias.Name).WithAlias(() => resultAlias.Group) .Select(() => commentsAuthorAlias.LastName).WithAlias(() => resultAlias.Author) .Select(() => commentAlias.Text).WithAlias(() => resultAlias.Text) .Select(() => commentAlias.CreateDate).WithAlias(() => resultAlias.Date) .Select(() => counterpartyAlias.Name).WithAlias(() => resultAlias.Counteparty) .Select(() => deliveryPointAlias.ShortAddress).WithAlias(() => resultAlias.DeliveryPoint) .Select(() => commentAlias.IsFixed).WithAlias(() => resultAlias.IsFixed) ) .Where(() => commentAlias.Order.Id == UowOrder.Id) .TransformUsing(Transformers.AliasToBean <CommentsVMNode>()) .List <CommentsVMNode>(); SetItemsSource(orderBottles.ToList()); } }