protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("查看提货码"); this.hfTakeCode = (HtmlInputHidden)this.FindControl("hfTakeCode"); string orderId = this.Page.Request.QueryString["orderId"].ToNullString(); OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId); if (orderInfo != null && orderInfo.UserId == HiContext.Current.UserId) { HtmlImage htmlImage = this.FindControl("imgProduct") as HtmlImage; Literal control = this.FindControl("litItemCount") as Literal; Literal control2 = this.FindControl("litStoreName") as Literal; Literal control3 = this.FindControl("litStoreAddress") as Literal; Literal control4 = this.FindControl("litTel") as Literal; LineItemInfo lineItemInfo = orderInfo.LineItems.Values.FirstOrDefault(); Literal control5 = this.FindControl("litTakeCode") as Literal; htmlImage.Src = (string.IsNullOrEmpty(lineItemInfo.ThumbnailsUrl) ? SettingsManager.GetMasterSettings().DefaultProductImage : lineItemInfo.ThumbnailsUrl); control.SetWhenIsNotNull(orderInfo.LineItems.Count.ToString()); control5.SetWhenIsNotNull(orderInfo.TakeCode); this.hfTakeCode.SetWhenIsNotNull(Globals.HIPOSTAKECODEPREFIX + orderInfo.TakeCode); StoresInfo storeById = DepotHelper.GetStoreById(orderInfo.StoreId); if (storeById != null) { control2.SetWhenIsNotNull(storeById.StoreName); control4.SetWhenIsNotNull(storeById.Tel); control3.SetWhenIsNotNull(RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address); } } }
protected override void AttachChildControls() { this.litSupplierName = (Literal)this.FindControl("litSupplierName"); this.litSupplierAbout = (Literal)this.FindControl("litSupplierAbout"); this.hdAppId = (HtmlInputHidden)this.FindControl("hdAppId"); this.hdTitle = (HtmlInputHidden)this.FindControl("hdTitle"); this.hdDesc = (HtmlInputHidden)this.FindControl("hdDesc"); this.hdImgUrl = (HtmlInputHidden)this.FindControl("hdImgUrl"); this.hdLink = (HtmlInputHidden)this.FindControl("hdLink"); this.hdAppId.Value = HiContext.Current.SiteSettings.WeixinAppId; int storeId = base.GetParameter("StoreId").ToInt(0); StoresInfo storeById = DepotHelper.GetStoreById(storeId); if (storeById == null) { base.GotoResourceNotFound(""); } else { this.hdTitle.Value = storeById.StoreName; this.hdDesc.Value = storeById.StoreName; string storeImages = storeById.StoreImages; string local = string.IsNullOrEmpty(storeImages) ? SettingsManager.GetMasterSettings().LogoUrl : storeImages; this.hdImgUrl.Value = Globals.FullPath(local); this.hdLink.Value = Globals.FullPath(this.Page.Request.Url.ToString()); this.litSupplierName.SetWhenIsNotNull(storeById.StoreName); this.litSupplierAbout.SetWhenIsNotNull(storeById.Introduce); } }
private void OfflinePayOder() { if (this.offlineOrder != null && this.offlineOrder.Status == 0) { if (this.offlineOrder.Status == 1) { if (this.isOfflineOrder) { base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}</p>", this.OrderId, this.Amount.ToString("F"))); } } else { this.offlineOrder.Status = 1; this.offlineOrder.PayTime = DateTime.Now; if (StoresHelper.UpdateStoreCollectionInfo(this.offlineOrder) && this.isOfflineOrder) { string text = ""; StoresInfo storeById = DepotHelper.GetStoreById(this.offlineOrder.StoreId); if (storeById != null) { text = storeById.StoreName; } if (storeById != null) { VShopHelper.AppPsuhRecordForStore(storeById.StoreId, this.offlineOrder.OrderId, "", EnumPushStoreAction.StoreOrderPayed); } base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}</p>", this.OrderId, this.Amount.ToString("F"))); } } } }
private void OfflinePayOder() { if (this.offlineOrder != null && this.offlineOrder.Status == 0) { this.offlineOrder.Status = 1; this.offlineOrder.PayTime = DateTime.Now; if (StoresHelper.UpdateStoreCollectionInfo(this.offlineOrder) && this.isOfflineOrder) { string text = ""; StoresInfo storeById = DepotHelper.GetStoreById(this.offlineOrder.StoreId); if (storeById != null) { text = storeById.StoreName; StoreBalanceDetailInfo storeBalanceDetailInfo = new StoreBalanceDetailInfo(); storeBalanceDetailInfo.StoreId = this.offlineOrder.StoreId; storeBalanceDetailInfo.TradeDate = DateTime.Now; storeBalanceDetailInfo.TradeType = StoreTradeTypes.OfflineCashier; storeBalanceDetailInfo.Expenses = default(decimal); storeBalanceDetailInfo.Income = this.offlineOrder.PayAmount; storeBalanceDetailInfo.Balance = storeById.Balance + this.offlineOrder.PayAmount; storeBalanceDetailInfo.Remark = "线下收银(" + this.offlineOrder.OrderId + ")"; storeBalanceDetailInfo.ManagerUserName = ""; storeBalanceDetailInfo.TradeNo = this.offlineOrder.OrderId; storeBalanceDetailInfo.CreateTime = DateTime.Now; storeBalanceDetailInfo.PlatCommission = decimal.Zero; StoreBalanceHelper.AddBalanceDetailInfo(storeBalanceDetailInfo); } if (storeById != null) { VShopHelper.AppPsuhRecordForStore(storeById.StoreId, this.offlineOrder.OrderId, "", EnumPushStoreAction.StoreOrderPayed); } } } }
private void dataSupplier_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } Repeater repeater = e.Item.FindControl("rptOrderProducts") as Repeater; repeater.ItemDataBound += this.rptOrderProducts_ItemDataBound; Label label = e.Item.FindControl("lblSupplierAmount") as Label; Label label2 = e.Item.FindControl("lblFreight") as Label; Label label3 = e.Item.FindControl("lblSupplierName") as Label; HtmlGenericControl htmlGenericControl = (HtmlGenericControl)e.Item.FindControl("divSupplier"); HtmlGenericControl htmlGenericControl2 = (HtmlGenericControl)e.Item.FindControl("divFreightAndAmount"); if (repeater != null) { int supplierId = 0; int.TryParse(DataBinder.Eval(e.Item.DataItem, "SupplierId").ToString(), out supplierId); label3.Text = DataBinder.Eval(e.Item.DataItem, "SupplierName").ToString(); List <ShoppingCartItemInfo> list = (from i in this.ShoppingCart.LineItems where i.SupplierId == supplierId select i).ToList(); decimal num = (from i in this.ShoppingCart.LineItems where i.SupplierId == supplierId select i.AdjustedPrice.F2ToString("f2").ToDecimal(0) * (decimal)i.Quantity).Sum(); repeater.DataSource = list; repeater.DataBind(); label.Text = "¥" + num.F2ToString("f2"); decimal num2 = ShoppingProcessor.CalcSupplierFreight(supplierId, this.RegionId, this.ShoppingCart); label2.Text = "¥" + num2.F2ToString("f2") + ((supplierId == 0 && this.ShoppingCart.LineGifts.Count() > 0) ? "(含礼品)" : ""); if (!HiContext.Current.SiteSettings.OpenSupplier) { htmlGenericControl2.Visible = false; } if (HiContext.Current.SiteSettings.OpenMultStore && this.StoreId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(this.StoreId); if (storeById != null) { label3.Text = storeById.StoreName; htmlGenericControl.Attributes["class"] = "mtitle"; } } else if (HiContext.Current.SiteSettings.OpenSupplier && supplierId > 0 && list.Count > 0) { label3.Text = list[0].SupplierName; htmlGenericControl.Attributes["class"] = "stitle"; } else { label3.Text = "平台"; htmlGenericControl.Attributes["class"] = "ztitle"; } } if (HiContext.Current.SiteSettings.OpenMultStore && this.StoreId > 0) { htmlGenericControl2.Visible = false; } }
public void ExportExcel(HttpContext context) { StoreBalanceDetailQuery dataQuery = this.GetDataQuery(context); StoresInfo storeById = DepotHelper.GetStoreById(dataQuery.StoreId.Value); IList <StoreBalanceDetailInfo> balanceDetails4Report = StoreBalanceHelper.GetBalanceDetails4Report(dataQuery); StringBuilder stringBuilder = new StringBuilder(300); stringBuilder.Append("门店"); stringBuilder.Append(",时间"); stringBuilder.Append(",类型"); stringBuilder.Append(",订单号"); stringBuilder.Append(",收入"); stringBuilder.Append(",支出"); stringBuilder.Append(",账户余额"); stringBuilder.Append(",备注\r\n"); foreach (StoreBalanceDetailInfo item in balanceDetails4Report) { stringBuilder.Append(storeById.StoreName); stringBuilder.Append("," + item.TradeDate); stringBuilder.Append("," + item.TradeTypeText); stringBuilder.Append("," + item.TradeNo); stringBuilder.Append("," + item.Income); stringBuilder.Append("," + item.Expenses); stringBuilder.Append("," + item.Balance); stringBuilder.Append("," + item.Remark + "\r\n"); } context.Response.Clear(); context.Response.Buffer = false; context.Response.Charset = "GB2312"; context.Response.AppendHeader("Content-Disposition", "attachment;filename=BalanceDetail.csv"); context.Response.ContentEncoding = Encoding.GetEncoding("GB2312"); context.Response.ContentType = "application/octet-stream"; context.Response.Write(stringBuilder.ToString()); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { int storeId = HiContext.Current.Manager.StoreId; string storeSlideImagesByStoreId = DepotHelper.GetStoreSlideImagesByStoreId(storeId); this.hidOldImages.Value = storeSlideImagesByStoreId; IList <StoreFloorInfo> storeFloorList = StoresHelper.GetStoreFloorList(storeId, FloorClientType.O2OApplet); int pageIndex = 1; int pageSize = 1000000000; DbQueryResult showProductList = WeChartAppletHelper.GetShowProductList(0, pageIndex, pageSize, storeId, ProductType.ServiceProduct); DataTable data = showProductList.Data; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < data.Rows.Count; i++) { if (stringBuilder.Length > 0) { stringBuilder.Insert(0, data.Rows[i]["ProductId"] + "|||" + data.Rows[i]["ProductName"] + ",,,"); } else { stringBuilder.Append(data.Rows[i]["ProductId"] + "|||" + data.Rows[i]["ProductName"]); } } this.hidSelectProducts.Value = stringBuilder.ToString(); this.lkbAddAppletFloor.Click += this.lkbAddAppletFloor_Click; }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("门店详情页"); this.imgStore = (HtmlImage)this.FindControl("imgStore"); this.hidLatitude = (HtmlInputHidden)this.FindControl("hidLatitude"); this.hidLongitude = (HtmlInputHidden)this.FindControl("hidLongitude"); this.hidTel = (HtmlInputHidden)this.FindControl("hidTel"); int.TryParse(this.Page.Request.QueryString["storeId"], out this.storeId); if (this.storeId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(this.storeId); if (!string.IsNullOrEmpty(storeById.StoreImages)) { this.imgStore.Src = storeById.StoreImages.Split(',')[0]; } HtmlInputHidden htmlInputHidden = this.hidLatitude; double? nullable = storeById.Latitude; htmlInputHidden.Value = nullable.ToString(); HtmlInputHidden htmlInputHidden2 = this.hidLongitude; nullable = storeById.Longitude; htmlInputHidden2.Value = nullable.ToString(); this.hidTel.Value = storeById.Tel; Literal literal = this.FindControl("ltopentime") as Literal; if (literal != null && !string.IsNullOrEmpty(storeById.StoreOpenTime)) { literal.Text = $"<div class=\"opentime\">营业时间:{storeById.StoreOpenTime}</div>"; } PageTitle.AddSiteNameTitle("周边门店-" + storeById.StoreName); } else { base.GotoResourceNotFound("参数错误"); } }
protected void btnSave_Click(object sender, EventArgs e) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); masterSettings.DadaAppKey = this.txtAppKey.Text; masterSettings.DadaAppSecret = this.txtAppSecret.Text; masterSettings.DadaSourceID = this.txtSourceID.Text; if (this.ooEnableHtmRewrite.SelectedValue) { if (string.IsNullOrEmpty(this.txtAppKey.Text)) { this.ShowMsg("app_key不能为空!", false); return; } if (string.IsNullOrEmpty(this.txtAppSecret.Text)) { this.ShowMsg("app_secret不能为空!", false); return; } if (string.IsNullOrEmpty(this.txtSourceID.Text)) { this.ShowMsg("source_id不能为空!", false); return; } DataTable dataTable = DepotHelper.SynchroDadaStoreList(0); if (dataTable != null && dataTable.Rows.Count > 0) { for (int i = 0; i < dataTable.Rows.Count; i++) { string station_name = dataTable.Rows[i]["StoreName"].ToNullString(); int business = 5; string city_name = dataTable.Rows[i]["CityName"].ToNullString().Replace("市", ""); string area_name = dataTable.Rows[i]["RegionName"].ToNullString(); string station_address = dataTable.Rows[i]["Address"].ToNullString(); double lng = dataTable.Rows[i]["Longitude"].ToDouble(0); double lat = dataTable.Rows[i]["Latitude"].ToDouble(0); string contact_name = dataTable.Rows[i]["ContactMan"].ToNullString(); string phone = dataTable.Rows[i]["Tel"].ToNullString(); string origin_shop_id = dataTable.Rows[i]["StoreId"].ToNullString(); string value = DadaHelper.shopAdd(this.txtSourceID.Text, station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, origin_shop_id, "", "", ""); JObject jObject = JsonConvert.DeserializeObject(value) as JObject; string a = jObject["status"].ToNullString(); int num = jObject["code"].ToInt(0); if (a == "fail" && num != 7718) { this.ShowMsg(jObject["msg"].ToNullString(), false); return; } } } } masterSettings.OpenDadaLogistics = this.ooEnableHtmRewrite.SelectedValue; SettingsManager.Save(masterSettings); this.ShowMsg("设置成功", true, "DadaLogistics"); }
private void bindShippingPaymentInfo() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); bool flag = masterSettings.OpenMultStore && !this.isPreSale; this.hidIsMultiStore.Value = (flag ? "1" : "0"); if (this.storeId > 0 & flag) { StoresInfo storeById = DepotHelper.GetStoreById(this.storeId); if (storeById != null && this.cart.LineItems.Count > 0) { this.hidIsSubmitInTime.Value = "1"; this.hidStoreName.Value = storeById.StoreName; this.hidStoreId.Value = this.storeId.ToString(); if (!SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime) { DateTime dateTime = DateTime.Now; string str = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenStartDate; DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value; dateTime = DateTime.Now; string str2 = dateTime.ToString("yyyy-MM-dd"); dateTime = storeById.OpenEndDate; DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value; if (dateTime2 <= value) { dateTime2 = dateTime2.AddDays(1.0); } if (DateTime.Now < value || DateTime.Now > dateTime2) { this.hidIsSubmitInTime.Value = "0"; } } } } if (this.paymentModeId == 0) { if (TradeHelper.WapPaymentTypeCount(base.ClientType, this.isFightGroup) > 0) { this.inputPaymentModeId.Value = this.paymentModeId.ToString(); } } else { this.inputPaymentModeId.Value = this.paymentModeId.ToString(); } if (this.isCountDown) { this.paymenttypeselect.OrderSalesPromotion = Common_WAPPaymentTypeSelect.EnumOrderSalesPromotion.CountDownBuy; } this.paymenttypeselect.IsServiceProduct = true; this.paymenttypeselect.IsFireGroup = this.isFightGroup; this.paymenttypeselect.ClientType = base.ClientType; }
private void BindStoreInfo() { StoresInfo storeById = DepotHelper.GetStoreById(this.order.StoreId); if (storeById != null) { this.litStoreName.SetWhenIsNotNull(storeById.StoreName); this.litStoreTel.SetWhenIsNotNull(storeById.Tel); this.litStoreInfo.SetWhenIsNotNull(RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address); } }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.ProductId = this.Page.Request.QueryString["ProductId"].ToInt(0); this.StoreId = this.Page.Request.QueryString["StoreId"].ToInt(0); if (this.StoreId < 0 || this.ProductId < 0) { base.GotoResourceNotFound(); } else { this.hidStoreId.Value = this.StoreId.ToString(); ProductInfo productById = ProductHelper.GetProductById(this.ProductId); if (productById != null) { this.ImgProduct.ImageUrl = productById.ThumbnailUrl40; this.litProductName.Text = productById.ProductName; } StoresInfo storeById = DepotHelper.GetStoreById(this.StoreId); if (storeById != null) { this.litStoreName.Text = storeById.StoreName; int num; if (storeById.IsModifyPrice) { decimal?maxPriceRate = storeById.MaxPriceRate; num = ((maxPriceRate.GetValueOrDefault() > default(decimal) && maxPriceRate.HasValue) ? 1 : 0); } else { num = 0; } if (num != 0) { this.priceTip.Visible = true; this.priceTipMessage.Text = $"可设置价格区间为商品价格的{storeById.MinPriceRate.ToNullString()}倍-{storeById.MaxPriceRate.ToNullString()}倍"; this.hidIsModifyPrice.Value = "1"; this.hidMinPriceRate.Value = storeById.MinPriceRate.ToNullString(); this.hidMaxPriceRate.Value = storeById.MaxPriceRate.ToNullString(); } } this.BindProduct(); } } }
protected override void AttachChildControls() { this.imgStore = (HtmlImage)this.FindControl("imgStore"); this.hidLatitude = (HtmlInputHidden)this.FindControl("hidLatitude"); this.hidLongitude = (HtmlInputHidden)this.FindControl("hidLongitude"); this.hidTel = (HtmlInputHidden)this.FindControl("hidTel"); this.hdAppId = (HtmlInputHidden)this.FindControl("hdAppId"); this.hdTitle = (HtmlInputHidden)this.FindControl("hdTitle"); this.hdDesc = (HtmlInputHidden)this.FindControl("hdDesc"); this.hdImgUrl = (HtmlInputHidden)this.FindControl("hdImgUrl"); this.hdLink = (HtmlInputHidden)this.FindControl("hdLink"); this.hdAppId.Value = HiContext.Current.SiteSettings.WeixinAppId; int.TryParse(this.Page.Request.QueryString["storeId"], out this.storeId); if (this.storeId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(this.storeId); if (!string.IsNullOrEmpty(storeById.StoreImages)) { this.imgStore.Src = storeById.StoreImages.Split(',')[0]; } HtmlInputHidden htmlInputHidden = this.hidLatitude; double? nullable = storeById.Latitude; htmlInputHidden.Value = nullable.ToString(); HtmlInputHidden htmlInputHidden2 = this.hidLongitude; nullable = storeById.Longitude; htmlInputHidden2.Value = nullable.ToString(); this.hidTel.Value = storeById.Tel; Literal literal = this.FindControl("ltopentime") as Literal; if (literal != null && !string.IsNullOrEmpty(storeById.StoreOpenTime)) { literal.Text = $"<div class=\"opentime\">营业时间:{storeById.StoreOpenTime}</div>"; } this.hdTitle.Value = storeById.StoreName; this.hdDesc.Value = storeById.StoreName; string storeImages = storeById.StoreImages; string local = string.IsNullOrEmpty(storeImages) ? SettingsManager.GetMasterSettings().LogoUrl : storeImages; this.hdImgUrl.Value = Globals.FullPath(local); this.hdLink.Value = Globals.FullPath(this.Page.Request.Url.ToString()); PageTitle.AddSiteNameTitle("周边门店-" + storeById.StoreName); } else { base.GotoResourceNotFound("参数错误"); } }
private void ConfirmOrder(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.IsConfirm || (orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid && orderInfo.PaymentTypeId != -3)) { return; } string empty = string.Empty; if (OrderHelper.ConfirmTakeOnStoreOrder(orderInfo, out empty, true, "", false)) { StoresInfo storeById = DepotHelper.GetStoreById(orderInfo.StoreId); MemberInfo user = Users.GetUser(orderInfo.UserId); if (user != null) { if (!string.IsNullOrEmpty(currentSiteSetting.HiPOSAppId) && !string.IsNullOrEmpty(currentSiteSetting.HiPOSAppSecret) && !string.IsNullOrEmpty(currentSiteSetting.HiPOSMerchantId) && !string.IsNullOrEmpty(currentSiteSetting.HiPOSExpireAt) && currentSiteSetting.HiPOSExpireAt.ToDateTime() > (DateTime?)DateTime.Now) { string empty2 = string.Empty; string siteUrl = currentSiteSetting.SiteUrl; string text2 = Globals.HIPOSTAKECODEPREFIX + orderInfo.TakeCode; empty2 = ((siteUrl.IndexOf("http") >= 0) ? (currentSiteSetting.SiteUrl + "/QRTakeCode.aspx?takeCode=" + text2) : ("http://" + currentSiteSetting.SiteUrl + "/QRTakeCode.aspx?takeCode=" + text2)); Messenger.OrderConfirmTakeOnStore(orderInfo, user, storeById, empty2); } else { Messenger.OrderConfirmTakeOnStore(orderInfo, user, storeById, ""); } base.ReturnResult(context, true, empty, 0, true); } return; } throw new HidistroAshxException(empty); }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("门店介绍"); this.litSupplierName = (Literal)this.FindControl("litSupplierName"); this.litSupplierAbout = (Literal)this.FindControl("litSupplierAbout"); int storeId = HttpContext.Current.Request.QueryString["StoreId"].ToInt(0); StoresInfo storeById = DepotHelper.GetStoreById(storeId); if (storeById == null) { base.GotoResourceNotFound(""); } else { this.litSupplierName.SetWhenIsNotNull(storeById.StoreName); this.litSupplierAbout.SetWhenIsNotNull(storeById.Introduce); } }
private void BindStoreInfo(OrderInfo order) { if (order.ShippingModeId == -2) { this.divstoreinfo.Visible = true; if (order.Gateway.ToLower() == "hishop.plugins.payment.payonstore") { this.hidIsPaymentStore.Value = "1"; } } this.litTakeCode.SetWhenIsNotNull(order.TakeCode); StoresInfo storeById = DepotHelper.GetStoreById(order.StoreId); if (storeById != null) { this.litStoreName.Text = storeById.StoreName; this.litStoreInfo.Text = RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address; this.litStoreTel.Text = storeById.Tel; } }
public void ExportToExcel(HttpContext context) { RefundApplyQuery refundApplyQuery = new RefundApplyQuery(); refundApplyQuery.OrderId = Globals.UrlDecode(context.Request["OrderId"]); refundApplyQuery.HandleStatus = base.GetIntParam(context, "HandleStatus", true); refundApplyQuery.RefundIds = context.Request["Ids"].ToNullString(); refundApplyQuery.SortBy = "ApplyForTime"; refundApplyQuery.SortOrder = SortAction.Desc; IList <RefundModel> refundApplysNoPage = OrderHelper.GetRefundApplysNoPage(refundApplyQuery); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<table border='1'>"); stringBuilder.Append("<thead><tr>"); stringBuilder.Append("<th>售后编号</th>"); stringBuilder.Append("<th>会员名</th>"); stringBuilder.Append("<th>订单编号</th>"); stringBuilder.Append("<th>申请时间</th>"); stringBuilder.Append("<th>匹配门店</th>"); stringBuilder.Append("<th>处理状态</th>"); stringBuilder.Append("<th>退款原因</th>"); stringBuilder.Append("<th>退款金额</th>"); stringBuilder.Append("<th>处理时间</th>"); stringBuilder.Append("<th>退款途径</th>"); stringBuilder.Append("</tr></thead>"); StringBuilder stringBuilder2 = new StringBuilder(); foreach (RefundModel item in refundApplysNoPage) { stringBuilder2.Append("<tr>"); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.RefundId, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.UserName, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.OrderId, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.ApplyForTime, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD((item.StoreId.HasValue && item.StoreId.Value > 0) ? DepotHelper.GetStoreNameByStoreId(item.StoreId.Value) : "平台店", true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(EnumDescription.GetEnumDescription((Enum)(object)item.HandleStatus, 0), true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.RefundReason, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.RefundAmount, false)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.GetDealTime, false)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(EnumDescription.GetEnumDescription((Enum)(object)item.RefundType, 0), true)); stringBuilder2.Append("</tr>"); } stringBuilder.AppendFormat("<tbody>{0}</tbody></table>", stringBuilder2.ToString()); StringWriter stringWriter = new StringWriter(); stringWriter.Write(stringBuilder); DownloadHelper.DownloadFile(context.Response, stringWriter.GetStringBuilder(), "RefundApplys" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls"); stringWriter.Close(); context.Response.End(); }
public override void OnLoad(HttpContext context) { base.OnLoad(context); if (context.Request["flag"] == "GetFinishedVerificationRecord") { int storeId = base.CurrentManager.StoreId; int managerId = 0; if (base.CurrentManager.RoleId == -3) { managerId = base.CurrentManager.ManagerId; } string keyword = context.Request["keyword"].ToNullString(); Pagination pagination = new Pagination(); int num = context.Request["PageIndex"].ToInt(0); if (num < 1) { num = 1; } int num2 = context.Request["PageSize"].ToInt(0); if (num2 < 1) { num2 = 10; } pagination.PageIndex = num; pagination.PageSize = num2; pagination.SortOrder = SortAction.Desc; pagination.SortBy = "VerificationDate"; DbQueryResult finishedVerificationRecord = OrderHelper.GetFinishedVerificationRecord(pagination, storeId, keyword, managerId); string s = JsonConvert.SerializeObject(new { Result = new { RecordCount = finishedVerificationRecord.TotalRecords, List = from d in finishedVerificationRecord.Data.AsEnumerable() select new { OrderId = d.Field <string>("OrderId"), ProductName = d.Field <string>("ItemDescription"), ThumbnailsUrl = Globals.FullPath(d.Field <string>("ThumbnailsUrl")), Price = d.Field <decimal>("ItemAdjustedPrice").F2ToString("f2"), num = d.Field <int>("num"), UserName = d.Field <string>("UserName"), VerificationDate = d.Field <DateTime>("VerificationDate").ToString("yyyy-MM-dd HH:mm:ss") } } }); context.Response.Write(s); context.Response.End(); } DateTime value; if (context.Request["flag"] == "CheckVerification") { int storeId2 = base.CurrentManager.StoreId; string verificationPassword = context.Request["VerificationItems"]; OrderVerificationItemInfo verificationInfoByPassword = OrderHelper.GetVerificationInfoByPassword(verificationPassword); if (verificationInfoByPassword == null) { context.Response.Write(this.GetErrorJosn(801, "该核销码无效,请重新输入")); return; } if (verificationInfoByPassword.StoreId != storeId2) { context.Response.Write(this.GetErrorJosn(802, "非本门店核销码,请买家核对信息")); return; } if (verificationInfoByPassword.VerificationStatus == 1) { HttpResponse response = context.Response; value = verificationInfoByPassword.VerificationDate.Value; response.Write(this.GetErrorJosn(801, "该核销码 于" + value.ToString("yyyy-MM-dd HH:mm:ss") + "已核销")); return; } if (verificationInfoByPassword.VerificationStatus == 3) { context.Response.Write(this.GetErrorJosn(801, "核销码已过期,无法核销")); return; } if (verificationInfoByPassword.VerificationStatus == 5) { context.Response.Write(this.GetErrorJosn(801, "此核销码已进行售后,无法核销")); return; } if (verificationInfoByPassword.VerificationStatus == 4) { context.Response.Write(this.GetErrorJosn(801, "此核销码正在进行售后,无法核销")); return; } string s2 = JsonConvert.SerializeObject(new { Result = new { Success = new { Status = true, Msg = "核销码可用" } } }); context.Response.Write(s2); context.Response.End(); } decimal num3 = default(decimal); if (context.Request["flag"] == "OrderVerification") { int storeId3 = base.CurrentManager.StoreId; string text = context.Request["VerificationItems"]; string[] array = text.Split(','); DateTime now = DateTime.Now; string text2 = ""; OrderVerificationItemInfo orderVerificationItemInfo = null; for (int i = 0; i < array.Length; i++) { if (!string.IsNullOrEmpty(array[i])) { OrderVerificationItemInfo verificationInfoByPassword2 = OrderHelper.GetVerificationInfoByPassword(array[i]); if (i == 0) { orderVerificationItemInfo = verificationInfoByPassword2; orderVerificationItemInfo.VerificationDate = DateTime.Now; } if (verificationInfoByPassword2 == null) { context.Response.Write(this.GetErrorJosn(801, "该核销码无效,请重新输入")); return; } if (verificationInfoByPassword2.StoreId != storeId3) { context.Response.Write(this.GetErrorJosn(802, "非本门店核销码,请买家核对信息")); return; } if (verificationInfoByPassword2.VerificationStatus == 1) { HttpResponse response2 = context.Response; value = verificationInfoByPassword2.VerificationDate.Value; response2.Write(this.GetErrorJosn(801, "该核销码 于" + value.ToString("yyyy-MM-dd HH:mm:ss") + "已核销")); return; } if (verificationInfoByPassword2.VerificationStatus == 3) { context.Response.Write(this.GetErrorJosn(801, "核销码已过期,无法核销")); return; } if (verificationInfoByPassword2.VerificationStatus == 5) { context.Response.Write(this.GetErrorJosn(801, "此核销码已进行售后,无法核销")); return; } if (verificationInfoByPassword2.VerificationStatus == 4) { context.Response.Write(this.GetErrorJosn(801, "此核销码正在进行售后,无法核销")); return; } verificationInfoByPassword2.VerificationStatus = 1; verificationInfoByPassword2.VerificationDate = now; verificationInfoByPassword2.ManagerId = base.CurrentManager.ManagerId; verificationInfoByPassword2.UserName = base.CurrentManager.UserName; OrderHelper.UpdateVerificationItem(verificationInfoByPassword2); text2 = verificationInfoByPassword2.OrderId; } WXAppletFormDataInfo wxFormData = WeChartAppletHelper.GetWxFormData(WXAppletEvent.ServiceProductValid, text2); if (wxFormData != null) { wxFormData.EventValue += now.ToString("yyyyMMddHHmmss"); new WeChatAppletDao().Update(wxFormData, null); } } OrderInfo serviceProductOrderInfo = OrderHelper.GetServiceProductOrderInfo(text2); if (serviceProductOrderInfo != null) { num3 = serviceProductOrderInfo.GetTotal(false) / (decimal)serviceProductOrderInfo.GetBuyQuantity() * (decimal)array.Length; MemberInfo user = Users.GetUser(serviceProductOrderInfo.UserId); string storeName = ""; string productName = ""; if (serviceProductOrderInfo.StoreId > 0) { storeName = DepotHelper.GetStoreNameByStoreId(serviceProductOrderInfo.StoreId); } if (serviceProductOrderInfo.LineItems != null && serviceProductOrderInfo.LineItems.Count > 0) { productName = serviceProductOrderInfo.LineItems.Values.FirstOrDefault().ItemDescription; } Messenger.ServiceOrderValidSuccess(orderVerificationItemInfo, user, serviceProductOrderInfo, productName, storeName, text, num3); if (OrderHelper.IsVerificationFinished(text2) && serviceProductOrderInfo.ItemStatus == OrderItemStatus.Nomarl) { serviceProductOrderInfo.OrderStatus = OrderStatus.Finished; serviceProductOrderInfo.FinishDate = DateTime.Now; TradeHelper.UpdateOrderInfo(serviceProductOrderInfo); } } string s3 = JsonConvert.SerializeObject(new { Result = new { Status = "SUCCESS", VerificationDate = now.ToString("yyyy-MM-dd HH:mm:ss") } }); context.Response.Write(s3); context.Response.End(); } }
private void UpdateStores() { StoresInfo storeById = StoresHelper.GetStoreById(this.storeId); ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.storeId, SystemRoles.StoreAdmin); if (storeById == null) { base.Response.Redirect("StoresList.aspx"); } double num = 0.0; int num2 = 0; int num3 = 0; decimal num4 = default(decimal); string text = ""; string text2 = ""; string Address = ""; string text3 = Globals.StripAllTags(this.txtStoresName.Text.Trim()); Address = Globals.StripAllTags(this.txtAddress.Text); string text4 = Globals.StripAllTags(this.txtRegionScop.Value.Trim()); string text5 = Globals.StripAllTags(this.txtRegionScopName.Value.Trim()); text = this.txtTel.Text; text2 = this.txtContactMan.Text; string[] array = text4.Split(','); string[] array2 = text5.Split(','); IDictionary <int, DeliveryScopeInfo> dictionary = new Dictionary <int, DeliveryScopeInfo>(); for (int i = 0; i < array.Length; i++) { int num5 = 0; if (int.TryParse(array[i], out num5) && array2.Length >= i && dictionary != null && !dictionary.ContainsKey(num5)) { DeliveryScopeInfo deliveryScopeInfo = new DeliveryScopeInfo(); deliveryScopeInfo.RegionId = num5; deliveryScopeInfo.RegionName = array2[i]; deliveryScopeInfo.FullRegionPath = RegionHelper.GetFullPath(num5, true); dictionary.Add(num5, deliveryScopeInfo); } } if (storeById.StoreName != text3 && StoresHelper.ExistStoreName(text3)) { this.ResetForm(storeById.StoreId); this.ShowMsg("门店名称已经存在,请重新输入!", false); } else if (string.Compare(this.txtUserPwd.Text, this.txtUserRePwd.Text) != 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请确保两次输入的密码相同", false); } else if (!this.dropRegion.GetSelectedRegionId().HasValue) { this.ResetForm(storeById.StoreId); this.ShowMsg("请选择店铺所在区域!", false); } else if (text2.Length > 8 || text2.Length < 2) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入联系人,联系人长度必须是2-8位!", false); } else if (string.IsNullOrEmpty(this.hfLatitude.Value) || string.IsNullOrEmpty(this.hfLongitude.Value)) { this.ResetForm(storeById.StoreId); this.ShowMsg("请给门店标注定位!", false); } else if (text == "" || !DataHelper.IsTel(text)) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的联系电话(手机或者固定电话)!", false); } else { if (!string.IsNullOrEmpty(this.txtUserPwd.Text)) { if (this.txtUserPwd.Text.Length < 6 || this.txtUserPwd.Text.Length > 20) { this.ResetForm(storeById.StoreId); this.ShowMsg("密码长度必须在6到20个字符之间!", false); return; } managerInfo.Password = Users.EncodePassword(this.txtUserPwd.Text, managerInfo.PasswordSalt); } if (!this.chkIsSupportExpress.Checked && !this.chkIsAboveSelf.Checked && !this.chkIsStoreDelive.Checked) { this.ResetForm(storeById.StoreId); this.ShowMsg("请选择一种配送方式!", false); } else { if (this.chkIsStoreDelive.Checked) { if (!double.TryParse(this.txtServeRadius.Text.Trim(), out num) || num > 10000.0 || num <= 0.0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的配送半径,为大于0至10000之间的数字!", false); return; } if (!int.TryParse(this.txtStoreFreight.Text.Trim(), out num2) || num2 > 99999999 || num2 < 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的配送费", false); return; } if (!int.TryParse(this.txtMinOrderPrice.Text.Trim(), out num3) || num3 > 99999999 || num3 < 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的起送价", false); return; } } if (!decimal.TryParse(this.txtCommissionRate.Text.Trim(), out num4) || num4 > 100m || num4 < decimal.Zero) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的平台抽佣比例", false); } else if (!this.chkOfflinePay.Checked && !this.chkOnlinePay.Checked && !this.chkCashOnDelivery.Checked) { this.ResetForm(storeById.StoreId); this.ShowMsg("支付方式请至少选择一种", false); } else { storeById.IsOfflinePay = this.chkOfflinePay.Checked; storeById.IsOnlinePay = this.chkOnlinePay.Checked; storeById.IsCashOnDelivery = this.chkCashOnDelivery.Checked; if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartH.Text) || this.txtStoreOpenTimeStartH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartH.Text.ToInt(0) >= 24) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业起始小时", false); } else if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartM.Text) || this.txtStoreOpenTimeStartM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartM.Text.ToInt(0) >= 60) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业起始分钟", false); } else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndH.Text) || this.txtStoreOpenTimeEndH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndH.Text.ToInt(0) >= 24) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业结束小时", false); } else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndM.Text) || this.txtStoreOpenTimeEndM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndM.Text.ToInt(0) >= 60) { this.ResetForm(storeById.StoreId); this.ShowMsg("请输入正确的营业结束分钟", false); } else { string empty = string.Empty; DateTime dateTime = DateTime.Now; string text6 = dateTime.ToString("yyyy-MM-dd"); DateTime?nullable = (text6 + " " + this.txtStoreOpenTimeStartH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeStartM.Text.ToInt(0)).ToDateTime(); DateTime?nullable2 = (text6 + " " + this.txtStoreOpenTimeEndH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeEndM.Text.ToInt(0)).ToDateTime(); dateTime = nullable.Value; string str = dateTime.ToString("HH:mm"); dateTime = nullable2.Value; string text7 = dateTime.ToString("HH:mm"); if (text7 == "00:00") { nullable2 = (text6 + " 23:59").ToDateTime(); text7 = "23:59"; } empty = (storeById.StoreOpenTime = str + "-" + text7); storeById.OpenStartDate = nullable.Value; storeById.OpenEndDate = nullable2.Value; storeById.IsSupportExpress = (this.chkIsSupportExpress.Checked && true); storeById.IsAboveSelf = (this.chkIsAboveSelf.Checked && true); storeById.IsStoreDelive = (this.chkIsStoreDelive.Checked && true); storeById.Introduce = this.editDescription.Text; if (this.chkIsStoreDelive.Checked) { storeById.ServeRadius = num; storeById.MinOrderPrice = num3; storeById.StoreFreight = num2; } else { storeById.ServeRadius = 0.0; storeById.MinOrderPrice = null; storeById.StoreFreight = null; } storeById.CommissionRate = num4; List <string> list = RegionHelper.GetFullRegion(this.dropRegion.GetSelectedRegionId().Value, ",", true, 0).Split(',').Take(3) .ToList(); list.ForEach(delegate(string c) { Address = Address.Replace(c, string.Empty); }); IList <string> list2 = new List <string>(); string text9 = this.hidUploadImages.Value.Trim(); string[] array3 = text9.Split(','); for (int j = 0; j < array3.Length; j++) { if (!string.IsNullOrEmpty(array3[j])) { string text10 = Globals.SaveFile("depot", array3[j], "/Storage/master/", true, false, ""); string text11 = base.Request.MapPath(text10); string virtualPath = HiContext.Current.GetStoragePath() + "/depot/thum_" + text10.Substring(text10.LastIndexOf("/") + 1); if (!File.Exists(text11)) { this.ShowMsg("缩略图文件夹未创建,请联系管理员", false); return; } ResourcesHelper.CreateThumbnail(text11, base.Request.MapPath(virtualPath), 160, 160); list2.Add(text10); } } if (list2.Count == 0) { this.ResetForm(storeById.StoreId); this.ShowMsg("logo已失效或未上传,请上传门店logo", false); } else if (ManagerHelper.Update(managerInfo)) { int value = this.dropRegion.GetSelectedRegionId().Value; storeById.StoreName = text3; storeById.RegionId = value; storeById.TopRegionId = RegionHelper.GetCityId(value); storeById.Tel = text; storeById.Address = Address; storeById.ContactMan = text2; storeById.StoreImages = ((list2.Count == 0) ? string.Empty : string.Join(",", list2.ToArray())); storeById.Longitude = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLongitude.Value) ? "0" : this.hfLongitude.Value), 6); storeById.Latitude = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLatitude.Value) ? "0" : this.hfLatitude.Value), 6); storeById.FullRegionPath = RegionHelper.GetFullPath(value, true); StoresHelper.UpdateStore(storeById); HiCache.Remove("DataCache-StoreInfoDataKey"); if (dictionary.Count > 0 && this.chkIsStoreDelive.Checked) { StoresHelper.AddDeliveryScope(this.storeId, dictionary); } else { StoresHelper.DeleteDevlieryScope(this.storeId); } if (!string.IsNullOrEmpty(this.txtStoreTag.Text.Trim())) { IList <int> list3 = new List <int>(); string text12 = this.txtStoreTag.Text.Trim(); string[] array4 = null; array4 = ((!text12.Contains(",")) ? new string[1] { text12 } : text12.Split(',')); string[] array5 = array4; foreach (string value2 in array5) { list3.Add(Convert.ToInt32(value2)); } StoresHelper.DeleteStoreTags(this.storeId); StoresHelper.BindStoreTags(this.storeId, list3); } else { StoresHelper.DeleteStoreTags(this.storeId); } HiCache.Remove($"DataCache-StoreStateCacheKey-{storeById.StoreId}"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.OpenDadaLogistics) { DataTable dataTable = DepotHelper.SynchroDadaStoreList(this.storeId); if (dataTable != null && dataTable.Rows.Count > 0) { for (int l = 0; l < dataTable.Rows.Count; l++) { string station_name = dataTable.Rows[l]["StoreName"].ToNullString(); int business = 5; string city_name = dataTable.Rows[l]["CityName"].ToNullString().Replace("市", ""); string area_name = dataTable.Rows[l]["RegionName"].ToNullString(); string station_address = dataTable.Rows[l]["Address"].ToNullString(); double lng = dataTable.Rows[l]["Longitude"].ToDouble(0); double lat = dataTable.Rows[l]["Latitude"].ToDouble(0); string contact_name = dataTable.Rows[l]["ContactMan"].ToNullString(); string phone = dataTable.Rows[l]["Tel"].ToNullString(); string text13 = dataTable.Rows[l]["StoreId"].ToNullString(); string text14 = DadaHelper.shopUpdate(masterSettings.DadaSourceID, this.storeId.ToString(), "", station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, -1); } } } } } } } } }
public void bindReplaceInfo() { int replaceId = this.Page.Request["replaceId"].ToInt(0); ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId); if (replaceInfo == null) { this.ShowMsg("换货信息错误!", false); } else { OrderInfo orderInfo = TradeHelper.GetOrderInfo(replaceInfo.OrderId); HiddenField hiddenField = this.hidReplaceStatus; int num = (int)replaceInfo.HandleStatus; hiddenField.Value = num.ToString(); if (orderInfo == null) { this.ShowMsg("错误的订单信息!", false); } else { if (string.IsNullOrEmpty(replaceInfo.SkuId)) { this.listPrducts.DataSource = orderInfo.LineItems.Values; } else { Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>(); foreach (LineItemInfo value in orderInfo.LineItems.Values) { if (value.SkuId == replaceInfo.SkuId) { dictionary.Add(value.SkuId, value); } } this.listPrducts.DataSource = dictionary.Values; } this.txtAdminRemark.Text = replaceInfo.AdminRemark; this.listPrducts.DataBind(); this.litOrderId.Text = orderInfo.PayOrderId; this.litOrderTotal.Text = orderInfo.GetTotal(false).F2ToString("f2"); this.litRefundReason.Text = replaceInfo.ReplaceReason; this.litRemark.Text = replaceInfo.UserRemark; Literal literal = this.litReturnQuantity; num = replaceInfo.Quantity; literal.Text = num.ToString(); string userCredentials = replaceInfo.UserCredentials; if (!string.IsNullOrEmpty(userCredentials)) { string[] array = userCredentials.Split('|'); userCredentials = ""; string[] array2 = array; foreach (string str in array2) { userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str); } this.litImageList.Text = userCredentials; } else { this.divCredentials.Visible = false; } if (orderInfo.StoreId <= 0) { if (replaceInfo.HandleStatus == ReplaceStatus.Applied) { this.btnAcceptReplace.Visible = true; this.btnRefuseReplace.Visible = true; } else if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.btnGetAndSendGoods.Visible = true; } } if (replaceInfo.HandleStatus != 0) { this.txtAdminCellPhone.Visible = false; this.txtAdminShipAddress.Visible = false; this.txtAdminShipTo.Visible = false; this.litAdminCellPhone.Visible = true; this.litAdminShipAddrss.Visible = true; this.litAdminShipTo.Visible = true; this.litAdminCellPhone.Text = replaceInfo.AdminCellPhone; this.litAdminShipTo.Text = replaceInfo.AdminShipTo; this.litAdminShipAddrss.Text = replaceInfo.AdminShipAddress; } else if (orderInfo.SupplierId > 0) { ShippersInfo defaultGetGoodsShipperBysupplierId = SalesHelper.GetDefaultGetGoodsShipperBysupplierId(orderInfo.SupplierId); if (defaultGetGoodsShipperBysupplierId != null) { Literal literal2 = this.litAdminShipAddrss; TextBox textBox = this.txtAdminShipAddress; string text3 = literal2.Text = (textBox.Text = RegionHelper.GetFullRegion(defaultGetGoodsShipperBysupplierId.RegionId, " ", true, 0) + " " + defaultGetGoodsShipperBysupplierId.Address); Literal literal3 = this.litAdminShipTo; TextBox textBox2 = this.txtAdminShipTo; text3 = (literal3.Text = (textBox2.Text = defaultGetGoodsShipperBysupplierId.ShipperName)); Literal literal4 = this.litAdminCellPhone; TextBox textBox3 = this.txtAdminCellPhone; text3 = (literal4.Text = (textBox3.Text = defaultGetGoodsShipperBysupplierId.CellPhone)); } } else if (orderInfo.StoreId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(orderInfo.StoreId); if (storeById != null) { Literal literal5 = this.litAdminShipAddrss; TextBox textBox4 = this.txtAdminShipAddress; string text3 = literal5.Text = (textBox4.Text = RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address); Literal literal6 = this.litAdminShipTo; TextBox textBox5 = this.txtAdminShipTo; text3 = (literal6.Text = (textBox5.Text = storeById.ContactMan)); Literal literal7 = this.litAdminCellPhone; TextBox textBox6 = this.txtAdminCellPhone; text3 = (literal7.Text = (textBox6.Text = storeById.Tel)); } } else { ShippersInfo defaultOrFirstGetGoodShipper = TradeHelper.GetDefaultOrFirstGetGoodShipper(); if (defaultOrFirstGetGoodShipper != null) { Literal literal8 = this.litAdminShipAddrss; TextBox textBox7 = this.txtAdminShipAddress; string text3 = literal8.Text = (textBox7.Text = RegionHelper.GetFullRegion(defaultOrFirstGetGoodShipper.RegionId, " ", true, 0) + " " + defaultOrFirstGetGoodShipper.Address); Literal literal9 = this.litAdminShipTo; TextBox textBox8 = this.txtAdminShipTo; text3 = (literal9.Text = (textBox8.Text = defaultOrFirstGetGoodShipper.ShipperName)); Literal literal10 = this.litAdminCellPhone; TextBox textBox9 = this.txtAdminCellPhone; text3 = (literal10.Text = (textBox9.Text = defaultOrFirstGetGoodShipper.CellPhone)); } } if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery) { this.btnViewUserLogistic.Visible = true; AttributeCollection attributes = this.btnViewUserLogistic.Attributes; num = replaceInfo.ReplaceId; attributes.Add("replaceid", num.ToString()); this.btnViewUserLogistic.Attributes.Add("expresscompanyname", replaceInfo.UserExpressCompanyName.ToString()); this.btnViewUserLogistic.Attributes.Add("shipordernumber", replaceInfo.UserShipOrderNumber.ToString()); } if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced) { this.btnViewMallLogistic.Visible = true; AttributeCollection attributes2 = this.btnViewMallLogistic.Attributes; num = replaceInfo.ReplaceId; attributes2.Add("replaceid", num.ToString()); this.btnViewMallLogistic.Attributes.Add("expresscompanyname", replaceInfo.ExpressCompanyName.ToString()); this.btnViewMallLogistic.Attributes.Add("shipordernumber", replaceInfo.ShipOrderNumber.ToString()); } string str2 = string.IsNullOrEmpty(orderInfo.RealName) ? "" : (orderInfo.RealName.Replace("\n\r", "").Replace("\n", "").Replace("\r", "") + " (" + (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone) + ")"); str2 = str2 + orderInfo.ShippingRegion + " " + orderInfo.Address; this.litUserAddress.Text = str2; this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 0); Literal literal11 = this.txtAfterSaleId; num = replaceInfo.ReplaceId; literal11.Text = num.ToString(); if (orderInfo.SupplierId > 0) { this.btnGetAndSendGoods.Visible = false; } } } }
protected override void AttachChildControls() { this.inputPaymentModeId = (HtmlInputHidden)this.FindControl("inputPaymentModeId"); this.inputShippingModeId = (HtmlInputHidden)this.FindControl("inputShippingModeId"); this.hidPaymentId_Podrequest = (HtmlInputHidden)this.FindControl("hidPaymentId_Podrequest"); this.hidPaymentId_Offline = (HtmlInputHidden)this.FindControl("hidPaymentId_Offline"); this.hidGetgoodsOnStores = (HtmlInputHidden)this.FindControl("hidGetgoodsOnStores"); this.hidHasStoresInCity = (HtmlInputHidden)this.FindControl("hidHasStoresInCity"); this.hidDeliveryTime = (HtmlInputHidden)this.FindControl("hidDeliveryTime"); this.hidStoreId = (HtmlInputHidden)this.FindControl("hidStoreId"); this.hidShipAddressId = (HtmlInputHidden)this.FindControl("hidShipAddressId"); this.litStoreName = (Literal)this.FindControl("litStoreName"); this.litAddress = (Literal)this.FindControl("litAddress"); this.litTel = (Literal)this.FindControl("litTel"); this.hidOnlinePayCount = (HtmlInputHidden)this.FindControl("hidOnlinePayCount"); this.hidHasSupplierProduct = (HtmlInputHidden)this.FindControl("hidHasSupplierProduct"); if (!this.Page.IsPostBack) { this.hidHasSupplierProduct.Value = this.hasSupplierProduct.ToString(); this.hidOnlinePayCount.Value = TradeHelper.WapPaymentTypeCount(base.ClientType, this.isFightGroup).ToNullString(); this.hidGetgoodsOnStores.Value = "false"; this.hidHasStoresInCity.Value = "false"; this.hidPaymentId_Podrequest.Value = "0"; int num = 0; int num2 = 0; if (this.from != "countdown" && this.from != "groupbuy" && this.hasSupplierProduct != 1) { if (this.from != "presale" && SalesHelper.IsSupportPodrequest()) { num = 1; this.hidPaymentId_Podrequest.Value = "1"; } if (ShoppingProcessor.IsSupportOfflineRequest()) { this.hidPaymentId_Offline.Value = "2"; num2 = 2; } } if (this.paymentModeId != 0 && this.paymentModeId != num && this.paymentModeId != num2 && this.paymentModeId != -3) { this.paymentModeId = 0; } this.hidDeliveryTime.Value = this.deliveryTime; if (this.paymentModeId == 0) { if (TradeHelper.WapPaymentTypeCount(base.ClientType, this.isFightGroup) > 0) { this.inputPaymentModeId.Value = this.paymentModeId.ToString(); } } else { this.inputPaymentModeId.Value = this.paymentModeId.ToString(); } this.inputShippingModeId.Value = this.shippingModeId.ToString(); int shipAddressId = 0; int.TryParse(this.Page.Request.QueryString["ShipAddressId"].ToNullString(), out shipAddressId); IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(false); int regionId = 0; IList <ShippingAddressInfo> list = new List <ShippingAddressInfo>(); ShippingAddressInfo shippingAddressInfo = null; if (shipAddressId > 0) { shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo a) => a.ShippingId == shipAddressId); if (shippingAddressInfo != null) { regionId = shippingAddressInfo.RegionId; } } else if (shippingAddresses != null && shippingAddresses.Count > 0) { regionId = shippingAddresses.FirstOrDefault().RegionId; } this.hidShipAddressId.Value = shipAddressId.ToString(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.OpenMultStore) { this.hidStoreId.Value = this.storeId.ToString(); if (this.storeId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(this.storeId); this.litStoreName.Text = (string.IsNullOrEmpty(storeById.StoreOpenTime) ? storeById.StoreName : (storeById.StoreName + " [营业时间:" + storeById.StoreOpenTime + "]")); this.litAddress.Text = RegionHelper.GetFullRegion(storeById.RegionId, string.Empty, true, 0) + storeById.Address; this.litTel.Text = storeById.Tel; } if (this.from != "countdown" && this.from != "groupbuy" && this.from != "presale" && this.shoppingCart.LineItems.Count > 0) { string str = this.productSku.Replace(",", "','"); str = "'" + str + "'"; if (ShoppingCartProcessor.CanGetGoodsOnStore(str)) { this.hidGetgoodsOnStores.Value = "true"; bool flag = StoresHelper.HasStoresInCity(str, regionId); this.hidHasStoresInCity.Value = (flag ? "true" : "false"); } } else { this.hidGetgoodsOnStores.Value = "false"; } } } }
private void UserPayOrder() { if (this.Order.OrderStatus == OrderStatus.Closed) { OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款"); Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId); } else if (this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid) { base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}<br><a href=\"{2}\">查看订单</a></p>", this.OrderId, this.Amount.ToString("F"), this.GetReturnLink(this.Order.OrderSource))); } else { int maxCount = 0; int yetOrderNum = 0; int currentOrderNum = 0; if (this.Order.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { base.Response.Write($"<p style=\"font-size:16px;\">订单为团购订单,团购活动已结束,支付失败<br><a href=\"{this.GetReturnLink(this.Order.OrderSource)}\">查看订单</a></p>"); return; } yetOrderNum = TradeHelper.GetOrderCount(this.Order.GroupBuyId); currentOrderNum = this.Order.GetGroupBuyOerderNumber(); maxCount = groupBuy.MaxCount; if (maxCount < yetOrderNum + currentOrderNum) { base.Response.Write($"<p style=\"font-size:16px;\">订单为团购订单,订购数量超过订购总数,支付失败<br><a href=\"{this.GetReturnLink(this.Order.OrderSource)}\">查看订单</a></p>"); return; } } if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order)) { Task.Factory.StartNew(delegate { TradeHelper.UserPayOrder(this.Order, false, true); try { if (this.offlineOrder != null) { OrderHelper.UpdateOrderPaymentTypeOfAPI(this.Order); OrderHelper.ConfirmTakeGoods(this.Order, true); } if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum) { TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId); } if (this.Order.UserId != 0 && this.Order.UserId != 1100) { Hidistro.Entities.Members.MemberInfo user = Users.GetUser(this.Order.UserId); string verificationPasswords = ""; if (this.Order.OrderType == OrderType.ServiceOrder) { verificationPasswords = OrderHelper.GetVerificationPasswordsOfOrderId(this.Order.OrderId); } if (user != null) { Messenger.OrderPayment(user, this.Order, this.Order.GetTotal(false), verificationPasswords); } } StoresInfo storesInfo = null; if (this.Order.StoreId > 0) { storesInfo = DepotHelper.GetStoreById(this.Order.StoreId); } if (storesInfo != null) { VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderPayed); if (this.offlineOrder == null) { if (this.Order.ShippingModeId == -2) { VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.TakeOnStoreOrderWaitConfirm); } else { VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderWaitSendGoods); } } } if (this.offlineOrder == null) { ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0); Messenger.OrderPaymentToShipper(defaultOrFirstShipper, storesInfo, null, this.Order, this.Order.GetTotal(false)); } this.Order.OnPayment(); } catch (Exception ex) { IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("ErrorMessage", ex.Message); dictionary.Add("StackTrace", ex.StackTrace); if (ex.InnerException != null) { dictionary.Add("InnerException", ex.InnerException.ToString()); } if (ex.GetBaseException() != null) { dictionary.Add("BaseException", ex.GetBaseException().Message); } if (ex.TargetSite != (MethodBase)null) { dictionary.Add("TargetSite", ex.TargetSite.ToString()); } dictionary.Add("ExSource", ex.Source); Globals.AppendLog(dictionary, "支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay"); } this.Order.OnPayment(); }); base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}<br><a href=\"{2}\">查看订单</a></p>", this.OrderId, this.Amount.ToString("F"), this.GetReturnLink(this.Order.OrderSource))); } else { base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}<br><a href=\"{2}\">查看订单</a></p>", this.OrderId, this.Amount.ToString("F"), this.GetReturnLink(this.Order.OrderSource))); } } }
public void SerachNearStore(HttpContext context) { string text = Globals.UrlDecode(context.Request["fromLatLng"].ToNullString()); string text2 = context.Request["changeStore"].ToNullString(); int num = context.Request["storeSource"].ToInt(0); int num2 = context.Request["storeId"].ToInt(0); context.Response.ContentType = "text/json"; if (string.IsNullOrEmpty(text)) { context.Response.Write("{\"Status\":\"noLatLng\",\"Message\":\"定位失败!\"}"); } else { try { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (!masterSettings.OpenMultStore) { context.Response.Write("{\"Status\":\"platform\",\"Message\":\"进入平台页面!\"}"); } else { DateTime now; if ((num == 2 || num == 3 || num == 4) && num2 > 0) { string value = num2.ToString(); now = DateTime.Now; WebHelper.SetCookie("UserCoordinateCookie", "StoreId", value, now.AddDays(10.0)); now = DateTime.Now; WebHelper.SetCookie("UserCoordinateCookie", "StoreType", "2", now.AddDays(10.0)); string userCoordinateTimeCookieName = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value2 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName, value2, now.AddMinutes(10.0), null, true); } string store_PositionRouteTo = masterSettings.Store_PositionRouteTo; text = text.Trim().Replace(" ", ""); MemberInfo user = HiContext.Current.User; int num3 = WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "StoreType").ToInt(0); int num4 = WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "StoreId").ToInt(0); string cookie = WebHelper.GetCookie(DepotHandler.UserCoordinateTimeCookieName); string cookie2 = WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Coordinate"); if (num4 > 0) { StoresInfo storeById = StoresHelper.GetStoreById(num4); if (storeById == null || storeById.State == 0) { num4 = 0; } } if (num2 > 0) { StoresInfo storeById2 = StoresHelper.GetStoreById(num2); if (storeById2 == null || storeById2.State == 0) { num2 = 0; } } if (num == 4 && num2 > 0) { DepotHelper.CookieUserCoordinate(text); context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num2 + "\"}"); } else if (num3 == 2 && num4 > 0 && num > 1 && !string.IsNullOrEmpty(cookie)) { context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}"); } else if (store_PositionRouteTo.Equals("NearestStore")) { if (!string.IsNullOrEmpty(cookie) && num3 == 2 && num4 > 0) { context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}"); } else if (!string.IsNullOrEmpty(text2) && text2.Equals("0") && num4 > 0) { string userCoordinateTimeCookieName2 = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value3 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName2, value3, now.AddMinutes(10.0), null, true); string userCoordinateCookieName = DepotHandler.UserCoordinateCookieName; string value4 = text; now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName, "NewCoordinate", value4, now.AddMinutes(10.0)); context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}"); } else if (user != null && user.StoreId > 0 && masterSettings.Store_IsMemberVisitBelongStore) { DepotHelper.CookieUserCoordinate(text); context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + user.StoreId + "\"}"); } else if (!string.IsNullOrEmpty(cookie) && !string.IsNullOrEmpty(cookie2) && num4 > 0) { context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}"); } else if (string.IsNullOrEmpty(cookie) && !string.IsNullOrEmpty(cookie2) && num4 > 0 && string.IsNullOrEmpty(text2)) { string[] array = cookie2.Split(','); PositionInfo degree = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0)); string[] array2 = text.Split(','); PositionInfo degree2 = new PositionInfo(array2[0].ToDouble(0), array2[1].ToDouble(0)); double distance = MapHelper.GetDistance(degree, degree2); if (distance > 500.0) { string text3 = ""; string text4 = ""; string text5 = ""; string text6 = ""; string text7 = ""; DepotHelper.GetAddressByLatLng(text, ref text3, ref text4, ref text5, ref text6, ref text7); string text8 = HttpUtility.UrlEncode(string.IsNullOrWhiteSpace(text3) ? text7 : text3); context.Response.Write("{\"Status\":\"tipChange\",\"Message\":\"提示切换!\",\"Addr\":\"" + text8 + "\",\"fromLatLng\":\"" + text + "\"}"); } else { string userCoordinateTimeCookieName3 = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value5 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName3, value5, now.AddMinutes(10.0), null, true); string userCoordinateCookieName2 = DepotHandler.UserCoordinateCookieName; string value6 = text; now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName2, "NewCoordinate", value6, now.AddMinutes(10.0)); context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + num4 + "\"}"); } } else { StoresInfo nearDeliveStores = DepotHelper.GetNearDeliveStores(text, false); if (nearDeliveStores == null || nearDeliveStores.StoreId <= 0) { string store_PositionNoMatchTo = masterSettings.Store_PositionNoMatchTo; if (store_PositionNoMatchTo == "Platform") { context.Response.Write("{\"Status\":\"noStoreToPlatform\",\"Message\":\"进入平台页面!\"}"); } else { context.Response.Write("{\"Status\":\"nothing\",\"Message\":\"进入无平台提示页面!\"}"); } } else { context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + nearDeliveStores.StoreId + "\"}"); } } } else if (store_PositionRouteTo.Equals("StoreList")) { if (!string.IsNullOrEmpty(text2) && text2.Equals("0")) { string userCoordinateTimeCookieName4 = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value7 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName4, value7, now.AddMinutes(10.0), null, true); string userCoordinateCookieName3 = DepotHandler.UserCoordinateCookieName; string value8 = text; now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName3, "NewCoordinate", value8, now.AddMinutes(10.0)); context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Address") + "\",\"Message\":\"进入多门店首页!\"}"); } else if (!string.IsNullOrEmpty(text2) && text2.Equals("1")) { string userCoordinateTimeCookieName5 = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value9 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName5, value9, now.AddMinutes(10.0), null, true); string str = DepotHelper.CookieUserCoordinate(text); context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + str + "\",\"Message\":\"进入多门店首页!\"}"); } else if (string.IsNullOrEmpty(cookie) && !string.IsNullOrEmpty(cookie2) && string.IsNullOrEmpty(text2)) { string[] array3 = cookie2.Split(','); PositionInfo degree3 = new PositionInfo(array3[0].ToDouble(0), array3[1].ToDouble(0)); string[] array4 = text.Split(','); PositionInfo degree4 = new PositionInfo(array4[0].ToDouble(0), array4[1].ToDouble(0)); double distance2 = MapHelper.GetDistance(degree3, degree4); if (distance2 > 500.0) { string text9 = ""; string text10 = ""; string text11 = ""; string text12 = ""; string text13 = ""; DepotHelper.GetAddressByLatLng(text, ref text9, ref text10, ref text11, ref text12, ref text13); string text14 = HttpUtility.UrlEncode(string.IsNullOrWhiteSpace(text9) ? text13 : text9); context.Response.Write("{\"Status\":\"tipChange\",\"Message\":\"提示切换!\",\"Addr\":\"" + text14 + "\",\"fromLatLng\":\"" + text + "\"}"); } else { string userCoordinateTimeCookieName6 = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value10 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName6, value10, now.AddMinutes(10.0), null, true); string userCoordinateCookieName4 = DepotHandler.UserCoordinateCookieName; string value11 = text; now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName4, "NewCoordinate", value11, now.AddDays(10.0)); context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Address") + "\",\"Message\":\"进入多门店首页!\"}"); } } else if (string.IsNullOrEmpty(cookie2)) { string userCoordinateTimeCookieName7 = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value12 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName7, value12, now.AddMinutes(10.0), null, true); string str2 = DepotHelper.CookieUserCoordinate(text); context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + str2 + "\",\"Message\":\"进入多门店首页!\"}"); } else { context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Address") + "\",\"Message\":\"进入多门店首页!\"}"); } } else if (store_PositionRouteTo.Equals("Platform")) { if (string.IsNullOrEmpty(cookie2) || string.IsNullOrEmpty(cookie)) { DepotHelper.CookieUserCoordinate(text); } if (user != null && user.StoreId > 0 && masterSettings.Store_IsMemberVisitBelongStore) { context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + user.StoreId + "\"}"); } else { context.Response.Write("{\"Status\":\"platform\",\"Addr\":\"" + WebHelper.GetCookie(DepotHandler.UserCoordinateCookieName, "Address") + "\",\"Message\":\"进入平台页面!\"}"); } } } } catch (Exception ex) { context.Response.Write("{\"Status\":\"error\",\"Message\":\"" + ex.Message + "\"}"); } } }
private void SaveNewStock() { List <StoreSKUInfo> list = new List <StoreSKUInfo>(); int storeId = HiContext.Current.Manager.StoreId; List <StoreStockLogInfo> list2 = new List <StoreStockLogInfo>(); decimal num = default(decimal); if (this.grdSelectedProducts.Items.Count > 0) { StoresInfo storeById = DepotHelper.GetStoreById(HiContext.Current.Manager.StoreId); foreach (RepeaterItem item in this.grdSelectedProducts.Items) { TextBox textBox = item.FindControl("txtStoreSalePrice") as TextBox; num = textBox.Text.Trim().ToDecimal(0); if (num >= decimal.Zero) { HiddenField hiddenField = item.FindControl("txtOldStoreSalePrice") as HiddenField; if (num != hiddenField.Value.ToDecimal(0)) { HiddenField hiddenField2 = item.FindControl("hidSKUContent") as HiddenField; TextBox textBox2 = item.FindControl("txtRemark") as TextBox; HiddenField hiddenField3 = item.FindControl("HidSkuId") as HiddenField; HiddenField hiddenField4 = item.FindControl("HidProductId") as HiddenField; string value = hiddenField3.Value; int num2 = hiddenField4.Value.ToInt(0); StoreSKUInfo storeSKUInfo = new StoreSKUInfo(); storeSKUInfo.ProductID = num2; storeSKUInfo.SkuId = value; storeSKUInfo.StoreId = storeId; storeSKUInfo.StoreSalePrice = num; list.Add(storeSKUInfo); HiddenField hiddenField5 = item.FindControl("hidOldSalePrice") as HiddenField; decimal num3 = hiddenField5.Value.ToDecimal(0); decimal? minPriceRate = storeById.MinPriceRate; if (minPriceRate.GetValueOrDefault() > default(decimal) && minPriceRate.HasValue) { decimal d = num; decimal value2 = num3; decimal?minPriceRate2 = storeById.MinPriceRate; minPriceRate = (decimal?)value2 * minPriceRate2; if (d < minPriceRate.GetValueOrDefault() && minPriceRate.HasValue) { this.ShowMsg("门店价格不能小于平台价格的" + storeById.MinPriceRate.Value.F2ToString("f2") + "倍!", false); return; } } minPriceRate = storeById.MaxPriceRate; if (minPriceRate.GetValueOrDefault() > default(decimal) && minPriceRate.HasValue) { decimal d2 = num; decimal value2 = num3; decimal?minPriceRate2 = storeById.MaxPriceRate; minPriceRate = (decimal?)value2 * minPriceRate2; if (d2 > minPriceRate.GetValueOrDefault() && minPriceRate.HasValue) { this.ShowMsg("门店价格不能大于平台价格的" + storeById.MaxPriceRate.Value.F2ToString("f2") + "倍!", false); return; } } StoreStockLogInfo storeStockLogInfo = new StoreStockLogInfo(); storeStockLogInfo.ProductId = num2; storeStockLogInfo.Remark = DataHelper.CleanSearchString(string.IsNullOrEmpty(textBox2.Text.Trim()) ? this.txtComment.Text.Trim() : textBox2.Text.Trim()); storeStockLogInfo.SkuId = value; storeStockLogInfo.Operator = HiContext.Current.Manager.UserName; storeStockLogInfo.StoreId = storeId; storeStockLogInfo.ChangeTime = DateTime.Now; storeStockLogInfo.Content = hiddenField2.Value + "售价由【" + hiddenField.Value.ToDecimal(0).F2ToString("f2") + "】修改为【" + num.F2ToString("f2") + "】"; list2.Add(storeStockLogInfo); } } } if (list.Count > 0) { if (StoresHelper.SaveStoreStock(list, list2, 3)) { base.CloseWindow(null); this.BindProduct(); } else { this.ShowMsg("保存失败!", false); } } else { base.CloseWindow(null); } } }
public void bindReturnInfo() { int returnId = this.Page.Request["ReturnId"].ToInt(0); ReturnInfo returnInfo = TradeHelper.GetReturnInfo(returnId); if (returnInfo == null) { this.ShowMsg("退货信息错误!", false); } else { HiddenField hiddenField = this.hidReturnStatus; int num = (int)returnInfo.HandleStatus; hiddenField.Value = num.ToString(); OrderInfo orderInfo = TradeHelper.GetOrderInfo(returnInfo.OrderId); if (orderInfo == null) { this.ShowMsg("错误的订单信息!", false); } else { if (string.IsNullOrEmpty(returnInfo.SkuId)) { this.listPrducts.DataSource = orderInfo.LineItems.Values; } else { Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>(); foreach (LineItemInfo value in orderInfo.LineItems.Values) { if (value.SkuId == returnInfo.SkuId) { dictionary.Add(value.SkuId, value); } } this.listPrducts.DataSource = dictionary.Values; } this.listPrducts.DataBind(); this.litOrderId.Text = orderInfo.PayOrderId; this.litOrderTotal.Text = orderInfo.GetTotal(false).F2ToString("f2"); this.litRefundReason.Text = returnInfo.ReturnReason; this.litRefundTotal.Text = returnInfo.RefundAmount.F2ToString("f2"); this.litRemark.Text = returnInfo.UserRemark; Literal literal = this.litReturnQuantity; num = returnInfo.Quantity; literal.Text = num.ToString(); if (returnInfo.RefundType == RefundTypes.InBankCard) { this.litType.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.RefundType, 0) + "(" + returnInfo.BankName + " " + returnInfo.BankAccountName + " " + returnInfo.BankAccountNo + ")"; } else { this.litType.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.RefundType, 0); } string userCredentials = returnInfo.UserCredentials; if (!string.IsNullOrEmpty(userCredentials)) { string[] array = userCredentials.Split('|'); userCredentials = ""; string[] array2 = array; foreach (string str in array2) { userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str); } this.litImageList.Text = userCredentials; } else { this.divCredentials.Visible = false; } if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund) { this.btnAcceptReturn.Text = "确认退款"; this.btnRefuseReturn.Text = "拒绝退款"; this.AfterSaleType = "退款"; } if (returnInfo.HandleStatus == ReturnStatus.Applied && !orderInfo.IsStoreCollect) { this.btnAcceptReturn.Visible = true; this.btnRefuseReturn.Visible = true; } if (returnInfo.HandleStatus == ReturnStatus.Deliverying && this.UserStoreId > 0 && !orderInfo.IsStoreCollect) { this.btnGetGoods.Visible = true; } if ((orderInfo.StoreId == this.UserStoreId || orderInfo.StoreId <= 0 || (!orderInfo.IsStoreCollect && this.UserStoreId == 0)) && (returnInfo.HandleStatus == ReturnStatus.GetGoods || (returnInfo.HandleStatus == ReturnStatus.Deliverying && orderInfo.StoreId <= 0))) { if (returnInfo.HandleStatus == ReturnStatus.Deliverying) { this.btnFinishReturn.Text = "确认收货并完成退款"; } this.btnFinishReturn.Visible = true; } if (returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) { this.inputPanel.Visible = true; this.showPanel.Visible = false; } else { this.inputPanel.Visible = false; this.showPanel.Visible = true; } if (returnInfo.HandleStatus != 0) { this.txtAdminCellPhone.Visible = false; this.txtAdminShipAddress.Visible = false; this.txtAdminShipTo.Visible = false; this.litAdminCellPhone.Visible = true; this.litAdminShipAddrss.Visible = true; this.litAdminShipTo.Visible = true; this.litAdminCellPhone.Text = returnInfo.AdminCellPhone; this.litAdminShipTo.Text = returnInfo.AdminShipTo; this.litAdminShipAddrss.Text = returnInfo.AdminShipAddress; } else if (orderInfo.SupplierId > 0) { ShippersInfo defaultGetGoodsShipperBysupplierId = SalesHelper.GetDefaultGetGoodsShipperBysupplierId(orderInfo.SupplierId); if (defaultGetGoodsShipperBysupplierId != null) { Literal literal2 = this.litAdminShipAddrss; TextBox textBox = this.txtAdminShipAddress; string text3 = literal2.Text = (textBox.Text = RegionHelper.GetFullRegion(defaultGetGoodsShipperBysupplierId.RegionId, " ", true, 0) + " " + defaultGetGoodsShipperBysupplierId.Address); Literal literal3 = this.litAdminShipTo; TextBox textBox2 = this.txtAdminShipTo; text3 = (literal3.Text = (textBox2.Text = defaultGetGoodsShipperBysupplierId.ShipperName)); Literal literal4 = this.litAdminCellPhone; TextBox textBox3 = this.txtAdminCellPhone; text3 = (literal4.Text = (textBox3.Text = defaultGetGoodsShipperBysupplierId.CellPhone)); } } else if (orderInfo.StoreId > 0) { StoresInfo storeById = DepotHelper.GetStoreById(orderInfo.StoreId); if (storeById != null) { Literal literal5 = this.litAdminShipAddrss; TextBox textBox4 = this.txtAdminShipAddress; string text3 = literal5.Text = (textBox4.Text = RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address); Literal literal6 = this.litAdminShipTo; TextBox textBox5 = this.txtAdminShipTo; text3 = (literal6.Text = (textBox5.Text = storeById.ContactMan)); Literal literal7 = this.litAdminCellPhone; TextBox textBox6 = this.txtAdminCellPhone; text3 = (literal7.Text = (textBox6.Text = storeById.Tel)); } } else { ShippersInfo defaultOrFirstGetGoodShipper = TradeHelper.GetDefaultOrFirstGetGoodShipper(); if (defaultOrFirstGetGoodShipper != null) { Literal literal8 = this.litAdminShipAddrss; TextBox textBox7 = this.txtAdminShipAddress; string text3 = literal8.Text = (textBox7.Text = RegionHelper.GetFullRegion(defaultOrFirstGetGoodShipper.RegionId, " ", true, 0) + " " + defaultOrFirstGetGoodShipper.Address); Literal literal9 = this.litAdminShipTo; TextBox textBox8 = this.txtAdminShipTo; text3 = (literal9.Text = (textBox8.Text = defaultOrFirstGetGoodShipper.ShipperName)); Literal literal10 = this.litAdminCellPhone; TextBox textBox9 = this.txtAdminCellPhone; text3 = (literal10.Text = (textBox9.Text = defaultOrFirstGetGoodShipper.CellPhone)); } } this.litRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2") + "元"; this.txtAdminRemark.Text = returnInfo.AdminRemark; if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund) { this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 3); } else { this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 0); } this.litRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2") + "元"; Literal literal11 = this.txtAfterSaleId; num = returnInfo.ReturnId; literal11.Text = num.ToString(); this.txtPayMoney.Text = orderInfo.GetTotal(false).F2ToString("f2"); this.txtRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2"); HiddenField hiddenField2 = this.hidAfterSaleType; num = (int)returnInfo.AfterSaleType; hiddenField2.Value = num.ToString(); this.hidRefundMaxAmount.Value = orderInfo.GetCanRefundAmount(returnInfo.SkuId, null, 0).F2ToString("f2"); if (returnInfo.AfterSaleType == AfterSaleTypes.ReturnAndRefund && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned)) { this.btnViewLogistic.Visible = true; AttributeCollection attributes = this.btnViewLogistic.Attributes; num = returnInfo.ReturnId; attributes.Add("returnsid", num.ToString()); AttributeCollection attributes2 = this.btnViewLogistic.Attributes; num = returnInfo.ReturnId; attributes2.Add("returnsid", num.ToString()); this.btnViewLogistic.Attributes.Add("expresscompanyname", returnInfo.ExpressCompanyName.ToString()); this.btnViewLogistic.Attributes.Add("shipordernumber", returnInfo.ShipOrderNumber.ToString()); } if (orderInfo.SupplierId > 0) { this.btnGetGoods.Visible = false; } } } }
private void UserPayOrder() { if (this.Order != null && this.Order.OrderStatus == OrderStatus.Closed) { OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款"); Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId); this.ResponseReturn(true, ""); } else if ((this.Order != null && this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid) || (this.offlineOrder != null && this.offlineOrder.Status == 1)) { this.ResponseReturn(true, ""); } else { try { int maxCount = 0; int yetOrderNum = 0; int currentOrderNum = 0; if (this.Order != null) { if (this.Order.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { return; } yetOrderNum = TradeHelper.GetOrderCount(this.Order.GroupBuyId); currentOrderNum = this.Order.GetGroupBuyOerderNumber(); maxCount = groupBuy.MaxCount; if (maxCount < yetOrderNum + currentOrderNum) { return; } } if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order)) { Task.Factory.StartNew(delegate { TradeHelper.UserPayOrder(this.Order, false, true); try { if (this.offlineOrder != null) { OrderHelper.UpdateOrderPaymentTypeOfAPI(this.Order); OrderHelper.ConfirmTakeGoods(this.Order, true); } if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum) { TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId); } if (this.Order.UserId != 0 && this.Order.UserId != 1100) { string verificationPasswords = ""; if (this.Order.OrderType == OrderType.ServiceOrder) { verificationPasswords = OrderHelper.GetVerificationPasswordsOfOrderId(this.Order.OrderId); } Hidistro.Entities.Members.MemberInfo user = Users.GetUser(this.Order.UserId); if (user != null) { Messenger.OrderPayment(user, this.Order, this.Order.GetTotal(true), verificationPasswords); } } StoresInfo storesInfo2 = null; if (this.Order.StoreId > 0) { storesInfo2 = DepotHelper.GetStoreById(this.Order.StoreId); } if (storesInfo2 != null) { VShopHelper.AppPsuhRecordForStore(storesInfo2.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderPayed); if (this.offlineOrder == null) { if (this.Order.ShippingModeId == -2) { VShopHelper.AppPsuhRecordForStore(storesInfo2.StoreId, this.Order.OrderId, "", EnumPushStoreAction.TakeOnStoreOrderWaitConfirm); } else { VShopHelper.AppPsuhRecordForStore(storesInfo2.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderWaitSendGoods); } } } if (this.offlineOrder == null) { ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0); Messenger.OrderPaymentToShipper(defaultOrFirstShipper, storesInfo2, null, this.Order, this.Order.GetTotal(true)); } this.Order.OnPayment(); } catch (Exception ex2) { IDictionary <string, string> dictionary2 = new Dictionary <string, string>(); dictionary2.Add("ErrorMessage", ex2.Message); dictionary2.Add("StackTrace", ex2.StackTrace); if (ex2.InnerException != null) { dictionary2.Add("InnerException", ex2.InnerException.ToString()); } if (ex2.GetBaseException() != null) { dictionary2.Add("BaseException", ex2.GetBaseException().Message); } if (ex2.TargetSite != (MethodBase)null) { dictionary2.Add("TargetSite", ex2.TargetSite.ToString()); } dictionary2.Add("ExSource", ex2.Source); Globals.AppendLog(dictionary2, "支付更新订单收款记录或者消息通知时出错:" + ex2.Message, "", "", "UserPay"); } this.Order.OnPayment(); this.ResponseReturn(true, ""); }); } if (this.Order.FightGroupId > 0) { VShopHelper.SetFightGroupSuccess(this.Order.FightGroupId); } } if (this.offlineOrder != null && this.offlineOrder.Status == 0) { this.offlineOrder.Status = 1; this.offlineOrder.PayTime = DateTime.Now; if (StoresHelper.UpdateStoreCollectionInfo(this.offlineOrder) && this.isOfflineOrder) { string text = ""; StoresInfo storeById = DepotHelper.GetStoreById(this.offlineOrder.StoreId); if (storeById != null) { text = storeById.StoreName; StoreBalanceDetailInfo storeBalanceDetailInfo = new StoreBalanceDetailInfo(); storeBalanceDetailInfo.StoreId = this.offlineOrder.StoreId; storeBalanceDetailInfo.TradeDate = DateTime.Now; storeBalanceDetailInfo.TradeType = StoreTradeTypes.OfflineCashier; storeBalanceDetailInfo.Expenses = default(decimal); storeBalanceDetailInfo.Income = this.offlineOrder.PayAmount; storeBalanceDetailInfo.Balance = storeById.Balance + this.offlineOrder.PayAmount; storeBalanceDetailInfo.Remark = "线下收银(" + this.offlineOrder.OrderId + ")"; storeBalanceDetailInfo.ManagerUserName = ""; storeBalanceDetailInfo.TradeNo = this.offlineOrder.OrderId; storeBalanceDetailInfo.CreateTime = DateTime.Now; storeBalanceDetailInfo.PlatCommission = decimal.Zero; if (StoreBalanceHelper.AddBalanceDetailInfo(storeBalanceDetailInfo)) { StoresInfo storesInfo = storeById; storesInfo.Balance += this.offlineOrder.PayAmount; StoresHelper.UpdateStore(storeById); } } if (storeById != null) { VShopHelper.AppPsuhRecordForStore(storeById.StoreId, this.offlineOrder.OrderId, "", EnumPushStoreAction.StoreOrderPayed); } } } } catch (Exception ex) { IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("ErrorMessage", ex.Message); dictionary.Add("StackTrace", ex.StackTrace); if (ex.InnerException != null) { dictionary.Add("InnerException", ex.InnerException.ToString()); } if (ex.GetBaseException() != null) { dictionary.Add("BaseException", ex.GetBaseException().Message); } if (ex.TargetSite != (MethodBase)null) { dictionary.Add("TargetSite", ex.TargetSite.ToString()); } dictionary.Add("ExSource", ex.Source); Globals.AppendLog(dictionary, "支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay1"); } this.ResponseReturn(true, ""); } }
public void SaveUploadFile() { string text = HiContext.Current.GetStoragePath() + "depot/"; string originalSavePath = HttpContext.Current.Server.MapPath(text); string tempPath = HiContext.Current.GetStoragePath() + "temp/"; if (!Globals.PathExist(text, false)) { Globals.CreatePath(text); } string[] source = this.hidOldImages.Value.Trim().Split(','); string text2 = this.hidUploadImages.Value.Trim(); string[] aryImgs = text2.Split(','); List <string> list = (from a in source where !aryImgs.Contains(a) && a.Length > 0 select a).ToList(); list.ForEach(delegate(string c) { c = c.Replace("//", "/"); if (c.Length > 0 && !c.Contains("http:")) { string str = c.Split('/')[4]; string path = originalSavePath + str; if (File.Exists(path)) { File.Delete(path); } string path2 = HttpContext.Current.Server.MapPath(tempPath + str); if (File.Exists(path2)) { File.Delete(path2); } } }); string text3 = ""; foreach (string text4_i in aryImgs) { string text4 = text4_i.Replace("//", "/"); if (text4.Length != 0) { if (text4.Contains("http:") || text4.Contains("https:")) { text3 = ((!(text3 == "")) ? (text3 + "," + text4) : text4); } else { string text5 = (text4.Split('/').Length == 6) ? text4.Split('/')[5] : text4.Split('/')[4]; if (File.Exists(originalSavePath + text5)) { text3 = ((!(text3 == "")) ? (text3 + "," + text + text5) : (text + text5)); } else if (File.Exists(HttpContext.Current.Server.MapPath(text4))) { File.Copy(HttpContext.Current.Server.MapPath(text4), originalSavePath + text5); if (File.Exists(HttpContext.Current.Server.MapPath(text4))) { File.Delete(HttpContext.Current.Server.MapPath(text4)); } text3 = ((!(text3 == "")) ? (text3 + "," + text + text5) : (text + text5)); } } } } DepotHelper.UpdateStoreSlideImages(HiContext.Current.Manager.StoreId, text3); if (this.hidProductIds.Value != "") { WeChartAppletHelper.AddChoiceProdcutByPC(this.hidProductIds.Value, HiContext.Current.Manager.StoreId); } }
private void QueryDeliverFee(HttpContext context) { StoresInfo storeById = StoresHelper.GetStoreById(HiContext.Current.Manager.StoreId); string text = context.Request["OrderId"].ToNullString(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (string.IsNullOrEmpty(text)) { context.Response.Write(this.GetFailResultJson("订单号不能为空")); } else { OrderInfo orderInfo = TradeHelper.GetOrderInfo(text); if (orderInfo == null) { context.Response.Write(this.GetFailResultJson("错误的订单号")); } else if (orderInfo.StoreId != HiContext.Current.Manager.StoreId) { context.Response.Write(this.GetFailResultJson("订单不是此门店的")); } else if ((orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid && (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1)))) || orderInfo.RealShippingModeId == -2) { context.Response.Write(this.GetFailResultJson("错误的订单状态")); } else { DataTable dataTable = DepotHelper.SynchroDadaStoreList(storeById.StoreId); if (!orderInfo.ShippingRegion.Contains(dataTable.Rows[0]["CityName"].ToString())) { context.Response.Write(this.GetFailResultJson("配送范围超区,无法配送")); } else { string text2 = ""; try { string value = DadaHelper.cityCodeList(masterSettings.DadaSourceID); JObject jObject = JsonConvert.DeserializeObject(value) as JObject; JArray jArray = (JArray)jObject["result"]; foreach (JToken item in (IEnumerable <JToken>)jArray) { if (orderInfo.ShippingRegion.Contains(item["cityName"].ToString())) { text2 = item["cityCode"].ToString(); break; } } } catch { } if (text2 == "") { context.Response.Write(this.GetFailResultJson("配送范围超区,无法配送")); } else { string shop_no = orderInfo.StoreId.ToNullString(); string orderId = orderInfo.OrderId; string city_code = text2; double cargo_price = orderInfo.GetTotal(false).F2ToString("f2").ToDouble(0); int is_prepay = 0; long expected_fetch_time = Globals.DateTimeToUnixTimestamp(DateTime.Now.AddMinutes(15.0)); string shipTo = orderInfo.ShipTo; string address = orderInfo.Address; string latLng = orderInfo.LatLng; if (string.IsNullOrWhiteSpace(latLng)) { ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId); latLng = shippingAddress.LatLng; } double receiver_lat = latLng.Split(',')[0].ToDouble(0); double receiver_lng = latLng.Split(',')[1].ToDouble(0); string callback = Globals.FullPath("/pay/dadaOrderNotify"); string cellPhone = orderInfo.CellPhone; string telPhone = orderInfo.TelPhone; bool isQueryDeliverFee = true; string value2 = DadaHelper.addOrder(masterSettings.DadaSourceID, shop_no, orderId, city_code, cargo_price, is_prepay, expected_fetch_time, shipTo, address, receiver_lat, receiver_lng, callback, cellPhone, telPhone, -1.0, -1.0, -1.0, -1.0, -1L, "", -1, -1.0, -1, -1L, "", "", "", false, isQueryDeliverFee); JObject jObject2 = JsonConvert.DeserializeObject(value2) as JObject; string a = jObject2["status"].ToString(); if (a == "success") { JObject jObject3 = JsonConvert.DeserializeObject(jObject2["result"].ToString()) as JObject; string s = JsonConvert.SerializeObject(new { Result = new { Status = "SUCCESS", distance = jObject3["distance"].ToNullString(), fee = "预计运费:¥" + jObject3["fee"].ToNullString(), deliveryNo = jObject3["deliveryNo"].ToNullString() } }); context.Response.Write(s); context.Response.End(); } else { context.Response.Write(this.GetFailResultJson(jObject2["msg"].ToNullString())); } } } } } }
private void UserPayOrder() { if (this.Order != null && this.Order.OrderStatus == OrderStatus.Closed) { OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款"); Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId); base.Response.Write("success"); } else if (this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid) { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "订单状态为已支付", "", "", "alipay"); base.Response.Write("success"); } else { int maxCount = 0; int yetOrderNum = 0; int currentOrderNum = 0; if (this.Order.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "错误的团购信息或者状态", "", "", "alipay"); base.Response.Write("success"); return; } yetOrderNum = TradeHelper.GetOrderCount(this.Order.GroupBuyId); currentOrderNum = this.Order.GetGroupBuyOerderNumber(); maxCount = groupBuy.MaxCount; if (maxCount < yetOrderNum + currentOrderNum) { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "团购数量已超过指定数量错", "", "", "alipay"); base.Response.Write("success"); return; } } if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order)) { Task.Factory.StartNew(delegate { TradeHelper.UserPayOrder(this.Order, false, true); try { if (this.offlineOrder != null) { OrderHelper.UpdateOrderPaymentTypeOfAPI(this.Order); OrderHelper.ConfirmTakeGoods(this.Order, true); } if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum) { TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId); } if (this.Order.UserId != 0 && this.Order.UserId != 1100) { Hidistro.Entities.Members.MemberInfo user = Users.GetUser(this.Order.UserId); string verificationPasswords = ""; if (this.Order.OrderType == OrderType.ServiceOrder) { verificationPasswords = OrderHelper.GetVerificationPasswordsOfOrderId(this.Order.OrderId); } if (user != null) { Messenger.OrderPayment(user, this.Order, this.Order.GetTotal(false), verificationPasswords); } } StoresInfo storesInfo = null; if (this.Order.StoreId > 0) { storesInfo = DepotHelper.GetStoreById(this.Order.StoreId); } if (storesInfo != null) { VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderPayed); if (this.offlineOrder == null) { if (this.Order.ShippingModeId == -2) { VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.TakeOnStoreOrderWaitConfirm); } else { VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderWaitSendGoods); } } } if (this.offlineOrder == null) { ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0); Messenger.OrderPaymentToShipper(defaultOrFirstShipper, storesInfo, null, this.Order, this.Order.GetTotal(false)); } this.Order.OnPayment(); } catch (Exception ex) { IDictionary<string, string> dictionary = new Dictionary<string, string>(); dictionary.Add("ErrorMessage", ex.Message); dictionary.Add("StackTrace", ex.StackTrace); if (ex.InnerException != null) { dictionary.Add("InnerException", ex.InnerException.ToString()); } if (ex.GetBaseException() != null) { dictionary.Add("BaseException", ex.GetBaseException().Message); } if (ex.TargetSite != (MethodBase)null) { dictionary.Add("TargetSite", ex.TargetSite.ToString()); } dictionary.Add("ExSource", ex.Source); Globals.AppendLog(dictionary, "支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay"); } }); base.Response.Write("success"); } else { Globals.WriteLog(new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }, "订单不是待支付状态,或者更新订单状态失败", "", "", "alipay"); base.Response.Write("success"); } } }
public void ChangePosition(HttpContext context) { string text = context.Request["fromLatLng"]; string str = context.Request["address"]; context.Response.ContentType = "text/json"; if (string.IsNullOrEmpty(text)) { context.Response.Write("{\"Status\":\"noLatLng\",\"Message\":\"定位失败!\"}"); } else { try { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (!masterSettings.OpenMultStore) { context.Response.Write("{\"Status\":\"platform\",\"Message\":\"进入平台页面!\"}"); } else { string store_PositionRouteTo = masterSettings.Store_PositionRouteTo; text = text.Trim().Replace(" ", ""); MemberInfo user = HiContext.Current.User; DateTime now; if (store_PositionRouteTo.Equals("NearestStore")) { if (user != null && user.StoreId > 0 && masterSettings.Store_IsMemberVisitBelongStore) { DepotHelper.CookieUserCoordinate(text); string userCoordinateCookieName = DepotHandler.UserCoordinateCookieName; string value = HttpUtility.UrlEncode(str); now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName, "Address", value, now.AddDays(10.0)); string userCoordinateTimeCookieName = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value2 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName, value2, now.AddMinutes(10.0), null, true); context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + user.StoreId + "\"}"); } else { StoresInfo nearDeliveStores = DepotHelper.GetNearDeliveStores(text, false); string userCoordinateCookieName2 = DepotHandler.UserCoordinateCookieName; string value3 = HttpUtility.UrlEncode(str); now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName2, "Address", value3, now.AddDays(10.0)); if (nearDeliveStores == null || nearDeliveStores.StoreId <= 0) { string store_PositionNoMatchTo = masterSettings.Store_PositionNoMatchTo; if (store_PositionNoMatchTo == "Platform") { context.Response.Write("{\"Status\":\"noStoreToPlatform\",\"Message\":\"进入平台页面!\"}"); } else { context.Response.Write("{\"Status\":\"nothing\",\"Message\":\"进入无平台提示页面!\"}"); } } else { now = DateTime.Now; WebHelper.SetCookie("UserCoordinateCookie", "StoreType", "2", now.AddDays(10.0)); string userCoordinateTimeCookieName2 = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value4 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName2, value4, now.AddMinutes(10.0), null, true); context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + nearDeliveStores.StoreId + "\"}"); } } } else if (store_PositionRouteTo.Equals("StoreList")) { string str2 = DepotHelper.CookieUserCoordinate(text); string userCoordinateCookieName3 = DepotHandler.UserCoordinateCookieName; string value5 = HttpUtility.UrlEncode(str); now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName3, "Address", value5, now.AddDays(10.0)); string userCoordinateTimeCookieName3 = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value6 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName3, value6, now.AddMinutes(10.0), null, true); context.Response.Write("{\"Status\":\"storeList\",\"Addr\":\"" + str2 + "\",\"Message\":\"进入多门店首页!\"}"); } else if (store_PositionRouteTo.Equals("Platform")) { DepotHelper.CookieUserCoordinate(text); if (user != null && user.StoreId > 0 && masterSettings.Store_IsMemberVisitBelongStore) { string userCoordinateCookieName4 = DepotHandler.UserCoordinateCookieName; string value7 = HttpUtility.UrlEncode(str); now = DateTime.Now; WebHelper.SetCookie(userCoordinateCookieName4, "Address", value7, now.AddDays(10.0)); string userCoordinateTimeCookieName4 = DepotHandler.UserCoordinateTimeCookieName; now = DateTime.Now; string value8 = now.ToString(); now = DateTime.Now; WebHelper.SetCookie(userCoordinateTimeCookieName4, value8, now.AddMinutes(10.0), null, true); context.Response.Write("{\"Status\":\"goToStore\",\"Message\":\"进入门店首页!\",\"StoreId\":\"" + user.StoreId + "\"}"); } else { context.Response.Write("{\"Status\":\"platform\",\"Message\":\"进入平台页面!\"}"); } } } } catch (Exception ex) { context.Response.Write("{\"Status\":\"error\",\"Message\":\"" + ex.Message + "\"}"); } } }