Beispiel #1
0
        /// <summary>
        /// 提交按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            //读取用户信息
            userID = Cookies.User.GetUserID(true);
            string userName  = Cookies.User.GetUserName(false);
            string userEmail = CookiesHelper.ReadCookieValue("UserEmail");
            //添加团购记录
            int id = RequestHelper.GetQueryString <int>("ID");

            groupBuy = GroupBuyBLL.ReadGroupBuy(id);
            UserGroupBuyInfo userGroupBuy = new UserGroupBuyInfo();

            userGroupBuy.GroupBuyID = id;
            userGroupBuy.Date       = RequestHelper.DateNow;
            userGroupBuy.IP         = ClientHelper.IP;
            userGroupBuy.BuyCount   = RequestHelper.GetForm <int>("BuyCount");
            userGroupBuy.OrderID    = 0;
            userGroupBuy.UserID     = userID;
            userGroupBuy.UserName   = userName;
            userGroupBuy.Consignee  = StringHelper.AddSafe(RequestHelper.GetForm <string>("Consignee"));
            userGroupBuy.RegionID   = RegionID.ClassID;
            userGroupBuy.Address    = StringHelper.AddSafe(RequestHelper.GetForm <string>("Address"));
            userGroupBuy.ZipCode    = StringHelper.AddSafe(RequestHelper.GetForm <string>("ZipCode"));
            userGroupBuy.Tel        = StringHelper.AddSafe(RequestHelper.GetForm <string>("Tel"));
            userGroupBuy.Email      = userEmail;
            userGroupBuy.Mobile     = StringHelper.AddSafe(RequestHelper.GetForm <string>("Mobile"));
            UserGroupBuyBLL.AddUserGroupBuy(userGroupBuy);
            UserAccountRecordBLL.AddUserAccountRecord(-groupBuy.Price * userGroupBuy.BuyCount, 0, "参加团购活动:" + groupBuy.Name, userID, userName);
            ScriptHelper.Alert("购买成功!", "GroupBuyDetail.aspx?ID=" + userGroupBuy.GroupBuyID);
        }
Beispiel #2
0
        /// <summary>
        /// 提交按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            GroupBuyInfo groupBuy = new GroupBuyInfo();

            groupBuy.ID          = RequestHelper.GetQueryString <int>("ID");
            groupBuy.Name        = Name.Text;
            groupBuy.Photo       = Photo.Text;
            groupBuy.Description = Description.Value;
            groupBuy.ProductID   = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$PrdouctID");
            groupBuy.StartDate   = Convert.ToDateTime(StartDate.Text);
            groupBuy.EndDate     = Convert.ToDateTime(EndDate.Text).AddDays(1).AddSeconds(-1);
            groupBuy.Price       = Convert.ToDecimal(Price.Text);
            groupBuy.MinCount    = Convert.ToInt32(MinCount.Text);
            groupBuy.MaxCount    = Convert.ToInt32(MaxCount.Text);
            groupBuy.EachNumber  = Convert.ToInt32(EachNumber.Text);
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (groupBuy.ID == int.MinValue)
            {
                CheckAdminPower("AddGroupBuy", PowerCheckType.Single);
                int id = GroupBuyBLL.AddGroupBuy(groupBuy);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("GroupBuy"), id);
            }
            else
            {
                CheckAdminPower("UpdateGroupBuy", PowerCheckType.Single);
                GroupBuyBLL.UpdateGroupBuy(groupBuy);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("GroupBuy"), groupBuy.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            Alert(alertMessage, RequestHelper.RawUrl);
        }
Beispiel #3
0
 /// <summary>
 /// 页面加载方法
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CheckAdminPower("ReadGroupBuy", PowerCheckType.Single);
         BindControl(GroupBuyBLL.ReadGroupBuyList(CurrentPage, PageSize, ref Count), RecordList, MyPager);
     }
 }
Beispiel #4
0
        /// <summary>
        /// 删除按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            CheckAdminPower("DeleteGroupBuy", PowerCheckType.Single);
            string deleteID = RequestHelper.GetIntsForm("SelectID");

            if (deleteID != string.Empty)
            {
                GroupBuyBLL.DeleteGroupBuy(deleteID);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("GroupBuy"), deleteID);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 页面加载方法
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CheckAdminPower("ReadUserGroupBuy", PowerCheckType.Single);
         int groupBuyID = RequestHelper.GetQueryString <int>("GroupBuyID");
         groupBuy = GroupBuyBLL.ReadGroupBuy(groupBuyID);
         BindControl(UserGroupBuyBLL.ReadUserGroupBuyList(groupBuyID, CurrentPage, PageSize, ref Count), RecordList, MyPager);
         if (groupBuy.MinCount <= UserGroupBuyBLL.ReadUserGroupBuyCount(groupBuyID))
         {
             isCreateOrder = true;
         }
     }
 }
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = RequestHelper.GetQueryString <int>("ID");

            groupBuy = GroupBuyBLL.ReadGroupBuy(id);
            TimeSpan timeSpan = groupBuy.EndDate - RequestHelper.DateNow;

            leftTime         = timeSpan.Days * 24 * 3600 + timeSpan.Hours * 3600 + timeSpan.Minutes * 60 + timeSpan.Seconds;
            userGroupBuyList = UserGroupBuyBLL.ReadUserGroupBuyList(id);
            foreach (UserGroupBuyInfo userGroupBuy in userGroupBuyList)
            {
                buyCount += userGroupBuy.BuyCount;
            }
            product    = ProductBLL.ReadProduct(groupBuy.ProductID);
            Head.Title = product.Name + " - 商品团购";
        }
