コード例 #1
0
        /// <summary>
        /// 获得下游
        /// </summary>
        /// <param name="sellerId"></param>
        /// <param name="dbId"></param>
        /// <returns></returns>
        public RelationMappingEntity GetDownOrder(int sellerId, int dbId, int orderId, int upBuyerId)
        {
            RelationMappingEntity relationMappingEntity = new RelationMappingEntity();
            ConnectorRelation     connectorEntity       = new ConnectorBusiness().GetDownConnector(sellerId, upBuyerId, dbId);

            if (connectorEntity.Id == null)
            {
                return(relationMappingEntity);
            }

            relationMappingEntity.ConnectorMapping.Add(sellerId, Utils.ToInt(connectorEntity.SellerId));

            relationMappingEntity.ConnectorEntity = connectorEntity;

            DataTable data = DBTable($"UpConnectorId={connectorEntity.ThirdConnectorId} and DownConnectorId={connectorEntity.Id} and UpOrderId={orderId}");

            if (data == null || data.Rows.Count == 0)
            {
                return(relationMappingEntity);
            }


            foreach (DataRow dr in data.Rows)
            {
                OrderRelationEntity orderRelationEntity = new OrderRelationEntity();
                orderRelationEntity.SetValues(dr);

                relationMappingEntity.OrderRelationEntity = orderRelationEntity;

                int    upOrderId     = Utils.ToInt(orderRelationEntity.UpOrderId);
                int    downOrderId   = Utils.ToInt(orderRelationEntity.DownOrderId);
                string upOddNumber   = orderRelationEntity.UpOddNumber;
                string downOddNumber = orderRelationEntity.DownOddNumber;

                if (!relationMappingEntity.OrderMapping.ContainsKey(upOrderId))
                {
                    relationMappingEntity.OrderMapping.Add(upOrderId, downOrderId);
                }
                if (!relationMappingEntity.OrderOddNumberMapping.ContainsKey(upOddNumber))
                {
                    relationMappingEntity.OrderOddNumberMapping.Add(upOddNumber, downOddNumber);
                }

                new DispatchRelationBusiness().GetOrderDispatch(relationMappingEntity);
            }


            return(relationMappingEntity);
        }
コード例 #2
0
        /// <summary>
        /// 获得关联映射
        /// </summary>
        /// <param name="sellerId"></param>
        /// <param name="dbId"></param>
        /// <returns></returns>
        public RelationMappingEntity GetUpMappingEntity(int sellerId, int dbId)
        {
            RelationMappingEntity relationMappingEntity = new RelationMappingEntity();
            ConnectorRelation     connectorEntity       = new ConnectorBusiness(_dapperFactory).GetUpConnector(sellerId, dbId);

            if (connectorEntity.Id == null)
            {
                new Exceptions(new Exception($"sellerId={sellerId},dbid={dbId}"), "productrelation");
                return(relationMappingEntity);
            }

            relationMappingEntity.ConnectorMapping.Add(sellerId, Utils.ToInt(connectorEntity.SellerId));

            relationMappingEntity.ConnectorEntity = connectorEntity;

            DataTable data = DBTable("UpConnectorId=" + connectorEntity.Id + " and DownConnectorId=" + connectorEntity.ThirdConnectorId);

            if (data == null || data.Rows.Count == 0)
            {
                new Exceptions(new Exception($"sellerId={sellerId},dbid={dbId},UpConnectorId ={connectorEntity.Id} and DownConnectorId={connectorEntity.ThirdConnectorId}"), "productrelation");
                return(relationMappingEntity);
            }

            foreach (DataRow dr in data.Rows)
            {
                int upProductId   = Utils.ToInt(dr["UpProductId"]);
                int downProductId = Utils.ToInt(dr["DownProductId"]);
                int upGoodsId     = Utils.ToInt(dr["UpGoodsId"]);
                int downGoodsId   = Utils.ToInt(dr["DownGoodsId"]);
                if (!relationMappingEntity.ProductMapping.ContainsKey(downProductId))
                {
                    relationMappingEntity.ProductMapping.Add(downProductId, upProductId);
                }
                if (!relationMappingEntity.GoodsMapping.ContainsKey(downGoodsId))
                {
                    relationMappingEntity.GoodsMapping.Add(downGoodsId, upGoodsId);
                }
            }
            return(relationMappingEntity);
        }
コード例 #3
0
        /// <summary>
        /// 获得关联映射
        /// </summary>
        /// <param name="sellerId"></param>
        /// <param name="dbId"></param>
        /// <returns></returns>
        public RelationMappingEntity GetDownMappingEntity(int sellerId, int upBuyerId, int dbId)
        {
            RelationMappingEntity relationMappingEntity = new RelationMappingEntity();
            ConnectorRelation     connectorEntity       = new ConnectorBusiness().GetDownConnector(sellerId, upBuyerId, dbId);

            if (connectorEntity.Id == null)
            {
                return(relationMappingEntity);
            }

            relationMappingEntity.ConnectorMapping.Add(sellerId, Utils.ToInt(connectorEntity.SellerId));

            relationMappingEntity.ConnectorEntity = connectorEntity;

            DataTable data = DBTable("UpConnectorId=" + connectorEntity.ThirdConnectorId + " and DownConnectorId=" + connectorEntity.Id);

            if (data == null || data.Rows.Count == 0)
            {
                return(relationMappingEntity);
            }

            foreach (DataRow dr in data.Rows)
            {
                int upProductId   = Utils.ToInt(dr["UpProductId"]);
                int downProductId = Utils.ToInt(dr["DownProductId"]);
                int upGoodsId     = Utils.ToInt(dr["UpGoodsId"]);
                int downGoodsId   = Utils.ToInt(dr["DownGoodsId"]);
                if (!relationMappingEntity.ProductMapping.ContainsKey(upProductId))
                {
                    relationMappingEntity.ProductMapping.Add(upProductId, downProductId);
                }
                if (!relationMappingEntity.GoodsMapping.ContainsKey(upGoodsId))
                {
                    relationMappingEntity.GoodsMapping.Add(upGoodsId, downGoodsId);
                }
            }
            return(relationMappingEntity);
        }