private void CheckVerification(HttpContext context) { string verificationPassword = context.Request["VerificationPassword"]; OrderVerificationItemInfo verificationInfoByPassword = OrderHelper.GetVerificationInfoByPassword(verificationPassword); if (verificationInfoByPassword == null) { throw new HidistroAshxException("该核销码无效,请重新输入"); } if (verificationInfoByPassword.VerificationStatus == 1) { throw new HidistroAshxException("该核销码 于" + verificationInfoByPassword.VerificationDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "已核销"); } if (verificationInfoByPassword.VerificationStatus == 3) { throw new HidistroAshxException("核销码已过期,无法核销"); } if (verificationInfoByPassword.VerificationStatus == 5) { throw new HidistroAshxException("此核销码已进行售后,无法核销"); } if (verificationInfoByPassword.VerificationStatus == 4) { throw new HidistroAshxException("此核销码已进行售后,无法核销"); } base.ReturnSuccessResult(context, "核销码可用", 0, true); }
private string GetVerificationCodeQRCodePath(OrderVerificationItemInfo data) { string result = ""; if (data != null && !string.IsNullOrWhiteSpace(data.VerificationPassword)) { string format = Globals.FullPath("/Storage/master/ServiceQRCode/{0}_{1}.png"); result = string.Format(format, data.Id, data.VerificationPassword); } return(result); }
private void rptVCodes_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { OrderVerificationItemInfo orderVerificationItemInfo = e.Item.DataItem as OrderVerificationItemInfo; Image image = e.Item.FindControl("codeqrcode") as Image; HtmlGenericControl htmlGenericControl = e.Item.FindControl("vcodepassword") as HtmlGenericControl; HtmlGenericControl htmlGenericControl2 = e.Item.FindControl("vqrcodebox") as HtmlGenericControl; image.ImageUrl = this.GetVerificationCodeQRCodePath(orderVerificationItemInfo); htmlGenericControl.InnerHtml = this.GetShowVerificationPassword(orderVerificationItemInfo.VerificationPassword); htmlGenericControl2.Attributes["class"] = "vcode-qrcodebox vcodestatus" + orderVerificationItemInfo.VerificationStatus; } }
private void rptVerCode_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { OrderVerificationItemInfo orderVerificationItemInfo = e.Item.DataItem as OrderVerificationItemInfo; Literal literal = e.Item.FindControl("lit_ver_img") as Literal; Literal literal2 = e.Item.FindControl("lit_ver_pass") as Literal; Literal literal3 = e.Item.FindControl("lit_ver_status") as Literal; literal.Text = $"<img class=\"v-code-img\" src=\"{this.GetVerificationCodeQRCodePath(orderVerificationItemInfo)}\" />"; literal2.Text = orderVerificationItemInfo.VerificationPassword; literal3.Text = EnumDescription.GetEnumDescription((Enum)(object)(VerificationStatus)orderVerificationItemInfo.VerificationStatus, 0); } }
protected void btnVerification_Click(object sender, EventArgs e) { this.btnVerification.Enabled = false; string text = ""; for (int i = 0; i < this.ckbList.Items.Count; i++) { if (this.ckbList.Items[i].Selected) { text = text + this.ckbList.Items[i].Value + ","; } } if (string.IsNullOrEmpty(text)) { this.ShowMsg("请选择核销码", false); this.btnVerification.Enabled = true; } else { string[] array = text.TrimEnd(',').Split(','); DateTime now = DateTime.Now; string orderId = ""; for (int j = 0; j < array.Length; j++) { if (!string.IsNullOrEmpty(array[j])) { OrderVerificationItemInfo verificationInfoByPassword = OrderHelper.GetVerificationInfoByPassword(array[j]); verificationInfoByPassword.VerificationStatus = 1; verificationInfoByPassword.VerificationDate = now; verificationInfoByPassword.ManagerId = HiContext.Current.Manager.ManagerId; verificationInfoByPassword.UserName = HiContext.Current.Manager.UserName; OrderHelper.UpdateVerificationItem(verificationInfoByPassword); orderId = verificationInfoByPassword.OrderId; } } OrderInfo serviceProductOrderInfo = OrderHelper.GetServiceProductOrderInfo(orderId); if (serviceProductOrderInfo != null && OrderHelper.IsVerificationFinished(orderId) && serviceProductOrderInfo.ItemStatus == OrderItemStatus.Nomarl) { serviceProductOrderInfo.OrderStatus = OrderStatus.Finished; serviceProductOrderInfo.FinishDate = DateTime.Now; TradeHelper.UpdateOrderInfo(serviceProductOrderInfo); } this.hidIsVerification.Value = "true"; this.ShowMsg("核销成功", true); } }
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(); } }
protected void Page_Load(object sender, EventArgs e) { string text = this.Page.Request["Code"].ToNullString(); OrderVerificationItemInfo verificationInfoByPassword = OrderHelper.GetVerificationInfoByPassword(text); if (verificationInfoByPassword == null) { this.ShowMsg("该核销码无效,请重新输入", false); } else if (verificationInfoByPassword.VerificationStatus == 1) { this.ShowMsg("该核销码 于" + verificationInfoByPassword.VerificationDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "已核销", false); } else if (verificationInfoByPassword.VerificationStatus == 3) { this.ShowMsg("核销码已过期,无法核销", false); } else if (verificationInfoByPassword.VerificationStatus == 5) { this.ShowMsg("此核销码已进行售后,无法核销", false); } else if (verificationInfoByPassword.VerificationStatus == 4) { this.ShowMsg("此核销码已进行售后,无法核销", false); } else { this.order = OrderHelper.GetServiceProductOrderInfo(verificationInfoByPassword.OrderId); if (this.order == null) { this.ShowMsg("订单不存在,或者已被删除。", false); } else { this.itemsList.Order = this.order; if (!this.Page.IsPostBack) { this.litStoreName.Text = this.order.StoreName; this.litOrderId.Text = this.order.OrderId; DataTable dataSource = OrderHelper.GetOrderInputItem(this.order.OrderId); this.orderInputItem.DataSource = dataSource; this.orderInputItem.DataBind(); DataTable verificationItem = OrderHelper.GetVerificationItem(this.order.OrderId); for (int i = 0; i < verificationItem.Rows.Count; i++) { if (verificationItem.Rows[i]["VerificationStatus"].ToInt(0) != 0.GetHashCode()) { verificationItem.Rows.Remove(verificationItem.Rows[i]); i--; } else { verificationItem.Rows[i]["SkuId"] = this.GetVerificationPassword(verificationItem.Rows[i]["VerificationPassword"], text); } } this.ckbList.DataSource = verificationItem; this.ckbList.DataTextField = "SkuId"; this.ckbList.DataValueField = "VerificationPassword"; this.ckbList.DataBind(); this.ckbList.SelectedValue = text; } } } }
protected void btnVerification_Click(object sender, EventArgs e) { this.btnVerification.Enabled = false; string text = ""; for (int i = 0; i < this.ckbList.Items.Count; i++) { if (this.ckbList.Items[i].Selected) { text = text + this.ckbList.Items[i].Value + ","; } } if (string.IsNullOrEmpty(text)) { this.ShowMsg("请选择核销码", false); this.btnVerification.Enabled = true; } else { string[] array = text.TrimEnd(',').Split(','); DateTime now = DateTime.Now; string orderId = ""; OrderVerificationItemInfo orderVerificationItemInfo = null; int num = 0; for (int j = 0; j < array.Length; j++) { if (!string.IsNullOrEmpty(array[j])) { OrderVerificationItemInfo verificationInfoByPassword = OrderHelper.GetVerificationInfoByPassword(array[j]); if (verificationInfoByPassword != null) { orderVerificationItemInfo = verificationInfoByPassword; verificationInfoByPassword.VerificationStatus = 1; verificationInfoByPassword.VerificationDate = now; verificationInfoByPassword.ManagerId = HiContext.Current.Manager.ManagerId; verificationInfoByPassword.UserName = HiContext.Current.Manager.UserName; OrderHelper.UpdateVerificationItem(verificationInfoByPassword); orderId = verificationInfoByPassword.OrderId; num++; } } } string text2 = "平台"; OrderInfo serviceProductOrderInfo = OrderHelper.GetServiceProductOrderInfo(orderId); if (serviceProductOrderInfo != null) { text2 = serviceProductOrderInfo.StoreName; if (orderVerificationItemInfo != null) { decimal verificationTotal = (decimal)num * (serviceProductOrderInfo.GetTotal(false) / (decimal)serviceProductOrderInfo.LineItems.Values.FirstOrDefault().Quantity); MemberInfo user = Users.GetUser(serviceProductOrderInfo.UserId); Messenger.ServiceOrderValidSuccess(orderVerificationItemInfo, user, serviceProductOrderInfo, serviceProductOrderInfo.LineItems.Values.FirstOrDefault().ItemDescription, text2, string.Join(",", array), verificationTotal); } if (OrderHelper.IsVerificationFinished(orderId) && serviceProductOrderInfo.ItemStatus == OrderItemStatus.Nomarl) { serviceProductOrderInfo.OrderStatus = OrderStatus.Finished; serviceProductOrderInfo.FinishDate = DateTime.Now; TradeHelper.UpdateOrderInfo(serviceProductOrderInfo); } } this.hidIsVerification.Value = "true"; this.ShowMsg("核销成功", true); } }