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; }
private void Delete(HttpContext context) { string text = context.Request["ids"]; if (text.Length < 0) { throw new HidistroAshxException("错误的参数!"); } if (WeChartAppletHelper.RemoveChoiceProduct(text, 0)) { base.ReturnSuccessResult(context, "删除成功!", 0, true); return; } throw new HidistroAshxException("请选择要删除的商品!"); }
private void AddProduct(HttpContext context) { string text = context.Request["ids"]; if (text.Length < 0) { throw new HidistroAshxException("错误的参数!"); } if (WeChartAppletHelper.AddChoiceProdcut(text, 0)) { base.ReturnSuccessResult(context, "添加成功!", 0, true); return; } throw new HidistroAshxException("选择首页商品失败!"); }
private void SaveOrder(HttpContext context) { int value = base.GetIntParam(context, "Value", false).Value; if (value >= 0) { int value2 = base.GetIntParam(context, "ProductId", false).Value; AppletChoiceProductInfo info = new AppletChoiceProductInfo { ProductId = value2, StoreId = 0, DisplaySequence = value }; if (WeChartAppletHelper.UpdateChoiceProductSequence(info)) { base.ReturnSuccessResult(context, "保存排序成功!", 0, true); return; } throw new HidistroAshxException("修改排序失败!未知错误!"); } throw new HidistroAshxException("错误的参数"); }
private DataGridViewModel<Dictionary<string, object>> GetDataList(HttpContext context) { DataGridViewModel<Dictionary<string, object>> dataGridViewModel = new DataGridViewModel<Dictionary<string, object>>(); int num = 1; int num2 = 10; num = context.Request["page"].ToInt(0); if (num < 1) { num = 1; } num2 = context.Request["rows"].ToInt(0); if (num2 < 1) { num2 = 10; } DbQueryResult showProductList = WeChartAppletHelper.GetShowProductList(0, num, num2, 0, ProductType.PhysicalProduct); dataGridViewModel.rows = DataHelper.DataTableToDictionary(showProductList.Data); dataGridViewModel.total = showProductList.TotalRecords; foreach (Dictionary<string, object> row in dataGridViewModel.rows) { ProductInfo productInfo = row.ToObject<ProductInfo>(); if (productInfo.ProductName.Length >= 26) { row.Add("SubProductName", productInfo.ProductName.Substring(0, 26) + "..."); } else { row.Add("SubProductName", productInfo.ProductName); } if (string.IsNullOrEmpty(productInfo.ThumbnailUrl160)) { row["ThumbnailUrl160"] = base.CurrentSiteSetting.DefaultProductThumbnail1; } } return dataGridViewModel; }
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(); } }
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); } }