示例#1
0
        public int AddBundlingProduct(BundlingInfo bind, DbTransaction dbTran)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("DECLARE @DisplaySequence AS INT SELECT @DisplaySequence = (CASE WHEN MAX(DisplaySequence) IS NULL THEN 1 ELSE MAX(DisplaySequence) + 1 END) FROM Ecshop_BundlingProducts;INSERT INTO Ecshop_BundlingProducts(Name,ShortDescription,Num,Price,SaleStatus,AddTime,DisplaySequence,SupplierId) VALUES(@Name,@ShortDescription,@Num,@Price,@SaleStatus,@AddTime,@DisplaySequence,@SupplierId); SELECT @@IDENTITY");

            this.database.AddInParameter(sqlStringCommand, "Name", DbType.String, bind.Name);
            this.database.AddInParameter(sqlStringCommand, "ShortDescription", DbType.String, bind.ShortDescription);
            this.database.AddInParameter(sqlStringCommand, "Num", DbType.Int32, bind.Num);
            this.database.AddInParameter(sqlStringCommand, "Price", DbType.Currency, bind.Price);
            this.database.AddInParameter(sqlStringCommand, "SaleStatus", DbType.Int32, bind.SaleStatus);
            this.database.AddInParameter(sqlStringCommand, "AddTime", DbType.DateTime, bind.AddTime);
            this.database.AddInParameter(sqlStringCommand, "SupplierId", DbType.Int32, bind.SupplierId);
            object obj;

            if (dbTran != null)
            {
                obj = this.database.ExecuteScalar(sqlStringCommand, dbTran);
            }
            else
            {
                obj = this.database.ExecuteScalar(sqlStringCommand);
            }
            int result;

            if (obj != null)
            {
                result = Convert.ToInt32(obj);
            }
            else
            {
                result = 0;
            }
            return(result);
        }
        private OrderInfo GetOrderInfo(ShoppingCartInfo shoppingCartInfo)
        {
            OrderInfo orderInfo = ShoppingProcessor.ConvertShoppingCartToOrder(shoppingCartInfo, this.isGroupBuy, this.isCountDown, this.isSignBuy);

            if (orderInfo == null)
            {
                return(null);
            }
            if (this.chkTax.Checked)
            {
                orderInfo.Tax = (orderInfo.GetTotal() * decimal.Parse(this.litTaxRate.Text)) / 100M;
                if (this.isBundling)
                {
                    BundlingInfo bundlingInfo = ProductBrowser.GetBundlingInfo(this.bundlingid);
                    orderInfo.Tax = (bundlingInfo.Price * decimal.Parse(this.litTaxRate.Text)) / 100M;
                }
            }
            orderInfo.InvoiceTitle = this.txtInvoiceTitle.Text;
            if (this.isGroupBuy)
            {
                GroupBuyInfo productGroupBuyInfo = ProductBrowser.GetProductGroupBuyInfo(shoppingCartInfo.LineItems[this.productSku].ProductId);
                orderInfo.GroupBuyId = productGroupBuyInfo.GroupBuyId;
                orderInfo.NeedPrice  = productGroupBuyInfo.NeedPrice;
            }
            if (this.isCountDown)
            {
                CountDownInfo countDownInfo = ProductBrowser.GetCountDownInfo(this.shoppingCart.LineItems[this.productSku].ProductId);
                orderInfo.CountDownBuyId = countDownInfo.CountDownId;
            }
            if (this.isBundling)
            {
                BundlingInfo info5 = ProductBrowser.GetBundlingInfo(this.bundlingid);
                orderInfo.BundlingID    = info5.BundlingID;
                orderInfo.BundlingPrice = info5.Price;
                orderInfo.Points        = this.shoppingCart.GetPoint(info5.Price);
            }
            orderInfo.OrderId   = this.GenerateOrderId();
            orderInfo.OrderDate = DateTime.Now;
            IUser user = HiContext.Current.User;

            orderInfo.UserId   = user.UserId;
            orderInfo.Username = user.Username;
            if (!user.IsAnonymous)
            {
                Member member = user as Member;
                orderInfo.EmailAddress = member.Email;
                orderInfo.RealName     = member.RealName;
                orderInfo.QQ           = member.QQ;
                orderInfo.Wangwang     = member.Wangwang;
                orderInfo.MSN          = member.MSN;
            }
            orderInfo.Remark       = Globals.HtmlEncode(this.txtMessage.Text);
            orderInfo.OrderStatus  = OrderStatus.WaitBuyerPay;
            orderInfo.RefundStatus = RefundStatus.None;
            this.FillOrderCoupon(orderInfo);
            this.FillOrderShippingMode(orderInfo, shoppingCartInfo);
            this.FillOrderPaymentMode(orderInfo);
            return(orderInfo);
        }