Beispiel #7
0
        /// <summary>
        /// 取消活动,退还用户余额
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void CancleButton_Click(object sender, EventArgs e)
        {
            int groupBuyID = RequestHelper.GetQueryString <int>("GroupBuyID");

            groupBuy = GroupBuyBLL.ReadGroupBuy(groupBuyID);
            List <UserGroupBuyInfo> userGroupBuyList = UserGroupBuyBLL.ReadUserGroupBuyList(groupBuyID);

            foreach (UserGroupBuyInfo userGroupBuy in userGroupBuyList)
            {
                if (userGroupBuy.OrderID == 0)
                {
                    UserGroupBuyBLL.UpdateUserGroupBuy(userGroupBuy.ID, -1);
                    UserAccountRecordBLL.AddUserAccountRecord(groupBuy.Price * userGroupBuy.BuyCount, 0, "退还团购活动支付余额:" + groupBuy.Name, userGroupBuy.UserID, userGroupBuy.UserName);
                }
            }
            ScriptHelper.Alert("处理成功", RequestHelper.RawUrl);
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int currentPage = RequestHelper.GetQueryString <int>("Page");

            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int pageSize = 10;
            int count    = 0;

            groupBuyList        = GroupBuyBLL.ReadGroupBuyList(currentPage, pageSize, ref count);
            MyPager.CurrentPage = currentPage;
            MyPager.PageSize    = pageSize;
            MyPager.Count       = count;

            string productIDList = string.Empty;
            string idList        = string.Empty;

            foreach (GroupBuyInfo groupBuy in groupBuyList)
            {
                if (productIDList == string.Empty)
                {
                    productIDList = groupBuy.ProductID.ToString();
                    idList        = groupBuy.ID.ToString();
                }
                else
                {
                    productIDList += "," + groupBuy.ProductID.ToString();
                    idList        += "," + groupBuy.ID.ToString();
                }
            }
            //读取商品
            if (productIDList != string.Empty)
            {
                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.InProductID = productIDList;
                productList = ProductBLL.SearchProductList(productSearch);
            }
            //读取购买人数
            if (idList != string.Empty)
            {
                dicCount = UserGroupBuyBLL.ReadUserGroupBuyCount(idList);
            }
        }
Beispiel #9
0
 /// <summary>
 /// 页面加载方法
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         int id = RequestHelper.GetQueryString <int>("ID");
         userID = Cookies.User.GetUserID(true);
         decimal moneyLeft = UserBLL.ReadUserMore(userID).MoneyLeft;
         if (userID == 0)
         {
             ScriptHelper.Alert("请先登录", "/User/Login.aspx?RedirectUrl=/Plugins/Activity/GroupBuy/GroupBuyAdd.aspx?ID=" + id.ToString());
         }
         groupBuy = GroupBuyBLL.ReadGroupBuy(id);
         if (moneyLeft < groupBuy.Price)
         {
             ScriptHelper.Alert("您账户余额不够该团购活动商品价格,请先充值", "/User/UserRecharge.aspx");
         }
         if (UserGroupBuyBLL.ReadUserGroupBuyByUser(id, userID).ID > 0)
         {
             ScriptHelper.Alert("您已经参加该活动了,请不要重复参加");
         }
         if (groupBuy.StartDate > DateTime.Now)
         {
             ScriptHelper.Alert("该团购活动未开始,不能购买");
         }
         if (groupBuy.EndDate < DateTime.Now)
         {
             ScriptHelper.Alert("该团购活动已经结束,不能购买");
         }
         buyCount            = UserGroupBuyBLL.ReadUserGroupBuyCount(id);
         product             = ProductBLL.ReadProduct(groupBuy.ProductID);
         RegionID.DataSource = RegionBLL.ReadRegionUnlimitClass();
         UserInfo user = UserBLL.ReadUser(userID);
         Consignee.Text   = user.UserName;
         Tel.Text         = user.Tel;
         Mobile.Text      = user.Mobile;
         Address.Text     = user.Address;
         RegionID.ClassID = user.RegionID;
         Head.Title       = "确认商品团购";
     }
 }
