public async Task <IActionResult> PutBProduct([FromRoute] int id, [FromBody] BProduct bProduct) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bProduct.ProductId) { return(BadRequest()); } _context.Entry(bProduct).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BProductExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult InitProduct() { string typeId = Request.Form["proT"]; List <ProductViewModel> lstRes = BProduct.SearchByTypeId(typeId); return(Content(LitJson.JsonMapper.ToJson(lstRes))); }
public override void DoSelfDuty() { BRes bRes = this.mediator.GetBRes(); BProduct bProduct = ProcessB(bRes); this.mediator.OutputBProduct(bProduct); }
/// <summary> /// 确定订单 /// </summary> /// <returns></returns> public ActionResult Confirm() { string email = Request.QueryString["mail"]; string id = Request.QueryString["id"]; string num = Request.QueryString["num"]; string random = Request.QueryString["t"]; ProductViewModel p = BProduct.SearchById(id); if (p == null) { return(View()); } double totalMoney = Convert.ToInt32(num) * p.Price; ViewBag.Email = email; ViewBag.Id = id; ViewBag.Num = num; ViewBag.Total = totalMoney; ViewBag.Name = p.Name; ViewBag.SinglePrice = p.Price; if (!ExisitCookie(email)) { HttpCookie cookie = new HttpCookie("cmail", email); cookie.Path = "/"; cookie.Domain = "1777ka.com"; cookie.Expires = DateTime.Now.AddYears(10); Response.Cookies.Add(cookie); } return(View()); }
public ApiMessage UpdateProductsWastage() { ApiMessage message = new ApiMessage() { Status = "ok" }; HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; HttpRequestBase request = context.Request; string user_id = User.Identity.Name; UserManager userMgr = new UserManager(int.Parse(user_id), null); BUser user = userMgr.CurrentUser; StockManager stockManager = new StockManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission); try { string ws = request["wastages"]; if (string.IsNullOrEmpty(ws)) { message.Status = "failed"; message.Message = "输入错误"; return(message); } ws = HttpUtility.UrlDecode(ws); JArray ps = (JArray)JArray.Parse(ws); if (ps != null && ps.Count > 0) { List <BProduct> products = new List <BProduct>(); for (int i = 0; i < ps.Count; i++) { BProduct product = new BProduct(); JObject json = (JObject)ps[i]; if (json["product_id"] != null) { product.ID = (int)json["product_id"]; } if (json["quantity"] != null) { product.Quantity = (int)json["quantity"]; } if (json["parent_id"] != null) { product.ParentID = (int)json["parent_id"]; } products.Add(product); } stockManager.UpdateProductsWastage(products); } } catch (KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { message.Status = "failed"; message.Message = "未知错误"; } return(message); }
public ActionResult Add() { string name = Request.Form["proT"]; if (string.IsNullOrEmpty(name)) { return(Content(ReturnMsg.empty.ToString())); } ProductViewModel model = LitJson.JsonMapper.ToObject <ProductViewModel>(name); if (model == null) { return(Content(ReturnMsg.fail.ToString())); } model.AddedTime = DateTime.Now; model.UpdateTime = DateTime.Now; bool isSucc = BProduct.Insert(model); if (isSucc) { return(Content(ReturnMsg.success.ToString())); } else { return(Content(ReturnMsg.fail.ToString())); } }
private void txtProductCode_Leave(object sender, EventArgs e) { //判断编号是否已存在 if (!string.IsNullOrEmpty(this.txtProductCode.Text.Trim())) { BaseProductTable product = new BaseProductTable(); BProduct bProduct = new BProduct(); product = bProduct.GetModel(this.txtProductCode.Text); if (product == null || "".Equals(product)) { txtProductCode.Focus(); txtProductCode.Text = ""; txtProductName.Text = ""; MessageBox.Show("商品编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { txtProductCode.Text = product.CODE; txtProductName.Text = product.NAME; } } else { txtProductName.Text = ""; } }
private void btnDelete_Click(object sender, EventArgs e) { try { DialogResult option; option = MessageBox.Show("Do you really want to delete?", "SysBusiness", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (option == DialogResult.OK) { string Code; string resp = ""; foreach (DataGridViewRow row in dataList.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { Code = Convert.ToString(row.Cells[1].Value); resp = BProduct.Delete(Convert.ToInt32(Code)); if (resp.Equals("OK")) { this.MessageOk("Success deleted"); } else { this.MessageError(resp); } } } this.ShowValues(); } } catch (Exception ex) { } }
/// <summary> /// 当前数据集的重新整理 /// </summary> private void reSetCurrentDt() { foreach (DataRow rows in _currentDt.Rows) { string code = CConvert.ToString(rows["PRODUCT_CODE"]); if (code.Length >= 4 && code.Substring(0, 4) == "9999") { BaseProductTable product = new BProduct().GetModel(code.Substring(0, 4)); if (product != null) { rows["FROMSET_FLAG"] = product.FROMSET_FLAG; } } if (rows["FROMSET_FLAG"].ToString() == "1") { rows["FROMSET"] = "否"; } else { rows["FROMSET"] = "是"; } } for (int i = _currentDt.Rows.Count; i < PageSize; i++) { _currentDt.Rows.Add(_currentDt.NewRow()); } }
public ActionResult Detail(string id) { if (string.IsNullOrEmpty(id)) { return(Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("请输入正确的产品ID"))); } int product_id = 0; int.TryParse(id, out product_id); if (product_id == 0) { return(Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("请输入正确的产品ID"))); } BProduct product = null; string user_id = HttpContext.User.Identity.Name; UserManager userMgr = new UserManager(int.Parse(user_id), null); BUser user = userMgr.CurrentUser; Shop MainShop = userMgr.Main_Shop; ProductManager pdtManager = new ProductManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission); try { product = pdtManager.GetProductFullInfo(product_id); } catch (KMJXCException kex) { return(Redirect("/Home/Error?message=" + HttpUtility.UrlEncode(kex.Message))); } catch { return(Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("未知错误"))); } return(View(product)); }
/// <summary> /// 数据查询,绑定 /// </summary> private void BindData(int currentPage) { string strWhere = GetConduction(); DataSet ds = bReceipt.GetList(strWhere); dgvData.Rows.Clear(); if (ds.Tables[0].Rows.Count > 0) { int i = 1; foreach (DataRow rows in ds.Tables[0].Rows) { int currentRowIndex = dgvData.Rows.Add(1); DataGridViewRow row = dgvData.Rows[currentRowIndex]; row.Cells["No"].Value = i; row.Cells["SLIP_NUMBER"].Value = rows["SLIP_NUMBER"]; row.Cells["PURCHASE_ORDER_SLIP_NUMBER"].Value = rows["PURCHASE_ORDER_SLIP_NUMBER"]; row.Cells["SUPPLIER_NAME"].Value = rows["SUPPLIER_NAME"]; row.Cells["WAREHOUSE_NAME"].Value = rows["WAREHOUSE_NAME"]; row.Cells["DUE_DATE"].Value = rows["DUE_DATE"]; row.Cells["PRODUCT_CODE"].Value = rows["PRODUCT_CODE"]; row.Cells["PRODUCT_NAME"].Value = rows["PRODUCT_NAME"]; row.Cells["RECEIPT_PLAN_QUANTITY"].Value = Convert.ToInt32(rows["RECEIPT_PLAN_QUANTITY"]); row.Cells["RECEIPT_QUANTITY"].Value = Convert.ToInt32(rows["RECEIPT_PLAN_QUANTITY"]); row.Cells["QUANTITY"].Value = Convert.ToInt32(rows["QUANTITY"]); row.Cells["UNIT_NAME"].Value = rows["UNIT_NAME"]; row.Cells["PURCHASE_ORDER_LINE_NUMBER"].Value = rows["PURCHASE_ORDER_LINE_NUMBER"]; row.Cells["RECEIPT_QUANTITY"].Style.BackColor = System.Drawing.SystemColors.Info; string code = CConvert.ToString(rows["PRODUCT_CODE"]); if (code.Length >= 4 && code.Substring(0, 4) == "9999") { BaseProductTable product = new BProduct().GetModel(code.Substring(0, 4)); if (product != null) { rows["FROMSET_FLAG"] = product.FROMSET_FLAG; } } if (rows["FROMSET_FLAG"].ToString() == "1") { row.Cells["FROMSET"].Value = "否"; } else { row.Cells["FROMSET"].Value = "是"; } i++; } //dgvData.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect; this.dgvData.Columns["RECEIPT_CHK"].Visible = true; //this.dgvData.DataSource = _currentDt; } else { init(); this.dgvData.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(192, 255, 192); } }
private void btnSave_Click(object sender, EventArgs e) { try { string resp = ""; if (txtNameConfig.Text == string.Empty || txtidcategory.Text == string.Empty || txtCode.Text == string.Empty) { MessageError("Fill the fields"); errorIcon.SetError(txtNameConfig, "Insert the name"); errorIcon.SetError(txtidcategory, "Insert the category id"); errorIcon.SetError(txtCode, "Insert the code"); } else { System.IO.MemoryStream ms = new System.IO.MemoryStream(); this.pxImage.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] image = ms.GetBuffer(); if (this.eNew) { resp = BProduct.Insert(this.txtCode.Text, this.txtNameConfig.Text, this.txtDescription.Text, image, Convert.ToInt32(this.txtidcategory.Text), Convert.ToInt32(this.cbPresentation.SelectedValue)); } else { resp = BProduct.Edit(Convert.ToInt32(this.txtIdProduct.Text), this.txtCode.Text, this.txtNameConfig.Text, this.txtDescription.Text, image, Convert.ToInt32(this.txtidcategory.Text), Convert.ToInt32(this.cbPresentation.SelectedValue)); } if (resp.Equals("OK")) { if (this.eNew) { this.MessageOk("Register saved"); } else { this.MessageOk("Register Edited"); } } else { this.MessageError(resp); } this.eNew = false; this.eEdit = false; this.Enabledbuttons(); this.Clean(); this.ShowValues(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
public ActionResult DeleteConfirmed(int id) { BProduct bproduct = db.BProducts.Find(id); db.BProducts.Remove(bproduct); db.SaveChanges(); return(RedirectToAction("Index")); }
private void init() { BaseProductTable product = null; DataSet ds = bPurchaseOrder.GetList(strWhere); int i = 1; DataRow row = null; foreach (DataRow dr in ds.Tables[0].Rows) { row = dt.NewRow(); row["NO"] = i++; row["SLIP_NUMBER"] = dr["SLIP_NUMBER"]; string code = CConvert.ToString(dr["PRODUCT_CODE"]); product = new BProduct().GetModel(code); row["PRODUCT_CODE"] = dr["PRODUCT_CODE"]; row["PRODUCT_NAME"] = dr["PRODUCT_NAME"]; if (product == null) { product = new BaseProductTable(); } row["SPEC"] = product.SPEC; row["SUPPLIER_NAME"] = dr["SUPPLIER_NAME"]; row["QUANTITY"] = (int)CConvert.ToDecimal(dr["QUANTITY"]); row["PRICE"] = dr["PRICE"]; row["AMOUNT"] = dr["AMOUNT_INCLUDED_TAX"]; row["SLIP_DATE"] = CConvert.ToDateTime(dr["SLIP_DATE"]).ToString("yyyy-MM-dd"); row["DUE_DATE"] = CConvert.ToDateTime(dr["DUE_DATE"]).ToString("yyyy-MM-dd"); DateTime now = CConvert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); DateTime due = CConvert.ToDateTime(CConvert.ToDateTime(dr["DUE_DATE"]).ToString("yyyy-MM-dd")); if (now > due) { TimeSpan ts = now - due; row["DUE_STATUS"] = "超过期限" + ts.TotalDays + "天"; } else { row["DUE_STATUS"] = "未到时间"; } getReceipt(CConvert.ToString(dr["SLIP_NUMBER"])); if (Receipt == CConstant.UN_RECEIPT) { row["DELIVERY_STATUS"] = "未入库"; } else if (Receipt == CConstant.COMPLETE_RECEIPT) { row["DELIVERY_STATUS"] = "入库完了"; } else if (Receipt == CConstant.PART_RECEIPT) { row["DELIVERY_STATUS"] = "入库一部分"; } row["ACTUAL_AMOUNT"] = bPurchaseOrder.GetReceiptActualQuantity(CConvert.ToString(dr["SLIP_NUMBER"]), CConvert.ToString(dr["PRODUCT_CODE"])); total += CConvert.ToDecimal(dr["AMOUNT_INCLUDED_TAX"]); dt.Rows.Add(row); } }
// POST api/<controller> public void Post([FromBody] BProduct p) { InitCache(); BProduct[] products = (BProduct[])memoryCache["products"]; p.ID = products.Max(x => x.ID) + 1; Array.Resize(ref products, products.Length + 1); products[products.Length - 1] = p; memoryCache["products"] = products; }
public ActionResult Edit(BProduct bproduct) { if (ModelState.IsValid) { db.Entry(bproduct).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bproduct)); }
// // GET: /BProduct/Delete/5 public ActionResult Delete(int id = 0) { BProduct bproduct = db.BProducts.Find(id); if (bproduct == null) { return(HttpNotFound()); } return(View(bproduct)); }
public ActionResult Create(BProduct bproduct) { if (ModelState.IsValid) { db.BProducts.Add(bproduct); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bproduct)); }
public async Task <IActionResult> PostBProduct([FromBody] BProduct bProduct) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.BProduct.Add(bProduct); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBProduct", new { id = bProduct.ProductId }, bProduct)); }
public string CheckProduct(string product, string title) { if (product == null || "".Equals(product)) { return(title + ERROR_NULL); } BProduct bProuduct = new BProduct(); if (bProuduct.Exists(product)) { return(""); } return(title + ERROR_EXIST); }
//#region 包装费用 //private void btnDivPackAmount_Click(object sender, EventArgs e) //{ // if (txtPackAmount.Text != "") // { // if (CConvert.ToDecimal(txtPackAmount.Text) > 0 && hashTable.Count > 0 && total_un_invoice_amount > 0) // { // decimal total = CConvert.ToDecimal(txtPackAmount.Text); // decimal other = 0; // int i = 1; // foreach (DataGridViewRow row in dgvData.Rows) // { // if (i < dgvData.Rows.Count) // { // if (row.Cells["PO_SLIP_NUMBER"].Value != null && row.Cells["PO_SLIP_NUMBER"].Value.ToString() != "") // { // row.Cells["PACKAGE_AMOUNT"].Value = Math.Round((CConvert.ToDecimal(row.Cells["UN_INVOICE_AMOUNT"].Value) / total_un_invoice_amount) * total, 2); // other += CConvert.ToDecimal(row.Cells["PACKAGE_AMOUNT"].Value); // i++; // } // } // else if (i == dgvData.Rows.Count) // { // if (row.Cells["PO_SLIP_NUMBER"].Value != null && row.Cells["PO_SLIP_NUMBER"].Value.ToString() != "") // { // row.Cells["PACKAGE_AMOUNT"].Value = total - other; // } // } // } // } // else // { // MessageBox.Show("包装费用不能小于0!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); // } // } // else // { // MessageBox.Show("包装费用不能为空!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); // return; // } //} //#endregion #region dgvData单元格验证 private void dgvData_CellValidated(object sender, DataGridViewCellEventArgs e) { DataGridViewRow dr = dgvData.Rows[e.RowIndex]; string suppliercode = CConvert.ToString(dr.Cells["SUPPLIER_CODE"].Value); if (!string.IsNullOrEmpty(suppliercode)) { if (e.ColumnIndex == dgvData.Columns["AMOUNT"].Index) { if (CConvert.ToDecimal(dr.Cells["AMOUNT"].Value) > CConvert.ToDecimal(dr.Cells["AMOUNT_INCLUDED_TAX"].Value)) { MessageBox.Show("开票金额不能大于金额!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); dr.Cells["AMOUNT"].Value = ""; dr.Cells["AMOUNT"].Selected = true; } if (new BSupplier().GetModel(suppliercode).TYPE == 1) { string productcode = CConvert.ToString(dr.Cells["PRODUCT_CODE"].Value); if (!string.IsNullOrEmpty(productcode)) { string hscode = new BProduct().GetModel(productcode).HS_CODE; decimal exch = 0; DateTime date = CConvert.ToDateTime(txtPurchaseDate.Value.Year + "/" + txtPurchaseDate.Value.Month + "/" + 1); try { exch = new BExchange().GetModel(date, dr.Cells["CURRENCY_CODE"].Value.ToString()).EXCHANGE_RATE; } catch { exch = 1; } if (!string.IsNullOrEmpty(hscode)) { decimal tax = new BHsCode().GetModel(hscode).TAX_RATE; dr.Cells["TAX_AMOUNT"].Value = CConvert.ToDecimal(dr.Cells["AMOUNT"].Value) * (tax / 100) * (exch / 100); } else { dr.Cells["TAX_AMOUNT"].Value = 0; } } else { dr.Cells["TAX_AMOUNT"].Value = 0; } } } } }
// PUT api/<controller>/5 public void Put(int id, [FromBody] BProduct pn) { InitCache(); BProduct[] products = (BProduct[])memoryCache["products"]; foreach (BProduct p in products) { if (p.ID == id) { p.Title = pn.Title; p.Category = pn.Category; p.Price = pn.Price; break; } } memoryCache["products"] = products; }
public ApiMessage GetFullInfo() { ApiMessage message = new ApiMessage() { Status = "ok" }; BProduct product = null; message.Item = product; HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; HttpRequestBase request = context.Request; string user_id = User.Identity.Name; UserManager userMgr = new UserManager(int.Parse(user_id), null); BUser user = userMgr.CurrentUser; ProductManager pdtManager = new ProductManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission); int product_id = 0; string mall_id = request["mall_id"]; int.TryParse(request["product_id"], out product_id); try { product = pdtManager.GetProductFullInfo(product_id, mall_id); if (product != null) { message.Item = product; } else { message.Status = "ok"; } } catch (KM.JXC.Common.KMException.KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { message.Status = "failed"; message.Message = "未知错误"; } return(message); }
public JsonResult GetProducts(int limit, int offset, string departmentname) { List <ProductViewModel> lstRes = null; if (!string.IsNullOrEmpty(departmentname)) { lstRes = BProduct.SearchBysql(departmentname); } else { lstRes = BProduct.SearchAll(); } var total = lstRes.Count; var rows = lstRes.Skip(offset).Take(limit).ToList(); return(Json(new { total = total, rows = rows }, JsonRequestBehavior.AllowGet)); }
private void txtProductCode_Leave(object sender, EventArgs e) { //判断编号是否已存在 if (!string.IsNullOrEmpty(this.txtWarehouseCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtProductCode.Text.Trim())) { BaseSafetyStockTable SafetyCode = new BaseSafetyStockTable(); SafetyCode = bSafetyStock.GetModel(txtWarehouseCode.Text, txtProductCode.Text); if (SafetyCode != null) { txtWarehouseCode.Text = ""; txtWarehouseName.Text = ""; txtProductCode.Text = ""; txtProductName.Text = ""; txtWarehouseCode.Focus(); MessageBox.Show("仓库编号与商品编号的组合已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } if (!string.IsNullOrEmpty(this.txtProductCode.Text.Trim())) { BaseProductTable product = new BaseProductTable(); BProduct bProduct = new BProduct(); product = bProduct.GetModel(this.txtProductCode.Text); if (product == null || "".Equals(product)) { txtProductCode.Focus(); txtProductCode.Text = ""; txtProductName.Text = ""; MessageBox.Show("商品编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { txtProductCode.Text = product.CODE; txtProductName.Text = product.NAME; txtUnitCode.Text = product.BASIC_UNIT_CODE; txtUnitName.Text = product.BASIC_UNIT_NAME; } } else { txtProductName.Text = ""; } }
public void Select() { bool result = false; TransactionScope ts = new TransactionScope(); EProduct eProduct = new EProduct(); EProduct insertedProduct = new EProduct(); BProduct bProduct = new BProduct(); eProduct.DescriptionForSale = Aleatory.GetString(60); eProduct.DescriptionForStore = Aleatory.GetString(60); eProduct.Audit.UserRegister = Aleatory.GetString(8); insertedProduct = bProduct.Insert(eProduct); if (insertedProduct != null) { result = true; } Assert.IsTrue(result); }
public ActionResult Delete() { string name = Request.Form["pId"]; List <DeleteId> models = LitJson.JsonMapper.ToObject <List <DeleteId> >(name); if (models == null) { return(Content(ReturnMsg.fail.ToString())); } bool isSucc = BProduct.Delete(models.Select(_ => _.Id).ToList()); if (isSucc) { return(Content(ReturnMsg.success.ToString())); } else { return(Content(ReturnMsg.fail.ToString())); } }
public ActionResult Update() { string newName = Request.Form["proM"]; ProductViewModel model = LitJson.JsonMapper.ToObject <ProductViewModel>(newName); model.UpdateTime = DateTime.Now; if (model == null) { return(Content(ReturnMsg.fail.ToString())); } if (string.IsNullOrEmpty(model.Name)) { return(Content(ReturnMsg.empty.ToString())); } if (BProduct.Update(model)) { return(Content(ReturnMsg.success.ToString())); } else { return(Content(ReturnMsg.fail.ToString())); } }
// DELETE api/<controller>/5 public void Delete(int id) { InitCache(); BProduct[] products = (BProduct[])memoryCache["products"]; if (products.First(x => x.ID == id) != null) { BProduct[] tproducts = new BProduct[products.Length - 1]; int i = 0; foreach (BProduct p in products) { if (p.ID != id) { BProduct pn = new BProduct(); pn.ID = p.ID; pn.Title = p.Title; pn.Category = p.Category; pn.Price = p.Price; tproducts[i++] = pn; } } memoryCache["products"] = tproducts; } }
/// <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); }