/// <summary>
        /// 更新一个产品
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static int UpdateOrderAreaProduct(OrderAreaProduct entity)
        {
            const string sql = @"UPDATE  Gungnir..[OrderFinishPageSettingProduct]
                        SET     PID = @PID ,
                                Position = @Position ,
                                State = @State ,
                                LastUpdateDateTime = GETDATE() ,
                                PromotionPrice = @PromotionPrice ,
                                PromotionNum = @PromotionNum ,
                                OrderAreaId = @OrderAreaId ,
                                ActivityId = @ActivityId
                        WHERE   ID = @ID";

            SqlParameter[] sqlPrams = new SqlParameter[] {
                new SqlParameter("@PID", entity.PId),
                new SqlParameter("@Position", entity.Position),
                new SqlParameter("@State", entity.State),
                new SqlParameter("@PromotionPrice", entity.PromotionPrice),
                new SqlParameter("@PromotionNum", entity.PromotionNum),
                new SqlParameter("@OrderAreaId", entity.OrderAreaId),
                new SqlParameter("@ID", entity.Id),
                new SqlParameter("@ActivityId", entity.ActivityId)
            };

            using (SqlConnection sqlConnection = new SqlConnection(connectionString))
            {
                return(SqlHelper.ExecuteNonQuery(sqlConnection, CommandType.Text, sql, sqlPrams));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Edit(OrderAreaProduct product)
        {
            //查询产品Id是否存在
            var resultData = AutoSuppliesManager.GetProductInfoByPIdNewVersion(product.PId);

            if (resultData == null)
            {
                ViewBag.Result = "您输入的产品Id不存在.";
                return(View());
            }
            //1.先查询数据是否存在
            //2. 如果不存在,直接跳转到HomePageConfig/Index页面
            if (product != null)
            {
                if (OrderAreaProductManager.HasSingleProduct(product.Id))
                {
                    ViewBag.Result = OrderAreaProductManager.UpdateOrderAreaProduct(product);
                }
                else
                {
                    return(RedirectToAction("Index", "OrderArea"));
                }
            }

            return(RedirectToAction("SearchProductsByMoudleId", new { id = product.OrderAreaId }));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 新增产品
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int AddOrderAreaProduct(OrderAreaProduct entity)
 {
     try
     {
         return(DALOrderAreaProduct.AddOrderAreaProduct(entity));
     }
     catch (TuhuBizException)
     {
         throw;
     }
     catch (Exception ex)
     {
         var exception = new OrderAreaProductException(1, "AddOrderAreaProduct", ex);
         Logger.Log(Level.Error, exception, "AddOrderAreaProduct");
         throw ex;
     }
 }
Ejemplo n.º 4
0
        public ActionResult Add(OrderAreaProduct product, int id)
        {
            var resultData = AutoSuppliesManager.GetProductInfoByPIdNewVersion(product.PId);

            if (resultData == null)
            {
                ViewBag.Result = "您输入的产品Id不存在.";
                return(View());
            }

            if (product != null)
            {
                // 设置上一个请求传递过来的appsetDataid
                product.OrderAreaId = id;
                ViewBag.Result      = OrderAreaProductManager.AddOrderAreaProduct(product);
            }

            return(RedirectToAction("SearchProductsByMoudleId", new { id = id }));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新产品信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int UpdateOrderAreaProduct(OrderAreaProduct entity)
        {
            try
            {
                //没有对应的产品信息
                if (DALOrderAreaProduct.SelectSingleOrderAreaProduct(entity.Id) == null)
                {
                    return(0);
                }

                return(DALOrderAreaProduct.UpdateOrderAreaProduct(entity));
            }
            catch (TuhuBizException)
            {
                throw;
            }
            catch (Exception ex)
            {
                var exception = new OrderAreaProductException(1, "UpdateOrderAreaProduct", ex);
                Logger.Log(Level.Error, exception, "UpdateOrderAreaProduct");
                throw ex;
            }
        }
        /// <summary>
        /// 添加一个产品
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static int AddOrderAreaProduct(OrderAreaProduct entity)
        {
            const string sql = @"INSERT  INTO Gungnir..[OrderFinishPageSettingProduct]
                                    ( PID ,
                                      Position ,
                                      State ,
                                      CreateDateTime ,
                                      PromotionPrice ,
                                      PromotionNum ,
                                      OrderAreaId ,
                                      ActivityId
                                    )
                            VALUES  ( @PID ,
                                      @Position ,
                                      @State ,
                                      GETDATE() ,
                                      @PromotionPrice ,
                                      @PromotionNum ,
                                      @OrderAreaId  ,
                                      @ActivityId     
                                    )";

            SqlParameter[] sqlPrams = new SqlParameter[]
            {
                new SqlParameter("@PID", entity.PId),
                new SqlParameter("@Position", entity.Position),
                new SqlParameter("@State", entity.State),
                new SqlParameter("@PromotionPrice", entity.PromotionPrice),
                new SqlParameter("@PromotionNum", entity.PromotionNum),
                new SqlParameter("@OrderAreaId", entity.OrderAreaId),
                new SqlParameter("@ActivityId", entity.ActivityId)
            };
            using (SqlConnection sqlConnection = new SqlConnection(connectionString))
            {
                return(SqlHelper.ExecuteNonQuery(sqlConnection, CommandType.Text, sql, sqlPrams));
            }
        }