Exemplo n.º 1
0
        public static StoreBasicInfo QueryStoreBasicInfoBySellerSysNo(int sellerSysNo)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("QueryStoreBasicInfoBySellerSysNo");

            cmd.SetParameterValue("@SellerSysNo", sellerSysNo);

            var ds = cmd.ExecuteDataSet();

            List <string> BrandNames = new List <string>();

            if (ds.Tables.Count > 0)
            {
                var dt0 = ds.Tables[0];
                foreach (DataRow row in dt0.Rows)
                {
                    BrandNames.Add(row[0].ToString());
                }
            }

            List <string> CategoryNames = new List <string>();

            if (ds.Tables.Count > 1)
            {
                var dt1 = ds.Tables[1];
                foreach (DataRow row in dt1.Rows)
                {
                    CategoryNames.Add(row[0].ToString());
                }
            }

            StoreBasicInfo result = new StoreBasicInfo();

            if (ds.Tables.Count > 2)
            {
                var dt2 = ds.Tables[2];
                if (dt2.Rows.Count > 0)
                {
                    DataMapper.AutoMap <StoreBasicInfo>(result, dt2.Rows[0]);
                }
            }
            result.MainBrand           = String.Join("/", BrandNames.ToArray());
            result.MainProductCategory = String.Join("/", CategoryNames.ToArray());
            return(result);
        }
Exemplo n.º 2
0
        private RefundPrintInfo GetRefundInfo(int refundSysNo)
        {
            RefundPrintInfo refundInfo = new RefundPrintInfo();

            refundInfo.Items = new List <RefundItemPrintInfo>();

            var dtRefund = ObjectFactory <RefundProcessor> .Instance.GetRefundPrintDetail(refundSysNo);

            var dtRefundItems = ObjectFactory <RefundProcessor> .Instance.GetRefundPrintItems(refundSysNo);

            if (dtRefund.Rows.Count == 0)
            {
                throw new BizException(ResouceManager.GetMessageString("RMA.Refund", "Refund_Refund_NotExists"));
            }
            DataMapper.AutoMap <RefundPrintInfo>(refundInfo, dtRefund.Rows[0]);
            if (dtRefundItems.Rows.Count > 0)
            {
                foreach (DataRow row in dtRefundItems.Rows)
                {
                    RefundItemPrintInfo item = new RefundItemPrintInfo();
                    DataMapper.AutoMap <RefundItemPrintInfo>(item, row);
                    refundInfo.Items.Add(item);
                }
            }

            if (refundInfo.Items != null)
            {
                refundInfo.Items.ForEach(item =>
                {
                    item.Quantity    = -1;
                    item.IsPoint     = false;
                    item.Price       = refundInfo.RefundPayType == RefundPayType.TransferPointRefund ? 0M : (item.RefundCash ?? 0M);
                    item.TotalAmount = item.Quantity * item.Price;
                });

                if (refundInfo.DeductPointFromCurrentCash != null && refundInfo.DeductPointFromCurrentCash != 0)
                {
                    RefundItemPrintInfo printItem = new RefundItemPrintInfo()
                    {
                        ProductID   = "赎回积分",
                        IsPoint     = false,
                        TotalAmount = refundInfo.DeductPointFromCurrentCash.Value
                    };

                    refundInfo.Items.Add(printItem);
                }

                if (refundInfo.CompensateShipPrice != null && refundInfo.CompensateShipPrice.Value != 0)
                {
                    RefundItemPrintInfo printItem = new RefundItemPrintInfo()
                    {
                        ProductID   = "补偿运费",
                        IsPoint     = false,
                        TotalAmount = -1 * refundInfo.CompensateShipPrice.Value
                    };

                    refundInfo.Items.Add(printItem);
                }

                if (refundInfo.PointAmount != null && refundInfo.PointAmount.Value != 0)
                {
                    RefundItemPrintInfo printItem = new RefundItemPrintInfo()
                    {
                        ProductID   = "影响积分",
                        IsPoint     = true,
                        TotalAmount = refundInfo.PointAmount.Value + (refundInfo.RefundPayType == RefundPayType.TransferPointRefund ? (refundInfo.CashAmount ?? 0M) * ExternalDomainBroker.GetPointToMoneyRatio() : 0M)
                    };

                    refundInfo.Items.Add(printItem);
                }
            }

            return(refundInfo);
        }