Exemple #1
0
            /// <summary>
            /// 检查渠道商品价格信息实体
            /// </summary>
            /// <param name="entity"></param>
            public static void CheckProductChannelPeriodPriceInfo(ProductChannelPeriodPrice entity)
            {
                if (entity.Operate != ProductChannelPeriodPriceOperate.Stop)
                {
                    int result = _ProductChannelInfoDA.CheckProductChannelPeriodPrice(entity);

                    if (result == -1)
                    {
                        //该时段价格已存在
                        throw new BizException(ResouceManager.GetMessageString("IM.ProductChannelInfo", "ProductChannelPeriodPriceIsExists"));
                    }
                }
            }
Exemple #2
0
        /// <summary>
        /// Check渠道商品价格信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int CheckProductChannelPeriodPrice(ProductChannelPeriodPrice entity)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("CheckProductChannelPeriodPrice");

            cmd.SetParameterValue("@SysNo", entity.SysNo);
            cmd.SetParameterValue("@BeginDate", entity.BeginDate);
            cmd.SetParameterValue("@EndDate", entity.EndDate);
            cmd.SetParameterValue("@ChannelProductInfoSysNo", entity.ChannelProductInfo.SysNo);

            cmd.ExecuteNonQuery();

            return(int.Parse(cmd.GetParameterValue("@Flag").ToString()));
        }
Exemple #3
0
        /// <summary>
        /// 创建渠道商品价格信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public ProductChannelPeriodPrice CreateProductChannelPeriodPrice(ProductChannelPeriodPrice entity)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("CreateProductChannelPeriodPrice");

            cmd.SetParameterValue("@ChannelProductInfoSysNo", entity.ChannelProductInfo.SysNo);
            cmd.SetParameterValue("@PeriodPrice", entity.PeriodPrice);
            cmd.SetParameterValue("@BeginDate", entity.BeginDate);
            cmd.SetParameterValue("@EndDate", entity.EndDate);
            cmd.SetParameterValue("@Status", entity.Status);
            cmd.SetParameterValue("@IsChangePrice", BooleanEnum.No);
            cmd.SetParameterValue("@Note", entity.Note);
            cmd.SetParameterValue("@CreateUser", entity.CreateUser.UserDisplayName);

            cmd.ExecuteNonQuery();
            entity.SysNo = int.Parse(cmd.GetParameterValue("@SysNo").ToString());
            return(entity);
        }
Exemple #4
0
        /// <summary>
        /// 修改渠道商品价格信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public ProductChannelPeriodPrice UpdateProductChannelPeriodPrice(ProductChannelPeriodPrice entity)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("UpdateProductChannelPeriodPrice");

            cmd.SetParameterValue("@ChannelProductInfoSysNo", entity.ChannelProductInfo.SysNo);
            cmd.SetParameterValue("@PeriodPrice", entity.PeriodPrice);
            cmd.SetParameterValue("@BeginDate", entity.BeginDate);
            cmd.SetParameterValue("@EndDate", entity.EndDate);
            cmd.SetParameterValue("@Status", entity.Status);
            cmd.SetParameterValue("@IsChangePrice", BooleanEnum.No);
            cmd.SetParameterValue("@Note", entity.Note);
            cmd.SetParameterValue("@EditUser", entity.EditUser.UserDisplayName);
            cmd.SetParameterValue("@AuditUser", entity.AuditUser.UserDisplayName);
            cmd.SetParameterValue("@SysNo", entity.SysNo);

            cmd.ExecuteNonQuery();
            return(entity);
        }
        /// <summary>
        /// 转换分类视图和分类实体
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private ProductChannelPeriodPrice CovertVMtoEntity(ProductChannelPeriodPriceVM data)
        {
            ProductChannelPeriodPrice msg = data.ConvertVM <ProductChannelPeriodPriceVM, ProductChannelPeriodPrice>();


            msg.CreateUser = new UserInfo {
                SysNo = CPApplication.Current.LoginUser.userSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName
            };
            msg.EditUser = new UserInfo {
                SysNo = CPApplication.Current.LoginUser.userSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName
            };
            msg.AuditUser = new UserInfo {
                SysNo = CPApplication.Current.LoginUser.userSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName
            };

            msg.SysNo = data.SysNo;
            return(msg);
        }
        /// <summary>
        /// 修改渠道商品价格信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public ProductChannelPeriodPrice UpdateProductChannelPeriodPrice(ProductChannelPeriodPrice entity)
        {
            var result = ObjectFactory <ProductChannelInfoProcessor> .Instance.UpdateProductChannelPeriodPrice(entity);

            return(result);
        }