示例#3
0
        protected void btnEditBindProduct_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(base.Request.Form["selectProductsinfo"]))
            {
                this.ShowMsg("获取绑定商品信息错误", false);
                return;
            }
            if (string.IsNullOrEmpty(this.txtBindName.Text) || string.IsNullOrEmpty(this.txtNum.Text) || string.IsNullOrEmpty(this.txtSalePrice.Text))
            {
                this.ShowMsg("你的资料填写不完整", false);
                return;
            }
            BundlingInfo bundlingInfo = new BundlingInfo();

            bundlingInfo.BundlingID = this.bundlingid;
            bundlingInfo.AddTime    = System.DateTime.Now;
            bundlingInfo.Name       = this.txtBindName.Text;
            bundlingInfo.Price      = System.Convert.ToDecimal(this.txtSalePrice.Text);
            bundlingInfo.SaleStatus = System.Convert.ToInt32(this.radstock.SelectedValue);
            bundlingInfo.Num        = System.Convert.ToInt32(this.txtNum.Text);
            if (!string.IsNullOrEmpty(this.txtShortDescription.Text))
            {
                bundlingInfo.ShortDescription = this.txtShortDescription.Text;
            }
            string text = base.Request.Form["selectProductsinfo"];

            string[] array = text.Split(new char[]
            {
                ','
            });
            System.Collections.Generic.List <BundlingItemInfo> list = new System.Collections.Generic.List <BundlingItemInfo>();
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string           text2            = array2[i];
                BundlingItemInfo bundlingItemInfo = new BundlingItemInfo();
                string[]         array3           = text2.Split(new char[]
                {
                    '|'
                });
                bundlingItemInfo.ProductID  = System.Convert.ToInt32(array3[0]);
                bundlingItemInfo.SkuId      = array3[1];
                bundlingItemInfo.ProductNum = System.Convert.ToInt32(array3[2]);
                list.Add(bundlingItemInfo);
            }
            bundlingInfo.BundlingItemInfos = list;
            if (PromoteHelper.UpdateBundlingProduct(bundlingInfo))
            {
                this.ShowMsg("修改绑定商品成功", true);
                this.BindEditBindProduct();
                return;
            }
            this.ShowMsg("修改绑定商品错误", false);
        }
示例#4
0
        protected void BindEditBindProduct()
        {
            BundlingInfo bundlingInfo = PromoteHelper.GetBundlingInfo(this.bundlingid);

            this.txtBindName.Text         = bundlingInfo.Name;
            this.txtNum.Text              = bundlingInfo.Num.ToString();
            this.txtSalePrice.Text        = bundlingInfo.Price.ToString("F");
            this.radstock.SelectedValue   = System.Convert.ToBoolean(bundlingInfo.SaleStatus);
            this.txtShortDescription.Text = bundlingInfo.ShortDescription;
            this.Rpbinditems.DataSource   = bundlingInfo.BundlingItemInfos;
            this.Rpbinditems.DataBind();
        }
