private void lkbtnDeleteCheck_Click(object sender, EventArgs e) { int?nullable = null; foreach (GridViewRow row in this.grdGroupBuyList.Rows) { CheckBox box = (CheckBox)row.FindControl("checkboxCol"); if (box.Checked) { nullable = new int?(nullable.GetValueOrDefault()); int groupBuyId = Convert.ToInt32(this.grdGroupBuyList.DataKeys[row.RowIndex].Value, CultureInfo.InvariantCulture); GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(groupBuyId); if ((groupBuy.Status != GroupBuyStatus.UnderWay) && (groupBuy.Status != GroupBuyStatus.EndUntreated)) { nullable = new int?(nullable.GetValueOrDefault() + 1); PromoteHelper.DeleteGroupBuy(groupBuyId); } } } if (nullable.HasValue) { this.BindGroupBuy(); this.ShowMsg(string.Format("成功删除{0}条团购活动", nullable), true); } else { this.ShowMsg("请先选择需要删除的团购活动", false); } }
private void lkbtnDeleteCheck_Click(object sender, System.EventArgs e) { int?num = null; foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdGroupBuyList.Rows) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol"); if (checkBox.Checked) { num = new int?(num.GetValueOrDefault()); int groupBuyId = System.Convert.ToInt32(this.grdGroupBuyList.DataKeys[gridViewRow.RowIndex].Value, System.Globalization.CultureInfo.InvariantCulture); GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(groupBuyId); if (groupBuy.Status != GroupBuyStatus.UnderWay && groupBuy.Status != GroupBuyStatus.EndUntreated) { num = new int?(num.GetValueOrDefault() + 1); PromoteHelper.DeleteGroupBuy(groupBuyId); } } } if (num.HasValue) { this.BindGroupBuy(); this.ShowMsg(string.Format("成功删除{0}条团购活动", num), true); return; } this.ShowMsg("请先选择需要删除的团购活动", false); }
protected override void Render(HtmlTextWriter writer) { if (string.IsNullOrEmpty(base.Text)) { base.Text = "我要咨询"; } int num = RouteConfig.GetParameter(this.Page, "countDownId", false).ToInt(0); int num2 = RouteConfig.GetParameter(this.Page, "groupBuyId", false).ToInt(0); int num3 = RouteConfig.GetParameter(this.Page, "PreSaleId", false).ToInt(0); if (num > 0) { CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num, 0); if (countDownInfo != null) { base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new { countDownInfo.ProductId }); } } else if (num2 > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num2); if (groupBuy != null) { base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new { groupBuy.ProductId }); } } else if (num3 > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(num3); if (productPreSaleInfo != null) { base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new { productPreSaleInfo.ProductId }); } } else { base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new { ProductId = RouteConfig.GetParameter(this.Page, "productId", false) }); } base.Render(writer); }
private void BindProduct() { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(this.groupBuyId); this.productId = ((this.productId == 0) ? groupBuy.ProductId : this.productId); IList <int> list = null; Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >); ProductInfo productDetails = ProductHelper.GetProductDetails(this.productId, out dictionary, out list); if (productDetails != null) { this.ltProductName.Text = productDetails.ProductName; this.lblPrice.Text = productDetails.MinSalePrice.F2ToString("f2"); } }
private void grdGroupBuyList_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy((int)this.grdGroupBuyList.DataKeys[e.RowIndex].Value); if (groupBuy.Status == GroupBuyStatus.UnderWay || groupBuy.Status == GroupBuyStatus.EndUntreated) { this.ShowMsg("团购活动正在进行中或结束未处理,不允许删除", false); return; } if (PromoteHelper.DeleteGroupBuy((int)this.grdGroupBuyList.DataKeys[e.RowIndex].Value)) { this.BindGroupBuy(); this.ShowMsg("成功删除了选择的团购活动", true); return; } this.ShowMsg("删除失败", false); }
private void grdGroupBuyList_RowDeleting(object sender, GridViewDeleteEventArgs e) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy((int)grdGroupBuyList.DataKeys[e.RowIndex].Value); if ((groupBuy.Status == GroupBuyStatus.UnderWay) || (groupBuy.Status == GroupBuyStatus.EndUntreated)) { ShowMsg("团购活动正在进行中或结束未处理,不允许删除", false); } else if (PromoteHelper.DeleteGroupBuy((int)grdGroupBuyList.DataKeys[e.RowIndex].Value)) { BindGroupBuy(); ShowMsg("成功删除了选择的团购活动", true); } else { ShowMsg("删除失败", false); } }
protected override void Render(HtmlTextWriter writer) { int num = 0; if (!int.TryParse(this.Page.Request.QueryString["productId"].ToNullString(), out num)) { int num2 = 0; int.TryParse(this.Page.Request.QueryString["countDownId"].ToNullString(), out num2); if (num2 > 0) { CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num2, 0); if (countDownInfo != null) { num = countDownInfo.ProductId; } } if (num <= 0) { int num3 = 0; int.TryParse(this.Page.Request.QueryString["groupBuyId"].ToNullString(), out num3); if (num3 > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num3); if (groupBuy != null) { num = groupBuy.ProductId; } } } } if (num > 0) { base.NavigateUrl = base.GetRouteUrl("ProductImages", new { ProductId = num }); } else { this.Visible = false; } base.Render(writer); }
protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(base.Request.QueryString["groupBuyId"], out groupBuyId)) { base.GotoResourceNotFound(); } else { btnUpdateGroupBuy.Click += new EventHandler(btnUpdateGroupBuy_Click); btnFail.Click += new EventHandler(btnFail_Click); btnSuccess.Click += new EventHandler(btnSuccess_Click); btnFinish.Click += new EventHandler(btnFinish_Click); if (!base.IsPostBack) { dropGroupBuyProduct.DataBind(); dropCategories.DataBind(); GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(groupBuyId); if (PromoteHelper.GetOrderCount(groupBuyId) > 0) { dropGroupBuyProduct.Enabled = false; } if (groupBuy == null) { base.GotoResourceNotFound(); } else { if (groupBuy.Status == GroupBuyStatus.EndUntreated) { btnFail.Visible = true; btnSuccess.Visible = true; } if (groupBuy.Status == GroupBuyStatus.UnderWay) { btnFinish.Visible = true; } LoadGroupBuy(groupBuy); } } } }
public void Delete(HttpContext context) { string text = context.Request["GroupBuyIds"]; if (string.IsNullOrWhiteSpace(text)) { throw new HidistroAshxException("错误的活动编号"); } int[] array = (from d in text.Split(',') select int.Parse(d)).ToArray(); int num = 0; int num2 = array.Count(); int[] array2 = array; foreach (int groupBuyId in array2) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(groupBuyId); if ((groupBuy.Status == GroupBuyStatus.UnderWay && groupBuy.StartDate <= DateTime.Now && groupBuy.EndDate >= DateTime.Now) || groupBuy.Status == GroupBuyStatus.EndUntreated) { if (num2 == 1) { throw new HidistroAshxException("团购活动正在进行中或结束未处理,不允许删除!"); } } else { num++; PromoteHelper.DeleteGroupBuy(groupBuyId); } } if (num > 0) { base.ReturnSuccessResult(context, $"成功删除{num}条团购活动!", 0, true); return; } throw new HidistroAshxException("选择的团购活动暂不可删除!"); }
private void btnUpdateGroupBuy_Click(object sender, EventArgs e) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(this.groupBuyId); string text = string.Empty; if (this.productId > 0) { if (groupBuy.ProductId != this.productId && PromoteHelper.ProductGroupBuyExist(this.productId)) { this.ShowMsg("已经存在此商品的团购活动,并且活动正在进行中", false); return; } groupBuy.ProductId = this.productId; } else { text += Formatter.FormatErrorMessage("请选择团购商品"); } if (!this.calendarStartDate.SelectedDate.HasValue) { text += Formatter.FormatErrorMessage("请选择开始日期"); } else { groupBuy.StartDate = this.calendarStartDate.SelectedDate.Value; } if (!this.calendarEndDate.SelectedDate.HasValue) { text += Formatter.FormatErrorMessage("请选择结束日期"); } else { groupBuy.EndDate = this.calendarEndDate.SelectedDate.Value; if (groupBuy.StartDate >= groupBuy.EndDate) { text += Formatter.FormatErrorMessage("开始日期必须要早于结束日期"); } } if (!string.IsNullOrEmpty(this.txtNeedPrice.Text)) { decimal needPrice = default(decimal); if (decimal.TryParse(this.txtNeedPrice.Text.Trim(), out needPrice)) { groupBuy.NeedPrice = needPrice; } else { text += Formatter.FormatErrorMessage("违约金填写格式不正确"); } } int maxCount = default(int); if (int.TryParse(this.txtMaxCount.Text.Trim(), out maxCount)) { groupBuy.MaxCount = maxCount; } else { text += Formatter.FormatErrorMessage("限购数量不能为空,只能为整数"); } groupBuy.Content = this.txtContent.Text; int count = default(int); if (int.TryParse(this.txtCount.Text.Trim(), out count)) { groupBuy.Count = count; } else { text += Formatter.FormatErrorMessage("团购满足数量不能为空,只能为整数"); } decimal price = default(decimal); if (decimal.TryParse(this.txtPrice.Text.Trim(), out price)) { groupBuy.Price = price; } else { text += Formatter.FormatErrorMessage("团购价格不能为空,只能为数值类型"); } if (groupBuy.MaxCount < groupBuy.Count) { text += Formatter.FormatErrorMessage("限购数量必须大于等于满足数量 "); } if (!string.IsNullOrEmpty(text)) { this.ShowMsg(text, false); } else if (PromoteHelper.UpdateGroupBuy(groupBuy)) { this.ShowMsg("编辑团购活动成功", true, "GroupBuys.aspx"); } else { this.ShowMsg("编辑团购活动失败", true); } }
protected void dlstOrders_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString()); if (orderInfo != null) { if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId); if (countDownBuy == null || countDownBuy.EndDate < System.DateTime.Now) { this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false); return; } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy != null) { if (groupBuy.Status == GroupBuyStatus.UnderWay) { num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); num = groupBuy.MaxCount; num3 = orderInfo.GetGroupBuyOerderNumber(); if (num < num2 + num3) { this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } goto IL_E2; } } this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } IL_E2: if (OrderHelper.ConfirmPay(orderInfo)) { DebitNote debitNote = new DebitNote(); debitNote.NoteId = Globals.GetGenerateId(); debitNote.OrderId = e.CommandArgument.ToString(); debitNote.Operator = Hidistro.Membership.Context.HiContext.Current.User.Username; debitNote.Remark = "后台" + debitNote.Operator + "收款成功"; OrderHelper.SaveDebitNote(debitNote); if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } this.BindOrders(); int num4 = orderInfo.UserId; if (num4 == 1100) { num4 = 0; } Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num4); Messenger.OrderPayment(user, orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "sucess", string.Format("<script language=\"javascript\" >alert('确认收款成功');window.location.href=\"{0}\"</script>", System.Web.HttpContext.Current.Request.RawUrl)); return; } this.ShowMsg("确认订单收款失败", false); return; } else { if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { if (OrderHelper.ConfirmOrderFinish(orderInfo)) { this.BindOrders(); this.ShowMsg("成功的完成了该订单", true); return; } this.ShowMsg("完成订单失败", false); return; } else { if (e.CommandName == "Match_Order") { if (orderInfo == null) { return; } if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); return; } if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); return; } if (Methods.Supplier_OrderIsFenPei(e.CommandArgument.ToString())) { this.ShowMsg("生成成功", true); return; } string text = Methods.Supplier_OrderItemSupplierUpdate(orderInfo); if (text != "true") { this.ShowMsg(text, false); return; } orderInfo.RealShippingModeId = 0; orderInfo.RealModeName = "配送方式(已实际发货单为准)"; orderInfo.ShipOrderNumber = string.Format("{0}", string.Format(" <a style=\"color:red;cursor:pointer;\" target=\"_blank\" onclick=\"{0}\">物流详细</a>", "showWindow_ShipInfoPage('" + orderInfo.OrderId + "')")); if (OrderHelper.SendGoods(orderInfo)) { Methods.Supplier_OrderItemsSupplierFenPeiOverUpdate(orderInfo.OrderId); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } int num5 = orderInfo.UserId; if (num5 == 1100) { num5 = 0; } Hidistro.Membership.Core.IUser user2 = Hidistro.Membership.Context.Users.GetUser(num5); Messenger.OrderShipping(orderInfo, user2); orderInfo.OnDeliver(); this.ShowMsg("生成成功", true); this.BindOrders(); return; } this.ShowMsg("发货失败", false); this.ShowMsg("生成成功", true); } } } } }
private void btnUpdateGroupBuy_Click(object sender, System.EventArgs e) { GroupBuyInfo groupBuyInfo = new GroupBuyInfo(); groupBuyInfo.GroupBuyId = this.groupBuyId; string text = string.Empty; if (this.dropGroupBuyProduct.SelectedValue > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(this.groupBuyId); if (groupBuy.ProductId != this.dropGroupBuyProduct.SelectedValue.Value && PromoteHelper.ProductGroupBuyExist(this.dropGroupBuyProduct.SelectedValue.Value)) { this.ShowMsg("已经存在此商品的团购活动,并且活动正在进行中", false); return; } groupBuyInfo.ProductId = this.dropGroupBuyProduct.SelectedValue.Value; } else { text += Formatter.FormatErrorMessage("请选择团购商品"); } if (!this.calendarStartDate.SelectedDate.HasValue) { text += Formatter.FormatErrorMessage("请选择开始日期"); } if (!this.calendarEndDate.SelectedDate.HasValue) { text += Formatter.FormatErrorMessage("请选择结束日期"); } else { groupBuyInfo.EndDate = this.calendarEndDate.SelectedDate.Value.AddHours((double)this.HourDropDownList1.SelectedValue.Value); if (System.DateTime.Compare(groupBuyInfo.EndDate, System.DateTime.Now) <= 0 && groupBuyInfo.Status == GroupBuyStatus.UnderWay) { text += Formatter.FormatErrorMessage("结束日期必须要晚于今天日期"); } else { if (System.DateTime.Compare(this.calendarStartDate.SelectedDate.Value.AddHours((double)this.drophours.SelectedValue.Value), groupBuyInfo.EndDate) >= 0) { text += Formatter.FormatErrorMessage("开始日期必须要早于结束日期"); } else { groupBuyInfo.StartDate = this.calendarStartDate.SelectedDate.Value.AddHours((double)this.drophours.SelectedValue.Value); } } } if (!string.IsNullOrEmpty(this.txtNeedPrice.Text)) { decimal needPrice; if (decimal.TryParse(this.txtNeedPrice.Text.Trim(), out needPrice)) { groupBuyInfo.NeedPrice = needPrice; } else { text += Formatter.FormatErrorMessage("违约金填写格式不正确"); } } int maxCount; if (int.TryParse(this.txtMaxCount.Text.Trim(), out maxCount)) { groupBuyInfo.MaxCount = maxCount; } else { text += Formatter.FormatErrorMessage("限购数量不能为空,只能为整数"); } groupBuyInfo.Content = this.txtContent.Text; GropBuyConditionInfo gropBuyConditionInfo = new GropBuyConditionInfo(); int count; if (int.TryParse(this.txtCount.Text.Trim(), out count)) { gropBuyConditionInfo.Count = count; } else { text += Formatter.FormatErrorMessage("团购满足数量不能为空,只能为整数"); } decimal price; if (decimal.TryParse(this.txtPrice.Text.Trim(), out price)) { gropBuyConditionInfo.Price = price; } else { text += Formatter.FormatErrorMessage("团购价格不能为空,只能为数值类型"); } groupBuyInfo.GroupBuyConditions.Add(gropBuyConditionInfo); if (groupBuyInfo.MaxCount < groupBuyInfo.GroupBuyConditions[0].Count) { text += Formatter.FormatErrorMessage("限购数量必须大于等于满足数量 "); } if (!string.IsNullOrEmpty(text)) { this.ShowMsg(text, false); return; } if (PromoteHelper.UpdateGroupBuy(groupBuyInfo)) { this.ShowMsg("编辑团购活动成功", true); return; } this.ShowMsg("编辑团购活动失败", true); }
private void ConfirmPayOrder(HttpContext context) { SiteSettings currentSiteSetting = base.CurrentSiteSetting; string text = context.Request.Form["orderId"]; if (string.IsNullOrWhiteSpace(text)) { throw new HidistroAshxException("异常的参数:订单编号"); } OrderInfo orderInfo = OrderHelper.GetOrderInfo(text); if (orderInfo == null) { throw new HidistroAshxException("异常的参数:订单编号"); } if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { return; } PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest"); if (paymentMode != null) { orderInfo.Gateway = paymentMode.Gateway; orderInfo.PaymentType = paymentMode.Name; orderInfo.PaymentTypeId = paymentMode.ModeId; } else { orderInfo.Gateway = "hishop.plugins.payment.bankrequest"; orderInfo.PaymentType = "线下支付"; orderInfo.PaymentTypeId = 0; } orderInfo.IsStoreCollect = true; int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { string empty = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems) { CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId); if (countDownInfo == null) { throw new HidistroAshxException(empty); } } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付"); } num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); num = groupBuy.MaxCount; num3 = orderInfo.GetGroupBuyOerderNumber(); if (num < num2 + num3) { throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付"); } } if (orderInfo.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo == null) { throw new HidistroAshxException("预售活动不存在"); } if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now) { throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款"); } } if (OrderHelper.ConfirmPay(orderInfo)) { if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } if (orderInfo.ParentOrderId == "-1") { OrderQuery orderQuery = new OrderQuery(); orderQuery.ParentOrderId = orderInfo.OrderId; IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery); foreach (OrderInfo item in listUserOrder) { OrderHelper.OrderConfirmPaySendMessage(item); } } else { OrderHelper.OrderConfirmPaySendMessage(orderInfo); } base.ReturnResult(context, true, "成功的确认了订单收款", 0, true); return; } throw new HidistroAshxException("确认订单收款失败"); }
private void ShowCoupons(HttpContext context) { int num = context.Request["ProductId"].ToInt(0); bool flag = context.Request["IsGroup"].ToBool(); bool flag2 = context.Request["IsPanicBuying"].ToBool(); bool useWithFireGroup = context.Request["IsFireGroup"].ToBool(); StringBuilder stringBuilder = new StringBuilder(); if (flag) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num); num = (groupBuy?.ProductId ?? 0); } if (flag2) { CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num, 0); num = (countDownInfo?.ProductId ?? 0); } DataTable couponList = CouponHelper.GetCouponList(num, HiContext.Current.UserId, flag, flag2, useWithFireGroup); if (couponList.Rows.Count > 0) { foreach (DataRow row in couponList.Rows) { decimal num2 = row["Price"].ToDecimal(0); string text = ""; text = ((!(num2 <= 5m)) ? ((!(num2 <= 50m)) ? "Tag3" : "Tag2") : "Tag1"); try { StringBuilder stringBuilder2 = stringBuilder; object[] obj = new object[6] { text, row["CouponId"].ToNullString(), num2.F2ToString("f2"), string.IsNullOrEmpty(row["CanUseProducts"].ToNullString().Trim()) ? "通用" : "部分", (row["OrderUseLimit"].ToDecimal(0) == decimal.Zero) ? "无限制" : ("满" + row["OrderUseLimit"].ToDecimal(0).F2ToString("f2") + "元使用"), null }; object str; DateTime value; if (!row["StartTime"].ToDateTime().HasValue) { str = ""; } else { value = row["StartTime"].ToDateTime().Value; str = value.ToString("yyyy.MM.dd"); } object str2; if (!row["ClosingTime"].ToDateTime().HasValue) { str2 = ""; } else { value = row["ClosingTime"].ToDateTime().Value; str2 = value.ToString("yyyy.MM.dd"); } obj[5] = (string)str + "至" + (string)str2; stringBuilder2.AppendFormat("{{ \"LiId\": \"{0}\", \"CId\": \"{1}\", \"Price\": \"{2}\", \"CanUseProducts\": \"{3}\", \"OrderUseLimit\": \"{4}\", \"SCTime\": \"{5}\"}},", obj); } catch (Exception ex) { string message = ex.Message; } } } context.Response.Write("{\"TotalRecords\":\"" + couponList.Rows.Count + "\",\"Data\":[" + stringBuilder.ToString().TrimEnd(',') + "]}"); context.Response.End(); }
protected void dlstOrders_ItemCommand(object sender, DataListCommandEventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString()); if (orderInfo != null) { if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { int maxCount = 0; int orderCount = 0; int groupBuyOerderNumber = 0; if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId); if ((countDownBuy == null) || (countDownBuy.EndDate < DateTime.Now)) { this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false); return; } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if ((groupBuy == null) || (groupBuy.Status != GroupBuyStatus.UnderWay)) { this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } orderCount = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); maxCount = groupBuy.MaxCount; groupBuyOerderNumber = orderInfo.GetGroupBuyOerderNumber(); if (maxCount < (orderCount + groupBuyOerderNumber)) { this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } } if (OrderHelper.ConfirmPay(orderInfo)) { DebitNote note = new DebitNote(); note.NoteId = Globals.GetGenerateId(); note.OrderId = e.CommandArgument.ToString(); note.Operator = HiContext.Current.User.Username; note.Remark = "后台" + note.Operator + "收款成功"; OrderHelper.SaveDebitNote(note); if ((orderInfo.GroupBuyId > 0) && (maxCount == (orderCount + groupBuyOerderNumber))) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } this.BindOrders(); int userId = orderInfo.UserId; if (userId == 0x44c) { userId = 0; } Messenger.OrderPayment(Users.GetUser(userId), orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); this.ShowMsg("成功的确认了订单收款", true); } else { this.ShowMsg("确认订单收款失败", false); } } else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { if (OrderHelper.ConfirmOrderFinish(orderInfo)) { this.BindOrders(); this.ShowMsg("成功的完成了该订单", true); } else { this.ShowMsg("完成订单失败", false); } } } }
private void btnUpdateGroupBuy_Click(object sender, EventArgs e) { int num2; int num3; decimal num4; GroupBuyInfo groupBuy = new GroupBuyInfo { GroupBuyId = this.groupBuyId }; string str = string.Empty; if (this.dropGroupBuyProduct.SelectedValue > 0) { if ((PromoteHelper.GetGroupBuy(this.groupBuyId).ProductId != this.dropGroupBuyProduct.SelectedValue.Value) && PromoteHelper.ProductGroupBuyExist(this.dropGroupBuyProduct.SelectedValue.Value)) { this.ShowMsg("已经存在此商品的团购活动,并且活动正在进行中", false); return; } groupBuy.ProductId = this.dropGroupBuyProduct.SelectedValue.Value; } else { str = str + Formatter.FormatErrorMessage("请选择团购商品"); } if (!this.calendarStartDate.SelectedDate.HasValue) { str = str + Formatter.FormatErrorMessage("请选择开始日期"); } if (!this.calendarEndDate.SelectedDate.HasValue) { str = str + Formatter.FormatErrorMessage("请选择结束日期"); } else { groupBuy.EndDate = this.calendarEndDate.SelectedDate.Value.AddHours((double)this.HourDropDownList1.SelectedValue.Value); if ((DateTime.Compare(groupBuy.EndDate, DateTime.Now) <= 0) && (groupBuy.Status == GroupBuyStatus.UnderWay)) { str = str + Formatter.FormatErrorMessage("结束日期必须要晚于今天日期"); } else if (DateTime.Compare(this.calendarStartDate.SelectedDate.Value.AddHours((double)this.drophours.SelectedValue.Value), groupBuy.EndDate) >= 0) { str = str + Formatter.FormatErrorMessage("开始日期必须要早于结束日期"); } else { groupBuy.StartDate = this.calendarStartDate.SelectedDate.Value.AddHours((double)this.drophours.SelectedValue.Value); } } if (!string.IsNullOrEmpty(this.txtNeedPrice.Text)) { decimal num; if (decimal.TryParse(this.txtNeedPrice.Text.Trim(), out num)) { groupBuy.NeedPrice = num; } else { str = str + Formatter.FormatErrorMessage("违约金填写格式不正确"); } } if (int.TryParse(this.txtMaxCount.Text.Trim(), out num2)) { groupBuy.MaxCount = num2; } else { str = str + Formatter.FormatErrorMessage("限购数量不能为空,只能为整数"); } groupBuy.Content = this.txtContent.Text; GropBuyConditionInfo item = new GropBuyConditionInfo(); if (int.TryParse(this.txtCount.Text.Trim(), out num3)) { item.Count = num3; } else { str = str + Formatter.FormatErrorMessage("团购满足数量不能为空,只能为整数"); } if (decimal.TryParse(this.txtPrice.Text.Trim(), out num4)) { item.Price = num4; } else { str = str + Formatter.FormatErrorMessage("团购价格不能为空,只能为数值类型"); } groupBuy.GroupBuyConditions.Add(item); if (groupBuy.MaxCount < groupBuy.GroupBuyConditions[0].Count) { str = str + Formatter.FormatErrorMessage("限购数量必须大于等于满足数量 "); } if (!string.IsNullOrEmpty(str)) { this.ShowMsg(str, false); } else if (PromoteHelper.UpdateGroupBuy(groupBuy)) { this.ShowMsg("编辑团购活动成功", true); } else { this.ShowMsg("编辑团购活动失败", true); } }
private void btnUpdateGroupBuy_Click(object sender, EventArgs e) { int num; int num2; decimal num3; GroupBuyInfo info3 = new GroupBuyInfo(); info3.GroupBuyId = groupBuyId; GroupBuyInfo groupBuy = info3; string str = string.Empty; if (dropGroupBuyProduct.SelectedValue > 0) { if ((PromoteHelper.GetGroupBuy(groupBuyId).ProductId != dropGroupBuyProduct.SelectedValue.Value) && PromoteHelper.ProductGroupBuyExist(dropGroupBuyProduct.SelectedValue.Value)) { ShowMsg("已经存在此商品的团购活动,并且活动正在进行中", false); return; } groupBuy.ProductId = dropGroupBuyProduct.SelectedValue.Value; } else { str = str + Formatter.FormatErrorMessage("请选择团购商品"); } if (!calendarEndDate.SelectedDate.HasValue) { str = str + Formatter.FormatErrorMessage("请选择结束日期"); } else { groupBuy.EndDate = calendarEndDate.SelectedDate.Value; } if (!string.IsNullOrEmpty(txtNeedPrice.Text)) { decimal num4; if (decimal.TryParse(txtNeedPrice.Text.Trim(), out num4)) { groupBuy.NeedPrice = num4; } else { str = str + Formatter.FormatErrorMessage("违约金填写格式不正确"); } } if (int.TryParse(txtMaxCount.Text.Trim(), out num)) { groupBuy.MaxCount = num; } else { str = str + Formatter.FormatErrorMessage("限购数量不能为空,只能为整数"); } groupBuy.Content = txtContent.Text; GropBuyConditionInfo item = new GropBuyConditionInfo(); if (int.TryParse(txtCount.Text.Trim(), out num2)) { item.Count = num2; } else { str = str + Formatter.FormatErrorMessage("团购满足数量不能为空,只能为整数"); } if (decimal.TryParse(txtPrice.Text.Trim(), out num3)) { item.Price = num3; } else { str = str + Formatter.FormatErrorMessage("团购价格不能为空,只能为数值类型"); } groupBuy.GroupBuyConditions.Add(item); if (groupBuy.MaxCount < groupBuy.GroupBuyConditions[0].Count) { str = str + Formatter.FormatErrorMessage("限购数量必须大于等于满足数量 "); } if (!string.IsNullOrEmpty(str)) { ShowMsg(str, false); } else if (PromoteHelper.UpdateGroupBuy(groupBuy)) { ShowMsg("编辑团购活动成功", true); } else { ShowMsg("编辑团购活动失败", true); } }
protected override void AttachChildControls() { if (!int.TryParse(base.GetParameter("groupBuyId", false), out this.groupBuyId)) { base.GotoResourceNotFound(); } this.ltlConsultation = (Literal)this.FindControl("ltlConsultation"); this.ltlSaleCount = (Literal)this.FindControl("ltlSaleCount"); this.common_Location = (Common_Location)this.FindControl("common_Location"); this.litProductName = (Literal)this.FindControl("litProductName"); this.lblSku = (SkuLabel)this.FindControl("lblSku"); this.lblStock = (StockLabel)this.FindControl("lblStock"); this.litUnit = (Literal)this.FindControl("litUnit"); this.litWeight = (Label)this.FindControl("litWeight"); this.litBrosedNum = (Literal)this.FindControl("litBrosedNum"); this.litBrand = (Literal)this.FindControl("litBrand"); this.litContent = (Literal)this.FindControl("litContent"); this.lblSalePrice = (FormatedMoneyLabel)this.FindControl("lblSalePrice"); this.lblTotalPrice = (TotalLabel)this.FindControl("lblTotalPrice"); this.litDescription = (Literal)this.FindControl("litDescription"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.btnOrder = (BuyButton)this.FindControl("btnOrder"); this.ltlReviewCount = (Literal)this.FindControl("ltlReviewCount"); this.txtMaxCount = (HtmlInputHidden)this.FindControl("txtMaxCount"); this.txtSoldCount = (HtmlInputHidden)this.FindControl("txtSoldCount"); this.hidden_IsOver = (HtmlInputHidden)this.FindControl("hidden_IsOver"); this.hidden_GroupBuyId = (HtmlInputHidden)this.FindControl("hidden_GroupBuyId"); this.hidden_productId = (HtmlInputHidden)this.FindControl("hidden_productId"); this.lblCurrentSalePrice = (FormatedMoneyLabel)this.FindControl("lblCurrentSalePrice"); this.litCount = (Label)this.FindControl("litCount"); this.lblNeedPrice = (FormatedMoneyLabel)this.FindControl("lblNeedPrice"); this.lblEndTime = (FormatedTimeLabel)this.FindControl("lblEndTime"); this.lblStartTime = (FormatedTimeLabel)this.FindControl("lblStartTime"); this.litRemainTime = (Literal)this.FindControl("litRemainTime"); this.litNeedCount = (Literal)this.FindControl("litNeedCount"); this.litMaxCount = (Label)this.FindControl("litMaxCount"); this.images = (Common_ProductImages)this.FindControl("common_ProductImages"); this.rptExpandAttributes = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes"); this.skuSelector = (SKUSelector)this.FindControl("SKUSelector"); this.consultations = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations"); this.correlative = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative"); this.nowTime = (HtmlInputHidden)this.FindControl("nowTime"); this.nowTime.SetWhenIsNotNull(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo)); this.hidden_skus = (HtmlInputHidden)this.FindControl("hidden_skus"); this.hidden_skuItem = (HtmlInputHidden)this.FindControl("hidden_skuItem"); if (!this.Page.IsPostBack) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(this.groupBuyId); if (groupBuy == null) { base.GotoResourceNotFound(); } HtmlInputHidden htmlInputHidden = this.hidden_GroupBuyId; int num = groupBuy.GroupBuyId; htmlInputHidden.Value = num.ToString(); ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(groupBuy.ProductId, null, masterSettings.OpenMultStore, 0); Literal literal = this.ltlSaleCount; num = productBrowseInfo.SaleCount; literal.Text = num.ToString(); if (productBrowseInfo.Product == null) { this.hidden_IsOver.Value = "pullOff"; } else if (!productBrowseInfo.Product.SaleStatus.Equals(ProductSaleStatus.OnSale)) { this.hidden_IsOver.Value = "pullOff"; } if (productBrowseInfo.Product == null || groupBuy == null) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该件商品参与的团购活动已经结束;或已被管理员删除")); } else { if (groupBuy != null) { if (groupBuy.Status != GroupBuyStatus.UnderWay) { this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该团购活动已经结束")); return; } HtmlInputHidden htmlInputHidden2 = this.hidden_productId; num = groupBuy.ProductId; htmlInputHidden2.Value = num.ToString(); if (groupBuy.StartDate > DateTime.Now) { this.hidden_IsOver.Value = "AboutToBegin"; } else if (groupBuy.EndDate < DateTime.Now) { this.hidden_IsOver.Value = "over"; } } Literal literal2 = this.ltlConsultation; num = productBrowseInfo.ConsultationCount; literal2.Text = num.ToString(); Literal literal3 = this.ltlReviewCount; num = productBrowseInfo.ReviewCount; literal3.Text = num.ToString(); IEnumerable value = from item in productBrowseInfo.Product.Skus select item.Value; if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null) { this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs); } if (this.hidden_skus != null) { this.hidden_skus.Value = JsonConvert.SerializeObject(value); } this.LoadPageSearch(productBrowseInfo.Product); this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName); this.LoadProductGroupBuyInfo(groupBuy); this.btnOrder.Stock = productBrowseInfo.Product.Stock; BrowsedProductQueue.EnQueue(groupBuy.ProductId); this.images.ImageInfo = productBrowseInfo.Product; this.litContent.Text = groupBuy.Content; if (productBrowseInfo.DbAttribute != null) { this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute; this.rptExpandAttributes.DataBind(); } if (productBrowseInfo.DbSKUs != null) { this.skuSelector.ProductId = groupBuy.ProductId; this.skuSelector.DataSource = productBrowseInfo.DbSKUs; } if (productBrowseInfo.DBConsultations != null) { this.consultations.DataSource = productBrowseInfo.DBConsultations; this.consultations.DataBind(); } if (productBrowseInfo.DbCorrelatives != null) { this.correlative.DataSource = productBrowseInfo.DbCorrelatives; this.correlative.DataBind(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request["isCallback"]) && (base.Request["isCallback"] == "true")) { int num; if (int.TryParse(base.Request["productId"], out num)) { string priceByProductId = PromoteHelper.GetPriceByProductId(num); if (priceByProductId.Length > 0) { base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{ "); base.Response.Write("\"Status\":\"OK\","); base.Response.Write(string.Format("\"Price\":\"{0}\"", decimal.Parse(priceByProductId).ToString("F2"))); base.Response.Write("}"); base.Response.End(); } } } else if (!int.TryParse(base.Request.QueryString["groupBuyId"], out this.groupBuyId)) { base.GotoResourceNotFound(); } else { this.btnUpdateGroupBuy.Click += new EventHandler(this.btnUpdateGroupBuy_Click); this.btnFail.Click += new EventHandler(this.btnFail_Click); this.btnSuccess.Click += new EventHandler(this.btnSuccess_Click); this.btnFinish.Click += new EventHandler(this.btnFinish_Click); if (!base.IsPostBack) { this.dropGroupBuyProduct.DataBind(); this.dropCategories.DataBind(); this.HourDropDownList1.DataBind(); this.drophours.DataBind(); GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(this.groupBuyId); if (PromoteHelper.GetOrderCount(this.groupBuyId) > 0) { this.dropGroupBuyProduct.Enabled = false; } if (groupBuy == null) { base.GotoResourceNotFound(); } else { if (groupBuy.Status == GroupBuyStatus.EndUntreated) { this.btnFail.Visible = true; this.btnSuccess.Visible = true; } if (groupBuy.Status == GroupBuyStatus.UnderWay) { this.btnFinish.Visible = true; } this.LoadGroupBuy(groupBuy); } } } }
protected void Page_Load(object sender, EventArgs e) { this.productId = this.Page.Request["productId"].ToInt(0); if (!string.IsNullOrEmpty(base.Request["isCallback"]) && base.Request["isCallback"] == "true") { if (int.TryParse(base.Request["productId"], out this.productId)) { string priceByProductId = PromoteHelper.GetPriceByProductId(this.productId); if (priceByProductId.Length > 0) { base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{ "); base.Response.Write("\"Status\":\"OK\","); base.Response.Write(string.Format("\"Price\":\"{0}\"", decimal.Parse(priceByProductId).F2ToString("f2"))); base.Response.Write("}"); base.Response.End(); } } } else if (!int.TryParse(base.Request.QueryString["groupBuyId"], out this.groupBuyId)) { base.GotoResourceNotFound(); } else { this.hfGroupId.Value = base.Request.QueryString["groupBuyId"].ToString(); this.btnUpdateGroupBuy.Click += this.btnUpdateGroupBuy_Click; this.btnFail.Click += this.btnFail_Click; this.btnSuccess.Click += this.btnSuccess_Click; this.btnFinish.Click += this.btnFinish_Click; this.BindProduct(); this.SetDateControl(); if (!base.IsPostBack) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(this.groupBuyId); if (PromoteHelper.GetOrderCount(this.groupBuyId) > 0) { this.selectProductA.Disabled = true; } if (groupBuy == null) { base.GotoResourceNotFound(); } else { if (groupBuy.Status == GroupBuyStatus.EndUntreated) { this.btnFail.Visible = true; this.btnSuccess.Visible = true; this.selectProductA.Disabled = true; this.calendarStartDate.Enabled = false; this.calendarEndDate.Enabled = false; this.txtNeedPrice.Enabled = false; this.txtMaxCount.Enabled = false; this.txtCount.Enabled = false; this.txtPrice.Enabled = false; this.txtContent.Enabled = false; this.btnUpdateGroupBuy.Enabled = false; } if (groupBuy.Status == GroupBuyStatus.UnderWay) { this.selectProductA.Disabled = true; this.btnFinish.Visible = true; } this.LoadGroupBuy(groupBuy); } } } }
public void ConfirmPay(HttpContext context) { string text = context.Request["id"]; if (string.IsNullOrWhiteSpace(text)) { throw new HidistroAshxException("错误的编号"); } OrderInfo orderInfo = new OrderDao().GetOrderInfo(text); if (orderInfo == null) { throw new HidistroAshxException("错误的编号"); } if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { throw new HidistroAshxException("权限不足"); } PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest"); if (paymentMode != null) { orderInfo.Gateway = paymentMode.Gateway; orderInfo.PaymentType = paymentMode.Name; orderInfo.PaymentTypeId = paymentMode.ModeId; } else { orderInfo.Gateway = "hishop.plugins.payment.bankrequest"; orderInfo.PaymentType = "线下支付"; orderInfo.PaymentTypeId = 0; } int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { string empty = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems) { CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId); if (countDownInfo == null) { throw new HidistroAshxException(empty); } } } if (orderInfo.FightGroupId > 0) { string empty2 = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems) { FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2); if (fightGroupActivityInfo == null) { throw new HidistroAshxException(empty2); } } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付"); } num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); num = groupBuy.MaxCount; num3 = orderInfo.GetGroupBuyOerderNumber(); if (num < num2 + num3) { throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付"); } } if (orderInfo.PreSaleId > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo == null) { throw new HidistroAshxException("预售活动不存在"); } if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now) { throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款"); } } string empty3 = string.Empty; switch (TradeHelper.CheckOrderBeforePay(orderInfo, out empty3)) { case 1: throw new HidistroAshxException($"当前有商品{empty3}下架或者被删除,不能确认收款"); case 2: if ((orderInfo.PreSaleId <= 0 || orderInfo.DepositDate.HasValue) && orderInfo.PreSaleId > 0) { break; } throw new HidistroAshxException($"当前有商品{empty3}库存不足,不能确认收款"); } if (OrderHelper.ConfirmPay(orderInfo)) { if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } if (orderInfo.ParentOrderId == "-1") { OrderQuery orderQuery = new OrderQuery(); orderQuery.ParentOrderId = orderInfo.OrderId; IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery); foreach (OrderInfo item in listUserOrder) { OrderHelper.OrderConfirmPaySendMessage(item); } } else { OrderHelper.OrderConfirmPaySendMessage(orderInfo); } base.ReturnSuccessResult(context, "成功的确认了订单收款", 0, true); return; } throw new HidistroAshxException("确认订单收款失败"); }
private void ProcessProductSkus(HttpContext context) { context.Response.ContentType = "application/json"; int num = context.Request["sourceId"].ToInt(0); int productId = int.Parse(context.Request["productId"], NumberStyles.None); int attributeId = int.Parse(context.Request["AttributeId"], NumberStyles.None); int valueId = int.Parse(context.Request["ValueId"], NumberStyles.None); int num2 = context.Request["StoreId"].ToInt(0); DataTable skuItems = ShoppingProcessor.GetUnUpUnUpsellingSkus(productId, attributeId, valueId); if (skuItems == null || skuItems.Rows.Count == 0) { context.Response.Write("{\"Status\":\"1\"}"); } else { skuItems.Columns.Add(new DataColumn { ColumnName = "SalePrice", DataType = typeof(decimal) }); bool flag = false; if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("fightgroup".ToLower()) && num > 0) { IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(num); if (fightGroupSkus.Count > 0) { flag = true; for (int j = 0; j < skuItems.Rows.Count; j++) { DataRow row = skuItems.Rows[j]; FightGroupSkuInfo fightGroupSkuInfo = (from c in fightGroupSkus where c.SkuId == row["SkuId"].ToString() select c).FirstOrDefault(); if (fightGroupSkuInfo == null) { string skuId = skuItems.Rows[j]["skuId"].ToString(); DataTable theSku = new SkuDao().GetTheSku(skuId); if (theSku != null && theSku.Rows.Count > 0) { skuItems.Rows[j]["Stock"] = 0; skuItems.Rows[j]["SalePrice"] = theSku.Rows[0]["SalePrice"].ToDecimal(0).F2ToString("f2"); } } else { int totalCount = fightGroupSkuInfo.TotalCount; int boughtCount = fightGroupSkuInfo.BoughtCount; int num3 = totalCount - boughtCount; if (num3 > fightGroupSkuInfo.Stock) { num3 = fightGroupSkuInfo.Stock; } decimal salePrice = fightGroupSkuInfo.SalePrice; skuItems.Rows[j]["Stock"] = ((num3 >= 0) ? num3 : 0); skuItems.Rows[j]["SalePrice"] = salePrice.F2ToString("f2"); } } } } if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("countdown")) { CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num, num2); if (countDownInfo != null && countDownInfo.CountDownSkuInfo != null && countDownInfo.CountDownSkuInfo.Count > 0) { flag = true; skuItems.Columns.Add(new DataColumn { ColumnName = "OldSalePrice", DataType = typeof(decimal) }); List <CountDownSkuInfo> countDownSkuInfo = countDownInfo.CountDownSkuInfo; int i; for (i = 0; i < skuItems.Rows.Count; i++) { List <CountDownSkuInfo> list = (from s in countDownSkuInfo where s.SkuId == skuItems.Rows[i]["SkuId"].ToNullString() select s).ToList(); if (list == null || list.Count == 0) { string skuId2 = list[0].SkuId.ToString(); DataTable theSku2 = new SkuDao().GetTheSku(skuId2); if (theSku2 != null && theSku2.Rows.Count > 0) { skuItems.Rows[i]["Stock"] = 0; skuItems.Rows[i]["SalePrice"] = theSku2.Rows[0]["SalePrice"].ToDecimal(0).F2ToString("f2"); skuItems.Rows[i]["OldSalePrice"] = theSku2.Rows[0]["MarketPrice"].ToDecimal(0).F2ToString("f2"); } } else { int totalCount2 = list[0].TotalCount; int boughtCount2 = list[0].BoughtCount; int num4 = totalCount2 - boughtCount2; skuItems.Rows[i]["Stock"] = ((num4 >= 0) ? num4 : 0); decimal salePrice2 = list[0].SalePrice; decimal oldSalePrice = list[0].OldSalePrice; skuItems.Rows[i]["SalePrice"] = salePrice2.F2ToString("f2"); skuItems.Rows[i]["OldSalePrice"] = oldSalePrice.F2ToString("f2"); } } } } if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("groupbuy")) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num); if (groupBuy != null) { flag = true; skuItems.Columns.Add(new DataColumn { ColumnName = "OldSalePrice", DataType = typeof(decimal) }); Dictionary <string, SKUItem> productSkuSaleInfo = ProductBrowser.GetProductSkuSaleInfo(productId, 0); int soldCount = PromoteHelper.GetSoldCount(groupBuy.GroupBuyId); for (int k = 0; k < skuItems.Rows.Count; k++) { DataRow dataRow = skuItems.Rows[k]; if (productSkuSaleInfo.ContainsKey(dataRow["SkuId"].ToNullString())) { SKUItem sKUItem = productSkuSaleInfo[dataRow["SkuId"].ToNullString()]; int num5 = skuItems.Rows[k]["Stock"].ToInt(0); int num6 = groupBuy.MaxCount - soldCount; if (num5 < num6) { skuItems.Rows[k]["Stock"] = num5; } else { skuItems.Rows[k]["Stock"] = num6; } skuItems.Rows[k]["SalePrice"] = groupBuy.Price.F2ToString("f2"); skuItems.Rows[k]["OldSalePrice"] = sKUItem.SalePrice.F2ToString("f2"); } } } } if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("presaleproductdetails") && num > 0) { ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(num); if (productPreSaleInfo != null) { flag = true; Dictionary <string, SKUItem> preSaleProductSkuSaleInfo = ProductBrowser.GetPreSaleProductSkuSaleInfo(productId); foreach (DataRow row2 in skuItems.Rows) { if (preSaleProductSkuSaleInfo.ContainsKey(row2["SkuId"].ToString())) { SKUItem sKUItem2 = preSaleProductSkuSaleInfo[row2["SkuId"].ToString()]; row2["SalePrice"] = sKUItem2.SalePrice; row2["Stock"] = sKUItem2.Stock; } } } } if (!flag) { Dictionary <string, SKUItem> productSkuSaleInfo2 = ProductBrowser.GetProductSkuSaleInfo(productId, num2); string text = ""; if (num2 == 0) { text = PromoteHelper.GetPhonePriceByProductId(productId); } foreach (DataRow row3 in skuItems.Rows) { if (productSkuSaleInfo2.ContainsKey(row3["SkuId"].ToString())) { SKUItem sKUItem3 = productSkuSaleInfo2[row3["SkuId"].ToString()]; if (!string.IsNullOrEmpty(text)) { string s2 = text.Split(',')[0]; decimal num7 = (sKUItem3.SalePrice - decimal.Parse(s2) > decimal.Zero) ? (sKUItem3.SalePrice - decimal.Parse(s2)) : decimal.Zero; row3["SalePrice"] = num7.F2ToString("f2"); } else { row3["SalePrice"] = sKUItem3.SalePrice; } row3["Stock"] = sKUItem3.Stock; } else { row3["Stock"] = "0"; row3["SalePrice"] = "0.00"; } } } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("{"); stringBuilder.Append("\"Status\":\"OK\","); stringBuilder.Append("\"SkuItems\":["); foreach (DataRow row4 in skuItems.Rows) { stringBuilder.Append("{"); if (skuItems.Columns.Contains("SkuId")) { stringBuilder.AppendFormat("\"SkuId\":\"{0}\",", row4["SkuId"].ToString()); } if (skuItems.Columns.Contains("SalePrice")) { stringBuilder.AppendFormat("\"SalePrice\":\"{0}\",", row4["SalePrice"].ToDecimal(0).F2ToString("f2")); } if (skuItems.Columns.Contains("OldSalePrice")) { stringBuilder.AppendFormat("\"OldSalePrice\":\"{0}\",", row4["OldSalePrice"].ToDecimal(0).F2ToString("f2")); } if (skuItems.Columns.Contains("Stock")) { stringBuilder.AppendFormat("\"Stock\":\"{0}\",", row4["Stock"].ToString()); } stringBuilder.AppendFormat("\"AttributeId\":\"{0}\",", row4["AttributeId"].ToString()); stringBuilder.AppendFormat("\"ValueId\":\"{0}\"", row4["ValueId"].ToString()); stringBuilder.Append("},"); } stringBuilder.Remove(stringBuilder.Length - 1, 1); stringBuilder.Append("]"); stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); } }
protected void dlstOrders_ItemCommand(object sender, DataListCommandEventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString()); if (orderInfo != null) { if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { int maxCount = 0; int orderCount = 0; int groupBuyOerderNumber = 0; if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if ((groupBuy == null) || (groupBuy.Status != GroupBuyStatus.UnderWay)) { ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } orderCount = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); maxCount = groupBuy.MaxCount; groupBuyOerderNumber = orderInfo.GetGroupBuyOerderNumber(); if (maxCount < (orderCount + groupBuyOerderNumber)) { ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } } if (OrderHelper.ConfirmPay(orderInfo)) { if ((orderInfo.GroupBuyId > 0) && (maxCount == (orderCount + groupBuyOerderNumber))) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } BindOrders(); int userId = orderInfo.UserId; if (userId == 0x44c) { userId = 0; } Messenger.OrderPayment(Users.GetUser(userId), orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); ShowMsg("成功的确认了订单收款", true); } else { ShowMsg("确认订单收款失败", false); } } else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { if (OrderHelper.ConfirmOrderFinish(orderInfo)) { BindOrders(); ShowMsg("成功的完成了该订单", true); } else { ShowMsg("完成订单失败", false); } } } }
protected void dlstOrders_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString()); if (orderInfo != null) { if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId); if (countDownBuy == null || countDownBuy.EndDate < System.DateTime.Now) { this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false); return; } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy != null) { if (groupBuy.Status == GroupBuyStatus.UnderWay) { num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); num = groupBuy.MaxCount; num3 = orderInfo.GetGroupBuyOerderNumber(); if (num < num2 + num3) { this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } goto IL_D9; } } this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } IL_D9: if (OrderHelper.ConfirmPay(orderInfo)) { if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } this.BindOrders(); int num4 = orderInfo.UserId; if (num4 == 1100) { num4 = 0; } Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num4); Messenger.OrderPayment(user, orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); this.ShowMsg("成功的确认了订单收款", true); return; } this.ShowMsg("确认订单收款失败", false); return; } else { if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { if (OrderHelper.ConfirmOrderFinish(orderInfo)) { this.BindOrders(); this.ShowMsg("成功的完成了该订单", true); return; } this.ShowMsg("完成订单失败", false); } } } }