Exemple #7
0
        /// <summary>
        /// 修改渠道商品价格信息信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual ProductChannelPeriodPrice UpdateProductChannelPeriodPrice(ProductChannelPeriodPrice entity)
        {
            if (entity != null)
            {
                CheckProductChannelInfoProcessor.CheckProductChannelPeriodPriceSysNo(entity.SysNo);
            }

            CheckProductChannelInfoProcessor.CheckProductChannelPeriodPriceInfo(entity);

            var oldEntity = _ProductChannelInfoDA.GetProductChannelPeriodPriceBySysNo(entity.SysNo.Value);

            if (((entity.Operate == ProductChannelPeriodPriceOperate.CreateOrEdit ||
                  entity.Operate == ProductChannelPeriodPriceOperate.Submit) &&
                 oldEntity.Status != ProductChannelPeriodPriceStatus.Init) ||
                ((entity.Operate == ProductChannelPeriodPriceOperate.CancelSubmit ||
                  entity.Operate == ProductChannelPeriodPriceOperate.Approve ||
                  entity.Operate == ProductChannelPeriodPriceOperate.UnApprove) &&
                 oldEntity.Status != ProductChannelPeriodPriceStatus.WaitApproved) ||
                (entity.Operate == ProductChannelPeriodPriceOperate.Stop &&
                 oldEntity.Status != ProductChannelPeriodPriceStatus.Ready &&
                 oldEntity.Status != ProductChannelPeriodPriceStatus.Running))
            {
                //状态已变更请刷新再试
                throw new BizException(ResouceManager.GetMessageString("IM.ProductChannelInfo", "ProductChannelPeriodPriceStatusChanged"));
            }

            //根据操作类型填充数据
            switch (entity.Operate)
            {
            case ProductChannelPeriodPriceOperate.Stop:
                entity.Note                      = oldEntity.Note;
                entity.PeriodPrice               = oldEntity.PeriodPrice;
                entity.BeginDate                 = oldEntity.BeginDate;
                entity.EndDate                   = oldEntity.EndDate;
                entity.IsChangePrice             = oldEntity.IsChangePrice;
                entity.ChannelProductInfo        = oldEntity.ChannelProductInfo;
                entity.Status                    = ProductChannelPeriodPriceStatus.Abandon;
                entity.EndDate                   = System.DateTime.Now;
                entity.AuditUser.UserDisplayName = "";
                break;

            case ProductChannelPeriodPriceOperate.Submit:
                if (entity.PeriodPrice >= entity.ChannelProductInfo.CurrentPrice)
                {
                    entity.Status = ProductChannelPeriodPriceStatus.Ready;
                }
                else
                {
                    entity.Status = ProductChannelPeriodPriceStatus.WaitApproved;
                    entity.AuditUser.UserDisplayName = "";
                }
                break;

            case ProductChannelPeriodPriceOperate.CreateOrEdit:
            case ProductChannelPeriodPriceOperate.CancelSubmit:
                entity.Status = ProductChannelPeriodPriceStatus.Init;
                entity.AuditUser.UserDisplayName = "";
                break;

            case ProductChannelPeriodPriceOperate.UnApprove:
                entity.Status = ProductChannelPeriodPriceStatus.Init;
                break;

            case ProductChannelPeriodPriceOperate.Approve:
                entity.Status = ProductChannelPeriodPriceStatus.Ready;
                break;
            }

            return(_ProductChannelInfoDA.UpdateProductChannelPeriodPrice(entity));
        }
Exemple #8
0
 /// <summary>
 /// 创建渠道商品价格信息信息
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public virtual ProductChannelPeriodPrice CreatetProductChannelPeriodPrice(ProductChannelPeriodPrice entity)
 {
     CheckProductChannelInfoProcessor.CheckProductChannelPeriodPriceInfo(entity);
     return(_ProductChannelInfoDA.CreateProductChannelPeriodPrice(entity));
 }
Exemple #9
0
        public ProductChannelPeriodPrice UpdateProductChannelPeriodPrice(ProductChannelPeriodPrice request)
        {
            var entity = ObjectFactory <ProductChannelInfoAppService> .Instance.UpdateProductChannelPeriodPrice(request);

            return(entity);
        }