//更新优惠价和优惠比例
        public void UpdateProductChannelMemberPrice(ProductChannelMemberPriceInfo entity)
        {
            StringBuilder result = new StringBuilder();

            try
            {
                entity.MemberPricePercent = entity.MemberPricePercent != null
                    ? entity.MemberPricePercent / 100 : entity.MemberPricePercent;
                ProductChannelMemberPriceLogInfo log = new ProductChannelMemberPriceLogInfo()
                {
                    ProductSysNo       = entity.ProductSysNo,
                    ChannelName        = entity.ChannelName,
                    MemberPrice        = entity.MemberPrice,
                    MemberPricePercent = entity.MemberPricePercent,
                    OperationType      = "E",
                    InDate             = DateTime.Now,
                    InUser             = entity.EditUser,
                    CompanyCode        = entity.CompanyCode,
                    StoreCompanyCode   = entity.StoreCompanyCode,
                    LanguageCode       = entity.LanguageCode
                };
                ObjectFactory <ProductChannelMemberInfoProcessor> .Instance
                .UpdateProductChannelMemberPrice(entity);

                InsertProductChannelMemberPriceLog(log);
            }
            catch (BizException ex)
            {
                result.AppendLine(string.Format(ResouceManager.GetMessageString("IM.Category", "FailReason") + ":{0}", ex.Message));
                throw new BizException(result.ToString());
            }
        }
        //更新优惠价和优惠比例
        public Int32 UpdateProductChannelMemberPrice(ProductChannelMemberPriceInfo entity)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand(
                "UpdateProductChannelMemberPriceOrMemberPricePercentBySysNo");

            cmd.SetParameterValue("@SysNo", entity.SysNo);
            cmd.SetParameterValue("@MemberPrice", entity.MemberPrice);
            cmd.SetParameterValue("@MemberPricePercent", entity.MemberPricePercent);
            cmd.SetParameterValue("@EditDate", DateTime.Now);
            cmd.SetParameterValue("@EditUser", entity.EditUser);
            return(cmd.ExecuteNonQuery());
        }
        // 插入会员渠道价格表
        public Int32 InsertProductChannelMemberPricesBiz(ProductChannelMemberPriceInfo entity)
        {
            //找出当前渠道下的所有记录
            IList <ProductChannelMemberPriceInfo> _old =
                _ProductChannelInfoDA.GetProductChannelMemberPriceByChannelSysNo(entity.ChannelSysNO);

            if (_old.Select(p => p.ProductSysNo).Contains(entity.ProductSysNo))
            {
                throw new BizException(ResouceManager.GetMessageString("IM.ProductChannelInfo", "TheChannelExistsThePorduct"));
            }
            return(_ProductChannelInfoDA.InsertProductChannelMemberPrices(entity));
        }
        // 插入会员渠道信息
        public Int32 InsertProductChannelMemberPrices(ProductChannelMemberPriceInfo entity)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("InsertProductChannelMemberPrice");

            cmd.SetParameterValue("@ChannelSysNo", entity.ChannelSysNO);
            cmd.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            cmd.SetParameterValue("@MemberPrice", entity.MemberPrice);
            cmd.SetParameterValue("@MemberPricePercent", entity.MemberPricePercent);
            cmd.SetParameterValue("@InUser", entity.InUser);
            cmd.SetParameterValue("@EditUser", entity.EditUser);
            cmd.SetParameterValue("@CompanyCode", entity.CompanyCode);
            cmd.SetParameterValue("@StoreCompanyCode", entity.StoreCompanyCode);
            cmd.SetParameterValue("@LanguageCode", entity.LanguageCode);
            return(cmd.ExecuteNonQuery());
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            var vm = DataContext as ProductChannelMemberVM;

            if (vm == null || !ValidationManager.Validate(this))
            {
                return;
            }
            if (!String.IsNullOrEmpty(vm.MemberPrice) && !String.IsNullOrEmpty(vm.MemberPricePercent))
            {
                CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show(
                    "优惠价和优惠比例只能输入一项!.", MessageBoxType.Warning);
                return;
            }
            ProductChannelMemberPriceInfo info = new ProductChannelMemberPriceInfo()
            {
                SysNo            = vm.SysNo,
                ProductSysNo     = vm.ProductSysNo,
                ChannelName      = vm.ChannelName,
                EditDate         = DateTime.Now,
                EditUser         = CPApplication.Current.LoginUser.LoginName,
                CompanyCode      = CPApplication.Current.CompanyCode,
                StoreCompanyCode = CPApplication.Current.CompanyCode,
                LanguageCode     = CPApplication.Current.LanguageCode
            };

            if (!String.IsNullOrEmpty(vm.MemberPrice))
            {
                info.MemberPrice = decimal.Parse(vm.MemberPrice);
            }
            else
            {
                info.MemberPricePercent = decimal.Parse(vm.MemberPricePercent);
            }
            Facade.UpdateProductChannelMemberPrice(info, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                CPApplication.Current.CurrentPage
                .Context.Window.Alert(ResBrandMaintain.Info_SaveSuccessfully);
                CloseDialog(DialogResultType.OK);
            });
        }
 //更新优惠价和优惠比例
 public Int32 UpdateProductChannelMemberPrice(ProductChannelMemberPriceInfo entity)
 {
     return(_ProductChannelInfoDA.UpdateProductChannelMemberPrice(entity));
 }
 public void UpdateProductChannelMemberPrice(ProductChannelMemberPriceInfo ProductChannelMemberPrice)
 {
     ObjectFactory <ProductChannelMemberInfoAppService> .Instance
     .UpdateProductChannelMemberPrice(ProductChannelMemberPrice);
 }
Exemple #8
0
 //更新优惠价和优惠比例
 public void UpdateProductChannelMemberPrice(ProductChannelMemberPriceInfo data,
                                             EventHandler <RestClientEventArgs <ProductChannelMemberPriceInfo> > callback)
 {
     _restClient.Update(UpdateProductChannelMemberPriceUrl, data, callback);
 }