Beispiel #1
0
        protected override DQueryDom GetQueryDom()
        {
            var dom  = base.GetQueryDom();
            var prop = new JoinAlias(typeof(GoodsProperty));

            dom.From.AddJoin(JoinType.Inner, new DQDmoSource(prop), DQCondition.EQ(prop, "ID", dom.From.RootSource.Alias, "GoodsProperty_ID"));
            var catalog = dom.EJoin <GoodsPropertyCatalog>("GoodsPropertyCatalog_ID", JoinType.Left, prop);

            dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(prop, "Name"), "存货属性"));
            dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(catalog, "Name"), "存货属性分类"));

            TreeUtil.AddTreeCondition <GoodsPropertyCatalog>(dom, mQueryContainer, "存货属性分类", catalog);
            DomainUtil.AddDomainPermissionLimit(dom, typeof(GoodsProperty), prop);
            return(dom);
        }
Beispiel #2
0
        public virtual void GetDetail()
        {
            Details.Clear();
            var prop = JoinAlias.Create("prop");

            DQueryDom dom = mQueryContainer.Build();
//      dom.Where.Conditions.Add(DQCondition.EQ(prop, "IsButchery", true));
            var rootAlias = dom.From.RootSource.Alias;

            var goodsPropertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog));

            dom.From.AddJoin(JoinType.Left, new DQDmoSource(goodsPropertyCatalog), DQCondition.EQ(prop, "GoodsPropertyCatalog_ID", goodsPropertyCatalog, "ID"));

            dom.Columns.Add(DQSelectColumn.Field("Code", rootAlias));
            dom.Columns.Add(DQSelectColumn.Field("Name", rootAlias));
            dom.Columns.Add(DQSelectColumn.Field("Spec", rootAlias));
            dom.Columns.Add(DQSelectColumn.Field("MainUnit", rootAlias));
            dom.Columns.Add(DQSelectColumn.Field("SecondUnit", rootAlias));
            dom.Columns.Add(DQSelectColumn.Field("Name", prop));
            dom.Columns.Add(DQSelectColumn.Field("Name", goodsPropertyCatalog));
            dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false));
            DomainUtil.AddDomainPermissionLimit(dom, typeof(GoodsProperty), prop);
            using (var session = Dmo.NewSession())
            {
                using (var reader = session.ExecuteReader(dom))
                {
                    while (reader.Read())
                    {
                        var detail = new Goods();

                        detail.ID                        = (long)reader[0];
                        detail.Code                      = (string)reader[1];
                        detail.Name                      = (string)reader[2];
                        detail.Spec                      = (string)reader[3];
                        detail.MainUnit                  = (string)reader[4];
                        detail.SecondUnit                = (string)reader[5];
                        detail.GoodsProperty_Name        = (string)reader[6];
                        detail.GoodsPropertyCatalog_Name = (string)reader[7];

                        Details.Add(detail);
                    }
                }
            }
        }