public static string ToJson(this GoodsInfo item) => string.Concat(item);
/// <summary> /// 获取默认的表名 /// </summary> /// <param name="id"></param> /// <param name="name">表名</param> /// <param name="handText">列名</param> /// <param name="hideIndex">隐藏列</param> public static void GetHandTxtAndHideIndex(int id, ref List <string> name, ref List <string> handText, ref List <int> hideIndex) { switch (id) { case 0: name = new GoodsInfo().GetTableName(); handText = new GoodsInfo().GetHanderTxt(); hideIndex = new GoodsInfo().GetHideIndex(); break; case 1: name = new OrderInfo().GetTableName(); handText = new OrderInfo().GetHanderTxt(); hideIndex = new OrderInfo().GetHideIndex(); break; case 2: name = new GoodsInfo().GetTableName(); handText = new GoodsInfo().GetHanderTxt(); hideIndex = new GoodsInfo().GetHideIndex(); break; case 3: name = new OrderInfo().GetTableName(); handText = new OrderInfo().GetHanderTxt(); hideIndex = new OrderInfo().GetHideIndex(); break; case 4: name = new ProfitsInfo().GetTableName(); handText = new ProfitsInfo().GetHanderTxt(); hideIndex = new ProfitsInfo().GetHideIndex(); break; case 5: name = new NoReceiveMoney().GetTableName(); handText = new NoReceiveMoney().GetHanderTxt(); hideIndex = new NoReceiveMoney().GetHideIndex(); break; case 6: name = new UnitInfo().GetTableName(); handText = new UnitInfo().GetHanderTxt(); hideIndex = new UnitInfo().GetHideIndex(); break; case 7: name = new SortInfo().GetTableName(); handText = new SortInfo().GetHanderTxt(); hideIndex = new SortInfo().GetHideIndex(); break; case 8: name = new WholeSalerInfo().GetTableName(); handText = new WholeSalerInfo().GetHanderTxt(); hideIndex = new WholeSalerInfo().GetHideIndex(); break; case 9: name = new UserInfo().GetTableName(); handText = new UserInfo().GetHanderTxt(); hideIndex = new UserInfo().GetHideIndex(); break; default: break; } }
/// <summary> /// 填充数据SearchGoods /// </summary> /// <param name="ds"></param> /// <returns></returns> private List <GoodsInfo> SetGoodsList(DataTable dt, List <ImgInfo> ilist = null) { ///获取网站ip string web_url = BaseConfiguration.SercerIp; ////商品信息 List <GoodsInfo> gList = new List <GoodsInfo>(); long InventoryShows = long.Parse(BaseConfiguration.InventoryShows);//页面商品库存最大显示数量 foreach (DataRow dr in dt.Rows) { GoodsInfo gi = new GoodsInfo { Article_Id = dr["article_id"].ToString(), GoodsCode = dr["goodscode"].ToString(), Sub_Title = dr["sub_title"].ToString(), Drug_Spec = dr["drug_spec"].ToString(), Package_Unit = dr["package_unit"].ToString(), Drug_Factory = dr["drug_factory"].ToString(), Big_Package = BasisConfig.ObjToDecimal(dr["big_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M), Stock_Quantity = decimal.Parse(dr["stock_quantity"].ToString()), Cxbs = dr["cxbs"].ToString(), Fabh = dr["fabh"].ToString(), Describe = dr["Describe"].ToString(), ProposalPrice = Convert.ToDecimal(dr["proposalPrice"].ToString()), CollectId = dr["collectId"].ToString(), Valdate = dr["valdate"].ToString(), OldValdate = dr["old_valdate"].ToString(), Scattered = dr["scattered"].ToString(), ApprovalNumber = dr["approval_number"].ToString(), GoodsLimit = dr["goodslimit"].ToString().Trim(), PassSum = int.Parse(dr["passSum"].ToString()), //评论数 RaveReviews = decimal.Parse(dr["raveReviews"].ToString()), //好评率 Price = dr["price"].ToString(), Limit = dr["limit"].ToString().Trim(), ImgList = ilist//商品图片列表 }; //是否允许拆零 string scattered = dr["scattered"].ToString(); if (scattered == "Y") { gi.Min_Package = BasisConfig.ObjToDecimal(dr["scatteredPackage"].ToString(), BaseConfiguration.PackagePlace, 0.00M);//拆零包装 } else { gi.Min_Package = BasisConfig.ObjToDecimal(dr["min_package"].ToString(), BaseConfiguration.PackagePlace, 0.00M); } if (InventoryShows > 0 && gi.Stock_Quantity > InventoryShows) { if (gi.Stock_Quantity >= 1000) { gi.Inventory = "充裕"; } else { gi.Inventory = "紧张"; } } else { gi.Inventory = dr["stock_quantity"].ToString(); } if (dr["img_url"].ToString() != "") { gi.ImgUrl = web_url + dr["img_url"].ToString().Trim(); } else { gi.ImgUrl = ""; } if (dr.Table.Columns.Contains("content")) { gi.Content = dr["content"].ToString().Trim(); } //加载促销信息 gList.Add(gi); } return(gList); }
private async Task <bool> GetShopCartInfo() { try { Windows.Storage.StorageFolder storageFolder = ApplicationData.Current.LocalFolder; Windows.Storage.StorageFile shoppingCartStorageFile = await storageFolder.GetFileAsync("ShoppingCart.xml"); //string rootPath = Windows.ApplicationModel.Package.Current.InstalledLocation.Path; //rootPath = rootPath + @"\Data"; //StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(rootPath); //Windows.Storage.StorageFile shoppingCartStorageFile = await folder.GetFileAsync("ShoppingCart.xml"); XmlDocument doc = await Windows.Data.Xml.Dom.XmlDocument.LoadFromFileAsync(shoppingCartStorageFile); IXmlNode root = null; foreach (var item in doc.ChildNodes) { if (item.NodeName.Equals("goods")) { root = item; break; } } int goodsCount = 0; if (null != root) { foreach (var goods in root.ChildNodes) { if (goods.NodeName.Equals("item")) { string imgUrl = goods.SelectSingleNode("img").InnerText; string singlePrice = goods.SelectSingleNode("price").InnerText; string name = goods.SelectSingleNode("productName").InnerText; string count = goods.SelectSingleNode("count").InnerText; string imagename = goods.SelectSingleNode("imageName").InnerText; GoodsInfo info = new GoodsInfo(); StorageFile file = await StorageFile.GetFileFromPathAsync(imgUrl); using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read)) { BitmapImage image = new BitmapImage(); image.SetSource(fileStream); info.img = image; } info.name = name; info.price = singlePrice; info.count = Convert.ToInt32(count); info.imageName = imagename; info.imgUri = imgUrl; goodsList.Add(info); goodsCount += Convert.ToInt32(count); } } } if (goodsCount > 0) { shopcartGoodsNumber.Text = Convert.ToString(goodsCount); shopcartGoodsNumber.Visibility = Visibility.Visible; shopcartEllipse.Visibility = Visibility.Visible; } else { shopcartGoodsNumber.Text = "0"; shopcartGoodsNumber.Visibility = Visibility.Collapsed; shopcartEllipse.Visibility = Visibility.Collapsed; } return(true); } catch (Exception e) { #if DEBUG System.Diagnostics.Debug.WriteLine(e.Message); #endif return(false); } }
// 采购中 protected void IbnPurchasing_Click(object sender, EventArgs eventArgs) { bool isHave = false; var codeManager = new CodeManager(); foreach (GridDataItem dataItem in RG_DebitNote.Items) { var purchasingId = new Guid(dataItem.GetDataKeyValue("PurchasingId").ToString()); var personResponsible = new Guid(dataItem.GetDataKeyValue("PersonResponsible").ToString()); var cbCheck = (CheckBox)dataItem.FindControl("CB_Check"); if (cbCheck.Checked) { using (var ts = new TransactionScope(TransactionScopeOption.Required)) { isHave = true; _debitNoteDao.UpdateDebitNoteStateByPurchasingId(purchasingId, (int)DebitNoteState.Purchasing); //生成采购单 DebitNoteInfo debitNoteInfo = _debitNoteDao.GetDebitNoteInfo(purchasingId) ?? new DebitNoteInfo(); IList <DebitNoteDetailInfo> debitNoteDetailList = _debitNoteDao.GetDebitNoteDetailList(purchasingId); CompanyCussentInfo companyCussentInfo = CompanyCussentList.FirstOrDefault(w => w.CompanyId == debitNoteInfo.CompanyId); //var warehouseInfo = WarehouseManager.Get(debitNoteInfo.WarehouseId); PersonnelInfo personnelInfo = PersonnelList.FirstOrDefault(w => w.PersonnelId == debitNoteInfo.PersonResponsible) ?? new PersonnelInfo(null); PurchasingInfo oldPurchasingInfo = _purchasing.GetPurchasingById(purchasingId); var realName = CurrentSession.Personnel.Get().RealName; var filialeId = string.IsNullOrWhiteSpace(debitNoteInfo.PurchasingNo) || debitNoteInfo.PurchasingNo == "-"?FilialeManager.GetHeadList().First(ent => ent.Name.Contains("可得")).ID : _purchasing.GetPurchasingList(debitNoteInfo.PurchasingNo).FilialeID; var pInfo = new PurchasingInfo { PurchasingID = Guid.NewGuid(), PurchasingNo = codeManager.GetCode(CodeType.PH), CompanyID = debitNoteInfo.CompanyId, CompanyName = companyCussentInfo == null ? "" : companyCussentInfo.CompanyName, FilialeID = filialeId, WarehouseID = debitNoteInfo.WarehouseId, PurchasingState = (int)PurchasingState.Purchasing, PurchasingType = (int)PurchasingType.Custom, StartTime = DateTime.Now, EndTime = DateTime.MaxValue, //Description = "[采购类别:{0}赠品借记单][对应采购单号" + debitNoteInfo.PurchasingNo + "]" + CurrentSession.Personnel.Get().RealName, Description = string.Format("[采购类别:{0},赠品借记单对应采购单号{1};采购人:{2}]", EnumAttribute.GetKeyName(PurchasingType.Custom), debitNoteInfo.PurchasingNo, realName), PmId = personnelInfo.PersonnelId, PmName = personnelInfo.RealName, ArrivalTime = oldPurchasingInfo.ArrivalTime, PersonResponsible = personResponsible, PurchasingFilialeId = filialeId }; IList <PurchasingDetailInfo> purchasingDetailList = new List <PurchasingDetailInfo>(); if (debitNoteDetailList.Count > 0) { List <Guid> goodsIdOrRealGoodsIdList = debitNoteDetailList.Select(w => w.GoodsId).Distinct().ToList(); Dictionary <Guid, GoodsInfo> dicGoods = _goodsCenterSao.GetGoodsBaseListByGoodsIdOrRealGoodsIdList(goodsIdOrRealGoodsIdList); if (dicGoods != null && dicGoods.Count > 0) { foreach (var debitNoteDetailInfo in debitNoteDetailList) { bool hasKey = dicGoods.ContainsKey(debitNoteDetailInfo.GoodsId); if (hasKey) { GoodsInfo goodsBaseInfo = dicGoods.FirstOrDefault(w => w.Key == debitNoteDetailInfo.GoodsId).Value; // 获取商品的60、30、11天销量 var purchasingDetailInfo = _purchasingDetail.GetChildGoodsSale(debitNoteDetailInfo.GoodsId, debitNoteInfo.WarehouseId, DateTime.Now, pInfo.PurchasingFilialeId) ?? new PurchasingDetailInfo(); var durchasingDetailInfo = new PurchasingDetailInfo { PurchasingID = pInfo.PurchasingID, PurchasingGoodsID = Guid.NewGuid(), GoodsID = debitNoteDetailInfo.GoodsId, GoodsName = debitNoteDetailInfo.GoodsName, GoodsCode = goodsBaseInfo.GoodsCode, Specification = debitNoteDetailInfo.Specification, CompanyID = pInfo.CompanyID, Price = debitNoteDetailInfo.Price, PlanQuantity = debitNoteDetailInfo.GivingCount, RealityQuantity = 0, State = 0, Description = "", Units = goodsBaseInfo.Units, PurchasingGoodsType = (int)PurchasingGoodsType.Gift, SixtyDaySales = purchasingDetailInfo.SixtyDaySales, ThirtyDaySales = purchasingDetailInfo.ThirtyDaySales, ElevenDaySales = purchasingDetailInfo.ElevenDaySales == 0 ? 0 : purchasingDetailInfo.ElevenDaySales, // 11 //日均销量(11天) CPrice = debitNoteDetailInfo.Price }; purchasingDetailList.Add(durchasingDetailInfo); } } } } if (purchasingDetailList.Count > 0) { _debitNoteDao.UpdateDebitNoteNewPurchasingIdByPurchasingId(purchasingId, pInfo.PurchasingID); _purchasing.PurchasingInsert(pInfo); _purchasing.PurchasingUpdateIsOut(pInfo.PurchasingID); //报备管理生成采购单操作记录添加 WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, pInfo.PurchasingID, pInfo.PurchasingNo, OperationPoint.ReportManage.DebitToAddPurchasingList.GetBusinessInfo(), string.Empty); var purchasingDetailManager = new PurchasingDetailManager(_purchasingDetail, _purchasing); purchasingDetailManager.Save(purchasingDetailList); } ts.Complete(); } } } if (isHave == false) { RAM.Alert("未勾选借记单!"); } else { RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");"); } }
public static int UpdateGoods(GoodsInfo model, DbTransaction tran) { return(goodsDAL.Update(model, tran)); }
public GoodsCreatedEvent(Guid storeId, IList <Guid> categoryIds, GoodsInfo info) : base(info) { StoreId = storeId; CategoryIds = categoryIds; }
// // GET: /LE/Goods/_Update public int _Update(GoodsInfo node) { return(models.Goods.Update(node)); }
public GoodsInfo GetGoodsInfo(uint gid) { GoodsInfo goods_info = null; if (mGoodsInfos.TryGetValue(gid, out goods_info)) { return(goods_info); } string query = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", GoodsTableName, "gid", gid); var reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, GoodsTableName, query); if (reader == null) { GameDebug.LogError("Can not find goods info by gid " + gid + ", reader is null!!!"); mGoodsInfos[gid] = null; return(null); } if (!reader.HasRows || !reader.Read()) { GameDebug.LogError("Can not find goods info by gid " + gid); mGoodsInfos[gid] = null; reader.Close(); reader.Dispose(); return(null); } goods_info = new GoodsInfo(); goods_info.name = GetReaderString(reader, "name"); goods_info.sort_id = DBTextResource.ParseUI_s(GetReaderString(reader, "sort_id"), 0); goods_info.sort_top = DBTextResource.ParseUI_s(GetReaderString(reader, "sort_top"), 0); goods_info.type = DBTextResource.ParseBT_s(GetReaderString(reader, "type"), 0); goods_info.sub_type = DBTextResource.ParseUS_s(GetReaderString(reader, "sub_type"), 0); goods_info.color_type = DBTextResource.ParseBT_s(GetReaderString(reader, "color_type"), 0); goods_info.max_stack = DBTextResource.ParseUS_s(GetReaderString(reader, "max_stack"), 1); goods_info.effect = GetReaderString(reader, "effect"); var arg = GetReaderString(reader, "arg"); if (!string.IsNullOrEmpty(arg)) { goods_info.arg = arg.Replace(" ", ""); } else { goods_info.arg = ""; } goods_info.client_use = DBTextResource.ParseBT_s(GetReaderString(reader, "client_use"), 0); goods_info.cd_id = DBTextResource.ParseUI_s(GetReaderString(reader, "cd_id"), 0); goods_info.use_cd = DBTextResource.ParseUS_s(GetReaderString(reader, "use_cd"), 0); goods_info.use_lv = DBTextResource.ParseUI_s(GetReaderString(reader, "use_lv"), 0); goods_info.use_job = DBTextResource.ParseBT_s(GetReaderString(reader, "use_job"), 0); goods_info.use_transfer = DBTextResource.ParseBT_s(GetReaderString(reader, "use_transfer"), 0); goods_info.need_count = DBTextResource.ParseBT_s(GetReaderString(reader, "need_count"), 0); goods_info.guild_wpoint = DBTextResource.ParseUI_s(GetReaderString(reader, "guild_wpoint"), 0); goods_info.sell_price = DBTextResource.ParseUI_s(GetReaderString(reader, "sell_price"), 0); goods_info.expire_time = DBTextResource.ParseUI_s(GetReaderString(reader, "expire_time"), 0); goods_info.mktype_1 = DBTextResource.ParseBT_s(GetReaderString(reader, "mktype_1"), 0); goods_info.mktype_2 = DBTextResource.ParseBT_s(GetReaderString(reader, "mktype_2"), 0); goods_info.bind = DBTextResource.ParseBT_s(GetReaderString(reader, "bind"), 1); goods_info.price_recommend = (uint)(GetReaderFloat(reader, "price_recommend")); goods_info.price_lower_limit = GetReaderFloat(reader, "price_lower_limit"); goods_info.price_upper_limit = GetReaderFloat(reader, "price_upper_limit"); goods_info.desc = GetReaderString(reader, "desc"); goods_info.gain_text = GetReaderString(reader, "gain_text"); goods_info.gain_from = GetReaderString(reader, "gain_from"); goods_info.icon_id = DBTextResource.ParseUI_s(GetReaderString(reader, "icon_id"), 0); goods_info.is_show = DBTextResource.ParseBT_s(GetReaderString(reader, "is_show"), 0); goods_info.is_quick = DBTextResource.ParseBT_s(GetReaderString(reader, "is_quick"), 0); goods_info.is_confirmation = DBTextResource.ParseBT_s(GetReaderString(reader, "is_confirmation"), 0); goods_info.sys_id = DBTextResource.ParseUI_s(GetReaderString(reader, "sys_id"), 0); goods_info.is_mutil_use = DBTextResource.ParseBT_s(GetReaderString(reader, "is_mutil_use"), 0); goods_info.daily_use_limit = DBTextResource.ParseUS_s(GetReaderString(reader, "daily_use_limit"), 0); goods_info.is_display_goods = DBTextResource.ParseBT_s(GetReaderString(reader, "is_display_goods"), 0); goods_info.wing_exp = DBTextResource.ParseUI_s(GetReaderString(reader, "wing_exp"), 0); goods_info.show_step = DBTextResource.ParseUI_s(GetReaderString(reader, "show_step"), 0); goods_info.is_precious = DBTextResource.ParseUI_s(GetReaderString(reader, "is_precious"), 0); goods_info.discount = DBTextResource.ParseUI_s(GetReaderString(reader, "discount"), 0); goods_info.overdue_notice_time = DBTextResource.ParseUI_s(GetReaderString(reader, "overdue_notice_time"), 0); mGoodsInfos[gid] = goods_info; reader.Close(); reader.Dispose(); return(goods_info); }
private async void ConfirmPay_Click(object sender, RoutedEventArgs e) { OrderInfo orderList = new OrderInfo(); string id = DateTime.Now.ToString("yyyyMMddHHmmss"); string name = customerNameText.Text; string mobile = mobileText.Text; string totalPrice; string address = addressText.Text; double price = 0; foreach (var item in selectedGoods) { double singlePrice = Convert.ToDouble(item.Value.price.Substring(item.Value.price.IndexOf('¥') + 1)); price += (singlePrice * item.Value.count); } totalPrice = Convert.ToString(price); Windows.Storage.StorageFolder storageFolder = ApplicationData.Current.LocalFolder; Windows.Storage.StorageFile storageFile = await storageFolder.GetFileAsync("Goods.xml"); XmlDocument doc = await Windows.Data.Xml.Dom.XmlDocument.LoadFromFileAsync(storageFile); IXmlNode root = null; foreach (var item in doc.ChildNodes) { if (item.NodeName.Equals("orders")) { root = item; break; } } if (null == root) { return; } try { XmlElement orderEle = doc.CreateElement("order"); XmlElement ele = doc.CreateElement("id"); ele.InnerText = id; orderEle.AppendChild(ele); ele = doc.CreateElement("name"); ele.InnerText = name; orderEle.AppendChild(ele); ele = doc.CreateElement("mobile"); ele.InnerText = mobile; orderEle.AppendChild(ele); ele = doc.CreateElement("totalPrice"); ele.InnerText = totalPrice; orderEle.AppendChild(ele); ele = doc.CreateElement("address"); ele.InnerText = address; orderEle.AppendChild(ele); ele = doc.CreateElement("payed"); ele.InnerText = "true"; orderEle.AppendChild(ele); ele = doc.CreateElement("completed"); ele.InnerText = "false"; orderEle.AppendChild(ele); ele = doc.CreateElement("goods"); foreach (var item in selectedGoods) { XmlElement eleInner = doc.CreateElement("item"); XmlElement eleInnerChild = doc.CreateElement("img"); eleInnerChild.InnerText = item.Value.imgUri; eleInner.AppendChild(eleInnerChild); eleInnerChild = doc.CreateElement("count"); eleInnerChild.InnerText = Convert.ToString(item.Value.count); eleInner.AppendChild(eleInnerChild); eleInnerChild = doc.CreateElement("price"); eleInnerChild.InnerText = item.Value.price; eleInner.AppendChild(eleInnerChild); eleInnerChild = doc.CreateElement("productName"); eleInnerChild.InnerText = item.Value.name; eleInner.AppendChild(eleInnerChild); eleInnerChild = doc.CreateElement("imageName"); eleInnerChild.InnerText = item.Value.imageName; eleInner.AppendChild(eleInnerChild); ele.AppendChild(eleInner); } orderEle.AppendChild(ele); root.AppendChild(orderEle); await doc.SaveToFileAsync(storageFile); foreach (var item in selectedGoods) { GoodsInfo info = item.Value; foreach (var goods in goodsList) { if (goods.imgUri.Equals(info.imgUri) && goods.name.Equals(info.name)) { goodsList.Remove(goods); break; } } } bool success = await WriteShorppingcart(); MainPage._CurrentHandle.Navigate(typeof(Orders)); } catch (Exception ex) { #if DEBUG System.Diagnostics.Debug.WriteLine(ex.Message); #endif } }
/// <summary> /// 添加商品 /// </summary> /// <param name="g"></param> /// <returns></returns> public int GoodsAdd(GoodsInfo g) { string sql = $"insert into GoodsInfo values('{g.GoodsInfoName}','{g.GoodsInfoImage}','{g.GoodsInfoPrice}','{g.GoodsInfoCount}','{g.GoodsInfoState}','{g.GoodsInfoPlace}','{g.GoodsInfoColor}','{g.GoodsInfoSize}','{g.ShopIdOut}','{g.GoodsTypes}','{g.GoodsInfoDesc}')"; return(DapperHelper.Cud(sql)); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { goodsList.Clear(); try { List <GoodsInfo> list = e.Parameter as List <GoodsInfo>; if (null != list) { goodsList = list; } Windows.Storage.StorageFolder storageFolder = ApplicationData.Current.LocalFolder; Windows.Storage.StorageFile shoppingCartStorageFile = await storageFolder.GetFileAsync("ShoppingCart.xml"); XmlDocument doc = await Windows.Data.Xml.Dom.XmlDocument.LoadFromFileAsync(shoppingCartStorageFile); IXmlNode root = null; foreach (var item in doc.ChildNodes) { if (item.NodeName.Equals("goods")) { root = item; break; } } if (null != root) { foreach (var goods in root.ChildNodes) { if (goods.NodeName.Equals("item")) { string imgUrl = goods.SelectSingleNode("img").InnerText; string singlePrice = goods.SelectSingleNode("price").InnerText; string name = goods.SelectSingleNode("productName").InnerText; string count = goods.SelectSingleNode("count").InnerText; string imagename = goods.SelectSingleNode("imageName").InnerText; bool exist = false; foreach (var item in goodsList) { if (item.name.Equals(name) && item.imgUri.Equals(imgUrl)) { item.count = item.count + Convert.ToInt32(count); exist = true; break; } } if (!exist) { GoodsInfo info = new GoodsInfo(); StorageFile file = await StorageFile.GetFileFromPathAsync(imgUrl); using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read)) { BitmapImage image = new BitmapImage(); image.SetSource(fileStream); info.img = image; } info.name = name; info.price = singlePrice; info.count = Convert.ToInt32(count); info.imageName = imagename; info.imgUri = imgUrl; goodsList.Add(info); } } } } int index = 0; foreach (var item in goodsList) { ShopCartPanel panel = new ShopCartPanel(); panel.Picture = item.brush; panel.GoodsName = item.name; panel.PictureName = item.imageName; panel.GoodsCount = item.count; panel.Price = item.price; panel.Name = item.imgUri + item.name; panel.PictureURL = item.imgUri; CheckBox check = new CheckBox(); if (null != checkboxStyle) { check.SetValue(StyleProperty, checkboxStyle); } check.Checked += CheckBox_Checked; check.Unchecked += CheckBox_Unchecked; panel.Check = check; Button btnAdd = new Button(); btnAdd.Click += Add_Click; Button btnDecrease = new Button(); btnDecrease.Click += Decrease_Click; panel.ButtonAdd = btnAdd; panel.ButtonDecrease = btnDecrease; panel.PictureWith = PicWidth; if (index > 0 && goodsPanels.ContainsKey(index - 1)) { panel.SetValue(RelativePanel.RightOfProperty, goodsPanels[index - 1].Name); } else { panel.SetValue(RelativePanel.AlignLeftWithPanelProperty, true); } panel.SetValue(RelativePanel.AlignTopWithPanelProperty, true); goods.Children.Add(panel); goodsPanels.Add(index++, panel); } ResetPicturePanelPositon(); } catch (Exception ex) { #if DEBUG System.Diagnostics.Debug.WriteLine(ex.Message); #endif } }
public bool HasMember(GoodsInfo model) { return(MarketOperator.HasMember(model)); }
public ReturnState UserAddGoods(GoodsInfo model) { return(MarketOperator.UserAddGoods(model) ? ReturnState.ReturnOK : ReturnState.ReturnError); }
public static int AddGoods(GoodsInfo model) { return(goodsDAL.Add(model)); }
//插入 public int AddInfo(GoodsInfo gs) { return(gm.AddGoods(gs)); }
public static int UpdateGoods(GoodsInfo model) { return(goodsDAL.Update(model)); }
private void Bind(string nick, string session, DateTime start, DateTime end) { int TotalCount = 0; //总记录数 int TotalPage = 1; //总页数 string ip = Request.QueryString["visitip"]; int page = 1; try { page = int.Parse(Request.QueryString["Page"]); if (ViewState["page"] != null) { page = int.Parse(ViewState["page"].ToString()); ViewState["page"] = null; } } catch { } IList <TopVisitInfo> list = visitDal.GetVisitInfoByIp(DataHelper.Encrypt(HttpUtility.UrlDecode(Request.Cookies["nick"].Value)), ip, start, end); List <GoodsInfo> cachegoods = new List <GoodsInfo>(); if (Cache["taobaogoodslist"] != null) { cachegoods = (List <GoodsInfo>)Cache["taobaogoodslist"]; } for (int i = 0; i < list.Count; i++) { if (!string.IsNullOrEmpty(list[i].GoodsId)) { List <GoodsInfo> mylist = cachegoods.Where(o => o.num_iid == list[i].GoodsId).ToList(); if (mylist.Count == 0) { GoodsInfo rinfo = TaoBaoAPI.GetGoodsInfo(nick, session, list[i].GoodsId); list[i].GoodsName = rinfo.title; cachegoods.Add(rinfo); if (Cache["taobaogoodslist"] == null) { Cache.Insert("taobaogoodslist", cachegoods, null, DateTime.Now.AddHours(12), System.Web.Caching.Cache.NoSlidingExpiration); } } else { list[i].GoodsName = mylist[0].title; } } if (!string.IsNullOrEmpty(list[i].GoodsClassId)) { IList <GoodsClassInfo> cList = GoodsClassList.Where(o => o.cid == list[i].GoodsClassId).ToList(); if (cList.Count > 0) { list[i].GoodsClassName = cList[0].name; } } } TotalCount = list.Count; pds.DataSource = list; pds.AllowPaging = true; pds.PageSize = 20; if (TotalCount == 0) { TotalPage = 1; } else { if (TotalCount % pds.PageSize == 0) { TotalPage = TotalCount / pds.PageSize; } else { TotalPage = TotalCount / pds.PageSize + 1; } } string startstr = HttpUtility.UrlEncode(start.ToString("yyyy-MM-dd-HH")); string endstr = HttpUtility.UrlEncode(end.ToString("yyyy-MM-dd-HH")); pds.CurrentPageIndex = page - 1; lblCurrentPage.Text = "共" + TotalCount.ToString() + "条记录 当前页:" + page + "/" + TotalPage; lnkFrist.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1&visitip=" + ip + "&start=" + startstr + "&end=" + endstr; if (!pds.IsFirstPage) { lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (page - 1) + "&visitip=" + ip + "&start=" + startstr + "&end=" + endstr; } if (!pds.IsLastPage) { lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + (page + 1) + "&visitip=" + ip + "&start=" + startstr + "&end=" + endstr; } lnkEnd.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + TotalPage + "&visitip=" + ip + "&start=" + startstr + "&end=" + endstr; Rpt_PageVisit.DataSource = pds; Rpt_PageVisit.DataBind(); TB_Start.Text = start.ToString("yyyy-MM-dd HH"); TB_End.Text = end.ToString("yyyy-MM-dd HH"); }
public GoodsInfoSvs() { goodsInfo = new GoodsInfo(); }
/// <summary> /// 增加物资入库记录时修改物资总量、库存、入库数量 /// </summary> /// <param name="entity"></param> /// <returns></returns> public override GoodsIn Add(GoodsIn entity) { using (IGenericTransaction tx = this.m_UnitOfWork.BeginTransaction()) { try { IRepositoryBase <GoodsInfo> GoodsInfoResp = this.m_UnitOfWork.GetRepositoryBase <GoodsInfo>(); GoodsInfo goodsInfo = GoodsInfoResp.Get(entity.GoodsID); goodsInfo.InNum += entity.InNum; goodsInfo.ContentNum += entity.InNum; goodsInfo.TotalNum += entity.InNum; if (goodsInfo.tPrice == null) { goodsInfo.tPrice = (entity.InNum * entity.InPrice); } else { goodsInfo.tPrice += (entity.InNum * entity.InPrice); } goodsInfo.uPrice = (decimal)goodsInfo.tPrice / (decimal)goodsInfo.ContentNum; GoodsInfoResp.Update(goodsInfo, null); GoodsIn obj = base.Add(entity); //添加新的历史记录 if (s == null) { s = new PublicService(); } GoodsInHistory history = new GoodsInHistory(); history.Builder = obj.Builder; history.BuildTime = obj.BuildTime; history.GoodsID = obj.GoodsID; history.GoodsInIDHistory = obj.ID; history.InNum = obj.InNum; history.InPrice = obj.InPrice; history.InTime = obj.InTime; history.Lifecycle = obj.Lifecycle; history.Modifier = obj.Modifier; history.ModifyTime = obj.ModifyTime; history.Operator = obj.Operator; history.Remark = obj.Remark; history.SupplyName = obj.SupplyName; history.TransportName = obj.TransportName; history.action_u = "新增"; history.GoodsName = goodsInfo.GoodsName; s.GoodsInHistory.Add(history); tx.Commit(); return(obj); } catch (Exception ex) { tx.Rollback(); logger.Error(ex.Message); throw; } } }
private void Get(int i) { try { string appPath = AppContext.BaseDirectory; if (Directory.Exists(appPath)) { DirectoryInfo directoryInfo = new DirectoryInfo(appPath); //directoryInfo = directoryInfo.Parent.Parent.Parent; appPath = directoryInfo.ToString() + "\\wwwroot\\images\\"; } List <GoodsInfo> list = new List <GoodsInfo>(); int start = 15 * i; string json = HttpGet("https://store.steampowered.com/contenthub/querypaginated/specials/TopSellers/render/?query=&start=" + start + "&count=15&cc=CN&l=schinese&v=4&tag=", ""); json = Regex.Match(json, "\"results_html\":\"[\\S\\s]*\",").Value; int startIndex = "\"results_html\":\"".Count(); json = json.Substring(startIndex, json.Count() - startIndex - 2); json = Regex.Unescape(json); string pageHtml = json; //初始化网络请求客户端 HtmlWeb webClient = new HtmlWeb(); //初始化文档 //HtmlDocument doc = webClient.Load("https://store.steampowered.com/specials?p=4&tab=TopSellers"); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(pageHtml); //查找节点 HtmlNodeCollection itemNodes = doc.DocumentNode.SelectNodes(".//a[@class='tab_item ']"); if (itemNodes != null) { Regex priceRegex = new Regex("\\d+(\\.\\d+)?"); foreach (var item in itemNodes) { GoodsInfo g = new GoodsInfo(); g.name = item.SelectNodes(".//div[@class='tab_item_name']")[0].InnerText; g.originalPrice = priceRegex.Match(item.SelectNodes(".//div[@class='discount_original_price']")[0].InnerText).Value; g.finalPrice = priceRegex.Match(item.SelectNodes(".//div[@class='discount_final_price']")[0].InnerText).Value; g.pct = priceRegex.Match(item.SelectNodes(".//div[@class='discount_pct']")[0].InnerText).Value; g.img = item.SelectNodes(".//img[@class='tab_item_cap_img']")[0].Attributes["src"].Value; g.img = FileDownSave(g.img, appPath); foreach (var t in item.SelectNodes(".//span[@class='top_tag']")) { g.tag += t.InnerText; } list.Add(g); } } int rank = 1 + 15 * (i - 1); List <int> arr = new List <int>(); for (int j = 0; j < 15; j++) { arr.Add(rank + j); } ActivityDAO activityDAO = new ActivityDAO(); List <Activity> activityList = activityDAO.GetAll().Where(e => e.status == 1 && arr.Contains(e.rank)).ToList(); int alc = activityList.Count(); for (int j = 0; j < alc; j++) { activityList[j].endTime = DateTime.Now; activityList[j].status = 0; } int batch = 0; if (alc != 0) { activityDAO.BatchUpdate(activityList); batch = activityList[0].batch; } GoodsDAO goodsDAO = new GoodsDAO(); List <Activity> newActivityList = new List <Activity>(); foreach (var g in list) { Goods goods = goodsDAO.GetAll().Where(e => e.name == g.name).FirstOrDefault(); if (goods == null) { goods = new Goods() { name = g.name, price = decimal.Parse(g.originalPrice), tag = g.tag, imgURI = g.img, createTime = DateTime.Now, status = 1 }; goodsDAO.Add(goods); } else { if (File.Exists(goods.imgURI)) { FileInfo fileInfo = new FileInfo(goods.imgURI); fileInfo.Delete(); } goods.imgURI = g.img; goods.price = decimal.Parse(g.originalPrice); goods.tag = g.tag; goods.createTime = DateTime.Now; goods.status = 1; goodsDAO.Update(goods); } Activity activity = new Activity() { goodsId = goods.id, finalPrice = decimal.Parse(g.finalPrice), pct = int.Parse(g.pct), status = 1, createTime = DateTime.Now, rank = rank++, batch = batch + 1 }; newActivityList.Add(activity); } activityDAO.SaveList(newActivityList); } catch (Exception ex) { throw ex; } }
private async Task <bool> GetOrderInfo() { notPayOrders.Clear(); payedOrders.Clear(); completedOrders.Clear(); List <IXmlNode> orderNodes = new List <IXmlNode>(); //Windows.Storage.StorageFolder storageFolder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Data"); Windows.Storage.StorageFolder storageFolder = ApplicationData.Current.LocalFolder; Windows.Storage.StorageFile storageFile = await storageFolder.GetFileAsync("Goods.xml"); XmlDocument doc = await Windows.Data.Xml.Dom.XmlDocument.LoadFromFileAsync(storageFile); IXmlNode root = null; //遍历订单 foreach (var item in doc.ChildNodes) { var name = item.NodeName; if (name.Equals("orders")) { root = item; break; } } if (null == root) { return(false); } foreach (var item in root.ChildNodes) { var name = item.NodeName; if (name.Equals("order")) { orderNodes.Add(item); } } foreach (var item in orderNodes) { string customer = item.SelectSingleNode("name").InnerText; string mobile = item.SelectSingleNode("mobile").InnerText; string id = item.SelectSingleNode("id").InnerText; string price = item.SelectSingleNode("totalPrice").InnerText; string payed = item.SelectSingleNode("payed").InnerText; string completed = item.SelectSingleNode("completed").InnerText; string address = item.SelectSingleNode("address").InnerText; IXmlNode goodsNode = item.SelectSingleNode("goods"); List <GoodsInfo> goodsList = new List <GoodsInfo>(); foreach (var goods in goodsNode.ChildNodes) { if (goods.NodeName.Equals("item")) { string img = goods.SelectSingleNode("img").InnerText; string singlePrice = goods.SelectSingleNode("price").InnerText; string name = goods.SelectSingleNode("productName").InnerText; string count = goods.SelectSingleNode("count").InnerText; string imagename = goods.SelectSingleNode("imageName").InnerText; GoodsInfo info = new GoodsInfo(); StorageFile file = await StorageFile.GetFileFromPathAsync(img); using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read)) { BitmapImage image = new BitmapImage(); image.SetSource(fileStream); info.img = image; } info.name = name; info.price = singlePrice; info.count = Convert.ToInt32(count); info.imageName = imagename; goodsList.Add(info); } } OrderInfo orderInfo = new OrderInfo(); orderInfo.address = address; orderInfo.id = id; orderInfo.price = price; orderInfo.goodsList = goodsList; orderInfo.mobile = mobile; orderInfo.payed = payed; orderInfo.completed = completed; orderInfo.customerName = customer; if (!payed.Equals("true")) { notPayOrders.Add(orderInfo); } else if (payed.Equals("true") && completed.Equals("false")) { payedOrders.Add(orderInfo); } else { completedOrders.Add(orderInfo); } } return(true); }
public int Update(GoodsInfo node) { return(_Client.Update(node)); }
private static void BuildBillDataFromTable(string suser, bool onlyAdd, DataTable table, HashObjectList billList, HashObjectList detailList, DbHelper db = null, string ids = null, bool sureRate = true) { Dictionary <string, string> dic = GetExistBills(db, ids); List <string> dicDetail = GetExistBillDetails(db, ids); JavaScriptSerializer serializer = JavaScriptSerializer.CreateInstance(); foreach (DataRow row in table.Rows) { var ddid = row["订单ID"].ToString(); string id = Cuid.NewCuid().GetHashCode().ToString(); string oldid; if (dic.TryGetValue(ddid, out oldid)) { if (onlyAdd) { continue; } id = oldid; } string user = row["所属用户"].ToString(); if (user != suser) { throw new Exception("分析用户和数据保存用户不匹配,无法做数据保存"); } object sendDate = row["发货时间"]; object successDate = row["成交时间"]; Dictionary <string, decimal> goodsRate = GetGoodsRate(db, user); GoodsInfo[] ginfos = serializer.Deserialize <GoodsInfo[]>(row["货物信息"].ToString()); var sendWay = TaobaoDataHelper.GetLogisticsInfo(row["快递公司"]).IsEmptyObject() ? null : "快递"; string remark = GetRemark(row); decimal pall = Decimal.Parse(row["拍下总金额"].ToString()); decimal total = Decimal.Parse(row["支付金额"].ToString()); decimal ltotal = 0; decimal btotal = 0; decimal allPrice = 0; string address = TaobaoDataHelper.ReplaceHtmlText(row["具体地址"].ToString()); if (!dicDetail.Contains(ddid)) { for (int j = ginfos.Length - 1; j >= 0; j--) { GoodsInfo ginfo = ginfos[j]; string goodKey = GetGoodsKey(ginfo.Color, ginfo.Size, ginfo.Title); decimal rate = 0; if (db != null && (goodsRate == null || !goodsRate.ContainsKey(goodKey))) { if (!sureRate) { rate = 0; } else { throw new Exception(string.Format("【{3}】 color:{0} size:{1} title:{2}没有设置比例goodMatchRate", ginfo.Color, ginfo.Size, ginfo.Title, user)); } } else { if (db != null) { rate = goodsRate[goodKey]; } } decimal price = ginfo.PriceInfo / pall * total; if (j == 0) { price = total - allPrice; } allPrice += price; decimal tbtotal = (price * rate) * (decimal)(0.01); btotal += tbtotal; decimal tltotal = price - tbtotal; HashObject detailHash = new HashObject(); detailList.Add(detailHash); detailHash.Add("id", Cuid.NewCuid().GetHashCode()); detailHash.Add("bid", id); detailHash.Add("code", ddid); detailHash.Add("size", ginfo.Size); detailHash.Add("amount", ginfo.Amount); detailHash.Add("color", ginfo.Color); detailHash.Add("address", address); detailHash.Add("area", row["区域"]); detailHash.Add("total", price); detailHash.Add("remark", remark); detailHash.Add("ltotal", tltotal); detailHash.Add("sourceTitle", ginfo.Title); detailHash.Add("goodsstatus", int.Parse(row["发货状态status"].ToString()) >= 1 ? 2 : 1); detailHash.Add("sendway", sendWay); detailHash.Add("btotal", tbtotal); } ltotal = total - btotal; } if (IsNullDate(row["付款时间"])) { continue; } HashObject billHash = new HashObject(); billHash.Add("id", id); billHash.Add("date", row["付款时间"]); billHash.Add("taobaocode", row["旺旺名称"]); billHash.Add("cname", row["收货客户"]); billHash.Add("ctel", row["联系电话"]); billHash.Add("caddress", address); billHash.Add("carea", row["区域"]); billHash.Add("cremark", remark); billHash.Add("ltotal", ltotal); billHash.Add("status", row["发货状态status"]); billHash.Add("scode", TaobaoDataHelper.GetLogisticsInfo(row["物流单号"])); billHash.Add("sname", TaobaoDataHelper.GetLogisticsInfo(row["快递公司"])); billHash.Add("uid", GetUser(row["所属用户"], db == null)); billHash.Add("goodsstatus", 1); billHash.Add("billfrom", "抓取"); billHash.Add("createdate", row["创建时间"]); billHash.Add("zfbpaycode", row["支付宝交易号"]); billHash.Add("tbcode", ddid); billHash.Add("total", total); billHash.Add("btotal", btotal); billHash.Add("senddate", GetDate(sendDate)); billHash.Add("successdate", GetDate(successDate)); billList.Add(billHash); } }
private void btnGoodsEnter_Click(object sender, EventArgs e) { try { if (entityId != int.MaxValue) { var Oldgoodsinfo = DataManager.GoodsInfoBLL.GetEntityById(entityId); if (CheckData()) { Oldgoodsinfo.Total = Convert.ToDouble(txtGoods_Total.Text.Trim()); //更新库存 Oldgoodsinfo.SurplusCount = Convert.ToDouble(txtSurplusCount.Text.ToString()); Oldgoodsinfo.SalesCount = Convert.ToDouble(txtSalesCount.Text.ToString()); Oldgoodsinfo.PurPrice = Convert.ToDecimal(txtGoods_Purprice.Text.Trim()); Oldgoodsinfo.PayPrice = Convert.ToDecimal(txtGoods_Payprice.Text.Trim()); Oldgoodsinfo.GoodsName = txtGoods_Name.Text.Trim(); Oldgoodsinfo.UnitId = Convert.ToInt32(cbxGoods_Unit.SelectedValue.ToString().Trim()); Oldgoodsinfo.SortId = Convert.ToInt32(cbxGood_Sort.SelectedValue.ToString().Trim()); Oldgoodsinfo.WholeSalerId = Convert.ToInt32(cbxGood_WholerSaler.SelectedValue.ToString().Trim()); Oldgoodsinfo.GoodsType = txtGoos_Type.Text.Trim(); Oldgoodsinfo.Remark = txtGoods_Remark.Text; if ((Oldgoodsinfo.SalesCount + Oldgoodsinfo.SurplusCount) != Oldgoodsinfo.Total) { MessageBox.Show("商品数量出错!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var isSuccess = DataManager.GoodsInfoBLL.Edit(Oldgoodsinfo); if (isSuccess) { this.Tag = true; MessageBox.Show("修改商品信息成功!", "通知", MessageBoxButtons.OK, MessageBoxIcon.Information); Clear(); this.Close(); } } } else { if (CheckData()) { GoodsInfo goodsInfo = new GoodsInfo(); goodsInfo.GoodsName = txtGoods_Name.Text.Trim(); goodsInfo.UnitId = Convert.ToInt32(cbxGoods_Unit.SelectedValue.ToString().Trim()); goodsInfo.SortId = Convert.ToInt32(cbxGood_Sort.SelectedValue.ToString().Trim()); goodsInfo.WholeSalerId = Convert.ToInt32(cbxGood_WholerSaler.SelectedValue.ToString().Trim()); goodsInfo.GoodsType = txtGoos_Type.Text.Trim(); goodsInfo.Remark = txtGoods_Remark.Text; goodsInfo.SalesCount = Convert.ToDouble(txtSalesCount.Text.Trim()); goodsInfo.SurplusCount = Convert.ToDouble(txtSurplusCount.Text.Trim()); goodsInfo.Total = Convert.ToDouble(txtGoods_Total.Text.Trim()); goodsInfo.PurPrice = Convert.ToDecimal(txtGoods_Purprice.Text.Trim()); goodsInfo.PayPrice = Convert.ToDecimal(txtGoods_Payprice.Text.Trim()); if ((goodsInfo.SalesCount + goodsInfo.SurplusCount) != goodsInfo.Total) { MessageBox.Show("商品数量出错!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var isSuccess = DataManager.GoodsInfoBLL.Add(goodsInfo); if (isSuccess) { this.Tag = true; MessageBox.Show("添加商品信息成功!", "通知", MessageBoxButtons.OK, MessageBoxIcon.Information); Clear(); this.Close(); } } } } catch { MessageBox.Show("操作失败,请检查信息是否正确!!"); return; } }
public ActionResult Del(GoodsInfo goodsInfo) { return(Json(goodsInfoOper.Del(goodsInfo))); }
/// <summary> /// 构造支付请求数据 /// </summary> /// <returns>请求数据集</returns> private AlipayTradePrecreateContentBuilder BuildPrecreateContent() { //线上联调时,请输入真实的外部订单号。 string out_trade_no = System.DateTime.Now.ToString("yyyyMMddHHmmss") + "0000" + (new Random()).Next(1, 10000).ToString(); string total_fee = "1"; string subject = "test"; if (!string.IsNullOrEmpty(Request.QueryString["tid"])) { out_trade_no = Request.QueryString["tid"]; } OrderViewModel order = BOrder.SearchByTradeNo(out_trade_no); if (order != null) { subject = BProduct.ExecuteSql("select Name from Products where Id=" + order.Product_Id).ToString(); total_fee = (order.Price * order.Count).ToString(); } //if (String.IsNullOrEmpty(WIDout_request_no.Text.Trim())) //{ // out_trade_no = System.DateTime.Now.ToString("yyyyMMddHHmmss") + "0000" + (new Random()).Next(1, 10000).ToString(); //} //else //{ //out_trade_no = "WF87212910290"; //} AlipayTradePrecreateContentBuilder builder = new AlipayTradePrecreateContentBuilder(); //收款账号 builder.seller_id = Config.pid; //订单编号 builder.out_trade_no = out_trade_no; //订单总金额 builder.total_amount = total_fee; //参与优惠计算的金额 //builder.discountable_amount = ""; //不参与优惠计算的金额 //builder.undiscountable_amount = ""; //订单名称 builder.subject = subject; //自定义超时时间 builder.timeout_express = "5m"; //订单描述 builder.body = ""; //门店编号,很重要的参数,可以用作之后的营销 builder.store_id = "test store id"; //操作员编号,很重要的参数,可以用作之后的营销 builder.operator_id = "test"; //传入商品信息详情 List <GoodsInfo> gList = new List <GoodsInfo>(); if (order != null) { GoodsInfo goods = new GoodsInfo(); goods.goods_id = order.Product_Id.ToString(); goods.goods_name = subject; goods.price = order.Price.ToString(); goods.quantity = order.Count.ToString();; gList.Add(goods); } else { GoodsInfo goods = new GoodsInfo(); goods.goods_id = "520"; goods.goods_name = "捐助"; goods.price = "0.1"; goods.quantity = "1"; gList.Add(goods); } builder.goods_detail = gList; //系统商接入可以填此参数用作返佣 //ExtendParams exParam = new ExtendParams(); //exParam.sysServiceProviderId = "20880000000000"; //builder.extendParams = exParam; return(builder); }
/// <summary> /// 构造支付请求数据 /// </summary> /// <returns>请求数据集</returns> private AlipayTradePayContentBuilder BuildPayContent() { //线上联调时,请输入真实的外部订单号。 string out_trade_no = ""; if (String.IsNullOrEmpty(WIDout_request_no.Text.Trim())) { out_trade_no = System.DateTime.Now.ToString("yyyyMMddHHmmss") + "0000" + (new Random()).Next(1, 10000).ToString(); } else { out_trade_no = WIDout_request_no.Text.Trim(); } //扫码枪扫描到的用户手机钱包中的付款条码 AlipayTradePayContentBuilder builder = new AlipayTradePayContentBuilder(); //收款账号 builder.seller_id = Config.pid; //订单编号 builder.out_trade_no = out_trade_no; //支付场景,无需修改 builder.scene = "bar_code"; //支付授权码,付款码 builder.auth_code = WIDdynamic_id.Text.Trim(); //订单总金额 builder.total_amount = WIDtotal_fee.Text.Trim(); //参与优惠计算的金额 //builder.discountable_amount = ""; //不参与优惠计算的金额 //builder.undiscountable_amount = ""; //订单名称 builder.subject = WIDsubject.Text.Trim(); //自定义超时时间 builder.timeout_express = "2m"; //订单描述 builder.body = ""; //门店编号,很重要的参数,可以用作之后的营销 builder.store_id = "test store id"; //操作员编号,很重要的参数,可以用作之后的营销 builder.operator_id = "test"; //传入商品信息详情 List <GoodsInfo> gList = new List <GoodsInfo>(); GoodsInfo goods = new GoodsInfo(); goods.goods_id = "304"; goods.goods_name = "goods#name"; goods.price = "0.01"; goods.quantity = "1"; gList.Add(goods); builder.goods_detail = gList; //系统商接入可以填此参数用作返佣 //ExtendParams exParam = new ExtendParams(); //exParam.sysServiceProviderId = "20880000000000"; //builder.extendParams = exParam; return(builder); }
/// <summary> /// 刷卡支付完整业务流程逻辑(2018-04-19写) /// </summary> /// <param name="body">商品描述</param> /// <param name="total_fee">总金额(单位为元)</param> /// <param name="auth_code">支付授权码</param> /// <returns>刷卡支付结果</returns> public static AlipayPayResponse OrderPay(string body, string total_fee, string auth_code) { IAlipayTradeService serviceClient = F2FBiz.CreateClientInstance( F2FPayConfig.serverUrl, F2FPayConfig.appId, F2FPayConfig.merchant_private_key, F2FPayConfig.version, F2FPayConfig.sign_type, F2FPayConfig.alipay_public_key, F2FPayConfig.charset); var result = new AlipayPayResponse { Success = false, Message = "支付失败" }; //线上联调时,请输入真实的外部订单号。 result.OutTradeNo = DateTime.Now.ToString("yyyyMMddHHmmss") + "0000" + (new Random()).Next(1, 10000).ToString(); //扫码枪扫描到的用户手机钱包中的付款条码 AlipayTradePayContentBuilder builder = new AlipayTradePayContentBuilder(); //收款账号 builder.seller_id = F2FPayConfig.pid; //订单编号 builder.out_trade_no = result.OutTradeNo; //支付场景,无需修改 builder.scene = "bar_code"; //支付授权码,付款码 builder.auth_code = auth_code.Trim(); //订单总金额 builder.total_amount = total_fee.Trim(); //参与优惠计算的金额 //builder.discountable_amount = ""; //不参与优惠计算的金额 //builder.undiscountable_amount = ""; //订单名称 builder.subject = body.Trim(); //自定义超时时间 builder.timeout_express = "2m"; //订单描述 builder.body = body.Trim(); //门店编号,很重要的参数,可以用作之后的营销 builder.store_id = ""; //操作员编号,很重要的参数,可以用作之后的营销 builder.operator_id = ""; //传入商品信息详情 List <GoodsInfo> gList = new List <GoodsInfo>(); GoodsInfo goods = new GoodsInfo(); goods.goods_id = "304"; goods.goods_name = "goods#name"; goods.price = total_fee.Trim(); goods.quantity = "1"; gList.Add(goods); builder.goods_detail = gList; //系统商接入可以填此参数用作返佣 //ExtendParams exParam = new ExtendParams(); //exParam.sysServiceProviderId = "20880000000000"; //builder.extendParams = exParam; AlipayF2FPayResult payResult = serviceClient.tradePay(builder); switch (payResult.Status) { case ResultEnum.SUCCESS: result.Success = true; result.Message = "支付成功"; break; case ResultEnum.FAILED: var subMsg = payResult.response.SubMsg; if (string.IsNullOrEmpty(subMsg)) { subMsg = "支付失败"; } result.Message = subMsg; break; case ResultEnum.UNKNOWN: result.Message = "支付失败,网络异常,请检查网络配置后,更换外部订单号重试"; break; } return(result); }
/// <summary> /// 添加商品 /// </summary> /// <param name="g"></param> /// <returns></returns> public int GoodsAdd(GoodsInfo g) { return(dal.GoodsAdd(g)); }