public Product GetProduct(ProductHelper.ProductType productType) { // Daha Önce Oluşturduysak var olan nesneyi dönüyoruz. if (ProductList.ContainsKey(productType)) return ProductList[productType]; // İlk Defa Oluşturuyorsak Listemize Ekliyor Ve Geri Dönüyoruz. Product product; // Ürün Tipine Göre Ürünümüzü Oluşturuyoruz. if (productType == ProductHelper.ProductType.BestSaller) product = new BestSallerProduct("Ürün 1"); else product = new MostViewedProduct("Ürün 1"); // Listemize Ekliyoruz. ProductList.Add(productType, product); // Ürünü Geri Dönüyoruz. return ProductList[productType]; }
//Get a boat based on the id provided public static Boat GetBoatbyId(int boatId) { return(ProductHelper.GetBoatsbyId(boatId)); }
protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["bargainId"], out this.bargainId)) { base.GotoResourceNotFound(""); } this.litProdcutName = (Literal)this.FindControl("litProdcutName"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.litSalePrice = (Literal)this.FindControl("litSalePrice"); this.litFloorPrice = (Literal)this.FindControl("litFloorPrice"); this.litFloorPrice1 = (Literal)this.FindControl("litFloorPrice1"); this.litPurchaseNumber = (Literal)this.FindControl("litPurchaseNumber"); this.litParticipantNumber = (Literal)this.FindControl("litParticipantNumber"); this.litProductDesc = (Literal)this.FindControl("litProductDesc"); this.litProductConsultationTotal = (Literal)this.FindControl("litProductConsultationTotal"); this.litProductCommentTotal = (Literal)this.FindControl("litProductCommentTotal"); this.litStock = (Literal)this.FindControl("litStock"); this.litPurcharseNum = (Literal)this.FindControl("litPurcharseNum"); this.hiddHasCollected = (HtmlInputHidden)this.FindControl("hiddHasCollected"); this.hiddProductId = (HtmlInputHidden)this.FindControl("hiddProductId"); this.hideTitle = (HtmlInputHidden)this.FindControl("hideTitle"); this.hideImgUrl = (HtmlInputHidden)this.FindControl("hideImgUrl"); this.hideDesc = (HtmlInputHidden)this.FindControl("hideDesc"); this.hiddEndDate = (HtmlInputHidden)this.FindControl("hiddEndDate"); this.hiddPurchaseNumber = (HtmlInputHidden)this.FindControl("hiddPurchaseNumber"); this.skuSelector = (Common_SKUSelector)this.FindControl("skuSelector"); this.rptProductImages = (VshopTemplatedRepeater)this.FindControl("rptProductImages"); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); bool flag = false; BargainInfo bargainInfo = BargainHelper.GetBargainInfo(this.bargainId); if (bargainInfo != null) { this.hideTitle.Value = bargainInfo.Title; this.hideDesc.Value = bargainInfo.Remarks; Uri url = HttpContext.Current.Request.Url; string activityCover = bargainInfo.ActivityCover; string str2 = string.Empty; if (!activityCover.StartsWith("http")) { str2 = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString())); } int id = Globals.RequestQueryNum("bargainDetialId"); if (id > 0) { BargainDetialInfo bargainDetialInfo = BargainHelper.GetBargainDetialInfo(id); if ((currentMember == null) || (((currentMember != null) && (bargainDetialInfo != null)) && (bargainDetialInfo.UserId != currentMember.UserId))) { HttpContext.Current.Response.Redirect(string.Concat(new object[] { "HelpBargainDetial.aspx?bargainId=", this.bargainId, "&bargainDetialId=", id })); HttpContext.Current.Response.End(); } } PageTitle.AddSiteNameTitle(bargainInfo.Title); this.litFloorPrice.Text = bargainInfo.FloorPrice.ToString("F2"); this.litFloorPrice1.Text = bargainInfo.FloorPrice.ToString("F2"); this.litPurchaseNumber.Text = (bargainInfo.ActivityStock - bargainInfo.TranNumber).ToString(); this.litParticipantNumber.Text = BargainHelper.HelpBargainCount(this.bargainId).ToString(); this.hiddEndDate.Value = bargainInfo.EndDate.ToString("yyyy:MM:dd:HH:mm:ss"); this.hiddPurchaseNumber.Value = bargainInfo.PurchaseNumber.ToString(); this.litStock.Text = bargainInfo.PurchaseNumber.ToString(); this.litPurcharseNum.Text = bargainInfo.PurchaseNumber.ToString(); if (bargainInfo.ProductId > 0) { this.skuSelector.ProductId = bargainInfo.ProductId; if (currentMember != null) { flag = ProductBrowser.CheckHasCollect(currentMember.UserId, bargainInfo.ProductId); } this.hiddHasCollected.SetWhenIsNotNull(flag ? "1" : "0"); ProductInfo productDetails = ProductHelper.GetProductDetails(bargainInfo.ProductId); this.hiddProductId.Value = bargainInfo.ProductId.ToString(); this.litProdcutName.Text = productDetails.ProductName; this.litShortDescription.Text = bargainInfo.Remarks; this.litSalePrice.Text = productDetails.MinSalePrice.ToString("f2"); this.litProductDesc.Text = productDetails.Description; this.hideImgUrl.Value = string.IsNullOrEmpty(productDetails.ThumbnailUrl60) ? (str2 + activityCover) : (str2 + productDetails.ThumbnailUrl60); if (this.rptProductImages != null) { string locationUrl = "javascript:;"; SlideImage[] imageArray = new SlideImage[] { new SlideImage(productDetails.ImageUrl1, locationUrl), new SlideImage(productDetails.ImageUrl2, locationUrl), new SlideImage(productDetails.ImageUrl3, locationUrl), new SlideImage(productDetails.ImageUrl4, locationUrl), new SlideImage(productDetails.ImageUrl5, locationUrl) }; this.rptProductImages.DataSource = from item in imageArray where !string.IsNullOrWhiteSpace(item.ImageUrl) select item; this.rptProductImages.DataBind(); } int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(bargainInfo.ProductId, false); this.litProductConsultationTotal.SetWhenIsNotNull(productConsultationsCount.ToString()); this.litProductCommentTotal.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(bargainInfo.ProductId).ToString()); } } else { HttpContext.Current.Response.Redirect("/default.aspx"); HttpContext.Current.Response.End(); } }
private void btnSave_Click(object sender, System.EventArgs e) { int num = Globals.RequestQueryNum("id"); string text = this.txtTitle.Text; if (string.IsNullOrWhiteSpace(text)) { this.ShowMsg("分享标题不能为空!", false); return; } string text2 = this.calendarStartDate.Text; string text3 = this.calendarEndDate.Text; if (string.IsNullOrWhiteSpace(text2) || string.IsNullOrWhiteSpace(text3)) { this.ShowMsg("活动时间不能为空!", false); return; } if (System.DateTime.Parse(text2) >= System.DateTime.Parse(text3)) { this.ShowMsg("结束时间必须大于开始时间!", false); return; } string value = this.hidpic.Value; if (string.IsNullOrWhiteSpace(value)) { this.ShowMsg("请先上传活动封面!", false); return; } string text4 = this.txtRemarks.Text; if (text4.Length > 200) { this.ShowMsg("活动说明不能超过200个字节!", false); return; } int num2 = Globals.ToNum(this.hiddProductId.Value); if (num2 <= 0) { this.ShowMsg("请先选择参加活动的产品!", false); return; } int num3 = Globals.ToNum(this.txtActivityStock.Text.Trim()); if (num3 <= 0) { this.ShowMsg("活动库存必须为大于0的正整数!", false); return; } int num4 = Globals.ToNum(this.txtPurchaseNumber.Text.Trim()); if (num4 <= 0) { this.ShowMsg("限购数量必须为大于0的正整数!", false); return; } float num5 = 0f; if (!float.TryParse(this.txtInitialPrice.Text, out num5)) { this.ShowMsg("初始价格输入不正确!", false); return; } float num6 = 0f; if (!float.TryParse(this.txtFloorPrice.Text, out num6)) { this.ShowMsg("活动底价输入不正确!", false); return; } if (num6 <= 0f || num5 <= 0f) { this.ShowMsg("活动底价必须或初始价格必须大于0!", false); return; } if (num5 < num6) { this.ShowMsg("初始价格不能小于活动底价!", false); return; } long productSumStock = ProductHelper.GetProductSumStock(num2); if ((long)num3 > productSumStock) { this.ShowMsg("活动库存不能大于商品库存!", false); return; } if (num4 > num3) { this.ShowMsg("限购数量不能大于活动库存!", false); return; } int num7 = this.rbtBargainTypeOne.Checked ? 0 : 1; BargainInfo bargainInfo = new BargainInfo(); bargainInfo.Title = text; bargainInfo.BeginDate = System.DateTime.Parse(text2); bargainInfo.EndDate = System.DateTime.Parse(text3); bargainInfo.ActivityCover = value; bargainInfo.Remarks = text4; bargainInfo.ProductId = num2; bargainInfo.ActivityStock = num3; bargainInfo.PurchaseNumber = num4; bargainInfo.TranNumber = 0; bargainInfo.InitialPrice = (decimal)num5; bargainInfo.FloorPrice = (decimal)num6; bargainInfo.BargainType = num7; bargainInfo.CreateDate = System.DateTime.Now; bargainInfo.IsCommission = this.ckIsCommission.Checked; if (num7 == 0) { string text5 = this.txtBargainTypeOneValue.Text; if (string.IsNullOrWhiteSpace(text5)) { this.ShowMsg("每次砍掉价格不能为空!", false); return; } bargainInfo.BargainTypeMinVlue = float.Parse(text5); } else { string text6 = this.txtBargainTypeTwoValue1.Text; string text7 = this.txtBargainTypeTwoValue2.Text; if (string.IsNullOrWhiteSpace(text6) || string.IsNullOrWhiteSpace(text7)) { this.ShowMsg("随机砍价最小值或最大值不能为空!", false); return; } float num8 = 0f; float num9 = 0f; if (!float.TryParse(text6, out num8)) { this.ShowMsg("随机砍价最小值必须为数值!", false); return; } if (!float.TryParse(text7, out num9)) { this.ShowMsg("随机砍价最大值必须为数值!", false); return; } if (num8 > num9) { this.ShowMsg("随机砍价最大值必须大于最小值!", false); return; } if (num8 < 0f || num9 < 0f) { this.ShowMsg("随机砍价最大值,最小值都必须大于零!", false); return; } bargainInfo.BargainTypeMinVlue = num8; bargainInfo.BargainTypeMaxVlue = num9; } if (num > 0) { bargainInfo.Id = num; bool flag = BargainHelper.UpdateBargain(bargainInfo); if (flag) { this.ShowMsgAndReUrl("修改成功", true, "ManagerBargain.aspx?Type=0"); return; } } else { bool flag2 = BargainHelper.InsertBargain(bargainInfo); if (flag2) { this.ShowMsgAndReUrl("添加成功", true, "ManagerBargain.aspx?Type=0"); } } }
private void btnImport_Click(object sender, System.EventArgs e) { if (this.CheckItems()) { string selectedValue = this.dropFiles.SelectedValue; string path = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(selectedValue)); ImportAdapter importer = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]); System.Data.DataSet mappingSet = null; if (this.txtMappedTypes.Text.Length > 0) { XmlDocument document = new XmlDocument(); document.LoadXml(this.txtMappedTypes.Text); mappingSet = (importer.CreateMapping(new object[] { document, path })[0] as System.Data.DataSet); ProductHelper.EnsureMapping(mappingSet); } bool includeCostPrice = this.chkIncludeCostPrice.Checked; bool includeStock = this.chkIncludeStock.Checked; bool includeImages = this.chkIncludeImages.Checked; int categoryId = this.dropCategories.SelectedValue.Value; string bandId = ""; if (CustomConfigHelper.Instance.BrandShow) { string strChecks = ""; for (int i = 0; i < this.BrandCategories.Items.Count; i++) { bool a = this.BrandCategories.Items[i].Selected; if (a) { strChecks += this.BrandCategories.Items[i].Value + ","; } } bandId = strChecks; } else { bandId = this.dropBrandList.SelectedValue.ToString(); } ProductSaleStatus delete = ProductSaleStatus.Delete; if (this.radInStock.Checked) { delete = ProductSaleStatus.OnStock; } if (this.radUnSales.Checked) { delete = ProductSaleStatus.UnSale; } if (this.radOnSales.Checked) { delete = ProductSaleStatus.OnSale; } ProductHelper.ImportProducts((System.Data.DataSet)importer.ParseProductData(new object[] { mappingSet, path, includeCostPrice, includeStock, includeImages })[0], categoryId, 0, bandId, delete, includeCostPrice, includeStock, includeImages); System.IO.File.Delete(System.IO.Path.Combine(this._dataPath, selectedValue)); System.IO.Directory.Delete(path, true); this.chkFlag.Checked = false; this.txtMappedTypes.Text = string.Empty; this.txtProductTypeXml.Text = string.Empty; this.txtPTXml.Text = string.Empty; this.OutputProductTypes(); this.BindFiles(); this.ShowMsg("此次商品批量导入操作已成功!", true); } }
private void btnAdd_Click(object sender, EventArgs e) { int stock = 0; // num; int alertStock = 0; // num2; int lineId = 0; // num3; decimal purchasePrice = 0m; // num4; decimal lowestSalePrice = 0m; // num5; decimal salePrice = 0m; // num6; decimal?costPrice = null; // nullable; decimal?marketPrice = null; // nullable2; int? weight = null; // nullable3; // (bool skuEnabled, out int displaySequence, out decimal purchasePrice, out decimal lowestSalePrice, out decimal salePrice, out decimal? costPrice, out decimal? marketPrice, out int stock, out int alertStock, out int? weight) if (ValidateConverts(chkSkuEnabled.Checked, out purchasePrice, out lowestSalePrice, out salePrice, out costPrice, out marketPrice, out stock, out alertStock, out weight, out lineId)) { if (!chkSkuEnabled.Checked) { if (salePrice <= 0M) { ShowMsg("商品一口价必须大于0", false); return; } if (costPrice.HasValue && (costPrice.Value >= salePrice)) { ShowMsg("商品成本价必须小于商品一口价", false); return; } if (purchasePrice > lowestSalePrice) { ShowMsg("分销商采购价必须要小于其最低零售价", false); return; } } string text = editDescription.Text; if (ckbIsDownPic.Checked) { text = base.DownRemotePic(text); } ProductInfo target = new ProductInfo(); target.CategoryId = categoryId; target.TypeId = dropProductTypes.SelectedValue; target.ProductName = txtProductName.Text; target.ProductCode = txtProductCode.Text; target.LineId = lineId; // num3; target.LowestSalePrice = lowestSalePrice; // num5; target.MarketPrice = marketPrice; // nullable2; target.Unit = txtUnit.Text; target.ImageUrl1 = uploader1.UploadedImageUrl; target.ImageUrl2 = uploader2.UploadedImageUrl; target.ImageUrl3 = uploader3.UploadedImageUrl; target.ImageUrl4 = uploader4.UploadedImageUrl; target.ImageUrl5 = uploader5.UploadedImageUrl; target.ThumbnailUrl40 = uploader1.ThumbnailUrl40; target.ThumbnailUrl60 = uploader1.ThumbnailUrl60; target.ThumbnailUrl100 = uploader1.ThumbnailUrl100; target.ThumbnailUrl160 = uploader1.ThumbnailUrl160; target.ThumbnailUrl180 = uploader1.ThumbnailUrl180; target.ThumbnailUrl220 = uploader1.ThumbnailUrl220; target.ThumbnailUrl310 = uploader1.ThumbnailUrl310; target.ThumbnailUrl410 = uploader1.ThumbnailUrl410; target.ShortDescription = txtShortDescription.Text; target.Description = (!string.IsNullOrEmpty(text) && (text.Length > 0)) ? text : null; target.PenetrationStatus = chkPenetration.Checked ? PenetrationStatus.Already : PenetrationStatus.Notyet; target.Title = txtTitle.Text; target.MetaDescription = txtMetaDescription.Text; target.MetaKeywords = txtMetaKeywords.Text; target.AddedDate = DateTime.Now; target.BrandId = dropBrandCategories.SelectedValue; target.MainCategoryPath = CatalogHelper.GetCategory(categoryId).Path + "|"; //ProductInfo info = info3; //ProductInfo target = info; ProductSaleStatus onSale = ProductSaleStatus.OnSale; if (radInStock.Checked) { onSale = ProductSaleStatus.OnStock; } if (radUnSales.Checked) { onSale = ProductSaleStatus.UnSale; } if (radOnSales.Checked) { onSale = ProductSaleStatus.OnSale; } target.SaleStatus = onSale; Dictionary <string, SKUItem> skus = null; Dictionary <int, IList <int> > attrs = null; if (chkSkuEnabled.Checked) { target.HasSKU = true; skus = base.GetSkus(txtSkus.Text); } else { // Dictionary<string, SKUItem> dictionary3 = new Dictionary<string, SKUItem>(); skus = new Dictionary <string, SKUItem>(); SKUItem item = new SKUItem(); item.SkuId = "0"; item.SKU = txtSku.Text; item.SalePrice = salePrice;// num6; item.CostPrice = costPrice.HasValue ? costPrice.Value : 0M; item.PurchasePrice = purchasePrice; item.Stock = stock; // num; item.AlertStock = alertStock; // num2; item.Weight = weight.HasValue ? weight.Value : 0; //dictionary3.Add("0", item); //skus = dictionary3; skus.Add("0", item); if (txtMemberPrices.Text.Length > 0) { base.GetMemberPrices(skus["0"], txtMemberPrices.Text); } if (txtDistributorPrices.Text.Length > 0) { base.GetDistributorPrices(skus["0"], txtDistributorPrices.Text); } } if (!(string.IsNullOrEmpty(txtAttributes.Text) || (txtAttributes.Text.Length <= 0))) { attrs = base.GetAttributes(txtAttributes.Text); } ValidationResults validateResults = Hishop.Components.Validation.Validation.Validate <ProductInfo>(target, new string[] { "AddProduct" }); if (!validateResults.IsValid) { ShowMsg(validateResults); } else { switch (ProductHelper.AddProduct(target, skus, attrs)) { case ProductActionStatus.Success: { ShowMsg("添加商品成功", true); Response.Redirect(Globals.GetAdminAbsolutePath(string.Format("/product/AddProductComplete.aspx?categoryId={0}&productId={1}", categoryId, target.ProductId)), true); return; } case ProductActionStatus.DuplicateName: { ShowMsg("添加商品失败,商品名称不能重复", false); return; } case ProductActionStatus.DuplicateSKU: { ShowMsg("添加商品失败,商家编码不能重复", false); return; } case ProductActionStatus.SKUError: { ShowMsg("添加商品失败,商家编码不能重复", false); return; } case ProductActionStatus.AttributeError: { ShowMsg("添加商品失败,保存商品属性时出错", false); return; } } ShowMsg("添加商品失败,未知错误", false); } } }
private void setInSaleAndStock() { System.Data.DataTable productNum = ProductHelper.GetProductNum(); this.lbsaleNumber.Text = productNum.Rows[0]["OnSale"].ToString(); this.lbwareNumber.Text = productNum.Rows[0]["OnStock"].ToString(); }
private void btnImport_Click(object sender, System.EventArgs e) { if (this.CheckItems()) { string selectedValue = this.dropFiles.SelectedValue; string path = System.IO.Path.Combine(this._dataPath, System.IO.Path.GetFileNameWithoutExtension(selectedValue)); ImportAdapter importer = TransferHelper.GetImporter(this.dropImportVersions.SelectedValue, new object[0]); int categoryId = this.dropCategories.SelectedValue.Value; string brandId = ""; if (CustomConfigHelper.Instance.BrandShow) { string strChecks = ""; for (int i = 0; i < this.BrandCategories.Items.Count; i++) { bool a = this.BrandCategories.Items[i].Selected; if (a) { strChecks += this.BrandCategories.Items[i].Value + ","; } } brandId = strChecks; } else { brandId = this.dropBrandList.SelectedValue.ToString(); } ProductSaleStatus delete = ProductSaleStatus.Delete; if (this.radInStock.Checked) { delete = ProductSaleStatus.OnStock; } if (this.radUnSales.Checked) { delete = ProductSaleStatus.UnSale; } if (this.radOnSales.Checked) { delete = ProductSaleStatus.OnSale; } selectedValue = System.IO.Path.Combine(this._dataPath, selectedValue); if (!System.IO.File.Exists(selectedValue)) { this.ShowMsg("选择的数据包文件有问题!", false); } else { importer.PrepareDataFiles(new object[] { selectedValue }); try { ProductHelper.ImportProducts((System.Data.DataTable)importer.ParseProductData(new object[] { path })[0], categoryId, 0, brandId, delete, true); System.IO.File.Delete(selectedValue); System.IO.Directory.Delete(path, true); this.BindFiles(); this.ShowMsg("此次商品批量导入操作已成功!", true); } catch { System.IO.File.Delete(selectedValue); System.IO.Directory.Delete(path, true); this.ShowMsg("选择的数据包文件有问题!", false); } } } }
protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId, false); decimal num = 0M; decimal num2 = 0M; if (orderMarkingOrderInfo.Count == 0) { this.Page.Response.Redirect("/Vshop/MemberOrders.aspx?status=0"); } bool flag = true; if (orderMarkingOrderInfo[0].UserId != 0) { foreach (OrderInfo info in orderMarkingOrderInfo) { if (info.OrderStatus != OrderStatus.BuyerAlreadyPaid) { num += info.GetTotal(); num2 += info.GetBalancePayMoneyTotal(); foreach (LineItemInfo info2 in info.LineItems.Values) { if (info2.Type == 0) { flag = false; } foreach (LineItemInfo info3 in info.LineItems.Values) { if (!ProductHelper.GetProductHasSku(info3.SkuId, info3.Quantity)) { info.OrderStatus = OrderStatus.Closed; info.CloseReason = "库存不足"; OrderHelper.UpdateOrder(info); HttpContext.Current.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>"); HttpContext.Current.Response.End(); return; } } } } } } else { num = orderMarkingOrderInfo[0].Amount; } this.Page.Request.Url.ToString().ToLower(); int num3 = Globals.RequestQueryNum("IsAlipay"); string userAgent = this.Page.Request.UserAgent; if (((num3 == 1) || !userAgent.ToLower().Contains("micromessenger")) || (string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) || !(orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest"))) { if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && (orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.offlinerequest")) { this.litMessage = (Literal)this.FindControl("litMessage"); this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent); } this.litOPertorList = (Literal)this.FindControl("litOPertorList"); this.litOPertorList.Text = "<div class=\"btns mt20\"><a id=\"linkToDetail\" class=\"btn btn-default mr10\" role=\"button\">查看订单</a><a href=\"/Default.aspx\" class=\"btn btn-default\" role=\"button\">继续逛逛</a></div>"; if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && (orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.weixinrequest")) { string str2 = "立即支付"; if ((num2 > 0M) && ((num - num2) > 0M)) { str2 = "还需支付 " + ((num - num2)).ToString("F2"); } this.litOPertorList.Text = "<div class=\"mt20\"><a href=\"/pay/wx_Submit.aspx?orderId=" + this.orderId + "\" class=\"btn btn-danger\" role=\"button\" id=\"btnToPay\">" + str2 + "</a></div>"; } if (((!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.podrequest")) && ((orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.offlinerequest") && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.weixinrequest"))) && (((orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.balancepayrequest") && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.pointtocach")) && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.coupontocach"))) { PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderMarkingOrderInfo[0].PaymentTypeId); string attach = ""; string showUrl = string.Format("http://{0}/vshop/", HttpContext.Current.Request.Url.Host); PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, num - num2, "订单支付", "订单号-" + this.orderId, orderMarkingOrderInfo[0].EmailAddress, orderMarkingOrderInfo[0].OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach).SendRequest(); } else { this.litOrderId = (Literal)this.FindControl("litOrderId"); this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.literalOrderTotal = (Literal)this.FindControl("literalOrderTotal"); this.literalBalancePayInfo = (Literal)this.FindControl("literalBalancePayInfo"); this.litPaymentType = (HtmlInputHidden)this.FindControl("litPaymentType"); int result = 0; this.litPaymentType.SetWhenIsNotNull("0"); if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out result)) { this.litPaymentType.SetWhenIsNotNull(result.ToString()); } this.litOrderId.SetWhenIsNotNull(this.orderId); if (flag) { this.litOrderTotal.SetWhenIsNotNull("您需要支付:\x00a5" + num.ToString("F2")); } this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span style='color:red'>\x00a5" + num.ToString("F2") + "</span>"); if (num2 > 0M) { this.literalBalancePayInfo.Text = "<div class='font-xl'>余额已支付:<span style='color:red'>\x00a5" + num2.ToString("F2") + "</span></div>"; } this.litHelperText = (Literal)this.FindControl("litHelperText"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent); PageTitle.AddSiteNameTitle("下单成功"); } } else { this.Page.Response.Redirect("/Pay/IframeAlipay.aspx?OrderId=" + this.orderId); } }
private void btnSave_Click(object sender, EventArgs e) { int num2; int num3; decimal num4; decimal?nullable; decimal?nullable2; decimal?nullable3; string str = this.ucFlashUpload1.Value.Trim(); this.ucFlashUpload1.Value = str; string[] strArray = str.Split(new char[] { ',' }); string[] strArray2 = new string[] { "", "", "", "", "" }; for (int i = 0; (i < strArray.Length) && (i < 5); i++) { strArray2[i] = strArray[i]; } if (this.categoryId == 0) { this.categoryId = (int)this.ViewState["ProductCategoryId"]; } if (this.ValidateConverts(this.chkSkuEnabled.Checked, out num2, out num4, out nullable, out nullable2, out num3, out nullable3)) { if (!this.chkSkuEnabled.Checked) { if (num4 <= 0M) { this.ShowMsg("商品一口价必须大于0", false); return; } if (nullable.HasValue && (nullable.Value >= num4)) { this.ShowMsg("商品成本价必须小于商品一口价", false); return; } } string text = this.fckDescription.Text; if (this.ckbIsDownPic.Checked) { text = base.DownRemotePic(text); } ProductInfo target = new ProductInfo { ProductId = this.productId, CategoryId = this.categoryId, TypeId = this.dropProductTypes.SelectedValue, ProductName = this.txtProductName.Text, ProductCode = this.txtProductCode.Text, DisplaySequence = num2, MarketPrice = nullable2, Unit = this.txtUnit.Text, ImageUrl1 = strArray2[0], ImageUrl2 = strArray2[1], ImageUrl3 = strArray2[2], ImageUrl4 = strArray2[3], ImageUrl5 = strArray2[4], ThumbnailUrl40 = strArray2[0].Replace("/images/", "/thumbs40/40_"), ThumbnailUrl60 = strArray2[0].Replace("/images/", "/thumbs60/60_"), ThumbnailUrl100 = strArray2[0].Replace("/images/", "/thumbs100/100_"), ThumbnailUrl160 = strArray2[0].Replace("/images/", "/thumbs160/160_"), ThumbnailUrl180 = strArray2[0].Replace("/images/", "/thumbs180/180_"), ThumbnailUrl220 = strArray2[0].Replace("/images/", "/thumbs220/220_"), ThumbnailUrl310 = strArray2[0].Replace("/images/", "/thumbs310/310_"), ThumbnailUrl410 = strArray2[0].Replace("/images/", "/thumbs410/410_"), ShortDescription = this.txtShortDescription.Text, IsfreeShipping = this.ChkisfreeShipping.Checked, Description = (!string.IsNullOrEmpty(text) && (text.Length > 0)) ? text : null, AddedDate = DateTime.Now, BrandId = this.dropBrandCategories.SelectedValue }; ProductSaleStatus onSale = ProductSaleStatus.OnSale; if (this.radInStock.Checked) { onSale = ProductSaleStatus.OnStock; } if (this.radUnSales.Checked) { onSale = ProductSaleStatus.UnSale; } if (this.radOnSales.Checked) { onSale = ProductSaleStatus.OnSale; } target.SaleStatus = onSale; CategoryInfo category = CatalogHelper.GetCategory(this.categoryId); if (category != null) { target.MainCategoryPath = category.Path + "|"; } Dictionary <string, SKUItem> skus = null; Dictionary <int, IList <int> > attrs = null; if (this.chkSkuEnabled.Checked) { target.HasSKU = true; skus = base.GetSkus(this.txtSkus.Text); } else { Dictionary <string, SKUItem> dictionary3 = new Dictionary <string, SKUItem>(); SKUItem item = new SKUItem { SkuId = "0", SKU = this.txtSku.Text, SalePrice = num4, CostPrice = nullable.HasValue ? nullable.Value : 0M, Stock = num3, Weight = nullable3.HasValue ? nullable3.Value : 0M }; dictionary3.Add("0", item); skus = dictionary3; if (this.txtMemberPrices.Text.Length > 0) { base.GetMemberPrices(skus["0"], this.txtMemberPrices.Text); } } if (!string.IsNullOrEmpty(this.txtAttributes.Text) && (this.txtAttributes.Text.Length > 0)) { attrs = base.GetAttributes(this.txtAttributes.Text); } ValidationResults validateResults = Hishop.Components.Validation.Validation.Validate <ProductInfo>(target); if (!validateResults.IsValid) { this.ShowMsg(validateResults); } else { IList <int> tagIds = new List <int>(); if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim())) { string str3 = this.txtProductTag.Text.Trim(); string[] strArray3 = null; if (str3.Contains(",")) { strArray3 = str3.Split(new char[] { ',' }); } else { strArray3 = new string[] { str3 }; } foreach (string str4 in strArray3) { tagIds.Add(Convert.ToInt32(str4)); } } ProductInfo productBaseInfo = ProductHelper.GetProductBaseInfo(this.productId); target.SaleCounts = productBaseInfo.SaleCounts; target.ShowSaleCounts = productBaseInfo.ShowSaleCounts; ProductActionStatus status2 = ProductHelper.UpdateProduct(target, skus, attrs, tagIds, wid); if (status2 == ProductActionStatus.Success) { this.litralProductTag.SelectedValue = tagIds; if (base.Request.QueryString["reurl"] != null) { this.ReUrl = base.Request.QueryString["reurl"].ToString(); } this.ShowMsgAndReUrl("修改商品成功", true, this.ReUrl); } else { switch (status2) { case ProductActionStatus.AttributeError: this.ShowMsg("修改商品失败,保存商品属性时出错", false); return; case ProductActionStatus.DuplicateName: this.ShowMsg("修改商品失败,商品名称不能重复", false); return; case ProductActionStatus.DuplicateSKU: this.ShowMsg("修改商品失败,商家编码不能重复", false); return; case ProductActionStatus.SKUError: this.ShowMsg("修改商品失败,商家编码不能重复", false); return; case ProductActionStatus.OffShelfError: this.ShowMsg("修改商品失败, 子站没在零售价范围内的商品无法下架", false); return; case ProductActionStatus.ProductTagEroor: this.ShowMsg("修改商品失败,保存商品标签时出错", false); return; } this.ShowMsg("修改商品失败,未知错误", false); } } } }
protected void Page_Load(object sender, EventArgs e) { TaobaoProductInfo taobaoProduct = new TaobaoProductInfo(); string s = base.Request.Form["productid"]; string str2 = base.Request.Form["stuffstatus"]; string str3 = base.Request.Form["title"]; long num = long.Parse(base.Request.Form["num"]); string str4 = base.Request.Form["locationcity"]; string str5 = base.Request.Form["LocationState"]; string str6 = base.Request.Form["Cid"]; string str7 = base.Request.Form["hasinvoice"]; string str8 = base.Request.Form["HasWarranty"]; string str9 = base.Request.Form["props"]; string str10 = base.Request.Form["inputpids"]; string str11 = base.Request.Form["inputstr"]; string str12 = base.Request.Form["skuproperties"]; string str13 = base.Request.Form["skuquantities"]; string str14 = base.Request.Form["skuprices"]; string str15 = base.Request.Form["skuouterids"]; string str16 = base.Request.Form["freightpayer"]; if (str16 == "buyer") { string str17 = base.Request.Form["postfee"]; string str18 = base.Request.Form["expressfee"]; string str19 = base.Request.Form["emsfee"]; taobaoProduct.PostFee = decimal.Parse(str17); taobaoProduct.EMSFee = decimal.Parse(str19); taobaoProduct.ExpressFee = decimal.Parse(str18); } taobaoProduct.ProductId = int.Parse(s); taobaoProduct.StuffStatus = str2; taobaoProduct.PropertyAlias = str9; taobaoProduct.ProTitle = str3; taobaoProduct.Num = num; taobaoProduct.LocationState = str5; taobaoProduct.LocationCity = str4; taobaoProduct.FreightPayer = str16; taobaoProduct.Cid = Convert.ToInt64(str6); if (!string.IsNullOrEmpty(str10)) { taobaoProduct.InputPids = str10; } if (!string.IsNullOrEmpty(str11)) { taobaoProduct.InputStr = str11; } if (!string.IsNullOrEmpty(str12)) { taobaoProduct.SkuProperties = str12; } if (!string.IsNullOrEmpty(str14)) { taobaoProduct.SkuPrices = str14; } if (!string.IsNullOrEmpty(str15)) { taobaoProduct.SkuOuterIds = str15; } if (!string.IsNullOrEmpty(str13)) { taobaoProduct.SkuQuantities = str13; } taobaoProduct.HasInvoice = Convert.ToBoolean(str7); taobaoProduct.HasWarranty = Convert.ToBoolean(str8); taobaoProduct.HasDiscount = false; taobaoProduct.ListTime = DateTime.Now; if (ProductHelper.UpdateToaobProduct(taobaoProduct)) { this.litmsg.Text = "制作淘宝格式的商品数据成功"; } else { this.litmsg.Text = "制作淘宝格式的商品数据失败"; } }
protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId, false); decimal d = 0m; decimal num = 0m; if (orderMarkingOrderInfo.Count == 0) { this.Page.Response.Redirect("/Vshop/MemberOrders.aspx?status=0"); } bool flag = true; foreach (OrderInfo current in orderMarkingOrderInfo) { //牛奶配送计算总价 d += current.GetMilkTotal(); //d += current.GetTotal(); num += current.GetBalancePayMoneyTotal(); foreach (LineItemInfo current2 in current.LineItems.Values) { if (current2.Type == 0) { flag = false; } foreach (LineItemInfo current3 in current.LineItems.Values) { if (!ProductHelper.GetProductHasSku(current3.SkuId, current3.Quantity)) { current.OrderStatus = OrderStatus.Closed; current.CloseReason = "库存不足"; OrderHelper.UpdateOrder(current); System.Web.HttpContext.Current.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>"); System.Web.HttpContext.Current.Response.End(); return; } } } } string text = this.Page.Request.Url.ToString().ToLower(); int num2 = Globals.RequestQueryNum("IsAlipay"); string userAgent = this.Page.Request.UserAgent; if (num2 != 1 && userAgent.ToLower().Contains("micromessenger") && !string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { this.Page.Response.Redirect("/Pay/IframeAlipay.aspx?OrderId=" + this.orderId); } else { if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.offlinerequest") { this.litMessage = (System.Web.UI.WebControls.Literal) this.FindControl("litMessage"); this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent); } this.litOPertorList = (System.Web.UI.WebControls.Literal) this.FindControl("litOPertorList"); this.litOPertorList.Text = "<div class=\"btns mt20\"><a id=\"linkToDetail\" class=\"btn btn-default mr10\" role=\"button\">查看订单</a><a href=\"/Default.aspx\" class=\"btn btn-default\" role=\"button\">继续逛逛</a></div>"; if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.weixinrequest") { string text2 = "立即支付"; if (num > 0m && d - num > 0m) { text2 = "还需支付 " + (d - num).ToString("F2"); } this.litOPertorList.Text = string.Concat(new string[] { "<div class=\"mt20\"><a href=\"/pay/wx_Submit.aspx?orderId=", this.orderId, "\" class=\"btn btn-danger\" role=\"button\" id=\"btnToPay\">", text2, "</a></div>" }); } if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.podrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.offlinerequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.weixinrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.balancepayrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.pointtocach" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.coupontocach") { PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderMarkingOrderInfo[0].PaymentTypeId); string attach = ""; string showUrl = string.Format("http://{0}/vshop/", System.Web.HttpContext.Current.Request.Url.Host); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, d - num, "订单支付", "订单号-" + this.orderId, orderMarkingOrderInfo[0].EmailAddress, orderMarkingOrderInfo[0].OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach); paymentRequest.SendRequest(); } else { this.litOrderId = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderId"); this.litOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal"); this.literalOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("literalOrderTotal"); this.literalBalancePayInfo = (System.Web.UI.WebControls.Literal) this.FindControl("literalBalancePayInfo"); this.litPaymentType = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litPaymentType"); int num3 = 0; this.litPaymentType.SetWhenIsNotNull("0"); if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out num3)) { this.litPaymentType.SetWhenIsNotNull(num3.ToString()); } this.litOrderId.SetWhenIsNotNull(this.orderId); if (flag) { this.litOrderTotal.SetWhenIsNotNull("您需要支付:¥" + d.ToString("F2")); } this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span style='color:red'>¥" + d.ToString("F2") + "</span>"); if (num > 0m) { this.literalBalancePayInfo.Text = "<div class='font-xl'>余额已支付:<span style='color:red'>¥" + num.ToString("F2") + "</span></div>"; } this.litHelperText = (System.Web.UI.WebControls.Literal) this.FindControl("litHelperText"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent); PageTitle.AddSiteNameTitle("下单成功"); } } }
private void BindProducts(int exchangeId) { if (exchangeId != 0) { string text = this.txt_name.Text; string val = this.txt_minPrice.Text; string str3 = this.txt_maxPrice.Text; decimal?nullable = null; decimal?nullable2 = null; decimal i = 0M; if (!this.bDecimal(val, ref i)) { nullable = null; } else { nullable = new decimal?(i); } if (!this.bDecimal(str3, ref i)) { nullable2 = null; } else { nullable2 = new decimal?(i); } ProductQuery entity = new ProductQuery { Keywords = text, ProductCode = "", CategoryId = null, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = SortAction.Desc, SortBy = "DisplaySequence", StartDate = null, BrandId = null, EndDate = null, TypeId = null, SaleStatus = this.status, minPrice = nullable, maxPrice = nullable2, TwoSaleStatus = "OnStock" }; Globals.EntityCoding(entity, true); DbQueryResult products = ProductHelper.GetProducts(entity); DataTable data = (DataTable)products.Data; DataTable table2 = PointExChangeHelper.GetProducts(this.eId); data.Columns.Add("ProductNumber"); data.Columns.Add("PointNumber"); data.Columns.Add("eachMaxNumber"); data.Columns.Add("seledStatus"); data.Columns.Add("canSelStatus"); data.Columns.Add("canChkStatus"); if ((data != null) && (data.Rows.Count > 0)) { for (int j = 0; j < data.Rows.Count; j++) { data.Rows[j]["ProductNumber"] = 0; data.Rows[j]["PointNumber"] = 0; data.Rows[j]["eachMaxNumber"] = 0; } } if (table2 != null) { if ((data.Rows.Count > 0) && (table2.Rows.Count > 0)) { for (int k = 0; k < data.Rows.Count; k++) { int num4 = int.Parse(data.Rows[k]["ProductId"].ToString()); if (table2.Select(string.Format("ProductId={0}", num4)).Length > 0) { data.Rows[k]["seledStatus"] = "''"; data.Rows[k]["canSelStatus"] = "none"; data.Rows[k]["canChkStatus"] = "disabled"; PointExchangeProductInfo productInfo = PointExChangeHelper.GetProductInfo(exchangeId, num4); if (productInfo != null) { data.Rows[k]["ProductNumber"] = productInfo.ProductNumber.ToString(); data.Rows[k]["PointNumber"] = productInfo.PointNumber.ToString(); data.Rows[k]["eachMaxNumber"] = productInfo.EachMaxNumber.ToString(); } } else { data.Rows[k]["seledStatus"] = "none"; data.Rows[k]["canSelStatus"] = "''"; data.Rows[k]["canChkStatus"] = string.Empty; } } } else if (data.Rows.Count > 0) { for (int m = 0; m < data.Rows.Count; m++) { data.Rows[m]["seledStatus"] = "none"; data.Rows[m]["canSelStatus"] = "''"; data.Rows[m]["canChkStatus"] = string.Empty; } } } this.grdProducts.DataSource = products.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = products.TotalRecords; this.lbwareNumber.Text = products.TotalRecords.ToString(); this.lbSelectNumber.Text = (table2 != null) ? table2.Rows.Count.ToString() : "0"; this.setInSale(); } }
private void setInSale() { DataTable productNum = ProductHelper.GetProductNum(); this.lbsaleNumber.Text = productNum.Rows[0]["OnSale"].ToString(); }
protected void Restore() { TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id); this.txtBannerDesc.Text = tplCfgById.ShortDesc; this.ddlType.SelectedValue = tplCfgById.LocationType.ToString(); this.littlepic.Src = tplCfgById.ImageUrl; this.fmSrc.Value = tplCfgById.ImageUrl; switch (tplCfgById.LocationType) { case LocationType.Topic: this.ddlSubType.Attributes.CssStyle.Remove("display"); this.ddlSubType.DataSource = VShopHelper.Gettopics(); this.ddlSubType.DataTextField = "Title"; this.ddlSubType.DataValueField = "TopicId"; this.ddlSubType.DataBind(); this.ddlSubType.SelectedValue = tplCfgById.Url; break; case (LocationType)1: case LocationType.Home: case LocationType.ShoppingCart: case LocationType.OrderCenter: case LocationType.VipCard: case LocationType.GroupBuy: break; case LocationType.Brand: int BrandId = 0; if (tplCfgById != null && !string.IsNullOrEmpty(tplCfgById.Url)) { int.TryParse(tplCfgById.Url, out BrandId); } this.dropBrandTypes.Attributes.CssStyle.Remove("display"); this.dropBrandTypes.DataSource = ControlProvider.Instance().GetBrandCategories(); this.dropBrandTypes.DataTextField = "BrandName"; this.dropBrandTypes.DataValueField = "BrandId"; this.dropBrandTypes.DataBind(); if (BrandId > 0) { dropBrandTypes.SelectedValue = BrandId; } break; case LocationType.Category: int categoryId = 0; if (tplCfgById != null && !string.IsNullOrEmpty(tplCfgById.Url)) { //string[] str = tplCfgById.Url.Split('?'); //if (str.Length > 0) //{ // string[] str1 = (tplCfgById.Url.Split('?')[1]).Split('='); // int.TryParse(str1[1].ToString(), out categoryId); //} int.TryParse(tplCfgById.Url, out categoryId); } this.dropCategories.Attributes.CssStyle.Remove("display"); this.dropCategories.DataSource = CatalogHelper.GetMainCategories(); this.dropCategories.DataTextField = "Name"; this.dropCategories.DataValueField = "CategoryId"; this.dropCategories.DataBind(); if (categoryId > 0) { dropCategories.SelectedValue = categoryId; } break; case LocationType.ImportSourceType: int importSourceId = 0; if (tplCfgById != null && !string.IsNullOrEmpty(tplCfgById.Url)) { //string[] str = tplCfgById.Url.Split('?'); //if (str.Length > 0) //{ // string[] str1 = (tplCfgById.Url.Split('?')[1]).Split('='); // int.TryParse(str1[1].ToString(), out importSourceId); //} int.TryParse(tplCfgById.Url, out importSourceId); } this.dropImportSourceType.Attributes.CssStyle.Remove("display"); this.dropImportSourceType.DataSource = ImportSourceTypeHelper.GetAllImportSourceTypes(); this.dropImportSourceType.DataTextField = "CnArea"; this.dropImportSourceType.DataValueField = "ImportSourceId"; this.dropImportSourceType.DataBind(); if (importSourceId > 0) { dropImportSourceType.SelectedValue = importSourceId; } break; case LocationType.Activity: { this.ddlSubType.Attributes.CssStyle.Remove("display"); this.ddlSubType.BindEnum <EcShop.Entities.VShop.LocationType>(""); //修改1 this.ddlSubType.SelectedValue = tplCfgById.Url.Split(new char[] { ',' })[0]; this.ddlThridType.Attributes.CssStyle.Remove("display"); LotteryActivityType lotteryActivityType = (LotteryActivityType)System.Enum.Parse(typeof(LotteryActivityType), tplCfgById.Url.Split(new char[] { ',' })[0]); if (lotteryActivityType == LotteryActivityType.SignUp) { this.ddlThridType.DataSource = from item in VShopHelper.GetAllActivity() select new { ActivityId = item.ActivityId, ActivityName = item.Name }; } else { this.ddlThridType.DataSource = VShopHelper.GetLotteryActivityByType(lotteryActivityType); } this.ddlThridType.DataTextField = "ActivityName"; this.ddlThridType.DataValueField = "Activityid"; this.ddlThridType.DataBind(); this.ddlThridType.SelectedValue = tplCfgById.Url.Split(new char[] { ',' })[1]; return; } case LocationType.Link: this.Tburl.Text = tplCfgById.Url; this.Tburl.Attributes.CssStyle.Remove("display"); return; case LocationType.Phone: this.Tburl.Text = tplCfgById.Url; this.Tburl.Attributes.CssStyle.Remove("display"); return; case LocationType.Address: this.Tburl.Attributes.CssStyle.Remove("display"); this.navigateDesc.Attributes.CssStyle.Remove("display"); this.Tburl.Text = tplCfgById.Url; return; case LocationType.Article: { this.ddlSubType.Attributes.CssStyle.Remove("display"); System.Collections.Generic.IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories(); this.ddlSubType.Items.Clear(); int num = 0; int num2 = 0; if (!string.IsNullOrEmpty(tplCfgById.Url)) { int num3 = tplCfgById.Url.LastIndexOf('='); int.TryParse(tplCfgById.Url.Substring(num3 + 1), out num); } if (num > 0) { ArticleInfo article = CommentBrowser.GetArticle(num); if (article != null) { num2 = article.CategoryId; } } if (articleMainCategories != null && articleMainCategories.Count > 0) { foreach (ArticleCategoryInfo current in articleMainCategories) { this.ddlSubType.Items.Add(new System.Web.UI.WebControls.ListItem(current.Name, current.CategoryId.ToString())); } if (num2 > 0) { this.ddlSubType.SelectedValue = num2.ToString(); } } if (num > 0) { this.ddlThridType.Attributes.CssStyle.Remove("display"); System.Collections.Generic.IList <ArticleInfo> articleList = CommentBrowser.GetArticleList(num2, 1000); foreach (ArticleInfo current2 in articleList) { this.ddlThridType.Items.Add(new System.Web.UI.WebControls.ListItem(current2.Title, current2.ArticleId.ToString())); } this.ddlThridType.SelectedValue = num.ToString(); return; } break; } case LocationType.Product: this.linkSelectProduct.Attributes.CssStyle.Remove("display"); this.productName.Attributes.CssStyle.Remove("display"); this.productid.Value = tplCfgById.Url; int result; if (int.TryParse(tplCfgById.Url, out result)) { this.productName.InnerText = ProductHelper.GetProductDetails(result).ProductName; } break; default: return; } }
public ActionResult Index() { List <ProductModel> models = ProductHelper.GetProducts(); return(View(models)); }
private void setInStock() { DataTable productNum = ProductHelper.GetProductNum(this.wid); this.lbwareNumber.Text = productNum.Rows[0]["OnStock"].ToString(); }
// GET: /<controller>/ public IActionResult Index(List <string> filterBrand = null, List <string> filterDepartment = null, int pageItems = 20, int pageNumber = 1, string search = null, string orderBy = "createdate", string orderByModifier = "desc", string statusMessage = null, string successMessage = null, string failureMessage = null) { var products = new List <Product>(); var pageProducts = new List <Product>(); var where = ""; string searchTerm = null; var maxPages = 1; var pageStart = 1; var pageEnd = 1; //checked filter for brand and ensure no SQL injection if (filterBrand != null && filterBrand.Count > 0) { if (searchTerm == null) { searchTerm = "select * from products where "; } foreach (var brand in filterBrand) { if (!ProductHelper.CheckSQL(brand)) { return(ControllerHelper.RedirectToLocal(this, "/Products?failureMessage=Filter not available.")); } } where = ProductHelper.CreateFilterSQL("productbrandid", filterBrand, _context); searchTerm += where; } //if both brand and department filtered then add 'and' to where if (where.Length > 0 && filterDepartment != null && filterDepartment.Count > 0) { searchTerm += " and "; } //checked department filter and ensure no SQL injection if (filterDepartment != null && filterDepartment.Count > 0) { if (searchTerm == null) { searchTerm = "select * from products where "; } foreach (var dept in filterDepartment) { if (!ProductHelper.CheckSQL(dept)) { return(ControllerHelper.RedirectToLocal(this, "/Products?failureMessage=Filter not available.")); } } where = ProductHelper.CreateFilterSQL("departmentid", filterDepartment, _context); searchTerm += where; } if (!string.IsNullOrWhiteSpace(search)) { if (where.Length > 0 && (filterDepartment != null || filterDepartment.Count > 0)) { searchTerm += " and "; } else { searchTerm = "select * from products where "; } searchTerm += ProductHelper.CreateSearchSQL(search); } products = ProductHelper.GetProducts(_context, searchTerm, orderBy, orderByModifier); //select just the products relevant to selected page if (pageItems == 1) { maxPages = 1; } else { double pages = Convert.ToDouble(products.Count) / Convert.ToDouble(pageItems); maxPages = Convert.ToInt32(Math.Ceiling(pages)); } if (pageNumber > 1) { pageStart = ((pageNumber - 1) * pageItems) + 1; } if (pageItems == 1 || products.Count < pageItems) { pageEnd = products.Count; } else { pageEnd = pageNumber * pageItems; } if (pageItems == 1) { pageProducts = products; } else { var i = 0; foreach (var product in products) { i++; if (i >= pageStart && i <= pageEnd) { pageProducts.Add(product); } } } var previousUrl = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber - 1, orderBy, orderByModifier, search); var nextUrl = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 1, orderBy, orderByModifier, search); var page1Url = ""; var page2Url = ""; var page3Url = ""; var page4Url = ""; var page5Url = ""; if (pageNumber == 1) { page1Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber, orderBy, orderByModifier, search); page2Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 1, orderBy, orderByModifier, search); page3Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 2, orderBy, orderByModifier, search); page4Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 3, orderBy, orderByModifier, search); page5Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 4, orderBy, orderByModifier, search); } else if (pageNumber == 2) { page1Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber - 1, orderBy, orderByModifier, search); page2Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber, orderBy, orderByModifier, search); page3Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 1, orderBy, orderByModifier, search); page4Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 2, orderBy, orderByModifier, search); page5Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 3, orderBy, orderByModifier, search); } else { page1Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber - 2, orderBy, orderByModifier, search); page2Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber - 1, orderBy, orderByModifier, search); page3Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber, orderBy, orderByModifier, search); page4Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 1, orderBy, orderByModifier, search); page5Url = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber + 2, orderBy, orderByModifier, search); } var viewModel = new ProductListViewModel { Products = pageProducts, Brands = _context.ProductBrands.OrderBy(x => x.Brand).ToList(), Departments = _context.Departments.OrderBy(x => x.DepartmentName).ToList(), PageItems = pageItems, PageNumber = pageNumber, MaxPages = maxPages, OrderBy = orderBy, PreviousUrl = previousUrl, NextUrl = nextUrl, PageURLs = new List <string> { page1Url, page2Url, page3Url, page4Url, page5Url }, ItemCountUrl1 = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", 20, 1, orderBy, orderByModifier, search), ItemCountUrl2 = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", 40, 1, orderBy, orderByModifier, search), ItemCountUrl3 = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", 1, 1, orderBy, orderByModifier, search), CreateDateUrl = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, 1, "createDate", "desc", search), BrandUrl = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, 1, "brand", "asc", search), DepartmentUrl = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, 1, "department", "asc", search), PriceUrl = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, 1, "price", "asc", search), TitleUrl = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, 1, "title", "asc", search), ReturnUrl = string.Format("/Products?pageItems={0}&&pageNumber={1}&&orderBy={2}&&orderByModifier={3}&&search={4}", pageItems, pageNumber, orderBy, orderByModifier, search), OrderByModifier = orderByModifier, SuccessMessage = successMessage, FailureMessage = failureMessage, StatusMessage = statusMessage }; if (filterBrand != null) { viewModel.FilteredBrands = filterBrand; } else { viewModel.FilteredBrands = new List <string>(); } if (filterDepartment != null) { viewModel.FilteredDepartments = filterDepartment; } else { viewModel.FilteredDepartments = new List <string>(); } return(View(viewModel)); //return ControllerHelper.RedirectToLocal(this,"/Home/ComingSoon"); }
private void BindProducts(int couponId) { DataTable selectedProducts = this.GetSelectedProducts(couponId); string text = this.txt_name.Text; string val = this.txt_minPrice.Text; string str3 = this.txt_maxPrice.Text; decimal? nullable = null; decimal? nullable2 = null; decimal i = 0M; if (!this.bDecimal(val, ref i)) { nullable = null; } else { nullable = new decimal?(i); } if (!this.bDecimal(str3, ref i)) { nullable2 = null; } else { nullable2 = new decimal?(i); } ProductQuery entity = new ProductQuery { Keywords = text, ProductCode = "", CategoryId = null, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = SortAction.Desc, SortBy = "DisplaySequence", StartDate = null, BrandId = null, EndDate = null, TypeId = null, SaleStatus = this.status, minPrice = nullable, maxPrice = nullable2 }; Globals.EntityCoding(entity, true); DbQueryResult products = ProductHelper.GetProducts(entity); DataTable data = (DataTable)products.Data; data.Columns.Add("seledStatus"); data.Columns.Add("canSelStatus"); data.Columns.Add("canChkStatus"); if ((data != null) && (selectedProducts != null)) { if ((data.Rows.Count > 0) && (selectedProducts.Rows.Count > 0)) { for (int j = 0; j < data.Rows.Count; j++) { int num3 = int.Parse(data.Rows[j]["ProductId"].ToString()); if (selectedProducts.Select(string.Format("ProductId={0}", num3)).Length > 0) { data.Rows[j]["seledStatus"] = "''"; data.Rows[j]["canSelStatus"] = "none"; data.Rows[j]["canChkStatus"] = "disabled"; } else { data.Rows[j]["seledStatus"] = "none"; data.Rows[j]["canSelStatus"] = "''"; data.Rows[j]["canChkStatus"] = string.Empty; } } } else if (data.Rows.Count > 0) { for (int k = 0; k < data.Rows.Count; k++) { data.Rows[k]["seledStatus"] = "none"; data.Rows[k]["canSelStatus"] = "''"; data.Rows[k]["canChkStatus"] = string.Empty; } } } this.grdProducts.DataSource = products.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = products.TotalRecords; this.lbsaleNumber.Text = products.TotalRecords.ToString(); this.lblJoin.Text = (selectedProducts != null) ? selectedProducts.Rows.Count.ToString() : "0"; this.setInStock(); }
private void BindProducts(int couponId) { System.Data.DataTable selectedProducts = this.GetSelectedProducts(couponId); string text = this.txt_name.Text; string text2 = this.txt_minPrice.Text; string text3 = this.txt_maxPrice.Text; decimal?minPrice = null; decimal?maxPrice = null; decimal value = 0m; if (!this.bDecimal(text2, ref value)) { minPrice = null; } else { minPrice = new decimal?(value); } if (!this.bDecimal(text3, ref value)) { maxPrice = null; } else { maxPrice = new decimal?(value); } ProductQuery productQuery = new ProductQuery { Keywords = text, ProductCode = "", CategoryId = null, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = SortAction.Desc, SortBy = "DisplaySequence", StartDate = null, BrandId = null, EndDate = null, TypeId = null, SaleStatus = this._status, minPrice = minPrice, maxPrice = maxPrice, selectQuery = string.Format("productId in (select productId from Hishop_Activities_Product where ActivitiesId={0})", this._id) }; Globals.EntityCoding(productQuery, true); DbQueryResult products = ProductHelper.GetProducts(productQuery); System.Data.DataTable dataTable = (System.Data.DataTable)products.Data; dataTable.Columns.Add("setStatus"); if (dataTable != null && selectedProducts != null && dataTable.Rows.Count > 0 && selectedProducts.Rows.Count > 0) { for (int i = 0; i < dataTable.Rows.Count; i++) { int num = int.Parse(dataTable.Rows[i]["ProductId"].ToString()); System.Data.DataRow[] array = selectedProducts.Select(string.Format("ProductId={0}", num)); if (array.Length > 0) { dataTable.Rows[i]["setStatus"] = ((array[0]["status"].ToString() == "0") ? "暂停" : "恢复"); } } } this.grdProducts.DataSource = products.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = products.TotalRecords; this.lblJoin.Text = ((selectedProducts != null) ? selectedProducts.Rows.Count.ToString() : "0"); this.setInSaleAndStock(); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(hdnCatId.Value); Categories _otherCat = bCategory.List().Where(m => m.Category_Id != id && m.Category_Title == txtCategory.Text).FirstOrDefault(); int adminId = Convert.ToInt32(Session[ConfigurationSettings.AppSettings["AdminSession"].ToString()].ToString()); if (_otherCat == null) { Categories Categories = bCategory.List().Where(m => m.Category_Id == id).FirstOrDefault(); Categories.Category_Title = txtCategory.Text; Categories.Category_UpdatedDate = DateTime.Now; Categories.Administrators_Id = adminId; Categories.Category_Status = (chkIsActive.Checked) ? eStatus.Active.ToString() : eStatus.InActive.ToString(); if (imgInp.HasFile) { Categories.Category_Photo = "files/category/" + "Category_" + Categories.Category_Id + ".png"; string path = Server.MapPath("../" + Categories.Category_Photo); FileInfo file = new FileInfo(path); if (file.Exists)//check file exsit or not { file.Delete(); } Upload(Categories.Category_Id); } Categories = bCategory.Update(Categories); if (string.IsNullOrEmpty(Categories.ErrorMessage) && Categories.Category_Status == eStatus.InActive.ToString()) { List <SubCategories> subCategories = new List <SubCategories>(); List <Product> products = new List <Product>(); subCategories = bSubCategory.List().Where(m => m.Category_Id == Categories.Category_Id && m.SubCategory_Status == eStatus.Active.ToString()).ToList(); foreach (var item113 in subCategories) { List <Product> productsTemp = new List <Product>(); productsTemp = bProduct.List().Where(m => m.Product_Status == eProductStatus.Published.ToString() && m.SubCategory.SubCategory_Id == item113.SubCategory_Id).ToList(); products.AddRange(productsTemp); } foreach (var item in products) { item.Product_Status = eProductStatus.ReviewPending.ToString(); bProduct.Update(item); ProductHelper.CreateProductFlow(item.Product_Id, item.Product_Title, adminId, "System", "Category In Active : Product Updated and set to Review Pending Status", item.Product_Status); bProduct.DeleteTopEight(item.Product_Id); bProduct.DeleteProductFeature(item.Product_Id); bProduct.DeleteCart(item.Product_Id); } } ActivityHelper.Create("Update Category", "New Category Updated On " + DateTime.Now.ToString("D") + " Successfully and Title is " + Categories.Category_Title + ".", adminId); Response.Redirect("/administration/categories/category.aspx?id=2000&redirecturl=admin-category-RachnaTeracotta"); } else { pnlErrorMessage.Attributes.Remove("class"); pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable"; pnlErrorMessage.Visible = true; lblMessage.Text = "Oops!! Category not updated successfully, category name should not be same as other"; } } catch (Exception ex) { pnlErrorMessage.Attributes.Remove("class"); pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable"; pnlErrorMessage.Visible = true; lblMessage.Text = ex.InnerException.InnerException.Message; } }
private void btnAddFightGroupActivitiy_Click(object sender, EventArgs e) { lock (AddFightGroupActivitiy.ObjLock) { FightGroupActivityInfo fightGroupActivityInfo = new FightGroupActivityInfo(); List <FightGroupSkuInfo> list = new List <FightGroupSkuInfo>(); if (this.productId == 0) { this.ShowMsg(Formatter.FormatErrorMessage("请选择商品"), false); goto end_IL_0009; } fightGroupActivityInfo.ProductId = this.productId; string text = Globals.StripAllTags(this.txtFightGroupShareTitle.Text.Trim()); string text2 = Globals.StripAllTags(this.txtFightGroupShareDetails.Text.Trim()); int num; if ((this.rbtlTitle.SelectedIndex != 1 || (!string.IsNullOrEmpty(text) && text.Length <= 60)) && !string.IsNullOrEmpty(text2)) { num = ((text2.Length > 60) ? 1 : 0); goto IL_00bb; } num = 1; goto IL_00bb; IL_00bb: if (num != 0) { this.ShowMsg("请按要求输入分享标题和详情", false); } else { if (this.rbtlTitle.SelectedIndex == 0) { fightGroupActivityInfo.ShareTitle = ""; } else { fightGroupActivityInfo.ShareTitle = text; } fightGroupActivityInfo.ShareContent = text2; for (int i = 0; i < this.rptProductSkus.Items.Count; i++) { RepeaterItem repeaterItem = this.rptProductSkus.Items[i]; HiddenField hiddenField = repeaterItem.FindControl("hfSkuId") as HiddenField; TextBox textBox = repeaterItem.FindControl("txtActivityStock") as TextBox; TextBox textBox2 = repeaterItem.FindControl("txtActivitySalePrice") as TextBox; if (textBox2.Text.Trim().ToDecimal(0) == decimal.Zero) { this.ShowMsg("请完整填写商品规格", false); return; } FightGroupSkuInfo item = new FightGroupSkuInfo { SalePrice = textBox2.Text.Trim().ToDecimal(0), TotalCount = textBox.Text.Trim().ToInt(0), SkuId = hiddenField.Value }; list.Add(item); } if (this.rptProductSkus.Items.Count == 0) { if (this.txtPrice.Text.Trim().ToDecimal(0) == decimal.Zero) { this.ShowMsg("请填写火拼价", false); goto end_IL_0009; } if (this.txtTotalCount.Text.Trim().ToInt(0) == 0) { this.ShowMsg("请填写活动库存", false); goto end_IL_0009; } } if (!this.CPStartTime.SelectedDate.HasValue) { this.ShowMsg(Formatter.FormatErrorMessage("请填写开始时间"), false); } else { fightGroupActivityInfo.StartDate = this.CPStartTime.SelectedDate.Value; if (!this.CPEndDate.SelectedDate.HasValue) { this.ShowMsg(Formatter.FormatErrorMessage("请填写结束时间"), false); } else { fightGroupActivityInfo.EndDate = this.CPEndDate.SelectedDate.Value; if (fightGroupActivityInfo.StartDate >= fightGroupActivityInfo.EndDate) { this.ShowMsg(Formatter.FormatErrorMessage("结束时间要大于开始时间"), false); } else if (fightGroupActivityInfo.EndDate <= DateTime.Now) { this.ShowMsg(Formatter.FormatErrorMessage("结束时间要大于当前系统时间"), false); } else if (string.IsNullOrEmpty(this.txtJoinNumber.Text.Trim())) { this.ShowMsg("请填写参团人数", false); } else { fightGroupActivityInfo.JoinNumber = this.txtJoinNumber.Text.ToInt(0); if (fightGroupActivityInfo.JoinNumber.ToInt(0) <= 1) { this.ShowMsg("参团人数要大于1人0", false); } else if (string.IsNullOrEmpty(this.txtLimitedHour.Text.Trim())) { this.ShowMsg("请填写成团时限", false); } else { fightGroupActivityInfo.LimitedHour = this.txtLimitedHour.Text.ToInt(0); if (fightGroupActivityInfo.LimitedHour.ToInt(0) <= 0) { this.ShowMsg("成团时限要大于0", false); } else if (this.txtMaxCount.Text.Trim().ToInt(0) == 0) { this.ShowMsg("请填写每人限购数量", false); } else { fightGroupActivityInfo.MaxCount = this.txtMaxCount.Text.ToInt(0); if (VShopHelper.ProductFightGroupActivitiyExist(fightGroupActivityInfo.ProductId)) { this.ShowMsg("已经存在此商品的火拼团活动", false); } else { int num2 = 0; num2 = ((this.rptProductSkus.Items.Count == 0) ? this.txtTotalCount.Text.Trim().ToInt(0) : list.Sum((FightGroupSkuInfo c) => c.TotalCount)); if (fightGroupActivityInfo.MaxCount > num2) { this.ShowMsg(Formatter.FormatErrorMessage("每人限购数量不能大于活动库存"), false); } else if (list.Count > 0 && fightGroupActivityInfo.MaxCount > (from c in list where c.TotalCount > 0 select c).Min((FightGroupSkuInfo c) => c.TotalCount)) { this.ShowMsg(Formatter.FormatErrorMessage("每人限购数量不能大于规格的最小活动库存"), false); } else { IList <int> list2 = null; Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >); ProductInfo productDetails = ProductHelper.GetProductDetails(fightGroupActivityInfo.ProductId, out dictionary, out list2); if (productDetails != null) { fightGroupActivityInfo.ProductName = productDetails.ProductName; if (productDetails.Stock < fightGroupActivityInfo.MaxCount) { this.ShowMsg("库存小于每人限购数量", false); goto end_IL_0009; } if (productDetails.Stock < num2) { this.ShowMsg($"当前活动库存为 {num2},商品库存小于活动库存", false); goto end_IL_0009; } if (list.Count > 0) { foreach (KeyValuePair <string, SKUItem> sku in productDetails.Skus) { FightGroupSkuInfo fightGroupSkuInfo = (from s in list where s.SkuId == sku.Value.SkuId select s).FirstOrDefault(); if (fightGroupSkuInfo == null) { this.ShowMsg("规格不存在,请重新刷新页面", false); return; } if (fightGroupSkuInfo.TotalCount > sku.Value.Stock) { this.ShowMsg($"当前规格活动库存为 {fightGroupSkuInfo.TotalCount},商品库存小于活动库存", false); return; } } } } if (list.Count == 0) { DataTable skusByProductId = ProductHelper.GetSkusByProductId(this.productId); if (skusByProductId.Rows.Count > 0) { DataRow dataRow = skusByProductId.Rows[0]; FightGroupSkuInfo item2 = new FightGroupSkuInfo { SalePrice = this.txtPrice.Text.Trim().ToDecimal(0), TotalCount = num2, SkuId = dataRow["SkuId"].ToNullString() }; list.Add(item2); } } if (string.IsNullOrEmpty(this.hidUploadLogo.Value)) { this.ShowMsg("请上传活动图片", false); } else if (VShopHelper.CanAddFightGroupActivitiy(fightGroupActivityInfo.ProductId, productDetails.ProductName, 0)) { fightGroupActivityInfo.Icon = Globals.SaveFile("GroupActivitie", this.hidUploadLogo.Value, "/Storage/master/", true, false, ""); VShopHelper.AddFightGroupActivitie(fightGroupActivityInfo, list); this.ShowMsg("添加火拼团活动成功", true, "FightGroupActivitiyList.aspx"); } else { this.ShowMsg("该商品正在参加其他活动,无法同时参加拼团活动", false); } } } } } } } } } end_IL_0009 :; } }
protected override IEnumerable <StoreMoveSearchEntity> SearchData() { var lp = VMGlobal.DistributionQuery.LinqOP; var brands = VMGlobal.PoweredBrands; var brandIDs = brands.Select(b => b.ID); var storemoveContext = lp.Search <BillStoreMove, BillStoreMove>(selector: o => new BillStoreMove { BrandID = o.BrandID, Code = o.Code, CreateTime = o.CreateTime.Date, CreatorID = o.CreatorID, ID = o.ID, OrganizationID = o.OrganizationID, Remark = o.Remark, StorageIDOut = o.StorageIDOut, StorageIDIn = o.StorageIDIn }, condition: o => o.OrganizationID == VMGlobal.CurrentUser.OrganizationID && brandIDs.Contains(o.BrandID)); var filtedData = (IQueryable <BillStoreMove>)storemoveContext.Where(FilterDescriptors); var detailsContext = lp.GetDataContext <BillStoreMoveDetails>(); var pIDs = ProductHelper.GetProductIDArrayWithCondition(DetailsDescriptors, brandIDs); if (pIDs != null) { if (pIDs.Count() == 0) { return(null); } filtedData = from d in filtedData where detailsContext.Any(od => od.BillID == d.ID && pIDs.Contains(od.ProductID)) select d; } TotalCount = filtedData.Count(); filtedData = filtedData.OrderByDescending(o => o.ID).Skip(PageIndex * PageSize).Take(PageSize); var userContext = lp.GetDataContext <ViewUser>(); var result = from d in filtedData from user in userContext where d.CreatorID == user.ID select new StoreMoveSearchEntity { ID = d.ID, BrandID = d.BrandID, Code = d.Code, CreateTime = d.CreateTime, CreatorName = user.Name, Remark = d.Remark, StorageIDOut = d.StorageIDOut, StorageIDIn = d.StorageIDIn }; var storemove = result.ToList(); var bIDs = storemove.Select(o => (int)o.ID); var sum = detailsContext.Where(o => bIDs.Contains(o.BillID)).GroupBy(o => o.BillID).Select(g => new { BillID = g.Key, Quantity = g.Sum(o => o.Quantity) }).ToList(); storemove.ForEach(d => { d.BrandName = brands.First(b => b.ID == d.BrandID).Name; d.Quantity = sum.Find(o => o.BillID == d.ID).Quantity; d.OutStorageName = ReportDataContext.Storages.First(b => b.ID == d.StorageIDOut).Name; d.InStorageName = ReportDataContext.Storages.First(b => b.ID == d.StorageIDIn).Name; }); return(storemove); }
public void Execute(IServiceProvider serviceProvider) { SqlDataAccess sda = null; sda = new SqlDataAccess(); sda.openConnection(Globals.ConnectionString); #region | SERVICE | IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); #region | Validate Request | //Target yoksa veya Entity tipinde değilse, devam etme. if (!context.InputParameters.Contains("Target") || !(context.InputParameters["Target"] is Entity)) { return; } #endregion IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService(Globals.AdministratorId); #region |DEFINE IMAGE IF EXISTS| Entity preImage = null; if (context.PreEntityImages.Contains("PreImage") && context.PreEntityImages["PreImage"] is Entity) { preImage = (Entity)context.PreEntityImages["PreImage"]; } #endregion #endregion Entity entity = (Entity)context.InputParameters["Target"]; try { if (entity.Attributes.Contains("new_issendingapproval")) { if (entity.GetAttributeValue <bool>("new_issendingapproval")) { EntityReference currency = preImage.Attributes.Contains("transactioncurrencyid") && preImage["transactioncurrencyid"] != null ? (EntityReference)preImage["transactioncurrencyid"] : null; EntityReference projectId = preImage.Attributes.Contains("new_projectid") && preImage["new_projectid"] != null ? (EntityReference)preImage["new_projectid"] : null; MsCrmResultObject productResult = SecondHandHelper.GetSecondHandProducts(entity.Id, sda); if (productResult.Success) { //Ürün alındı Product product = ((List <Product>)productResult.ReturnObject)[0]; //Rule alındı SecondHandControlSetting control = ProductHelper.GetSecondHandControlSettingByProject(product.Project.Id, sda); //Kiralama tutarı alındı decimal secondHandAmount = preImage.GetAttributeValue <Money>("new_salesfee").Value; if (control.SecondHandControlSettingId != Guid.Empty) { if (control.ConsultantRate != null) { if (control.ConsultantRate != decimal.MaxValue) { decimal rate = (product.PaymentOfHire.Value * (control.ConsultantRate.Value / 100)); decimal minRate = product.PaymentOfHire.Value - rate; decimal maxRate = product.PaymentOfHire.Value + rate; if (secondHandAmount >= minRate && secondHandAmount <= maxRate) { //Opsiyona takılmaz. Entity ent = new Entity("product"); ent.Id = product.ProductId; ent["new_usedrentalandsalesstatus"] = new OptionSetValue(7); //Satıldı. service.Update(ent); entity["statuscode"] = new OptionSetValue((int)SecondHandStatuses.Onaylandi); //Kiralama Durumu } else { //Ürün kiralama opsiyonlu //Onaya gönder Entity ent = new Entity("product"); ent.Id = product.ProductId; ent["new_usedrentalandsalesstatus"] = new OptionSetValue(6); //konut durumu 2.el satış opsiyonlu service.Update(ent); entity["statuscode"] = new OptionSetValue((int)SecondHandStatuses.OnayBekleniyor); //Kiralama Durumu MsCrmResult mailResult = SecondHandHelper.SendMailSecondHandToApproval(product, preImage, UserTypes.IkinciElSatisDirektoru, sda, service); if (!mailResult.Success) { throw new Exception(mailResult.Result); } } } } } } } } } catch (Exception ex) { throw new InvalidPluginExecutionException(ex.Message + ex.StackTrace); } finally { if (sda != null) { sda.closeConnection(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Globals.RequestFormStr("gettype") == "getcategorycommission") { base.Response.ContentType = "application/json"; string s = "{\"type\":\"0\",\"tips\":\"获取失败!\"}"; this.categoryid = Globals.RequestFormNum("categoryId"); if (this.categoryid > 0) { CategoryInfo category = CatalogHelper.GetCategory(this.categoryid); if (category != null) { s = "{\"type\":\"1\",\"f\":\"" + category.FirstCommission + "\",\"s\":\"" + category.SecondCommission + "\",\"t\":\"" + category.ThirdCommission + "\"}"; } } base.Response.Write(s); base.Response.End(); } else { if (string.IsNullOrEmpty(this.reurl)) { this.reurl = "productonsales.aspx"; } this.thisUrl = base.Request.Url.ToString().ToLower(); if (!string.IsNullOrEmpty(base.Request.QueryString["isCallback"]) && (base.Request.QueryString["isCallback"] == "true")) { base.DoCallback(); } else { this.productId = Globals.RequestQueryNum("productId"); if ((this.productId == 0) && (this.isnext == 1)) { this.thisUrl = this.thisUrl.Replace("isnext=1", "").Replace("&&", "&"); base.Response.Redirect(this.thisUrl); base.Response.End(); } if ((this.productId > 0) && (Globals.RequestFormStr("posttype") == "updatecontent")) { base.Response.ContentType = "application/json"; string str4 = "{\"type\":\"0\",\"tips\":\"操作失败!\"}"; string content = Globals.RequestFormStr("memo"); if (Globals.ToNum(ProductHelper.UpdateProductContent(this.productId, content)) > 0) { str4 = "{\"type\":\"1\",\"tips\":\"商品信息保存成功!\"}"; } base.Response.Write(str4); base.Response.End(); } if (!this.Page.IsPostBack) { this.FreightTemplateDownList1.DataBind(); IList <int> tagsId = null; if (this.productId > 0) { Dictionary <int, IList <int> > dictionary; ProductInfo product = ProductHelper.GetProductDetails(this.productId, out dictionary, out tagsId); if (product == null) { base.GotoResourceNotFound(); } else { if (this.categoryid > 0) { this.litCategoryName.Text = CatalogHelper.GetFullCategory(this.categoryid); this.ViewState["ProductCategoryId"] = this.categoryid; this.lnkEditCategory.NavigateUrl = "SelectCategory.aspx?categoryId=" + this.categoryid.ToString(CultureInfo.InvariantCulture) + "&reurl=" + base.Server.UrlEncode(this.reurl); } else { this.litCategoryName.Text = CatalogHelper.GetFullCategory(product.CategoryId); this.categoryid = product.CategoryId; this.ViewState["ProductCategoryId"] = product.CategoryId; this.lnkEditCategory.NavigateUrl = "SelectCategory.aspx?categoryId=" + product.CategoryId.ToString(CultureInfo.InvariantCulture); } string navigateUrl = this.lnkEditCategory.NavigateUrl; this.lnkEditCategory.NavigateUrl = navigateUrl + "&productId=" + product.ProductId.ToString(CultureInfo.InvariantCulture) + "&reurl=" + base.Server.UrlEncode(this.reurl); this.litralProductTag.SelectedValue = tagsId; if (tagsId.Count > 0) { foreach (int num in tagsId) { this.txtProductTag.Text = this.txtProductTag.Text + num.ToString() + ","; } this.txtProductTag.Text = this.txtProductTag.Text.Substring(0, this.txtProductTag.Text.Length - 1); } this.dropProductTypes.DataBind(); this.dropBrandCategories.DataBind(); this.LoadProduct(product, dictionary); } } else if (this.categoryid > 0) { this.litCategoryName.Text = CatalogHelper.GetFullCategory(this.categoryid); this.ViewState["ProductCategoryId"] = this.categoryid; this.lnkEditCategory.NavigateUrl = "SelectCategory.aspx?categoryId=" + this.categoryid.ToString(CultureInfo.InvariantCulture); this.dropProductTypes.DataBind(); this.dropBrandCategories.DataBind(); CategoryInfo info3 = CatalogHelper.GetCategory(this.categoryid); if (info3 != null) { this.txtFirstCommission.Text = info3.FirstCommission; this.txtSecondCommission.Text = info3.SecondCommission; this.txtThirdCommission.Text = info3.ThirdCommission; this.txtSku.Text = info3.SKUPrefix; this.txtProductCode.Text = info3.SKUPrefix; } } else { base.Response.Redirect("selectcategory.aspx"); base.Response.End(); } } } } }
public IList <ProductInfo> GetGoods(HttpContext context, string ids) { return(ProductHelper.GetProducts((from s in ids.Split(new char[] { ',' }) select int.Parse(s)).ToList <int>(), true)); }
private void SubmitProduct(string opername) { int num2; int num3; decimal num4; decimal?nullable; decimal?nullable2; decimal num6; decimal num7; decimal num8; decimal num9; decimal num10; decimal?nullable3; string str = this.ucFlashUpload1.Value.Trim(); this.ucFlashUpload1.Value = str; string[] strArray = str.Split(new char[] { ',' }); string[] strArray2 = new string[] { "", "", "", "", "" }; for (int i = 0; (i < strArray.Length) && (i < 5); i++) { strArray2[i] = strArray[i]; } if (this.categoryid == 0) { this.categoryid = (int)this.ViewState["ProductCategoryId"]; } bool flag = !this.cbIsSetCommission.Checked; int showSaleCounts = 0; if (this.ValidateConverts(this.txtProductName.Text.Trim(), this.chkSkuEnabled.Checked, out num2, out num4, out nullable, out nullable2, out num3, out nullable3, out showSaleCounts, out num6, out num7, out num8, out num9, out num10)) { Globals.Debuglog("商品规格:" + this.chkSkuEnabled.Checked.ToString(), "_Debuglog.txt"); if (!this.chkSkuEnabled.Checked && (num4 <= 0M)) { this.ShowMsg("商品现价必须大于0", false); } else { string text = this.fckDescription.Text; if (this.ckbIsDownPic.Checked) { text = base.DownRemotePic(text); } ProductInfo target = new ProductInfo { ProductId = this.productId, CategoryId = this.categoryid, TypeId = this.dropProductTypes.SelectedValue, ProductName = this.txtProductName.Text.Trim().Replace(@"\", ""), ProductShortName = this.txtProductShortName.Text.Trim(), ProductCode = this.txtProductCode.Text.Trim(), DisplaySequence = num2, MarketPrice = nullable2, Unit = this.txtUnit.Text.Trim(), ImageUrl1 = strArray2[0], ImageUrl2 = strArray2[1], ImageUrl3 = strArray2[2], ImageUrl4 = strArray2[3], ImageUrl5 = strArray2[4], ThumbnailUrl40 = strArray2[0].Replace("/images/", "/thumbs40/40_"), ThumbnailUrl60 = strArray2[0].Replace("/images/", "/thumbs60/60_"), ThumbnailUrl100 = strArray2[0].Replace("/images/", "/thumbs100/100_"), ThumbnailUrl160 = strArray2[0].Replace("/images/", "/thumbs160/160_"), ThumbnailUrl180 = strArray2[0].Replace("/images/", "/thumbs180/180_"), ThumbnailUrl220 = strArray2[0].Replace("/images/", "/thumbs220/220_"), ThumbnailUrl310 = strArray2[0].Replace("/images/", "/thumbs310/310_"), ThumbnailUrl410 = strArray2[0].Replace("/images/", "/thumbs410/410_"), ShortDescription = this.txtShortDescription.Text, IsfreeShipping = this.ChkisfreeShipping.Checked, Description = (!string.IsNullOrEmpty(text) && (text.Length > 0)) ? text : null, AddedDate = DateTime.Now, BrandId = this.dropBrandCategories.SelectedValue, FirstCommission = num6, SecondCommission = num7, ThirdCommission = num8, FreightTemplateId = this.ChkisfreeShipping.Checked ? 0 : this.FreightTemplateDownList1.SelectedValue, IsSetCommission = flag, CubicMeter = num9, FreightWeight = num10 }; ProductSaleStatus onSale = ProductSaleStatus.OnSale; if (this.radInStock.Checked) { onSale = ProductSaleStatus.OnStock; } if (this.radUnSales.Checked) { onSale = ProductSaleStatus.UnSale; } if (this.radOnSales.Checked) { onSale = ProductSaleStatus.OnSale; } target.SaleStatus = onSale; CategoryInfo category = CatalogHelper.GetCategory(this.categoryid); if (category != null) { target.MainCategoryPath = category.Path + "|"; } Dictionary <string, SKUItem> skus = null; Dictionary <int, IList <int> > attrs = null; if (this.chkSkuEnabled.Checked) { decimal num11 = 0M; decimal num12 = new decimal(0); target.HasSKU = true; skus = base.GetSkus(this.txtSkus.Text); if (skus == null) { this.ShowMsg("商品规格填写不完整!", false); return; } decimal[] minSalePrice = new decimal[] { 79228162514264337593543950335M }; foreach (SKUItem item in from sku in skus.Values where sku.SalePrice < minSalePrice[0] select sku) { minSalePrice[0] = item.SalePrice; } num11 = minSalePrice[0]; decimal[] maxSalePrice = new decimal[] { -79228162514264337593543950335M }; foreach (SKUItem item2 in from sku in skus.Values where sku.SalePrice > maxSalePrice[0] select sku) { maxSalePrice[0] = item2.SalePrice; } num12 = maxSalePrice[0]; target.MinShowPrice = num11; target.MaxShowPrice = num12; } else { Dictionary <string, SKUItem> dictionary3 = new Dictionary <string, SKUItem>(); SKUItem item3 = new SKUItem { SkuId = "0", SKU = this.txtSku.Text, SalePrice = num4, CostPrice = nullable.HasValue ? nullable.Value : 0M, Stock = num3, Weight = nullable3.HasValue ? nullable3.Value : 0M }; dictionary3.Add("0", item3); skus = dictionary3; if (this.txtMemberPrices.Text.Length > 0) { base.GetMemberPrices(skus["0"], this.txtMemberPrices.Text); } target.MinShowPrice = num4; target.MaxShowPrice = num4; } if (!string.IsNullOrEmpty(this.txtAttributes.Text) && (this.txtAttributes.Text.Length > 0)) { attrs = base.GetAttributes(this.txtAttributes.Text); } ValidationResults validateResults = Hishop.Components.Validation.Validation.Validate <ProductInfo>(target); if (!validateResults.IsValid) { this.ShowMsg(validateResults); } else { IList <int> tagIds = new List <int>(); if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim())) { string str3 = this.txtProductTag.Text.Trim(); string[] strArray3 = null; if (str3.Contains(",")) { strArray3 = str3.Split(new char[] { ',' }); } else { strArray3 = new string[] { str3 }; } foreach (string str4 in strArray3) { tagIds.Add(Convert.ToInt32(str4)); } } if (this.productId > 0) { ProductInfo productBaseInfo = ProductHelper.GetProductBaseInfo(this.productId); target.SaleCounts = productBaseInfo.SaleCounts; target.ShowSaleCounts = productBaseInfo.ShowSaleCounts; } else { target.SaleCounts = 0; target.ShowSaleCounts = showSaleCounts; } if (this.productId > 0) { switch (ProductHelper.UpdateProduct(target, skus, attrs, tagIds)) { case ProductActionStatus.AttributeError: this.ShowMsg("保存商品失败,保存商品属性时出错", false); return; case ProductActionStatus.DuplicateName: this.ShowMsg("保存商品失败,商品名称不能重复", false); return; case ProductActionStatus.DuplicateSKU: this.ShowMsg("保存商品失败,商品编码不能重复", false); return; case ProductActionStatus.SKUError: this.ShowMsg("保存商品失败,商品编码不能重复", false); return; case ProductActionStatus.OffShelfError: this.ShowMsg("保存商品失败,子站没在零售价范围内的商品无法下架", false); return; case ProductActionStatus.ProductTagEroor: this.ShowMsg("保存商品失败,保存商品标签时出错", false); return; case ProductActionStatus.Success: ProductHelper.UpdateShoppingCartsTemplateId(this.productId, target.FreightTemplateId); this.litralProductTag.SelectedValue = tagIds; if (opername == "next") { string thisUrl = this.thisUrl; if (this.isnext != 1) { thisUrl = string.Concat(new object[] { "/Admin/goods/ProductEdit.aspx?productId=", this.productId, "&isnext=1&reurl=", base.Server.UrlEncode(this.reurl) }); } base.Response.Redirect(thisUrl); base.Response.End(); return; } this.spanJs.InnerHtml = "<script>$('#ctl00_ContentPlaceHolder1_btnSave,#preview,#prevBtn').attr('disabled', 'true');setTimeout(function () { $('#ctl00_ContentPlaceHolder1_btnSave,#preview,#prevBtn').removeAttr('disabled'); }, 5000);</script>"; this.ShowMsgAndReUrl("保存商品信息成功!", true, this.reurl); return; } this.ShowMsg("保存商品失败,未知错误", false); } else { string s = ProductHelper.AddProductNew(target, skus, attrs, tagIds); int num13 = Globals.ToNum(s); if (num13 > 0) { base.Response.Redirect("productedit.aspx?productid=" + num13 + "&isnext=1"); base.Response.End(); } else { this.ShowMsg("保存商品失败," + s, false); } } } } } }
//Get all the boats public static Boats GetBoats() { return(ProductHelper.GetBoats()); }
private void LoadProduct(ProductInfo product, Dictionary <int, IList <int> > attrs) { this.dropProductTypes.SelectedValue = product.TypeId; this.dropBrandCategories.SelectedValue = product.BrandId; if (product.IsSetCommission) { this.cbIsSetCommission.Checked = false; this.txtFirstCommission.Enabled = true; this.txtSecondCommission.Enabled = true; this.txtThirdCommission.Enabled = true; this.txtFirstCommission.Text = product.FirstCommission.ToString("F2"); this.txtSecondCommission.Text = product.SecondCommission.ToString("F2"); this.txtThirdCommission.Text = product.ThirdCommission.ToString("F2"); } else { CategoryInfo category = CatalogHelper.GetCategory(this.categoryid); if (category != null) { this.txtFirstCommission.Text = category.FirstCommission; this.txtSecondCommission.Text = category.SecondCommission; this.txtThirdCommission.Text = category.ThirdCommission; } } this.txtDisplaySequence.Text = product.DisplaySequence.ToString(); this.txtProductName.Text = Globals.HtmlDecode(product.ProductName); this.txtProductShortName.Text = Globals.HtmlDecode(product.ProductShortName); this.txtProductCode.Text = product.ProductCode; this.txtUnit.Text = product.Unit; if (product.MarketPrice.HasValue) { this.txtMarketPrice.Text = product.MarketPrice.Value.ToString("F2"); } this.txtShortDescription.Text = product.ShortDescription; this.fckDescription.Text = product.Description; if (product.SaleStatus == ProductSaleStatus.OnSale) { this.radOnSales.Checked = true; } else if (product.SaleStatus == ProductSaleStatus.UnSale) { this.radUnSales.Checked = true; } else { this.radInStock.Checked = true; } this.ChkisfreeShipping.Checked = product.IsfreeShipping; string str = product.ImageUrl1 + "," + product.ImageUrl2 + "," + product.ImageUrl3 + "," + product.ImageUrl4 + "," + product.ImageUrl5; this.ucFlashUpload1.Value = str.Replace(",,", ",").Replace(",,", ",").Trim(new char[] { ',' }); if ((attrs != null) && (attrs.Count > 0)) { StringBuilder builder = new StringBuilder(); builder.Append("<xml><attributes>"); foreach (int num in attrs.Keys) { builder.Append("<item attributeId=\"").Append(num.ToString(CultureInfo.InvariantCulture)).Append("\" usageMode=\"").Append(((int)ProductTypeHelper.GetAttribute(num).UsageMode).ToString()).Append("\" >"); foreach (int num2 in attrs[num]) { builder.Append("<attValue valueId=\"").Append(num2.ToString(CultureInfo.InvariantCulture)).Append("\" />"); } builder.Append("</item>"); } builder.Append("</attributes></xml>"); this.txtAttributes.Text = builder.ToString(); } if (product.HasSKU && (product.Skus.Keys.Count > 0)) { StringBuilder builder2 = new StringBuilder(); builder2.Append("<xml><productSkus>"); foreach (string str2 in product.Skus.Keys) { SKUItem item = product.Skus[str2]; string str3 = ("<item skuCode=\"" + item.SKU + "\" salePrice=\"" + item.SalePrice.ToString("F2") + "\" costPrice=\"" + ((item.CostPrice > 0M) ? item.CostPrice.ToString("F2") : "") + "\" qty=\"" + item.Stock.ToString(CultureInfo.InvariantCulture) + "\" weight=\"" + ((item.Weight > 0M) ? item.Weight.ToString("F2") : "") + "\">") + "<skuFields>"; foreach (int num3 in item.SkuItems.Keys) { string[] strArray3 = new string[] { "<sku attributeId=\"", num3.ToString(CultureInfo.InvariantCulture), "\" valueId=\"", item.SkuItems[num3].ToString(CultureInfo.InvariantCulture), "\" />" }; string str4 = string.Concat(strArray3); str3 = str3 + str4; } str3 = str3 + "</skuFields>"; if (item.MemberPrices.Count > 0) { str3 = str3 + "<memberPrices>"; foreach (int num4 in item.MemberPrices.Keys) { decimal num17 = item.MemberPrices[num4]; str3 = str3 + string.Format("<memberGrande id=\"{0}\" price=\"{1}\" />", num4.ToString(CultureInfo.InvariantCulture), num17.ToString("F2")); } str3 = str3 + "</memberPrices>"; } str3 = str3 + "</item>"; builder2.Append(str3); } builder2.Append("</productSkus></xml>"); this.txtSkus.Text = builder2.ToString(); } else { product.HasSKU = false; } SKUItem defaultSku = product.DefaultSku; this.txtSku.Text = product.SKU; this.txtSalePrice.Text = defaultSku.SalePrice.ToString("F2"); this.txtCostPrice.Text = (defaultSku.CostPrice > 0M) ? defaultSku.CostPrice.ToString("F2") : ""; this.txtStock.Text = ProductHelper.GetProductSumStock(product.ProductId).ToString(); this.txtWeight.Text = (defaultSku.Weight > 0M) ? defaultSku.Weight.ToString("F2") : ""; if (defaultSku.MemberPrices.Count > 0) { this.txtMemberPrices.Text = "<xml><gradePrices>"; foreach (int num5 in defaultSku.MemberPrices.Keys) { decimal num22 = defaultSku.MemberPrices[num5]; this.txtMemberPrices.Text = this.txtMemberPrices.Text + string.Format("<grande id=\"{0}\" price=\"{1}\" />", num5.ToString(CultureInfo.InvariantCulture), num22.ToString("F2")); } this.txtMemberPrices.Text = this.txtMemberPrices.Text + "</gradePrices></xml>"; } this.chkSkuEnabled.Checked = product.HasSKU; this.rbtIsSetTemplate.Checked = product.FreightTemplateId > 0; this.txtShowSaleCounts.Text = product.ShowSaleCounts.ToString(); this.txtCubicMeter.Text = product.CubicMeter.ToString("F2"); this.txtFreightWeight.Text = product.FreightWeight.ToString("F2"); this.FreightTemplateDownList1.SelectedValue = product.FreightTemplateId; }
private void BindProducts(int couponId) { DataTable selectedProducts = this.GetSelectedProducts(couponId); string text = this.txt_name.Text; string val = this.txt_minPrice.Text; string str3 = this.txt_maxPrice.Text; decimal? nullable = null; decimal? nullable2 = null; decimal i = 0M; if (!this.bDecimal(val, ref i)) { nullable = null; } else { nullable = new decimal?(i); } if (!this.bDecimal(str3, ref i)) { nullable2 = null; } else { nullable2 = new decimal?(i); } ProductQuery entity = new ProductQuery { Keywords = text, ProductCode = "", CategoryId = null, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = SortAction.Desc, SortBy = "DisplaySequence", StartDate = null, BrandId = null, EndDate = null, TypeId = null, SaleStatus = this._status, minPrice = nullable, maxPrice = nullable2, selectQuery = string.Format("productId in (select productId from Hishop_Activities_Product where ActivitiesId={0})", this._id) }; Globals.EntityCoding(entity, true); DbQueryResult products = ProductHelper.GetProducts(entity); DataTable data = (DataTable)products.Data; data.Columns.Add("setStatus"); if (((data != null) && (selectedProducts != null)) && ((data.Rows.Count > 0) && (selectedProducts.Rows.Count > 0))) { for (int j = 0; j < data.Rows.Count; j++) { int num3 = int.Parse(data.Rows[j]["ProductId"].ToString()); DataRow[] rowArray = selectedProducts.Select(string.Format("ProductId={0}", num3)); if (rowArray.Length > 0) { data.Rows[j]["setStatus"] = (rowArray[0]["status"].ToString() == "0") ? "暂停" : "恢复"; } } } this.grdProducts.DataSource = products.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = products.TotalRecords; this.lblJoin.Text = (selectedProducts != null) ? selectedProducts.Rows.Count.ToString() : "0"; this.setInSaleAndStock(); }
protected void Page_Load(object sender, EventArgs e) { string str = base.Request["OrderIds"].Trim(new char[] { ',' }); if (!string.IsNullOrEmpty(str)) { foreach (OrderInfo info in (from a in this.GetPrintData(str) orderby string.Concat(new object[] { a.ShipTo, a.RegionId, a.ExpressCompanyAbb, a.Address, a.CellPhone }) descending select a).ToList <OrderInfo>()) { HtmlGenericControl child = new HtmlGenericControl("div"); child.Attributes["class"] = "order print"; child.Attributes["style"] = "padding-bottom:60px;padding-top:40px;"; StringBuilder builder = new StringBuilder(""); builder.AppendFormat("<div class=\"info clear\"><ul class=\"sub-info\"><li><span>订单号: </span>{2}</li><li><span>成交时间: </span>{1}</li><li><span>收货人姓名: </span>{0}</li></ul></div>", info.ShipTo, (info.FinishDate.HasValue ? DateTime.Parse(info.FinishDate.ToString()) : info.OrderDate).ToString("yyyy-MM-dd HH:mm:ss"), info.OrderId); builder.Append("<table><col class=\"col-1\" /><col class=\"col-3\" /><col class=\"col-3\" /><col class=\"col-3\" /><col class=\"col-4\" /><col class=\"col-5\" /><thead><tr><th>商品信息</th><th>商品编码</th><th>单价</th><th>数量</th><th>小计</th><th>总价</th></tr></thead><tbody>"); Dictionary <string, LineItemInfo> lineItems = info.LineItems; if (lineItems != null) { int num = 0; foreach (string str2 in lineItems.Keys) { LineItemInfo info2 = lineItems[str2]; string sKU = string.Empty; if (info2.OrderItemsStatus == OrderStatus.Returned) { sKU = "(已退货,金额¥" + info2.ReturnMoney.ToString("F2") + ")"; } else if (info2.OrderItemsStatus == OrderStatus.Refunded) { sKU = "(已退款,金额¥" + info2.ReturnMoney.ToString("F2") + ")"; } builder.AppendFormat("<tr><td>{0}</td>", info2.ItemDescription + sKU + (string.IsNullOrEmpty(info2.SKUContent) ? "" : ("<br>" + info2.SKUContent))); sKU = info2.SKU; if (string.IsNullOrEmpty(sKU)) { ProductInfo productDetails = ProductHelper.GetProductDetails(info2.ProductId); if (productDetails != null) { sKU = productDetails.ProductCode; } } if (string.IsNullOrEmpty(sKU)) { sKU = "-"; } builder.AppendFormat("<td style='text-align:center;'>{0}</td>", sKU); builder.AppendFormat("<td>¥{0}</td>", Math.Round(info2.ItemListPrice, 2)); builder.AppendFormat("<td style='padding-left:15px;'>{0}</td>", info2.ShipmentQuantity); builder.AppendFormat("<td style='border-left:1px solid #858585;'>¥{0}</td>", Math.Round((decimal)(info2.GetSubTotal() - info2.DiscountAverage), 2)); if (num == 0) { string str4 = string.Empty; StringBuilder builder2 = new StringBuilder(); if (!string.IsNullOrEmpty(info.ActivitiesName)) { builder2.Append("<p>" + info.ActivitiesName + ":¥" + info.DiscountAmount.ToString("F2") + "</p>"); } if (!string.IsNullOrEmpty(info.ReducedPromotionName)) { builder2.Append("<p>" + info.ReducedPromotionName + ":¥" + info.ReducedPromotionAmount.ToString("F2") + "</p>"); } if (!string.IsNullOrEmpty(info.CouponName)) { builder2.Append("<p>" + info.CouponName + ":¥" + info.CouponAmount.ToString("F2") + "</p>"); } if (!string.IsNullOrEmpty(info.RedPagerActivityName)) { builder2.Append("<p>" + info.RedPagerActivityName + ":¥" + info.RedPagerAmount.ToString("F2") + "</p>"); } if (info.PointToCash > 0M) { builder2.Append("<p>积分抵现:¥" + info.PointToCash.ToString("F2") + "</p>"); } decimal adjustCommssion = info.GetAdjustCommssion(); if (adjustCommssion > 0M) { builder2.Append("<p>管理员调价优惠:¥" + adjustCommssion.ToString("F2") + "</p>"); } else if (adjustCommssion < 0M) { builder2.Append("<p>管理员调价增加:¥" + adjustCommssion.ToString("F2").Trim(new char[] { '-' }) + "</p>"); } str4 = builder2.ToString(); builder.AppendFormat("<td rowspan='{0}' colspan='1' style='border-left:1px solid #858585;'>{1}</td>", lineItems.Keys.Count, string.Format("<p><strong>¥{0}</strong></p>" + str4 + "<p>含运费¥{1}</p><p></p>", info.GetTotal().ToString("F2"), info.AdjustedFreight.ToString("F2"))); } builder.Append("</tr>"); num++; } } builder.Append("</tbody></table>"); child.InnerHtml = builder.ToString(); this.divContent.Controls.AddAt(0, child); } } }