示例#5
0
        public static bool UpdateBundlingProduct(BundlingInfo bundlingInfo)
        {
            Database database = DatabaseFactory.CreateDatabase();
            bool     result;

            using (System.Data.Common.DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                System.Data.Common.DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    BundlingDao bundlingDao = new BundlingDao();
                    if (!bundlingDao.UpdateBundlingProduct(bundlingInfo, dbTransaction))
                    {
                        dbTransaction.Rollback();
                        result = false;
                    }
                    else
                    {
                        if (!bundlingDao.DeleteBundlingByID(bundlingInfo.BundlingID, dbTransaction))
                        {
                            dbTransaction.Rollback();
                            result = false;
                        }
                        else
                        {
                            if (!bundlingDao.AddBundlingProductItems(bundlingInfo.BundlingID, bundlingInfo.BundlingItemInfos, dbTransaction))
                            {
                                dbTransaction.Rollback();
                                result = false;
                            }
                            else
                            {
                                dbTransaction.Commit();
                                result = true;
                            }
                        }
                    }
                }
                catch (Exception var_4_91)
                {
                    dbTransaction.Rollback();
                    result = false;
                }
                finally
                {
                    dbConnection.Close();
                }
            }
            return(result);
        }
 private void BindShoppingCartInfo(ShoppingCartInfo shoppingCart)
 {
     if (shoppingCart.LineItems.Values.Count > 0)
     {
         this.cartProductList.DataSource = shoppingCart.LineItems.Values;
         this.cartProductList.DataBind();
         this.cartProductList.ShowProductCart();
     }
     if (shoppingCart.LineGifts.Count > 0)
     {
         IEnumerable <ShoppingCartGiftInfo> source = shoppingCart.LineGifts.Where <ShoppingCartGiftInfo>(delegate(ShoppingCartGiftInfo s) {
             return(s.PromoType == 0);
         });
         IEnumerable <ShoppingCartGiftInfo> enumerable2 = shoppingCart.LineGifts.Where <ShoppingCartGiftInfo>(delegate(ShoppingCartGiftInfo s) {
             return(s.PromoType == 5);
         });
         this.cartGiftList.DataSource     = source;
         this.cartGiftList.FreeDataSource = enumerable2;
         this.cartGiftList.DataBind();
         this.cartGiftList.ShowGiftCart(source.Count <ShoppingCartGiftInfo>() > 0, enumerable2.Count <ShoppingCartGiftInfo>() > 0);
     }
     if (shoppingCart.IsReduced)
     {
         this.litProductAmount.Text           = string.Format("商品金额:{0}", Globals.FormatMoney(shoppingCart.GetAmount()));
         this.hlkReducedPromotion.Text        = shoppingCart.ReducedPromotionName + string.Format(" 优惠:{0}", shoppingCart.ReducedPromotionAmount.ToString("F2"));
         this.hlkReducedPromotion.NavigateUrl = Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails", new object[] { shoppingCart.ReducedPromotionId });
     }
     if (shoppingCart.IsFreightFree)
     {
         this.hlkFeeFreight.Text        = string.Format("({0})", shoppingCart.FreightFreePromotionName);
         this.hlkFeeFreight.NavigateUrl = Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails", new object[] { shoppingCart.FreightFreePromotionId });
     }
     this.lblTotalPrice.Money = shoppingCart.GetTotal();
     this.lblOrderTotal.Money = shoppingCart.GetTotal();
     this.litPoint.Text       = shoppingCart.GetPoint().ToString();
     if (this.isBundling)
     {
         BundlingInfo bundlingInfo = ProductBrowser.GetBundlingInfo(this.bundlingid);
         this.lblTotalPrice.Money     = bundlingInfo.Price;
         this.lblOrderTotal.Money     = bundlingInfo.Price;
         this.litPoint.Text           = shoppingCart.GetPoint(bundlingInfo.Price).ToString();
         this.litProductBundling.Text = "(捆绑价)";
     }
     this.litAllWeight.Text = shoppingCart.Weight.ToString();
     if (shoppingCart.IsSendTimesPoint)
     {
         this.hlkSentTimesPoint.Text        = string.Format("({0};送{1}倍)", shoppingCart.SentTimesPointPromotionName, shoppingCart.TimesPoint.ToString("F2"));
         this.hlkSentTimesPoint.NavigateUrl = Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails", new object[] { shoppingCart.SentTimesPointPromotionId });
     }
 }
