//更新优惠价和优惠比例
        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 void InsertProductChannelMemberPrices(List <ProductChannelMemberPriceInfo> entityList)
        {
            StringBuilder result = new StringBuilder();

            foreach (var entity in entityList)
            {
                try
                {
                    entity.ChannelName = ChannelMemberInfoByChannelNo[entity.ChannelSysNO];
                    ProductChannelMemberPriceLogInfo log = new ProductChannelMemberPriceLogInfo()
                    {
                        ProductSysNo       = entity.ProductSysNo,
                        ChannelName        = entity.ChannelName,
                        MemberPrice        = entity.MemberPrice,
                        MemberPricePercent = entity.MemberPricePercent,
                        OperationType      = "A",
                        InDate             = DateTime.Now,
                        InUser             = entity.InUser,
                        CompanyCode        = entity.CompanyCode,
                        StoreCompanyCode   = entity.StoreCompanyCode,
                        LanguageCode       = entity.LanguageCode
                    };
                    //插入会员渠道价格表
                    ObjectFactory <ProductChannelMemberInfoProcessor> .Instance
                    .InsertProductChannelMemberPricesBiz(entity);

                    //插入会员渠道日志
                    InsertProductChannelMemberPriceLog(log);
                    successCount++;
                }
                catch (BizException ex)
                {
                    string message = ResouceManager.GetMessageString("IM.Category", "ProductSysNo");
                    message += ":{0},";
                    message += ResouceManager.GetMessageString("IM.Category", "FailReason");
                    message += ":{1}";
                    result.AppendLine(string.Format(message
                                                    , entity.ProductSysNo, ex.Message));
                    errorCount++;
                }
            }
            string resMessage = ResouceManager.GetMessageString("IM.ProductChannelInfo", "AddSuccess");

            resMessage += ":{0},";
            resMessage += ResouceManager.GetMessageString("IM.Category", "NumberUnit");
            resMessage += ResouceManager.GetMessageString("IM.ProductChannelInfo", "AddFail");
            resMessage += ":{1}";
            resMessage += ResouceManager.GetMessageString("IM.Category", "NumberUnit");
            resMessage += "。\r\n";
            result.Insert(0, string.Format(resMessage
                                           , successCount, errorCount));
            _ChannelMemberInfoByChannelNo = null;
            ClearNum();
            throw new BizException(result.ToString());
        }
        //成批删除渠道会员表
        public void DeleteProductChannelMemberPrices(List <ProductChannelMemberPriceInfo> entityList)
        {
            StringBuilder result = new StringBuilder();

            foreach (var entity in entityList)
            {
                try
                {
                    DeleteProductChannelMemberPrice(int.Parse(entity.SysNo.ToString()));
                    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      = "D",
                        InDate             = DateTime.Now,
                        InUser             = entity.EditUser,
                        CompanyCode        = entity.CompanyCode,
                        StoreCompanyCode   = entity.StoreCompanyCode,
                        LanguageCode       = entity.LanguageCode
                    };
                    InsertProductChannelMemberPriceLog(log);
                    successCount++;
                }
                catch (BizException ex)
                {
                    string message = ResouceManager.GetMessageString("IM.ProductChannelInfo", "SystemNo");
                    message += ":{0},";
                    message += ResouceManager.GetMessageString("IM.Category", "FailReason");
                    message += ":{1}";
                    result.AppendLine(string.Format(message
                                                    , entity.SysNo, ex.Message));
                    errorCount++;
                }
            }
            string resMessage = ResouceManager.GetMessageString("IM.ProductChannelInfo", "DeleteSuccess");

            resMessage += ":{0},";
            resMessage += ResouceManager.GetMessageString("IM.Category", "NumberUnit");
            resMessage += ResouceManager.GetMessageString("IM.ProductChannelInfo", "DeleteFail");
            resMessage += ":{1}";
            resMessage += ResouceManager.GetMessageString("IM.Category", "NumberUnit");
            resMessage += "。\r\n";
            result.Insert(0, string.Format(resMessage
                                           , successCount, errorCount));
            _ChannelMemberInfoByChannelNo = null;
            ClearNum();
            throw new BizException(result.ToString());
        }
        //添加日志记录
        public Int32 InsertProductChannelMemberPriceLog(ProductChannelMemberPriceLogInfo entity)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("InsertProductChannelMemberPriceLog");

            cmd.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            cmd.SetParameterValue("@ChannelName", entity.ChannelName);
            cmd.SetParameterValue("@MemberPrice", entity.MemberPrice);
            cmd.SetParameterValue("@MemberPricePercent", entity.MemberPricePercent);
            cmd.SetParameterValue("@OperationType", entity.OperationType);
            cmd.SetParameterValue("@InUser", entity.InUser);
            cmd.SetParameterValue("@CompanyCode", entity.CompanyCode);
            cmd.SetParameterValue("@StoreCompanyCode", entity.StoreCompanyCode);
            cmd.SetParameterValue("@LanguageCode", entity.LanguageCode);
            return(cmd.ExecuteNonQuery());
        }
 //插入日志
 public Int32 InsertProductChannelMemberPriceLog(ProductChannelMemberPriceLogInfo entity)
 {
     return(ObjectFactory <ProductChannelMemberInfoProcessor>
            .Instance.InsertProductChannelMemberPriceLogBiz(entity));
 }
 //插入日志
 public Int32 InsertProductChannelMemberPriceLogBiz(ProductChannelMemberPriceLogInfo entity)
 {
     return(_ProductChannelInfoDA.InsertProductChannelMemberPriceLog(entity));
 }