Beispiel #10
0
 /// <summary>
 /// 页面加载方法
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         int groupBuyID = RequestHelper.GetQueryString <int>("ID");
         if (groupBuyID != 0)
         {
             CheckAdminPower("ReadGroupBuy", PowerCheckType.Single);
             GroupBuyInfo groupBuy = GroupBuyBLL.ReadGroupBuy(groupBuyID);
             Name.Text         = groupBuy.Name;
             Photo.Text        = groupBuy.Photo;
             Description.Value = groupBuy.Description;
             PrdouctID.Items.Add(new ListItem(ProductBLL.ReadProduct(groupBuy.ProductID).Name, groupBuy.ProductID.ToString()));
             StartDate.Text  = groupBuy.StartDate.ToString("yyyy-MM-dd");
             EndDate.Text    = groupBuy.EndDate.ToString("yyyy-MM-dd");
             Price.Text      = groupBuy.Price.ToString();
             MinCount.Text   = groupBuy.MinCount.ToString();
             MaxCount.Text   = groupBuy.MaxCount.ToString();
             EachNumber.Text = groupBuy.EachNumber.ToString();
         }
     }
 }
Beispiel #11
0
        /// <summary>
        /// 全部生成订单按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void CreateOrderButton_Click(object sender, EventArgs e)
        {
            int groupBuyID = RequestHelper.GetQueryString <int>("GroupBuyID");

            groupBuy = GroupBuyBLL.ReadGroupBuy(groupBuyID);
            ProductInfo             product          = ProductBLL.ReadProduct(groupBuy.ProductID);
            List <UserGroupBuyInfo> userGroupBuyList = UserGroupBuyBLL.ReadUserGroupBuyList(groupBuyID);

            foreach (UserGroupBuyInfo userGroupBuy in userGroupBuyList)
            {
                if (userGroupBuy.OrderID == 0)
                {
                    decimal totalPrice = groupBuy.Price * userGroupBuy.BuyCount;
                    //添加订单
                    OrderInfo order = new OrderInfo();
                    order.OrderNumber         = ShopCommon.CreateOrderNumber();
                    order.IsActivity          = (int)BoolType.True;
                    order.OrderStatus         = (int)OrderStatus.WaitCheck;
                    order.OrderNote           = "团购活动:" + groupBuy.Name;
                    order.ProductMoney        = totalPrice;
                    order.Balance             = totalPrice;
                    order.FavorableMoney      = 0;
                    order.OtherMoney          = 0;
                    order.CouponMoney         = 0;
                    order.Consignee           = userGroupBuy.Consignee;
                    order.RegionID            = userGroupBuy.RegionID;
                    order.Address             = userGroupBuy.Address;
                    order.ZipCode             = userGroupBuy.ZipCode;
                    order.Tel                 = userGroupBuy.Tel;
                    order.Email               = userGroupBuy.Email;
                    order.Mobile              = userGroupBuy.Mobile;
                    order.ShippingID          = 0;
                    order.ShippingDate        = RequestHelper.DateNow;
                    order.ShippingNumber      = string.Empty;
                    order.ShippingMoney       = 0;
                    order.PayKey              = string.Empty;
                    order.PayName             = string.Empty;
                    order.PayDate             = userGroupBuy.Date;;
                    order.IsRefund            = (int)BoolType.False;
                    order.FavorableActivityID = 0;
                    order.GiftID              = 0;
                    order.InvoiceTitle        = string.Empty;
                    order.InvoiceContent      = string.Empty;
                    order.UserMessage         = string.Empty;
                    order.AddDate             = RequestHelper.DateNow;
                    order.IP       = userGroupBuy.IP;
                    order.UserID   = userGroupBuy.UserID;
                    order.UserName = userGroupBuy.UserName;
                    int orderID = OrderBLL.AddOrder(order);
                    //添加订单详细
                    OrderDetailInfo orderDetail = new OrderDetailInfo();
                    orderDetail.OrderID       = orderID;
                    orderDetail.ProductID     = product.ID;
                    orderDetail.ProductName   = product.Name;
                    orderDetail.ProductWeight = product.Weight;
                    orderDetail.SendPoint     = 0;
                    orderDetail.ProductPrice  = groupBuy.Price;
                    orderDetail.BuyCount      = userGroupBuy.BuyCount;
                    orderDetail.FatherID      = 0;
                    orderDetail.RandNumber    = string.Empty;
                    orderDetail.GiftPackID    = 0;
                    OrderDetailBLL.AddOrderDetail(orderDetail);
                    //更新订单 ID
                    UserGroupBuyBLL.UpdateUserGroupBuy(userGroupBuy.ID, orderID);
                    //更改产品库存订单数量
                    ProductBLL.ChangeProductOrderCountByOrder(orderID, ChangeAction.Plus);
                }
            }
            ScriptHelper.Alert("处理成功", RequestHelper.RawUrl);
        }