示例#7
0
        public override BundlingInfo GetBundlingInfo(int bundlingID)
        {
            BundlingInfo result = null;

            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_BundlingProducts WHERE BundlingID=@BundlingID");
            this.database.AddInParameter(sqlStringCommand, "BundlingID", System.Data.DbType.Int32, bundlingID);
            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    result = DataMapper.PopulateBindInfo(dataReader);
                }
            }
            return(result);
        }
        public override BundlingInfo GetBundlingInfo(int bundlingID)
        {
            BundlingInfo info             = null;
            DbCommand    sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_BundlingProducts WHERE BundlingID=@BundlingID");

            this.database.AddInParameter(sqlStringCommand, "BundlingID", DbType.Int32, bundlingID);
            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (reader.Read())
                {
                    info = DataMapper.PopulateBindInfo(reader);
                }
            }
            return(info);
        }
示例#9
0
 protected void btnEditBindProduct_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(base.Request.Form["selectProductsinfo"]))
     {
         this.ShowMsg("获取绑定商品信息错误", false);
     }
     else if ((!string.IsNullOrEmpty(this.txtBindName.Text) && !string.IsNullOrEmpty(this.txtNum.Text)) && !string.IsNullOrEmpty(this.txtSalePrice.Text))
     {
         BundlingInfo bundlingInfo = new BundlingInfo();
         bundlingInfo.BundlingID = this.bundlingid;
         bundlingInfo.AddTime    = DateTime.Now;
         bundlingInfo.Name       = this.txtBindName.Text;
         bundlingInfo.Price      = Convert.ToDecimal(this.txtSalePrice.Text);
         bundlingInfo.SaleStatus = Convert.ToInt32(this.radstock.SelectedValue);
         bundlingInfo.Num        = Convert.ToInt32(this.txtNum.Text);
         if (!string.IsNullOrEmpty(this.txtShortDescription.Text))
         {
             bundlingInfo.ShortDescription = this.txtShortDescription.Text;
         }
         string[] strArray            = base.Request.Form["selectProductsinfo"].Split(new char[] { ',' });
         List <BundlingItemInfo> list = new List <BundlingItemInfo>();
         foreach (string str2 in strArray)
         {
             BundlingItemInfo item      = new BundlingItemInfo();
             string[]         strArray2 = str2.Split(new char[] { '|' });
             item.ProductID  = Convert.ToInt32(strArray2[0]);
             item.SkuId      = strArray2[1];
             item.ProductNum = Convert.ToInt32(strArray2[2]);
             list.Add(item);
         }
         bundlingInfo.BundlingItemInfos = list;
         if (SubsitePromoteHelper.UpdateBundlingProduct(bundlingInfo))
         {
             this.ShowMsg("修改绑定商品成功", true);
             this.BindEditBindProduct();
         }
         else
         {
             this.ShowMsg("修改绑定商品错误", false);
         }
     }
     else
     {
         this.ShowMsg("你的资料填写不完整", false);
     }
 }
示例#10
0
        public BundlingInfo GetBundlingInfo(int bundlingID)
        {
            BundlingInfo  bundlingInfo  = null;
            StringBuilder stringBuilder = new StringBuilder("SELECT * FROM Ecshop_BundlingProducts WHERE BundlingID=@BundlingID;");

            stringBuilder.Append("SELECT [BundlingID] ,a.[ProductId] ,[SkuId] ,[ProductNum], productName,");
            stringBuilder.Append(" (select saleprice FROM  Ecshop_SKUs c where c.SkuId= a.SkuId ) as ProductPrice");
            stringBuilder.Append(" FROM  Ecshop_BundlingProductItems a JOIN Ecshop_Products p ON a.ProductID = p.ProductId where BundlingID=@BundlingID AND p.SaleStatus = 1");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());

            this.database.AddInParameter(sqlStringCommand, "BundlingID", DbType.Int32, bundlingID);
            List <BundlingItemInfo> list = new List <BundlingItemInfo>();

            using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    bundlingInfo = DataMapper.PopulateBindInfo(dataReader);
                }
                dataReader.NextResult();
                while (dataReader.Read())
                {
                    BundlingItemInfo bundlingItemInfo = new BundlingItemInfo();
                    bundlingItemInfo.ProductID  = (int)dataReader["ProductID"];
                    bundlingItemInfo.ProductNum = (int)dataReader["ProductNum"];
                    if (dataReader["SkuId"] != DBNull.Value)
                    {
                        bundlingItemInfo.SkuId = (string)dataReader["SkuId"];
                    }
                    if (dataReader["ProductName"] != DBNull.Value)
                    {
                        bundlingItemInfo.ProductName = (string)dataReader["ProductName"];
                    }
                    if (dataReader["ProductPrice"] != DBNull.Value)
                    {
                        bundlingItemInfo.ProductPrice = (decimal)dataReader["ProductPrice"];
                    }
                    bundlingItemInfo.BundlingID = bundlingID;
                    list.Add(bundlingItemInfo);
                }
            }
            bundlingInfo.BundlingItemInfos = list;
            return(bundlingInfo);
        }
示例#11
0
        public static bool AddBundlingProduct(BundlingInfo bundlingInfo)
        {
            Database database = DatabaseFactory.CreateDatabase();
            bool     result;

            using (System.Data.Common.DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                System.Data.Common.DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    int num = PromotionsProvider.Instance().AddBundlingProduct(bundlingInfo, dbTransaction);
                    if (num <= 0)
                    {
                        dbTransaction.Rollback();
                        result = false;
                    }
                    else
                    {
                        if (!PromotionsProvider.Instance().AddBundlingProductItems(num, bundlingInfo.BundlingItemInfos, dbTransaction))
                        {
                            dbTransaction.Rollback();
                            result = false;
                        }
                        else
                        {
                            dbTransaction.Commit();
                            result = true;
                        }
                    }
                }
                catch (Exception)
                {
                    dbTransaction.Rollback();
                    result = false;
                }
                finally
                {
                    dbConnection.Close();
                }
            }
            return(result);
        }
示例#12
0
        public static bool UpdateBundlingProduct(BundlingInfo bundlingInfo)
        {
            bool flag;

            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    if (!PromotionsProvider.Instance().UpdateBundlingProduct(bundlingInfo, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    if (!PromotionsProvider.Instance().DeleteBundlingByID(bundlingInfo.BundlingID, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    if (!PromotionsProvider.Instance().AddBundlingProductItems(bundlingInfo.BundlingID, bundlingInfo.BundlingItemInfos, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    dbTran.Commit();
                    flag = true;
                }
                catch (Exception)
                {
                    dbTran.Rollback();
                    flag = false;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(flag);
        }
示例#13
0
        public bool UpdateBundlingProduct(BundlingInfo bind, DbTransaction dbTran)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Ecshop_BundlingProducts  SET Name=@Name,ShortDescription=@ShortDescription,Num=@Num,Price=@Price,SaleStatus=@SaleStatus,AddTime=@AddTime WHERE BundlingID=@BundlingID");

            this.database.AddInParameter(sqlStringCommand, "Name", DbType.String, bind.Name);
            this.database.AddInParameter(sqlStringCommand, "BundlingID", DbType.Int32, bind.BundlingID);
            this.database.AddInParameter(sqlStringCommand, "ShortDescription", DbType.String, bind.ShortDescription);
            this.database.AddInParameter(sqlStringCommand, "Num", DbType.Int32, bind.Num);
            this.database.AddInParameter(sqlStringCommand, "Price", DbType.Currency, bind.Price);
            this.database.AddInParameter(sqlStringCommand, "SaleStatus", DbType.Int32, bind.SaleStatus);
            this.database.AddInParameter(sqlStringCommand, "AddTime", DbType.DateTime, bind.AddTime);
            bool result;

            if (dbTran != null)
            {
                result = (this.database.ExecuteNonQuery(sqlStringCommand, dbTran) == 1);
            }
            else
            {
                result = (this.database.ExecuteNonQuery(sqlStringCommand) == 1);
            }
            return(result);
        }
示例#14
0
 public abstract bool UpdateBundlingProduct(BundlingInfo bind, System.Data.Common.DbTransaction dbTran);
示例#15
0
 public abstract bool UpdateBundlingProduct(BundlingInfo bind, DbTransaction dbTran);
示例#16
0
 public abstract int AddBundlingProduct(BundlingInfo bind, DbTransaction dbTran);
示例#17
0
 public abstract int AddBundlingProduct(BundlingInfo bind, System.Data.Common.DbTransaction dbTran);